You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by ChristoDeluxe <na...@cfs.parliant.com> on 2011/07/15 22:54:09 UTC

mod_perl2 memory growth after restart of Apache

Hi,

Looking in the archives, I see people (mostly back a few years) saying that
people should not use "apachectl restart" or "apachectl graceful" (or
sending the HUP signal) to restart Apache since it leaks memory.

This is the case that I'm seeing (Apache/2.2.19 (FreeBSD 8.0) mod_perl/2.0.5
Perl/v5.8.9) where for every time I run apachectl restart, it leaks a few MB
of RAM into the parent process and thus into all the children too.  The size
of the leak is very dependent on how much code I preload into mod_perl using
a PerlRequire in the main server's config, so my guess is that the compiled
version of my perl modules is leaking for every restart.

Is this a known issue, is it specific to FreeBSD, or is there a way to
mitigate this leaking?

I'd rather not stop/start the server, since "graceful" results in almost no
downtime that would affect incoming HTTP requests.

Thanks,
Chris
-- 
View this message in context: http://old.nabble.com/mod_perl2-memory-growth-after-restart-of-Apache-tp32071270p32071270.html
Sent from the mod_perl - General mailing list archive at Nabble.com.


Re: mod_perl2 memory growth after restart of Apache

Posted by Perrin Harkins <pe...@elem.com>.
On Fri, Jul 15, 2011 at 4:54 PM, ChristoDeluxe <na...@cfs.parliant.com> wrote:
> Looking in the archives, I see people (mostly back a few years) saying that
> people should not use "apachectl restart" or "apachectl graceful" (or
> sending the HUP signal) to restart Apache since it leaks memory.

That was the case in the past.  Maybe someone else has found a way
around it.  I haven't.  One thing you could try is using graceful
shutdown, followed by start.  This actually shuts down, but doesn't
cut off any existing requests.  Another common approach is to have a
load balancer that allows you to take half of your cluster offline and
restart, and then do the other half.

- Perrin

Re: mod_perl2 memory growth after restart of Apache

Posted by Fred Moyer <fr...@redhotpenguin.com>.
On Fri, Jul 15, 2011 at 1:54 PM, ChristoDeluxe <na...@cfs.parliant.com> wrote:

> This is the case that I'm seeing (Apache/2.2.19 (FreeBSD 8.0) mod_perl/2.0.5
> Perl/v5.8.9) where for every time I run apachectl restart, it leaks a few MB
> of RAM into the parent process and thus into all the children too.  The size
> of the leak is very dependent on how much code I preload into mod_perl using
> a PerlRequire in the main server's config, so my guess is that the compiled
> version of my perl modules is leaking for every restart.
>
> Is this a known issue, is it specific to FreeBSD, or is there a way to
> mitigate this leaking?

If you have Dtrace installed on your system, you can use the iosnoop
utility to see what files are accessed during the graceful restart,
and add those modules via PerlRequire or startup.pl.  When I used this
approach with Perl 5.8.8, there were a few files like utf8_heavy.pl
that were being stat'd each time a child httpd forked, so I was able
to really maximize the amount of used modules in shared memory.