My site has gone from getting 20,000 visits/day, to 182,000 yesterday, due to being featured on a number of popular sites.

The site has become somewhat unresponsive. Many requests will lead to a timeout. Yet there is plenty of CPU & RAM available. CPU and RAM does has not really peaked above 20%, and is on average around 12%.

When trying to download the homepage with WGET, it will stall here:

Resolving domain.io (domain.io)... Connecting to domain.io (domain.io)||:80... failed: Connection timed out. Retrying.

But if it does actually connect, it will download the page quickly. Additionally, I can connect to phpMyAdmin via the brower via IP and it works as normal.

This leads me to believe there is an issue in Apache

My settings:

Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5

<IfModule mpm_prefork_module>
StartServers          5
MinSpareServers       5
MaxSpareServers      10
MaxClients          150
MaxRequestsPerChild   0

<IfModule mpm_worker_module>
StartServers          2
MinSpareThreads      25
MaxSpareThreads      75
ThreadLimit          64
ThreadsPerChild      25
MaxClients          150
MaxRequestsPerChild   0

<IfModule mpm_event_module>
StartServers          2
MinSpareThreads      25
MaxSpareThreads      75
ThreadLimit          64
ThreadsPerChild      25
MaxClients          150
MaxRequestsPerChild   0

Not which sure of these I am using, will check now.

Does anyone have any suggestions as to what to tinker with here? In Apache or otherwise.

When I login via SSH it says:

System load:    2.92
Processes:           289
Users logged in:     0
Memory usage:   9%
Swap usage:     0%

The server is a 4 core 3.2Ghz with 32GB RAM and 2x2TB, little of which is used.


You should enable mod_status and see if you're not reaching apache limits of concurrent connections. Probably you have set this limits too low and should increase values of MaxClients, ThreadLimit and ThreadPerChild depends on which mpm module you are using.

  • I have checked and it is prefork. I have disabled KeepAlive and upped MaxClients to 300 and it is working better. I will try your suggestions now... – Kohjah Breese Nov 3 '15 at 12:19
  • mod_status will show you how many preforked childs are busy and how many is idle, waiting for new clients. AFAIK apache can handle only MaxClients concurent connections. – Ondra Sniper Flidr Nov 3 '15 at 12:45

Some other stuff to check, on apache's error log, chek for entries like this one:

apache server reached MaxClients setting, consider raising the MaxClients setting

That means you've reached the configured maximum number of processes / threads

Another good indication that apache isn't keeping up with load, perhaps because of the max thread / process configuration is an overflow if the listen queue, you can check it like this:

netstat -s | grep -i listen

Normally you wont get output from that, but in case of trouble you get:

# netstat -s | grep -i listen 
    26760 times the listen queue of a socket overflowed
    26760 SYNs to LISTEN sockets ignored

Hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.