Web-server – AB failed requests – What can I do about them

apache-2.2optimizationweb-server

So, in the past I've never had any problems with this app. All benchmarks had 100% success rate. Yesterday I set up nginx to server static content and pass on other requests to apache. Now, if I have 1 concurrent user (-c 1) then everything is fine. But it seems the more concurrent users I have, the more failed requests I get. Not a lot, but maybe about 10 or 15 out of 350. They're "length", whatever that means. Visiting the website with a browser, I don't have any problems at all. How can I find out the cause of these failed requests?

Here's part of my httpd.conf:

Timeout 20

KeepAlive Off

MaxKeepAliveRequests 100

<IfModule prefork.c>
StartServers 1
MinSpareServers 1
MaxSpareServers 3
ServerLimit 50
MaxClients 50
MaxRequestsPerChild  4000
</IfModule>

<IfModule worker.c>
StartServers 1
MaxClients 50
MinSpareThreads     25
MaxSpareThreads     75 
ThreadsPerChild     25
MaxRequestsPerChild  0
</IfModule>

Is there other info you need?

Best Answer

My guess is that you're hitting the MaxClients limit when you're benchmarking the site.

While benchmarking the site, try to see how many connections are established in port 80:

netstat -tnap | grep ":80" | grep -c ESTA

Repeat this command a couple of times while benchmarking the site. Probably you'll be hitting 50 established connections.

A rrdtool trending application (like Cacti, Munin or Ganglia) graphing the number of TCP connections is also good to debug this kind of problems as you can see the historic.

Hope this helps!