cluster: implement API for pluggable distribute() for round-robin scheduler #6001
Comments
\cc @indutny |
Assigning to me. |
For posterity, I haven't decided yet if making distribute() configurable is actually a good thing. There's a number of corner cases that an implementer will need to deal with, like workers coming online/going offline. There's also the fact that distribute() is currently an implementation detail. Making it configurable effectively means making it public and freezing it for all eternity. I don't know if I'm ready to commit to that. |
`distribute` is a user-specified callback for asynchronous balancing of incoming connections to cluster workers. fix nodejs#6001
I understand your concerns about making distribute() configurable. |
@indutny @bnoordhuis One thing this would help with is users who want to use servers which require "sticky session" like functionality. We have this issue with socket.io users that want to use cluster module. Having access to a distribute method would allow us to support that use case. While it may be a bit "dangerous" to expose this with certain edge cases, not exposing this or a way to control request endpoints makes cluster unusable for certain classes of modules which confuses users who expect things shipped with core to work pretty transparently (even tho the docs for cluster do indeed call out sticky session limitations). |
Looks usefull to provide API in the cluster module to define user own
distribute
method.Something like following:
Previous discussion with @bnoordhuis in the issue #4435 (after closing)
The text was updated successfully, but these errors were encountered: