You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by John ORourke <jo...@o-rourke.org> on 2007/02/08 09:54:47 UTC

apache MaxClients and locking up

Hi folks,

Not sure if this is mod_perl related but the logic goes I've never had 
this issue on a non-mod_perl server...

I've got a busy server with quite a few problems, but one in particular 
is very odd.

Occasionally the DB gets a bit bogged down and starts taking a while to 
respond (optimisations are being done at the mo), and after a while in 
the error log I get:

[Wed Feb 07 12:35:53 2007] [error] server reached MaxClients setting, 
consider raising the MaxClients setting

and then a whole heap of nothing - I can't tell if the server is still 
accepting new connections at that point as the server accepts 
connections but does nothing, and the system is heavily loaded but still 
responsive at the command line, and it's not using any swap space on 
disk because I tuned the apache/mysql settings properly.

I do have MaxClients set quite low (13) because my httpd process size is 
60-70MB - it's all set up so it never needs to swap.  This is mod_perl 
2.08, Apache 2.2.0 both from Fedora Core 5 packages.  I'm using a 
persistent handler object set up during httpd startup, and caching DBI 
connection objects in that.

Obviously I will be attempting to reduce httpd process size and optimise 
the database but still a strange problem.

I'm wondering if maybe I've caused a race condition somewhere but don't 
really know where to start looking.  I'm thinking I'll put in some 
custom handlers to monitor each request's progress for problems.

cheers
John


Re: apache MaxClients and locking up

Posted by John ORourke <jo...@o-rourke.org>.
Thanks for all the advice guys - due to pressure from the customer I'm 
going to concentrate on optimising the app and then look into the server 
optimisations.  It's suffering from inner-platform-effect at the moment 
(http://thedailywtf.com/forums/69415/ShowPost.aspx ) so the DB is doing 
way too much work and can't cache efficiently.

cheers
John

Kjetil Kjernsmo wrote:
> On Thursday 08 February 2007 17:42, Jonathan Vanasco wrote:
>   
>> Are you using a 2 sever setup, where mp runs on an alternate port and
>>   something on port 80 (or elsewhere on the LAN) proxies the request
>> ? If not, try setting that up.  That can squeeze out some
>> performance. You could just have a ton of requests queued because
>> slow clients are tying up all 13 children.
>>     
>
> Actually, it is not only there to squeeze out some performance, in my 
> experience it is absolutely essential to do this on a somewhat heavy 
> mod_perl application. So, I'd strongly recommend it, John!
>
> And if that doesn't work, you need more RAM! :-) Unless, of course, you 
> max out the CPU, then you need a faster CPU or another box... 
>
> Cheers,
>
> Kjetil
>   


Re: apache MaxClients and locking up

Posted by Kjetil Kjernsmo <kj...@opera.com>.
On Thursday 08 February 2007 17:42, Jonathan Vanasco wrote:
> Are you using a 2 sever setup, where mp runs on an alternate port and
>   something on port 80 (or elsewhere on the LAN) proxies the request
> ? If not, try setting that up.  That can squeeze out some
> performance. You could just have a ton of requests queued because
> slow clients are tying up all 13 children.

Actually, it is not only there to squeeze out some performance, in my 
experience it is absolutely essential to do this on a somewhat heavy 
mod_perl application. So, I'd strongly recommend it, John!

And if that doesn't work, you need more RAM! :-) Unless, of course, you 
max out the CPU, then you need a faster CPU or another box... 

Cheers,

Kjetil
-- 
Kjetil Kjernsmo
Information Systems Developer
Opera Software ASA

Re: apache MaxClients and locking up

Posted by Jonathan Vanasco <jv...@2xlp.com>.
On Feb 8, 2007, at 8:31 AM, Perrin Harkins wrote:

> Apache will accept more connections but they will just get queued.
> This is described in the docs for the MaxClients setting.
>
> What makes you think the server is doing nothing?  Maybe it's simply
> waiting for slow database results.  Have you tried some logging, or
> monitoring the database activity?  Have you tried to recreate this
> condition artificially with a load testing tool?

Are you using a 2 sever setup, where mp runs on an alternate port and  
something on port 80 (or elsewhere on the LAN) proxies the request ?
If not, try setting that up.  That can squeeze out some performance.   
You could just have a ton of requests queued because slow clients are  
tying up all 13 children.

Try running a performance benchmark to see how many connections you  
can handle with your DB as-is, and if you haven't done it yet, start  
profiling your setup for that.
In my situation, my system stops improving after 5 children -- the db  
can't keep up with apache being so fast.



// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
| SyndiClick.com
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
|      FindMeOn.com - The cure for Multiple Web Personality Disorder
|      Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
|      RoadSound.com - Tools For Bands, Stuff For Fans
|      Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -



Re: apache MaxClients and locking up

Posted by Perrin Harkins <ph...@gmail.com>.
On 2/8/07, John ORourke <jo...@o-rourke.org> wrote:
> Occasionally the DB gets a bit bogged down and starts taking a while to
> respond (optimisations are being done at the mo), and after a while in
> the error log I get:
>
> [Wed Feb 07 12:35:53 2007] [error] server reached MaxClients setting,
> consider raising the MaxClients setting
>
> and then a whole heap of nothing - I can't tell if the server is still
> accepting new connections at that point as the server accepts
> connections but does nothing, and the system is heavily loaded but still
> responsive at the command line, and it's not using any swap space on
> disk because I tuned the apache/mysql settings properly.

Apache will accept more connections but they will just get queued.
This is described in the docs for the MaxClients setting.

What makes you think the server is doing nothing?  Maybe it's simply
waiting for slow database results.  Have you tried some logging, or
monitoring the database activity?  Have you tried to recreate this
condition artificially with a load testing tool?

- Perrin