【效能測試】使用ab做Http效能測試

weixin_34259232發表於2018-01-08

[[TOC]]


Http效能測試工具

ab(ApacheBench)

  • 安裝:
yum install httpd
  • 使用
ab -n 20 -c 1 192.168.35.1:8988/fortest

引數說明:

-n: 總請求次數;
-c: 併發請求數(預設為1)
  • 結果示例:
[root@localhost ~]# ab -n 20 -c 1 192.168.35.1:8988/fortest
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.35.1 (be patient).....done


Server Software:        
Server Hostname:        192.168.35.1
Server Port:            8988

Document Path:          /fortest
Document Length:        2 bytes

Concurrency Level:      1
Time taken for tests:   2.099 seconds  //總共耗費時間
Complete requests:      20
Failed requests:        0
Write errors:           0
Total transferred:      2420 bytes
HTML transferred:       40 bytes
Requests per second:    9.53 [#/sec] (mean)   //每秒處理請求數量
Time per request:       104.968 [ms] (mean)   //每次併發消耗平均時間
Time per request:       104.968 [ms] (mean, across all concurrent requests) //每次請求消耗平時時間
Transfer rate:          1.13 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   1.9      0       9
Processing:   101  104   3.3    103     114
Waiting:      101  103   3.4    102     114
Total:        102  105   3.8    103     114

Percentage of the requests served within a certain time (ms)
  50%    103
  66%    104
  75%    107
  80%    108
  90%    112
  95%    114
  98%    114
  99%    114
 100%    114 (longest request)

相關文章