apache的bin目录下的ab.exe(apache> benchmark,基准测试,压力测试),
是一款非常不错的压力测试工具了,我们经常会利用它来ab压测我们服务器的负载能力
ab -c 200 -n 300 http://haojikj.com/weixin/develop/index.php
-c 代表并发数量 -n 代表请求数量
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
##请求完成数量
Benchmarking haojikj.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Finished 300 requests
Server Software: Apache/2.4.18
Server Hostname: haojikj.com
Server Port: 80
Document Path: /weixin/develop/index.php
Document Length: 6172 bytes
Concurrency Level: 200 ##并发量
Time taken for tests: 30.859 seconds ##花费时间
Complete requests: 300 ##请求数量
Failed requests: 1 ##失败请求数量
(Connect: 1, Receive: 0, Length: 0, Exceptions: 0)
Total transferred: 1976100 bytes ##总共传输字节数,包含http的头信息等
HTML transferred: 1851600 bytes ##html字节数,实际的页面传递字节数
Requests per second: 9.72 [#/sec] (mean) ##每秒多少请求,这个是非常重要的参数数值,服务器的吞吐量
Time per request: 20572.408 [ms] (mean) ##用户平均请求等待时间
Time per request: 102.862 [ms] (mean, across all concurrent requests) ##服务器平均处理时间,也就是服务器吞吐量的倒数
Transfer rate: 62.54 [Kbytes/sec] received ##每秒获取的数据长度
Connection Times (ms)
min mean[+/-sd] median max
Connect: 9 13 3.1 12 45
Processing: 81 10485 10765.8 2281 23573 ##响应等待时间
Waiting: 37 9616 10859.8 1036 23531 ##等待接受结果时间
Total: 92 10497 10765.6 2295 23583
Percentage of the requests served within a certain time (ms)
50% 2295 ##50%的请求在2295毫秒内完成
66% 23537
75% 23562
80% 23564
90% 23570
95% 23574
98% 23580
99% 23581
100% 23583 (longest request)