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.
Based on Perrin's advice I now have the following config: Keepalive Disabled Prefork MPM StartServers 10 MinSpareServers 10 MaxSpareServers 45 ServerLimit 50 MaxClients 50 MaxRequestsPerChild 5000 Here's how mod_status looked BEFORE this change with keepalive on and 250 threads with worker MPM: *snip* 37.6 requests/sec - 109.0 kB/second - 2969 B/request 63 requests currently being processed, 187 idle workers _C__C______C__K__KK_CK___KK__K____KC_______K______.............. C_KK__W__K______K_____K____________KK_K_______C_K_.............. C__CK______K_C______K_K__C_K____K_K__K_C__K____K__.............. __CKKK___________________C____KC____C_K________C__.............. _KC__KK_____K___W_________C____K_K___C_C________K_.............. And here's what it looks like after this change: *snip* 36.2 requests/sec - 107.9 kB/second - 3054 B/request 17 requests currently being processed, 24 idle workers ___C___CC_C__C_C__C_CCC_C_CC___C__W____CC......... There's no rise in CPU usage with keepalive off - in fact it seems to have dropped. And here's the output of 'free' after the change after running for 10 minutes: total used free shared buffers cached Mem: 2054504 1638580 415924 0 83376 772828 -/+ buffers/cache: 782376 1272128 Swap: 2096472 49340 2047132 LOTS of free memory. 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 <[EMAIL PROTECTED]> wrote: > On 10/16/07, Mark Maunder <[EMAIL PROTECTED]> 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::Directive 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 > -- Mark Maunder <[EMAIL PROTECTED]> http://markmaunder.com/ +1-206-6978723