mod_perl memory usage (was: Re: validator/httpd/cgi-bin check,1.546,1.547)

On Thursday 26 July 2007, you wrote:

> mod_perl2 helps with speed a lot, but appears to suck in a lot of
> memory, and two of our servers died by lack of swap, today...

I haven't run mod_perl 2 in production and I'm generally a bit rusty with this 
stuff, but at least with mod_perl 1.x on Linux a few years ago, you _really_ 
didn't want the mod_perl httpd processes to be swapped out in any 
circumstances.

These processes are often huge compared to usual httpd processes, but that's 
mostly fine as a lot of memory they use is actually shared between them.  
Well, up until they get swapped - that's when IIRC the shared memory in them 
goes non-shared and the total memory usage pretty much explodes.  Also, the 
memory once reserved by a mod_perl httpd process is never released back to 
the OS, but it does get reused.

I don't know if there's a mod_perl 2 specific guide to this, but for mod_perl 
1.x there's good stuff at 
http://perl.apache.org/docs/1.0/guide/performance.html

I'd guess things are more or less the same with 2.x, in a nutshell: find out 
how many mod_perl/httpd processes you can have without any of them getting 
swapped out and limit the number of them to that.  See also MaxClients and 
MaxRequestsPerChild in the above performance doc.

Again, I'm not quite up to date with this stuff - this was an experience some 
years back with mod_perl 1.x and Linux, so take it with a grain of salt.

Received on Thursday, 26 July 2007 07:02:43 UTC