perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tina Mueller <>
Subject Re: Why is my apache parent process growing...
Date Mon, 02 Jan 2006 22:15:52 GMT
On Mon, 2 Jan 2006, Len Kranendonk wrote:

> I'm running Apache/2.0.54, mod_perl/2.0.1, Perl/v5.8.7 on FreeBSD 6.0. 
> Right after starting apache (with preloading the needed perl modules) the httpd root
process is about 40MB. 
> After several days it has grown to over 100MB.

what would be interesting: how many requests do you have per second?
usually it doesn't hurt to set MaxRequestsPerChild to a desired low
i recently made a memory bench with a self-compiled apache 1.33 that
showed that every request (of a mod_perl-handler that just outputs
content-type) added a small amount of memory to the child process; i
haven't watched the parent process, though.

it's also common to regularly restart apache once a day/week/...

> I'm using Apache2::SizeLimit to kill of httpd childs that get too large. I'm using this
> $Apache2::SizeLimit::MAX_PROCESS_SIZE = 100000;
> $Apache2::SizeLimit::MAX_UNSHARED_SIZE = 25000;
> The problem here is that when the Apache parent process gets 100000 KB big, the spawned
> also are that size, which means that a spawned child is killed immediately after it served
its first request. 
> The only way to decrease the parent size is to stop and start apache.
> My understanding is that the parent process is not supposed to serve any requests itself.

> It's entire job is to manage the children. So, how come it is growing, and more importantly,
how can
> I control it ?

try to figure out what kind of data strucures you're using where.
if you have structures that are shared for all childs and you write to
them, then this data memory will be copied for all childs and the root
process (i think).
wherever you can, separate configuration data you don't write to from
data you are changing.
Devel::Size can help you to find out the sizes of your variables
(although a colleague tried it once on his webserver and it didn't show
correct sizes, while working on the command line, but it worked for me).

if you use Apache::Registry, then preload your scripts in the startup
script, so that the code is in "shared memory". this will increase the
root process first, but once it's loaded, the child processes don't have
to load it again, so the overall memory used will be less.



View raw message