我试图评估我的networking服务器,其中有Linux和Apache的性能。 我尝试使用JMeter进行负载testing,并逐渐增加了请求数量并logging了响应时间以及资源利用率统计信息。 每分钟点击40次后响应时间增加,但资源利用率保持不变! CPU,内存,networking,IO资源没有得到充分利用,即使我尝试了很多请求导致响应时间慢。 具体来说,当每分钟请求总数低于6000时,响应时间是好的,而当我们每分钟尝试8000个请求时,响应时间增加了50%。
Info of the server: Hardware: 1 Core with 2 GB RAM OS: Ubuntu 12.04 LTS Server Edition
。
Application stack: Apache, PHP
Apacheconfiguration客户端数量:
<IfModule mpm_prefork_module> StartServers 50 MinSpareServers 50 MaxSpareServers 100 MaxServers 600 MaxClients 600 MaxRequestsPerChild 0 </IfModule>
我不清楚,为什么这些资源没有得到充分利用。 请问我该怎么做,以便我可以利用资源利用率?
这是Apacheconfiguration的重要部分:
LockFile ${APACHE_LOCK_DIR}/accept.lock PidFile ${APACHE_PID_FILE} Timeout 300 KeepAlive On MaxKeepAliveRequests 1000 KeepAliveTimeout 5 <IfModule mpm_prefork_module> StartServers 50 MinSpareServers 50 MaxSpareServers 100 ServerLimit 600 MaxClients 600 MaxRequestsPerChild 0 </IfModule> <IfModule mpm_worker_module> StartServers 2 MinSpareThreads 25 MaxSpareThreads 75 ThreadLimit 64 ThreadsPerChild 25 MaxClients 150 MaxRequestsPerChild 0 </IfModule> <IfModule mpm_event_module> StartServers 2 MinSpareThreads 25 MaxSpareThreads 75 ThreadLimit 64 ThreadsPerChild 25 MaxClients 150 MaxRequestsPerChild 0 </IfModule> DefaultType None HostnameLookups Off Include mods-enabled/*.load Include mods-enabled/*.conf Include httpd.conf Include ports.conf Include conf.d/ Include sites-enabled/
首先,你应该尝试不同的url进行testing,而不仅仅是一个,我相信你正在尝试。
另外,请尝试增加MaxServers和MaxClients的值, MaxServers造成瓶颈。 您可以使用此命令查看是否正在处理进程数的瓶颈
# watch "ps ax | grep -http | wc -l"
如果接近600,那么你需要增加他们的价值,这样你可以进一步压力testing。 这也解释了不增加的负载,因为你的连接正在等待服务器从以前的连接中释放。
此外,我会build议禁用保持活动时间(不知道是否已禁用),以便您可以得到很多真实的结果。
Apache的性能可能受限于可用文件句柄和进程的数量。 本文可能有所帮助: http : //www.webperformance.com/load-testing/blog/2012/12/setting-apache2-ulimit-for-maximum-prefork-performance/
(免责声明:我和作者合作)