APACHE自带了压力测试工具,APACHE BENCHMARKING (ab),主要用来测试APACHE每秒钟能够处理的请求的数量。
使用方法:
ab –n 20000 –c 200 http://localhost
上述命令向localhost主机发送访问20000个请求,每次发送200个。
-n : 发送多少个访问请求
-c : 每次发送多少个访问请求
详细解释:
Benchmarking localhost (be patient)
Completed 2000 requests
Completed 4000 requests
Completed 6000 requests
Completed 8000 requests
Completed 10000 requests
Completed 12000 requests
Completed 14000 requests
Completed 16000 requests
Completed 18000 requests
Completed 20000 requests
Finished 20000 requests
//进度指示
Server Software: Apache/2.2.16 //服务器版本
Server Hostname: localhost //主机名
Server Port: 80 //端口
Document Path: / //网站路径
Document Length: 20 bytes //文档长度
Concurrency Level: 200 //并发数
Time taken for tests: 20.409 seconds //测试所花费时间
Complete requests: 20000 //完成请求总数
Failed requests: 0 //失败请求数
Write errors: 0
Total transferred: 5900000 bytes //总共传输字节
HTML transferred: 400000 bytes //总共传输HTML字节
Requests per second: 979.98 [#/sec] (mean) //平均每秒钟处理读取请求数
Time per request: 204.087 [ms] (mean) //平均每个请求所花的时间
Time per request: 1.020 [ms] (mean, across all concurrent requests) //每个请求实际运行的平均时间
Transfer rate: 282.32 [Kbytes/sec] received //传输速率
Connection Times (ms) //时间详情
min mean[+/-sd] median max
Connect: 0 69 115.0 69 3058
Processing: 16 134 264.2 100 7935
Waiting: 11 121 260.6 93 7921
Total: 85 203 294.3 157 7936
Percentage of the requests served within a certain time (ms) //响应时间内完成的请求百分比
50% 157
66% 220
75% 236
80% 250
90% 296
95% 354
98% 484
99% 582
100% 7936 (longest request)