[mod_python] RE: modPython pool of single-threaded sub-interpreters?

Graham Dumpleton grahamd at dscpl.com.au
Wed Oct 25 22:57:43 EDT 2006

Would prefer that you subscribe to the mod_python mailing list and ask
such questions there. I have cc'd this on to the mailing list and would
hope that you subscribe and follow up there as necessary.

Matt Krom wrote ..
> Hmm, could we employ forking (at the Apache level) to address this issue?
> Ideally with forking, each request would be handled in its own local memory,
> so the Python app would not have to be threadsafe...
> Thanks for any insight.  I've been reading more of your postings (Google
> "site:modpython.org grahamd") for tidbits.
> Matt

What you are talking about is exactly what Apache/mod_python does when
you use it on UNIX with 'prefork' MPM (the default). Read:


If you are running on Windows you are out of luck, your application will have
to be multithread safe.

To determine if your Apache (on UNIX) is built with 'prefork' MPM, run:

  httpd -l

If the listing mentions 'prefork.c', it is prefork. If it mentions 'worker.c' it
is worker MPM and can run multiple requests concurrently in separate
threads in the same process.


> -----Original Message-----
> From: Matt Krom
> Sent: Wed 10/25/2006 10:32 PM
> To: grahamd at dscpl.com.au
> Cc: Matt Krom
> Subject: modPython pool of single-threaded sub-interpreters?
> I'm reading up on the topic of sub-interpreters and threads within mod_python,
> and was encouraged by your knowiedge in this posting :
>    http://www.modpython.org/pipermail/mod_python/2006-August/021867.html
> (Although that posting doesn't address our particular issue).
> What we'd like ("need", actually, since our app is not thread-safe), is:
> - A pool of sub-interpreters
> - Each sub-interpreter handling only one request at a time (single-threaded)
> - New requests given to an idle sub-interpreter
> - Doesn't matter if this is by virtual host, by directory, etc
> As for efficiency of this model, it's no worse than what we're doing now
> (fastcgi manages a pool of C processes, each with its own Python interpreter).
> Do you know of a way to configure mod_python as above?  If you're a committer
> or have viewed the code, does it seem like an easy modification I could
> attempt?
> Thanks for any insight--we are sort of in a pickle and need to solve this
> issue.
> Matt
> mkrom at banta.com
> Cambridge, MA

More information about the Mod_python mailing list