My company runs a heavy traffic site, about 150k daily.
Each time after apache restarted, site load is very fast. The problem always comes after a couple of hours.
Server config :
Intel Core i3-2100 (3.1 GHz)
8 GB RAM
Server apache running processes :
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
35986 apache 20 0 1046m 15m 6912 D 24.9 0.1 0:00.86 httpd
35984 apache 20 0 1046m 15m 6916 D 21.9 0.1 0:00.78 httpd
35987 apache 20 0 1046m 15m 6916 D 21.6 0.1 0:00.76 httpd
35774 apache 20 0 1054m 35m 19m D 7.6 0.2 0:04.76 httpd
35947 apache 20 0 1061m 43m 29m D 7.6 0.3 0:02.05 httpd
35949 apache 20 0 1061m 44m 29m D 7.6 0.3 0:02.42 httpd
35951 apache 20 0 1046m 15m 6912 D 7.6 0.1 0:01.69 httpd
35952 apache 20 0 1046m 15m 6912 D 7.6 0.1 0:01.70 httpd
35953 apache 20 0 1045m 15m 6900 D 7.6 0.1 0:01.48 httpd
35983 apache 20 0 1046m 15m 6912 D 7.6 0.1 0:01.00 httpd
35418 apache 20 0 1067m 84m 64m D 7.3 0.5 1:14.12 httpd
35761 apache 20 0 1054m 36m 19m D 7.3 0.2 0:10.78 httpd
35770 apache 20 0 1066m 59m 39m D 7.3 0.4 0:04.12 httpd
35771 apache 20 0 1056m 36m 19m D 7.3 0.2 0:05.51 httpd
This is the ab result right after apache restart :
ab -n 300 -c 30 http://www.vibiznews.com/
Server Software: Apache
Server Hostname: www.vibiznews.com
Server Port: 80
Document Path: /
Document Length: 182372 bytes
Concurrency Level: 30
Time taken for tests: 40.708 seconds
Complete requests: 30
Failed requests: 15
(Connect: 0, Receive: 0, Length: 15, Exceptions: 0)
Write errors: 0
Total transferred: 5475675 bytes
HTML transferred: 5471175 bytes
Requests per second: 0.74 [#/sec] (mean)
Time per request: 40708.364 [ms] (mean)
Time per request: 1356.945 [ms] (mean, across all concurrent requests)
Transfer rate: 131.36 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 5 6 1.4 5 8
Processing: 17815 28229 9292.6 33340 40703
Waiting: 17731 28121 9339.8 33295 40666
Total: 17820 28235 9292.4 33345 40708
Percentage of the requests served within a certain time (ms)
50% 33345
66% 35458
75% 37776
80% 38302
90% 39178
95% 39302
98% 40708
99% 40708
100% 40708 (longest request)
Here is my current Apache configuration :
Apache API Version 20120211
StartServers 5
MaxClients 220
ServerLimit 220
MinSpareServers 8
MaxSpareServers 16
MaxRequestsPerChild 4000
After a couple of hours, ab resulted in apr_pollset_poll: The timeout specified has expired (70007
I calculated Max Client this way : 8196 (Physical Memory) / 35 (Apache average memory usage) = 234.17, rounded to 230 to give space for other processes besides apache.
My question is the apache configuration is optimal for the given condition?
I usually sees other's configuration for StartServer and MinSpareServer to be around 10, and MaxRequestsPerChild to 0.
Is that configuration safe, especially MaxRequestsPerChild to be 0? If so what is the benefit?
Any thought will be greatly appreciated.
Thanks!