passenger
passenger copied to clipboard
Atomically spawn multiple processes
Apps that have sticky session enabled suffer from an interesting problem: while processes are started, clients are routed to currently available processes, causing many clients to stick to those first few processes. Because of the sticky sessions, those clients are never balanced to the other processes.
A typical example is described at the Passenger mailing list:
- A user has ~500 people connected to the webapp and a reboot happens
- Nginx restarts, passenger restarts
- 2-4 passenger processes are up, automatically ~500 people are assigned to those 2-4 processes
- 28-30 processes are then started with 1 session on each, which makes them kind of useless
- Those 2-4 processes can’t keep up with the load and the webapp isn’t responsive for those people (which is like 95% of the current traffic)
One solution is to add an option for making the spawning of multiple processes "atomic": Passenger should wait until the min_instance threshold is reached before attaching all those processes. The boot time would be slower but the app would be usable after a reboot.
The hypothesized problem turned out to be a red herring. The real cause is much simpler, as is the solution. See #1322.
I compiled Passenger with the fix reported on #1322 and we’re using it in production, load balancing is working fine.
But when we're deploying and restarting Nginx this issue still happens. Everybody connects to the 2-3 processes that are up and it slows down the app. For now, we kill processes manually when this happens and people are correctly load balanced to other processes.
Long story short : #1322 helps #1317, but doesn’t fix it. An ideal solution would still be to wait until all processes are spawned before load balancing sessions.
Thank you
I will release 4.0.56 anyway, which contains #1322. That should at least help you guys in the short term.
Yes, thank you! I may have some time to look into this issue (or we may build a quick and dirty work around). I'll post my findings here if this happens.
Hey @FooBarWidget, is there any news on this? We're still manually killing the first 3-4 processes that spawned to load balance correctly :)
Thanks!
Hey got the same problem as allaire. Passenger-Version: 6.0.8 Still no other way than killing first process manually?