On Tue, Feb 10, 2009 at 4:22 AM, Joshua J. Kugler <[email protected]> wrote:
>
> On Sunday 08 February 2009, Graham Dumpleton said something like:
>> In PHP, it preloads all its extension modules in the Apache parent
>> process. That is, they have been loaded even before Apache forks off
>> the child processes which handle requests. As a result, creation of
>> new child processes capable of handling PHP requests is very quick
>> with neglible overhead.
>
> And, as has been mentioned, all those modules share memory, so memory
> usage is much lower.

I think there is a need to consider a couple of subtle differences
here: PHP does not have "modules" in the sense that Python has
"modules". The closest analog that PHP has to Python "import" are the
"include" and "require" statements. However these are more akin to
#include preprocessor directive in C.

PHP C *extensions* on the other hand are a different matter. They are
loaded (if you tell it to do so in php.ini) when a PHP interpreter is
started, they become part of the PHP interpreter process itself. It is
not correct to assume that Apache SAPI PHP subprocesses share memory
*at all times*, they only do so until something in the interpreter
changes memory that was initially shared (copy on write). This is why
you get faster response times for PHP because subprocess creation is
cheap and Apache is able to respond *apparently* quickly. But in
reality, it is just as "slow" as mod_wsgi the moment copy on write is
triggered and the OS allocates memory for the subprocess.

> So, in relation to this question, would there be any way to tell
> mod_wsgi to pre-load a set of modules, and then allow Apache to fork?

Like mod_perl's PerlLoadModule and PerlModule?

http://perl.apache.org/docs/2.0/user/config/config.html#C_PerlLoadModule_

> That would bring memory usage WAY down as Python only loads a module
> once, and it seems each instance could share.
>
> An alternative, but related: could mod_wsgi execute the WSGI script file
> before allowing Apache to fork?  Our script file loads just about all
> our modules when it does a bootstrap of our environment, so would be an
> ideal candidate for pre-loading all our modules.
>
> j
>
> --
> Joshua Kugler
> Part-Time System Admin/Programmer
> http://www.eeinternet.com
> PGP Key: http://pgp.mit.edu/  ID 0xDB26D7CE
>
> >
>



-- 
Best Regards,
Nimrod A. Abing

W http://arsenic.ph/
W http://preownedcar.com/
W http://preownedbike.com/
W http://abing.gotdns.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to