如果要测试HTTPS,需要在编译前指定Makefile中 SSL_TREE 的路径:一般为 /usr 或 /usr/local 。
2 ab
2.1 官方网站
描述:
ab is a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. It is designed to give you an impression of how your current Apache installation performs. This especially shows you how many requests per second your Apache installation is capable of serving.
地址:
http://httpd.apache.org/docs/2.0/programs/ab.html
2.2 具体操作
常用样例
ab -n 1000 -c 50 http://www.domain.com/myapp.php
样例说明
ab将同时向http://www.domain.com/myapp.php发出50个并发请求,共发出1000次。
返回结果
Server Software: nginx/0.6.25Server Hostname: www.domain.comServer Port: 80Document Path: /myapp.phpDocument Length: 37899 bytesConcurrency Level: 100Time taken for tests: 26.507540 secondsComplete requests: 2000Failed requests: 14 (Connect: 0, Length: 14, Exceptions: 0)Write errors: 0Keep-Alive requests: 0Total transferred: 75931178 bytesHTML transferred: 75439670 bytesRequests per second: 75.45 [#/sec] (mean)Time per request: 1325.377 [ms] (mean)Time per request: 13.254 [ms] (mean, across all concurrent requests)Transfer rate: 2797.36 [Kbytes/sec] receivedConnection Times (ms) min mean[+/-sd] median maxConnect: 24 640 1310.9 34 7478Processing: 86 590 2230.9 124 23256Waiting: 0 55 207.7 41 8292Total: 112 1230 2501.0 169 23304
部分返回字串省略,这里只表示关键部分;
myapp.php每秒钟可以处理的请求数为75.45个
特殊说明
若将请求数增加,看看服务器能否处理更大的压力,需要调节Apache的 MaxClients、ThreadsPerChild、MaxThreadsPerChild 等参数,基于httpd.conf中的MPM模块选择。
若本地服务器不是Apache,请使用其它测试方法
文章来源于领测软件测试网 https://www.ltesting.net/










