ab工具位于/usr/local/bin下面
ab工具命令格式
ab [options] [http://]hostname[:port]/path path表示请求的资源路径
参数 | 描述 |
---|
-n | 测试会话中所执行的请求总数,默认时仅执行一个请求 |
-c | 并发产生的请求个数 |
-t | 测试所执行的最大秒数 |
-v | 设置显示信息的详细程度 |
ab -n2000 -c1000 127.0.0.1/index.html
Server Software: Apache/2.4.38 #http响应数据的头信息
Server Hostname: 127.0.0.1 #请求的url中的主机名称
Server Port: 80 #web服务器软件的监听端口
Document Path: /index.html #请求的的url根的绝对路径
Document Length: 10375 bytes #httpd响应数据的正文长度
Concurrency Level: 1000 #并发数
Time taken for tests: 21.032 seconds #所有请求被处理完成所花费的时间总和
Complete requests: 2000 #总请求数
Failed requests: 125 #失败的请求总数
(Connect: 0, Receive: 0, Length: 125, Exceptions: 0)
Total transferred: 20546820 bytes #请求的响应数据长度总和
HTML transferred: 20044500 bytes
Requests per second: 95.09 [#/sec] (mean) #服务器吞吐率
Time per request: 10516.189 [ms] (mean) #用户平均请求等待时间
Time per request: 10.516 [ms] (mean, across all concurrent requests) #每个请求实际运行时间的平均值
Transfer rate: 954.02 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 12 16.9 4 50
Processing: 13 2070 6022.4 24 21014
Waiting: 0 1374 4949.4 19 20469
Total: 17 2083 6028.6 30 21014
Percentage of the requests served within a certain time (ms) #每个请求处理时间的分布情况
50% 30
66% 49
75% 57
80% 69
90% 2910
95% 20508
98% 20513
99% 21014
100% 21014 (longest request)