Forum Moderators: phranque

Message Too Old, No Replies

Many sleeping Apache processes and high load average

Apache server misconfiguration

         

homeini

3:50 pm on Aug 5, 2010 (gmt 0)

10+ Year Member



Hello.

I am having problems with Apache server. I have seen how there are many times that the server becomes saturated and load up a lot. Executing 'top' in some cases there are values greater than 30 (when there are problems).

I notice that in these moments there are a lot of Apache processes and most of them are 'sleeping', I understand that this can be at least part of my problem.

The server hosts a website that runs PHP (+symfony) and MySQL which has about 600,000 different pages, and I think my biggest problem is when a Yahoo or Google's spider come to pay me a visit.

On the issue of traffic, we usually have 35,000 hits and 60,000 page views a week.

I think the server that I have hired is enough to accept this, if you want to see its features is this:
[ovh.co.uk...]

I think what happens is that we don't have a good Apache server configuration, but if anyone thinks the problem is something else tell me please.

We have this info message in error log continously:
server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning X children, there are X idle, and X total children

I will put my settings if someone can lend a hand and say we are doing wrong:

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 100

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5

##
## Server-Pool Size Regulation (MPM specific)
##

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 200
MaxClients 200
MaxRequestsPerChild 2000
</IfModule>


If anyone can help me is welcome ;)

Greatings!

lammert

9:07 pm on Aug 5, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



KeepAlive On Tells Apache that it has to keep the connection with the client open for a certain amount of time to see if more requests are coming through that pipe. This is on Apache the most common reason for the existence of a lot of processes which seem to do nothing. Setting this value to Off will force the connection with a client to be closed after every single item transfer. If this benefits your site depends on the amount of hits per page request you are serving. If you serve relatively few hits per page, it is better to turn this setting to Off. But if you have many images, CSS and JS files per page, disabling KeepAlive connections may increase page load time for visitors significantly because every single page item requires its own new TCP/IP connection.

Another issue is ServerLimit 200 and MaxClient 200. You should tune these values to a range where under heavy load the larger part of memory is occupied by running processes like Apache, but swapping still doesn´t occur. The optimal setting of these two parameters depend mainly on the amount of available RAM in your server and the memory usage of other processes which compete with Apache in RAM usage.