[mod_python] Multiple Interpreters mod_python optimization

Graham Dumpleton graham.dumpleton at gmail.com
Fri May 15 07:40:46 EDT 2009

2009/5/15 zsi <zsi at skolesys.dk>:
> On Fri, 15 May 2009 20:35:59 +1000, Graham Dumpleton
> <graham.dumpleton at gmail.com> wrote:
>>>> BTW, the process IDs in your 'ps' output don't even match what your
>>>> Python code is producing. Looks like you aren't even talking to the
>>>> same Apache instance.
>>> I wasn't expecting them to match. The process id's from the python code
>>> are the interpreter's pid not the apaches. What I wanted to show by
>>> that was that it is stille the same apache processes (8 of them) but
>>> I have 18 different interpreter process ID's. So it is not because I
>>> hit a new apache process every time.
>> Did you read the document I told you to read about process/interpreter
>> model of Apache/mod_python? As well as the blog entry?
>> The Python sub interpreters run in the Apache child processes. Thus
>> the process IDs from your Python code must have some overlap with the
>> Apache processes you listed.
>> Apache/mod_python does not create special Python interpreter processes.
> Yes, I read it and it makes it even more odd that I get a new pid everytime
> I call os.getpid(), that doesn't match the apache processes.

Have you run 'ps' to find out what processes are using those pids and
whether they exist after the requests are done.

If need be, put a time.sleep() call after you log the pid to give you
time to do the 'ps', just in case they are transient as a result of
Apache configuration, or because they are crashing at end of request.

Also ensure you have set:

  PythonDebug On

to enabled stuff in Apache error logs about mod_python loading of files.


More information about the Mod_python mailing list