[Web-SIG] multi-threaded or multi-process wsgi apps
graham.dumpleton at gmail.com
Fri Nov 30 01:01:44 CET 2007
On 30/11/2007, Chris Withers <chris at simplistix.co.uk> wrote:
> Graham Dumpleton wrote:
> > For daemon mode, in mod_wsgi 2.0 there is also 'Process' reload
> > mechanism as an option. Just touching the main WSGI script file entry
> > point will cause just the processes for that daemon process group to
> > be restarted on next request, thereby avoiding a restart of the whole
> > Apache web server and any other hosted applications.
> Cool, when's 2.0 out?
Release candidate for 2.0 including this feature is already available.
Everything was okay for release but then decided to tweak/enhance some
other features, including now finally adding means of specifying
script to run when process first starts so that one can preload stuff.
> > Thus, change your config file, whether it be actual Python code or an
> > ini file and touch the main WSGI script file for that application.
> > Upon the next request against that application it will detect WSGI
> > script file has changed and will do the restart.
> Will that restart all processes/sub processes/threads?
Where a daemon process contains multiple processes, it will result in
all the processes being restarted eventually. Because the restart only
happens when next request comes in, they all effectively get restarted
in a cascade. This is because request hits first sub process and
realises it will need to restart. Then try again and will likely hit
next process in group which indicates it needs to restart as well and
so on until hit process that has finished its restart. This is all
transparent to user except for the slight delay due to restart of
More information about the Web-SIG