[mod_python] Fw: slow child init problems

Jack Diederich jack_diederich at email.com
Mon Jul 29 11:20:21 EST 2002


I tried sending this before I was a member of the list, and  I guess it wasn't approved...

I have a project running under mod_python with about 10k of python source.

On a pIII-500 it takes 2 seconds for the first request to an httpd process,
and 0.2 seconds for each request after that to run.  This isn't a show stopper
for now, but it really bugs me (the software will be production in about a month)

I've thought of switching to WebWare, which shouldn't have this problem, but is
otherwise more than I need and the switching costs would be non-zero.

The problem seems to be that the imports, even with the PythonImport directive listing all of them
aren't done until ChildInitHanlder(), which is called the first time a child process
gets its first hit, apparently.  I say apparently because the difference between
using PythonImport or not is zero time-wise.  Using .pyo files instead of .py
cuts the first-hit time in half, but is still five times
larger than the time to handle a second hit.

Why can't the work (whatever it is) be done _before_ the fork of the children?
This is what mod_perl does.  mod_php doesn't, it has some possibly intentional
design problems that require a fresh interperator init and byte compile between
requests (but there are hooks in the code for the $ work-aournd module).
But looking through the python internals I couldn't figure out why this isn't possible. I couldn't figure out where to patch it myself, but I didn't see any showstoppers like with php.

So ... anyone know how to work around this, why its done this way, or where I
should look to patch it?

thanks in advance,
-jackdied

-- 
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

Get 4 DVDs for $.49 cents! plus shipping & processing. Click to join.
http://adfarm.mediaplex.com/ad/ck/990-1736-3566-59




More information about the Mod_python mailing list