cluster: add new ip-hash scheduling policy
Clients with the same remote address can be distributed to the
same worker by using the new cluster scheduling policy SCHED_IP
:
const cluster = require('cluster');
cluster.schedulingPolicy = cluster.SCHED_IP;
or
export NODE_CLUSTER_SCHED_POLICY=ip
Thus like WebSocket will work as expected, on cluster.
It can works correctly with IPv4 and IPv6.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines