[mod_python] Fw: slow child init problems

Jack Diederich jack_diederich at email.com
Mon Jul 29 21:02:27 EST 2002


[me]
> > Why can't the work (whatever it is) be done _before_ the fork of the
> > children?

[Gregory Trubetskoy]
> First, you should look at making sure that everything runs under one
> sub-interpreter. The information such as the name of the virtual host is
> undefined until the actual request comes in, so PythonImport imports
> everything under the interpreter named after the directory in the
> surrounding <Directory> tag or the main interpreter. Your other code
> probably runs in the subinterpreter for that virtual server, so it ends up
> reimporting everything again. You can force everything to run under the
> main interpreter by specifying "PythonInterpreter main_interpreter".

I'm not running any virtual servers. I tried the directive
and it had the same behavior (first time a process gets
hit it takes 10 times the second and further hits)

> It's possible that you're right that ChildInit gets executed on the first
> hit, I can't answer this off the top of my head without digging in apache
> source code or experimenting. 

I've looked at the code, and it doesn't get called until the
first hit.  BTW, one thing I love about python (and
mod_python) is that the source is incredibly easy to browse
and understand (compare perl internals).

That said, I'm going to go swimming in perl/mod_perl for a
bit to see how they do it. Failing that, maybe I'll hit up
the mod_perl mailing list for help.

thanks,

-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