Apache 2 settings for high traffic website

Posted by Harry on Server Fault See other posts from Server Fault or by Harry
Published on 2012-04-15T19:17:15Z Indexed on 2012/04/15 23:33 UTC
Read the original article Hit count: 150

Filed under:

I'm having problems with the load on my website. It's an amazon ec2 server with 15Gb ram and 4 CPUs behind an LB.

apachetop says I'm getting around 80 reqs per second which seems really low for this kind of server and the load ( given by top ) is usually around 15 but does increase to about 150 in 24 hrs. I'm seeing about 100 active apache processes at any time. Apache is in prefork mode.

Mysql is used very little on the server and there are almost no static files.

Here are my Apache settings:

Timeout 20
KeepAlive Off
MaxKeepAliveRequests 0
KeepAliveTimeout 3

<IfModule mpm_prefork_module>
    StartServers         40
    MinSpareServers      25
    MaxSpareServers      40
    ServerLimit         400
    MaxClients          400
    MaxRequestsPerChild  4
</IfModule>

Can anyone advise on how to tweak the settings? Thanx!

Edit: The config was gotten by trial and error. Any and I mean by a number, change to these lines make the load skyrocket in like 5 minutes. It literally jumps to like 200-300 in a matter of minutes. Especially MaxRequestsPerChild. I've tried with 10, 15, 100, 1000 and the load just skyrockets.

About php - there are actually only a few php files which aren't really that expensive at all. They just spit some simple stuff out.

If I turn on KeepAlive load also goes to space..

© Server Fault or respective owner

Related posts about apache2