压测工具ab
1、安装ab
yum install httpd-tools
2、使用
ab -n 2000 -c 2 http://www.cctv.com
-n:总的请求数
-c:并发数
-k:是否开启长连接
3、结果举例:
Concurrency Level: 20 ====>并发数
Time taken for tests: 37.252 seconds =====>总共的时间
Complete requests: 2000 ====>总请求数
Failed requests: 0
Write errors: 0
Total transferred: 637985160 bytes
HTML transferred: 637254000 bytes
Requests per second: 53.69 [#/sec] (mean) ====>服务端平均处理速率(即:总的请求数/总共的时间)
Time per request: 372.516 [ms] (mean) ===>在客户端处理单个请求所需要花费的时间
Time per request: 18.626 [ms] (mean, across all concurrent requests) ===>在服务端处理单个请求所需要花费的时间(不包含网络传输时间)
Transfer rate: 16724.98 [Kbytes/sec] received ====>网络传输带宽占用情况
Connection Times (ms)
min mean[+/-sd] median max
Connect: 5 42 212.1 26 3037
Processing: 23 329 89.5 321 799
Waiting: 4 32 28.5 28 348
Total: 29 371 231.2 348 3432