Apache Benchmark(简称ab) 是Apache安装包中自带的压力测试工具 ,简单易用
1、ab安装
yum -y install httpd-tools
2、ab参数详解,传送门:http://httpd.apache.org/docs/2.2/programs/ab.html
3、ab使用
模拟10000连接数、100并发量
ab -n 10000 -c 100 http://127.0.0.1:9501/client.php
内容及解释
Server Software: swoole-http-server(服务器软件名称及版本信息)
Server Hostname: 127.0.0.1(服务器主机名)
Server Port: 9501(服务器端口)
Document Path: /client.php(供测试的URL路径)
Document Length: 3270 bytes(供测试的URL返回的文档大小)
Concurrency Level: 100(并发数)
Time taken for tests: 5.977 seconds(压力测试消耗的总时间)
Complete requests: 10000(并发的总次数)
Failed requests: 956(失败的请求数)
(Connect: 0, Receive: 0, Length: 956, Exceptions: 0)
Write errors: 0(网络连接写入错误数)
Total transferred: 34198934 bytes(传输的总数据量)
HTML transferred: 32698934 bytes(HTML文档的总数据量)
Requests per second: 1673.16 [#/sec] (mean)(平均每秒的请求数)
Time per request: 59.767 [ms] (mean)(所有并发用户(这里是1000)都请求一次的平均时间)
Time per request: 0.598 [ms] (mean, across all concurrent requests)(单个用户请求一次的平均时间)
Transfer rate: 5587.91 [Kbytes/sec] received(每秒获取的数据长度 (传输速率,单位:KB/s))
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 2.4 0 27
Processing: 5 59 4.7 59 75
Waiting: 0 59 4.7 59 75
Total: 25 59 3.4 59 76
Percentage of the requests served within a certain time (ms)
50% 59 ## 50%的请求在59ms内返回
66% 60 ## 56%的请求在60ms内返回
75% 61
80% 61
90% 63
95% 66
98% 68
99% 71
100% 76 (longest request)
参考:https://blog.csdn.net/u011415782/article/details/78501799