On Mon, Jan 26, 2009 at 2:26 PM, Michael Ludwig <m...@as-guides.com> wrote:
> I think this is technically incorrect in that it does not match the
> Apache/LibPHP execution model (which is what I think they're trying to
> emulate), where the Apache/LibPHP process does not exit after serving
> only a single request.

Well, is your goal to be exactly like PHP or is it to provide a fast
environment for non-persistent perl execution?  Perl doesn't have the
same kind of reset switch for the interpreter, so creating a new one
each time is necessary.  Setting MaxRequestsPerChild to 1 causes
apache to prefork a new process with a new interpreter for each
request.  This should be faster than attempting to actually create a
new interpreter, since all it has to do is fork the parent process and
forking is very efficient on Linux and BSD.

> I'm not 100 % sure, but I think the Apache/LibPHP execution model
> compares roughly to this:
>
> mod_perl: Apache::PerlRun - Run unaltered CGI scripts under mod_perl
> http://perl.apache.org/docs/1.0/api/Apache/PerlRun.html

PerlRun is effective in many situations but it will never be as
effective as forking a fresh process/interpreter.

> PHP can leak memory, too. MaxRequestsPerChild is important, as it is
> with Perl. Setting it to 1 in either case means throwing the baby out
> with the bath water.

I disagree.  In fact this was a common recommendation for use with
PerlRun in the old days when people had scripts that were just too
dirty to get running in a persistent environment.

- Perrin

Reply via email to