cluster.schedulingPolicy


调度策略,cluster.SCHED_RR 用于循环或 cluster.SCHED_NONE 将其留给操作系统。 这是全局的设置,一旦衍生第一个工作进程或调用 .setupPrimary()(以先到者为准),就会有效地冻结。

SCHED_RR 是除 Windows 之外的所有操作系统的默认值。 一旦 libuv 能够有效地分发 IOCP 句柄而不会导致大量性能损失,则 Windows 将更改为 SCHED_RR

cluster.schedulingPolicy 也可以通过 NODE_CLUSTER_SCHED_POLICY 环境变量设置。 有效值为 'rr''none'

The scheduling policy, either cluster.SCHED_RR for round-robin or cluster.SCHED_NONE to leave it to the operating system. This is a global setting and effectively frozen once either the first worker is spawned, or .setupPrimary() is called, whichever comes first.

SCHED_RR is the default on all operating systems except Windows. Windows will change to SCHED_RR once libuv is able to effectively distribute IOCP handles without incurring a large performance hit.

cluster.schedulingPolicy can also be set through the NODE_CLUSTER_SCHED_POLICY environment variable. Valid values are 'rr' and 'none'.