You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by ne...@mediaone.net on 2001/04/25 12:43:54 UTC

What is the difference: PerlRun and MaxRequestsPerChild 1

I recently began to experience many lingering
mod_perl processes which slow down my tcp connection.

I use Apache::Registry for all my mod_perl need.
Not the "real" handler.

The practical solution I found was to cut down the 
number MaxRequestPerChild and kill off the processes
after a few requests.

I understand that Apache::PerlRun has the overhead
of compiling each script with a new request.  I would
like to know whether there is a compilation overhead
if I set say MaxRequestsPerChild 1  ??

I was also thinking that because the script is loaded
from the disk with each request there will be performance
degradation because of disk data ransfer rate will be
order of magnitude less than if the script were
to remain in the memory all the time.

That leads me to think about using very cool RAMFS that
comes linux-2.4.  What does everyone think about using
RAMFS to reduce the performance degradation due to
loading script from the disk if there is one.
I have over 100 scripts altogether but the total size of them
is less than 1 MB and I have plenty of memory.

Thanks in advance

Re: What is the difference: PerlRun and MaxRequestsPerChild 1

Posted by ne...@mediaone.net.
On Wed, Apr 25, 2001 at 12:10:01PM +0100, G.W. Haywood wrote:
> Hi there,
> 
> On Wed, 25 Apr 2001 newsreader@mediaone.net wrote:
> 
> > like to know whether there is a compilation overhead if I set say
> > MaxRequestsPerChild 1 ??
> 
> http://perl.apache.org/guide

I have read the "guide" cover to cover long ago :)


> You can use ramdisks with almost *any* Linux.
> 

Ah.. ramdisk and ramfs are different animals....



Re: What is the difference: PerlRun and MaxRequestsPerChild 1

Posted by ne...@mediaone.net.
Thanks.  I think that is what I really need :)

On Wed, Apr 25, 2001 at 08:19:21PM +0800, Stas Bekman wrote:
> the two events contrudict and lead to the need to re-read the guide, and
> especially this section:
> http://perl.apache.org/guide/performance.html#Preloading_Registry_Scripts_at_S
> 
> :)
> _____________________________________________________________________
> Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
> http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
> mailto:stas@stason.org   http://apachetoday.com http://eXtropia.com/
> http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
> 

Re: What is the difference: PerlRun and MaxRequestsPerChild 1

Posted by Stas Bekman <st...@stason.org>.
On Wed, 25 Apr 2001 newsreader@mediaone.net wrote:

In a different thread newsreader@mediaone.net said:

> I have read the "guide" cover to cover long ago :)

In the other thread newsreader@mediaone.net has asked:

> Not exactly sure how to preload these scripts.  I have the following

the two events contrudict and lead to the need to re-read the guide, and
especially this section:
http://perl.apache.org/guide/performance.html#Preloading_Registry_Scripts_at_S

:)
_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:stas@stason.org   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



Re: What is the difference: PerlRun and MaxRequestsPerChild 1

Posted by ne...@mediaone.net.
On Wed, Apr 25, 2001 at 07:19:25PM +0800, Stas Bekman wrote:
> > if I set say MaxRequestsPerChild 1  ??
> 
> Not if you preload your scripts at the server startup. But then you pay
> the price of the time to spawn a new process, which has a very little
> overhead under low load since Apache preforks processes (assuming that you
> have MaxSpareServers set to a reasonable number). Under very high load
> your machine will spend a lot of CPU, spawning processes, which is not
> good.
> 

I have lots of custom modules that I preload with "startup.pl".

Still I have many "scripts" that run under Apache::Registry.
Not exactly sure how to preload these scripts.  I have the following
directive
--------------------
PerlTaintCheck On
<IfModule mod_perl.c>
<Location />

#  PerlSetVar PerlRunOnce On

SetHandler perl-script
PerlRequire /home/apache/modperl/startup.pl
PerlHandler Apache::Registry

#  PerlSendHeader On

  Options +ExecCGI
</Location>
</IfModule>
------------
Note: this is a dedicated mod_perl server and I'm not serving
any static pages.
-----

Document root / contains 100 perl scripts.

I preload 40 modules (of which 29 is my own
custom modules) in startup.pl as
explained in your guide.

So I guess I don't understand what you mean by 
preloading "scripts".  One of the reasons
I like having 100 scripts in document root
with Apache::Registry is that I can modify
them at any time and I don't have restart
the server.  This is also one of the reasons
I don't bother with the "real" handler.

Thanks

Re: What is the difference: PerlRun and MaxRequestsPerChild 1

Posted by Stas Bekman <st...@stason.org>.
On Wed, 25 Apr 2001 newsreader@mediaone.net wrote:

> I recently began to experience many lingering
> mod_perl processes which slow down my tcp connection.
>
> I use Apache::Registry for all my mod_perl need.
> Not the "real" handler.
>
> The practical solution I found was to cut down the
> number MaxRequestPerChild and kill off the processes
> after a few requests.
>
> I understand that Apache::PerlRun has the overhead
> of compiling each script with a new request.  I would
> like to know whether there is a compilation overhead
> if I set say MaxRequestsPerChild 1  ??

Not if you preload your scripts at the server startup. But then you pay
the price of the time to spawn a new process, which has a very little
overhead under low load since Apache preforks processes (assuming that you
have MaxSpareServers set to a reasonable number). Under very high load
your machine will spend a lot of CPU, spawning processes, which is not
good.

> I was also thinking that because the script is loaded
> from the disk with each request there will be performance
> degradation because of disk data ransfer rate will be
> order of magnitude less than if the script were
> to remain in the memory all the time.

true, see above

> That leads me to think about using very cool RAMFS that
> comes linux-2.4.  What does everyone think about using
> RAMFS to reduce the performance degradation due to
> loading script from the disk if there is one.
> I have over 100 scripts altogether but the total size of them
> is less than 1 MB and I have plenty of memory.

don't. preload the code at the server startup.


_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:stas@stason.org   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



Re: What is the difference: PerlRun and MaxRequestsPerChild 1

Posted by "G.W. Haywood" <ge...@www.jubileegroup.co.uk>.
Hi there,

On Wed, 25 Apr 2001 newsreader@mediaone.net wrote:

> like to know whether there is a compilation overhead if I set say
> MaxRequestsPerChild 1 ??

http://perl.apache.org/guide

> disk data ransfer rate will be order of magnitude less than if the
> script were to remain in the memory all the time.

Not "order", "orders" :)

> That leads me to think about using very cool RAMFS that
> comes linux-2.4.

You can use ramdisks with almost *any* Linux.

> What does everyone think about using RAMFS to reduce the performance
> degradation due to loading script from the disk if there is one.

Anything that reduces the need to go to a rusty, spinning plate to get
your data is a Good Thing.

73,
Ged.