天天看點

網站性能測試工具—ApacheBench

  下面介紹幾個概念

  1:吞吐率(requests per second)

  伺服器并發處理能力的量化描述,機關是reqs/s,指的是某個并發使用者數下機關時間内處理的請求數。某個并發使用者數下機關時間内能處理的最大請求數,稱之為最大吞吐率。

  記住:吞吐率是基于并發使用者數的。這句話代表了兩個含義,1:吞吐率和并發使用者數相關;2:不同的并發使用者數下,吞吐率一般是不同的。

  計算公式:總請求數  / 處理完成這些請求數所花費的時間,即

  request per second = complete requests  / time taken for tests

  2:并發連接配接數(the number of concurrent connections)

  并發連接配接數指的是某個時刻伺服器所接受的請求數目,簡單的講,就是一個會話。

  3:并發使用者數(the number of concurrent users,concurrency level)

  要注意區分這個概念和并發連接配接數之間的差別,一個使用者可能同時會産生多個會話,也即連接配接數。在http/1.1下,ie7支援兩個并發連接配接,ie8支援6個并發連接配接,firefox3支援4個并發連接配接,是以相應的,我們的并發使用者數就得除以這個基數。

  下面主要說一下它的幾個主要的參數

  運作參數

  請求為100,并發為10,指令如下:apachebench -n100 -c10 http://uri

  運作結果

benchmarking www.cnblogs.com (be patient)

completed 100 requests

completed 200 requests

completed 300 requests

completed 400 requests

completed 500 requests

completed 600 requests

completed 700 requests

completed 800 requests

completed 900 requests

finished 1000 requests

server software:

server hostname:        www.cnblogs.com

server port:            80

document path:          /

document length:        45373 bytes

concurrency level:      10

time taken for tests:   45.299591 seconds

complete requests:      1000

failed requests:        0

write errors:           0

total transferred:      45679011 bytes

html transferred:       45373000 bytes

requests per second:    22.08 [#/sec] (mean)

time per request:       452.996 [ms] (mean)

time per request:       45.300 [ms] (mean, across all concurrent requests)

transfer rate:          984.73 [kbytes/sec] received

connection times (ms)

min  mean[+/-sd] median   max

connect:       26   44 189.5     31    3035

processing:    89  405 583.3    284    5190

waiting:       30  143 344.6     97    5031

total:        116  450 611.7    315    5224

percentage of the requests served within a certain time (ms)

50%    315

66%    322

75%    331

80%    343

90%    408

95%    549

98%   3333

99%   3375

100%   5224 (longest request)

最新内容請見作者的github頁:http://qaseven.github.io/

繼續閱讀