NodeJS cluster not using round robin (Developing o

2019-08-24 15:31发布

问题:

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.

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.

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?

Thank you!

回答1:

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.