问题描述
您好,我目前正在开发MEAN堆栈项目,我发现了在部署项目之前建议使用的nodejs集群模块.
Hi im currently developing a MEAN stack project and i found out the nodejs cluster module which is recommended before you deploy the the project.
我已经应用了它并做了一些ApacheBenchmark,事实是,它仅响应1个工作程序,并且没有围绕其他7个工作程序进行旋转.
I've applied it and done some ApacheBenchmark, the thing is, it's only responding to 1 worker, it's not rotating around my other 7 workers.
我已经在Google上搜索了,是的,默认情况下Windows无法进行轮询,但是有没有办法在Windows中启用轮询?
I've google about this and yeah windows default can't do round-robin, but is there a way to enable round-robin in windows?
谢谢!
推荐答案
在节点v4.x和更高版本中,您可以通过设置 cluster.schedulingPolicy
或设置 NODE_CLUSTER_SCHED_POLICY
环境变量来设置默认的调度策略.但是,如文档所述,出于性能原因,在Windows上默认 禁用循环调度.
In node v4.x and newer you can set the default scheduling policy by setting cluster.schedulingPolicy
or by setting the NODE_CLUSTER_SCHED_POLICY
environment variable. However, as the documentation describes, round-robin scheduling is disabled by default on Windows for performance reasons.
这篇关于NodeJS集群不使用轮询(在Windows上开发)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!