Sloooooowwwww WSGI restart

Ron Garret rNOSPAMon at
Thu Jan 29 03:52:34 CET 2009

In article 
<4cd232ff-ba8b-47aa-8ee6-d8d9712db84c at>,
 Graham Dumpleton <Graham.Dumpleton at> wrote:

> On Jan 29, 8:35 am, Ron Garret <rNOSPA... at> wrote:
> > I'm running a WSGI app under apache/mod_wsgiand 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?
> The better place to discuss this is the mod_wsgi list.

The reason I don't go there is that I'm using an NNTP client.  I find 
Google Groups' web interface to be very annoying because there's no way 
to keep track of read messages.

> As to the problem, you need to distinguish between whether it is
> Apache that is taking a long time to restart and ready to handle
> requests, or whether the delay is on the first subsequent request made
> against your WSGI application.
> When Apache restarts, it doesn't by default load your WSGI
> application, it only does that the first time a request comes in
> directed at it. Thus, if after you restart Apache you do a request of
> a static file, do you get a response straight away?

I thought I did, but having poked at it more I now realize that I was 
just getting a cached page.  It does appear to be an apache issue, not a 
WSGI issue.  Sorry for the false alarm.


More information about the Python-list mailing list