Re: Mod_Perl and MaxRequestsPerChild - modperl

This is a discussion on Re: Mod_Perl and MaxRequestsPerChild - modperl ; This server has no proxy in front of it and only serves mod_perl
requests. Static content is loaded from another server with a
different hostname. I had keepalive enabled with a 2 second timeout on
this server until a few ...

Re: Mod_Perl and MaxRequestsPerChild

This server has no proxy in front of it and only serves mod_perl
requests. Static content is loaded from another server with a
different hostname. I had keepalive enabled with a 2 second timeout on
this server until a few seconds ago. Now before you rake me over the
coals, I _thought_ that when I disabled keepalive I saw a significant
rise in CPU usage when running threaded. I suspected the overhead of
establishing a TCP connection as the cause of this, so I reenabled
keepalive with a 2 second timeout a while back. But that was a
mistake.

The only possible down-side of this is the tiny amount of extra
bandwidth used with each additional non-keepalive request by the HTTP
headers. But since I don't use large cookies, that really is a small
amount. Also, I'm using mod_deflate which means I can spare some
bandwidth.

I'm probably going to stick with this config because I like the tried
and tested prefork model, the fact that I can see each process and
it's memory usage and of course it solves my original problem (so far
anyway) of the number of processes doubling for an unknown reason. It
also seems to be a little more CPU efficient.

Thanks very much for all the help!!

Mark.

On 10/16/07, Perrin Harkins wrote:
> On 10/16/07, Mark Maunder wrote:
> > Mornings are the busiest for us, so the following is not during peak.
> > This is my current mod_status:
> > 39.4 requests/sec - 114.4 kB/second - 2976 B/request
> > 80 requests currently being processed, 170 idle workers
>
> Do you have a proxy server in front of this? If not, it might make a
> big difference in how many active mod_perl processes you need.
>
> > I peak at about 75% of my threads being busy. If I have any less than
> > 250 spare threads, then I get an alert from our monitoring every few
> > hours with a timeout because I suspect I'm hitting maxclients every
> > now and then.
>
> You'd see a message in your error_log if you were hitting MaxClients.
>
> > So
> > perlInterpStart and PerlInterpMax are 3 and 5 respectively if they are
> > the defaults.
>
> Then your 5 processes with only 4 using real memory probably means no
> more than 20 perl interpreters. I think that if you ran prefork with
> 20 processes and a front-end proxy you would see the same performance
> with less memory used. Right now, you have a lot of threads that
> aren't running perl but are sending out data to clients. A front-end
> proxy should do that in a prefork setup to avoid tying up the
> interpreters.
>
> > Is there a way to check at runtime what these params are
> > set to?
>
> I think Apache2:irective will do it.
>
> > And what do you recommend for 250 threads?
>
> I avoid threads like the plague, so I couldn't really tell you from
> experience. It sounds like your current settings are working for you
> though, except for the problem you originally mentioned, which I'm
> afraid I don't have any ideas about. Maybe someone who runs threads
> (Torsten?) would have a guess.
>
> - Perrin
>