Sloooooowwwww WSGI restart

Ron Garret rNOSPAMon at flownet.com
Thu Jan 29 17:54:33 EST 2009


In article <498170d4$0$23718$426a74cc at news.free.fr>,
 Bruno Desthuilliers <bruno.42.desthuilliers at websiteburo.invalid> 
 wrote:

> Ron Garret a écrit :
> > I'm running a WSGI app under apache/mod_wsgi and I've noticed that 
> > whenever I restart the server after making a code change it takes a very 
> > long time (like a minute) before the script is active again.  In other 
> > words, I do an apachectl restart, reload the page in my browser, and one 
> > minute later it finally comes up.  During this time CPU usage is 
> > essentially zero.  Loading all the code manually into a python 
> > interpreter is virtually instantaneous, and all subsequence interactions 
> > with the app are very fast.
> > 
> > Does anyone have any ideas what might be going on or how to debug this?
> 
> Restarting apache (with or without mod_wsgi) can by itself take some time.
> 
> Now, if you're running mod_wsgi in daemon mode, you _don't_ have to 
> restart apache to reload your code - just touch the wsgi script file and 
> you'll be done, ie with:
> 
> 
>    WSGIProcessGroup myproject.tld
>    WSGIDaemonProcess myproject.tld user=you group=you
>    WSGIReloadMechanism Process
>    WSGIScriptAlias / /var/www/myproject/apache/myapp.py
> 
> 
> you just have to touch myapp.py to force reload the subinterpreter(s).

Unfortunately, I'm running Debian Etch, which has an older mod_wsgi, 
which does not have the process reloading mechanism.

But I guess if this gets too painful I'll upgrade.

rg



More information about the Python-list mailing list