wandenberg / nginx-push-stream-module

A pure stream http push technology for your Nginx setup. Comet made easy and really scalable.
Other
2.21k stars 295 forks source link

All (or almost all) subscribers are registered at one worker #288

Closed leverice closed 4 years ago

leverice commented 4 years ago

My nginx is running in a docker swarm. I realized recently that all (or almost all) of subscribers are at the same worker. Why is it so? How are the subscribers distributed among workers?

Output from push_stream_channels_statistics: `

971 0 17794 17794 0 0 0 15 2160 6 1 2160 7 14 2160 8 0 2160 9 0 2160

`

wandenberg commented 4 years ago

Hi @leverice the distribution of requests across Nginx workers is done by the Ngnix, not something that the module can control. You can look for Nginx configurations like CPU affinity and others connected to this distribution. ;)

leverice commented 4 years ago

@wandenberg Thanks! I also suspected this but wanted to be sure. So, basically, the worker that got the initial websocket request will be responsible for the subscriber, right?

leverice commented 4 years ago

For those who has the same issue: look at reuseport directive.

wandenberg commented 4 years ago

Yes. The worker with the connection (doesn't matter if WebSocket or long polling or ... ) will be responsible for the subscriber.