我的公司经营着一个交通繁忙的地点,每天约有15万人。
每次在Apache重新启动后,网站加载速度非常快。 问题总是在几个小时后出现。
服务器configuration:
Intel Core i3-2100 (3.1 GHz) 8 GB RAM
Server apache运行进程:
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
这是apache重启后的ab结果:
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)
这是我目前的Apacheconfiguration:
Apache API Version 20120211 StartServers 5 MaxClients 220 ServerLimit 220 MinSpareServers 8 MaxSpareServers 16 MaxRequestsPerChild 4000
几个小时后,ab导致apr_pollset_poll: The timeout specified has expired (70007
我这样计算Max Client:8196(物理内存)/ 35(Apache平均内存使用率)= 234.17,四舍五入为230给apache之外的其他进程空间。
我的问题是Apacheconfiguration是最佳的给定的条件?
我通常将StartServer和MinSpareServer的其他configuration视为10,MaxRequestsPerChild视为0。
configuration是否安全,特别是MaxRequestsPerChild为0? 如果是的话,有什么好处?
任何想法将不胜感激。
谢谢!
这不是一个答案 – 但是评论太长了,这个问题不能用现在的forms来回答。
大约每天15万
什么 ? 唯一重要的指标是并发命中/平均持续时间。
您没有提供关于stream量的详细信息 – 显然不提供静态内容。 你没有提供任何细节。
每个请求1.3秒很慢。
ServerLimit 220
看起来很低。
35(Apache平均内存使用量)
你是怎么得到的?
这不是计算serverlimit / maxclients的正确方法。 尝试在不同的负载水平测量空闲内存(较less的缓冲区/caching),并根据服务器数量绘制。
找出正确的问题来询问这里的performance,至less需要几个小时才能知道自己在做什么 – find答案将需要更长的时间。
你应该可以运行更多的服务器,但是你的性能问题不在httpdconfiguration中。