Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A neat trick with uWSGI is to dynamically set the number of worker processes to 0, which causes incoming requests to hang whilst waiting to be processed by no-longer-extant workers.

As long as you can apply DB migrations before the waiting requests timeout (and then set the number of workers back to something sensible) you can perform quite major upgrades without even dropping connections.



While not great for migration uWSGI also has chain reloading [1] which will do the same thing as killing each worker. I use Tornado at work for some applications so I had to come up with something for Gunicorn as uWSGI + Tornado doesn't really fit together.

  [1] http://uwsgi-docs.readthedocs.org/en/latest/Changelog-1.9.html#chain-reloading


Does the master process actually accept() connections while the workers are being restarted? If not, clients will eventually fail to connect after the accept queue length has been reached. This can happen very quickly as accept queues tend to be pretty short (in the hundreds, if not less).


It doesn't accept, not sure what the queue length is, either 100 or 1k as a guess.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: