ab 的全称是 ApacheBench , 是 Apache 附带的一个小工具 , 专门用于 HTTP Server 的 benchmark testing , 能够同时模拟多个并发请求。简单的说它就是一个性能检测的小工具,使用简单方便。apache
使用方法:网络
一、打开命令行,输入cmd,回车并发
二、输入命令,示例:E:\test\ab.exe -n 1000 -c 50 http://192.168.1.149:18080/v1/CS/254767713_354476(请求1000次,并发50)工具
经常使用命令:性能
-n:请求个数,默认是一次一个测试
-c:并发数.net
-t:超时限制命令行
返回说明:blog
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 192.168.1.149 (be patient)
Server Software: Kestrel
Server Hostname: 192.168.1.149
Server Port: 18080 /* 端口*/
Document Path: /v1/CS/254767713_354476
Document Length: 354476 bytes /*请求文件大小 */
Concurrency Level: 50 /* 并发数 */
Time taken for tests: 7.314 seconds /* 整个测试所用的时间 */
Complete requests: 1000 /* 完成的请求数量 */
Failed requests: 0 /* 失败的请求数量 */
Total transferred: 354618000 bytes /* 整个场景的网络传输量 */
HTML transferred: 354476000 bytes /* 整个场景的HTML传输量 */
Requests per second: 136.72 [#/sec] (mean) /* 平均每秒请求数 */
Time per request: 365.721 [ms] (mean) /* 平均每一个请求的响应时间 */
Time per request: 7.314 [ms] (mean, across all concurrent requests)
Transfer rate: 47345.75 [Kbytes/sec] received /*平均每秒网络上的流量 */cmd
/* 网络上消耗时间分解 */
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 2 2.3 1 24
Processing: 78 360 87.0 383 528
Waiting: 3 88 39.3 89 199
Total: 79 362 86.6 385 528
/* 下面为整个场景全部请求的响应状况,50%的相应时间小于385毫秒,66%的响应时间小于402毫秒。。。。。。最长响应时间 528毫秒*/Percentage of the requests served within a certain time (ms) 50% 385 66% 402 75% 412 80% 421 90% 444 95% 459 98% 479 99% 497 100% 528 (longest request)