1. 程式人生 > >Apache ab 測試工具分析

Apache ab 測試工具分析

參 數 簡 要 描 述
-n requests
請求
Number of requests to perform
要執行的請求數量
-c concurrency
併發
Number of multiple requests to make at a time
同一時間請求的數量
-t timelimit Seconds to max. to spend on benchmarking This implies -n 50000
-s timeout Seconds to max. wait for each response Default is 30 seconds
-b windowsize Size of TCP send/receive buffer, in bytes
-B address Address to bind to when making outgoing connections
-p postfile File containing data to POST. Remember also to set -T
-u putfile File containing data to PUT. Remember also to set -T
-T content-type Content-type header to use for POST/PUT data, eg. ‘application/x-www-form-urlencoded’ Default is ‘text/plain’
-v verbosity How much troubleshooting info to print
-w Print out results in HTML tables
-i Use HEAD instead of GET
-x attributes String to insert as table attributes
-y attributes String to insert as tr attributes
-z attributes String to insert as td or th attributes
-C attribute Add cookie, eg. ‘Apache=1234’. (repeatable)
-H attribute Add Arbitrary header line, eg. ‘Accept-Encoding: gzip’ Inserted after all normal header lines. (repeatable)
-A attribute Add Basic WWW Authentication, the attributes are a colon separated username and password.
-P attribute Add Basic Proxy Authentication, the attributes are a colon separated username and password.
-X proxy:port Proxyserver and port number to use
-V Print version number and exit
-k Use HTTP KeepAlive feature
-d Do not show percentiles served table.
-S Do not show confidence estimators and warnings.
-q Do not show progress when doing more than 150 requests
-l Accept variable document length (use this for dynamic pages)
-g filename Output collected data to gnuplot format file.
-e filename Output CSV file with percentages served
-r Don’t exit on socket receive errors.
-m method Method name
-h Display usage information (this message)
-I Disable TLS Server Name Indication (SNI) extension
-Z ciphersuite Specify SSL/TLS cipher suite (See openssl ciphers)
-f protocol pecify SSL/TLS protocol

$ ab -c 100 -n 1000 http://php.me/test/index.php

Server Software:        nginx/1.12.2               # web 伺服器
Server Hostname:        php.me                     # 伺服器域名
Server Port:            80                         # 伺服器埠

Document Path:          /test/index.php            # 請求的檔案路徑
Document Length:        11 bytes                   # 請求檔案返回資料的大小,不是檔案本身的大小

Concurrency Level:      100                        # 併發數量
Time taken for tests:   0.023 seconds              # 測試花費的時間
Complete requests:      100                        # 完成的請求數,成功的請求數
Failed requests:        0                          # 失敗的請求數
Total transferred:      17400 bytes                # 傳輸的總位元組
HTML transferred:       1100 bytes                 # HTML 傳輸的位元組
Requests per second:    4297.19 [#/sec] (mean)     # 每秒響應請求數量
Time per request:       23.271 [ms] (mean)         # 
Time per request:       0.233 [ms] (mean, across all concurrent requests)  #
Transfer rate:          730.19 [Kbytes/sec] received #

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        2    3   0.9      3       5
Processing:     2   11   4.4     13      17
Waiting:        2   11   4.4     13      17
Total:          7   14   3.6     16      19

Percentage of the requests served within a certain time (ms)
  50%     16                      # 平均時間
  66%     17
  75%     18
  80%     18
  90%     18
  95%     18
  98%     18
  99%     19
 100%     19 (longest request)   # 最大請求時間