httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giles Coochey <gi...@coochey.net>
Subject Re: [users@httpd] apache seems to be busy
Date Tue, 18 Oct 2011 12:31:48 GMT
On 18/10/2011 12:59, Tom Evans wrote:
> On Tue, Oct 18, 2011 at 12:11 PM, Petr Hracek<phracek2@gmail.com>  wrote:
>> Dear users,
>>
>> There are run most AJAX requests. After increasing the values
>> StartServers 15
>> MinSpareServers 10
>> MaxSpareServers 30
>>
>> ==>  error_log<==
>> [Tue Oct 18 11:25:59 2011] [info] server seems busy, (you may need to
>> increase StartServers, or Min/MaxSpareServers), spawning 8 children,
>> there are 0 idle, and 23 total children
>> [Tue Oct 18 11:26:00 2011] [info] server seems busy, (you may need to
>> increase StartServers, or Min/MaxSpareServers), spawning 16 children,
>> there are 7 idle, and 31 total children
>>
>> Can there be a problem that AJAX objects did not close the connections properly?
>>
>> Thank you in advance
>>
> Anything is possible, but no, that is unlikely.
>
> Do you have more of these messages in the log? It looks like you don't
> start enough children to serve your peak load. These two log entries
> show that your server started with 15, and within a few seconds
> started an additional 16 children, indicating that you need to
> increase your StartServers.
>
> Forking isn't free, so you will want to start as many child processes
> as you will probably need, and allow them to stay alive rather than
> killing them off when you get quiet, just to respawn them again when
> you are busy. The trade-off from doing this is that each child
> consumes memory.
>
> Therefore:
>
> Set StartServers and MaxSpareServers to the same value, and increase
> both until you don't get these messages - we increase MaxSpareServers
> so that it doesn't just kill them all off in quiet periods.
>
> Once you have found how many server children you need, set
> StartServers to that value, MaxSpareServers to maybe 80% of that
> value, and MinSpareServers to about 10% of that value.
>
> The next step is working out how many server children is too many. To
> do this, you need to stress test your application, trying to get it
> super busy - basically, in fact, until Apache croaks that you need to
> increase MaxClients.
>
> Stop the test, increase MaxClients (if you increase it above 256, you
> also need to increase ServerLimit), repeat test. Do this until your
> server runs out of memory/CPU/disk - that is your absolute limit to
> number of server children. I'd normally step back a bit from that, to
> allow some overhead.
>
> As an example, one of our busy apache servers has StartServers 200,
> MinSpareServer 20, MaxSpareServers 160, MaxClients 512, ServerLimit
> 512. When we approach MaxClients, the box is approaching running out
> of memory.
>
>
Good advice.

You might want to bear in mind what else your server is doing other than 
running Apache and what your available resources (memory / CPU) are. If 
you are running maintenance jobs during low-usage periods and have 
limited resources, such as with many Vms, then you might want to trade 
off some of the 'StartServers' for the extra resources on your system at 
low usage periods.
The best action depends on your particular environment you should check 
the docs and come to a reasoned configuration based on what you've seen 
in your logs.



Mime
View raw message