ab和JMeter进行GET/POST压力测试的使用心得和比较(2)

Concurrency Level:      10
Time taken for tests:  100.137 seconds
Complete requests:      733
Failed requests:        732
  (Connect: 0, Receive: 0, Length: 732, Exceptions: 0)
Write errors:          0
Total transferred:      3672653 bytes
HTML transferred:      3572232 bytes
Requests per second:    7.32 [#/sec] (mean)
Time per request:      1366.124 [ms] (mean)
Time per request:      136.612 [ms] (mean, across all concurrent requests)
Transfer rate:          35.82 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median  max
Connect:        1    2  2.4      2      40
Processing:  342 1352 636.3  1183    6046
Waiting:      342 1351 636.2  1183    6046
Total:        345 1354 636.8  1186    6049

Percentage of the requests served within a certain time (ms)
  50%  1185
  66%  1333
  75%  1460
  80%  1564
  90%  1835
  95%  2357
  98%  3248
  99%  5205
 100%  6049 (longest request)

【jmeter】

再用jemeter以同样的配置(Thread数 为10, ramp时间为1秒,超时阈值为3000ms)

运行结果如下:
Creating summariser <summary>
Created the tree successfully using music_api_uid.jmx
Starting the test @ Thu Nov 19 11:19:43 CST 2015 (1447903183454)
Waiting for possible shutdown message on port 4445
summary +    90 in    16s =    5.7/s Avg:  1677 Min:  959 Max:  3757 Err:    0 (0.00%) Active: 10 Started: 10 Finished: 0
summary +    202 in  31.1s =    6.5/s Avg:  1477 Min:  912 Max:  2727 Err:    0 (0.00%) Active: 10 Started: 10 Finished: 0
summary =    292 in    46s =    6.4/s Avg:  1539 Min:  912 Max:  3757 Err:    0 (0.00%)
summary +    164 in    31s =    5.3/s Avg:  1830 Min:  972 Max:  5009 Err:    5 (3.05%) Active: 10 Started: 10 Finished: 0
summary =    456 in    76s =    6.0/s Avg:  1643 Min:  912 Max:  5009 Err:    5 (1.10

最终通过GUI打开请求详细记录,生成聚合报告的结果为

samples: 576

average: 1713

median: 1496

90% Line: 2353

min: 912

max: 5009

throught: 5.8/sec

kb/sec: 27.8

error%: 2.08%

GET API压测结果对比

ab   jmeter  
发送总请求数   733   576  
平均请求时间(ms)   1366   1713  
请求时间中位数(50%<)(ms)   1185   1496  
请求时间90%< (ms)   1835   2353  
error       2.08%  
QPS   7.32   6  

对比两次测试,ab完成了733次,而jmeter完成了576次而ab完成了733次,其实这个数据不算准确,因为jmeter不支持精确的测试时间的限制,所以我是按时强制终止了jemeter,所以有些请求可能就被漏掉了。不过我后来测试了同样总请求数时(ab用-n设置,jmeter则用 thread*loops来设置),jmeter也比ab慢戈15%,可能和jmeter自己要做很多统计有关系。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/9afd1bf81702d976ed377af9ee16cf0e.html