使用ab進行壓力測試

2021-07-03 19:23:54 字數 3822 閱讀 3204

ab是apache自帶的乙個很好用的壓力測試工具,當安裝完apache的時候,就可以在bin下面找到ab

1 我們可以模擬100個併發使用者,對乙個頁面傳送1000個請求

./ab -n1000 -c100

其中-n代表請求數,-c代表併發數

返回結果:

##首先是apache的版本資訊

this is apachebench, version 2.3 visi

on:655654

licensed to the apache software foundation,

benchmarking vm1.jianfeng.com (be patient)

server software:        apache/2.2.19    ##apache版本

server hostname:        vm1.jianfeng.com   ##請求的機子

server port:            80 ##請求埠

document path:          /a.html

document length:        25 bytes  ##頁面長度

concurrency level:      100  ##併發數

time taken for tests:   0.273 seconds  ##共使用了多少時間

complete requests:      1000   ##請求數

failed requests:        0   ##失敗請求

write errors:           0  

total transferred:      275000 bytes  ##總共傳輸位元組數,包含http的頭資訊等

html transferred:       25000 bytes  ##html位元組數,實際的頁面傳遞位元組數

requests per second:    3661.60 [#/sec] (mean)  ##每秒多少請求,這個是非常重要的引數數值,伺服器的吞吐量

time per request:       27.310 [ms] (mean)  ##使用者平均請求等待時間

time per request:       0.273 [ms] (mean, across all concurrent requests)  ##伺服器平均處理時間,也就是伺服器吞吐量的倒數

transfer rate:          983.34 [kbytes/sec] received  ##每秒獲取的資料長度

connection times (ms)

min  mean[+/-sd] median   max

connect:        0    1   2.3      0      16

processing:     6   25   3.2     25      32

waiting:        5   24   3.2     25      32

total:          6   25   4.0     25      48

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

50%     25  ## 50%的請求在25ms內返回

66%     26  ## 60%的請求在26ms內返回

75%     26

80%     26

90%     27

95%     31

98%     38

99%     43

100%     48 (longest request)

2 ab也可以執行在windows中,如果在windows下安裝apache,就可以在bin下找到ab.exe

直接就可以使用,不用依賴其他的dll

c:\users\nickyjf\desktop\useful>ab -n1000 -c100

this is apachebench, version 2.3 visi

on:655654

licensed to the apache software foundation,

benchmarking sports.sina.com.cn (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

completed 1000 requests

finished 1000 requests

server software:        apache/2.0.63

server hostname:        sports.sina.com.cn

server port:            80

document path:          /k/2011-05-24/12095590365.shtml

document length:        86680 bytes

concurrency level:      100

time taken for tests:   66.453 seconds

complete requests:      1000

failed requests:        0

write errors:           0

total transferred:      87135790 bytes

html transferred:       86680000 bytes

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

time per request:       6645.294 [ms] (mean)

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

transfer rate:          1280.51 [kbytes/sec] received

connection times (ms)

min  mean[+/-sd] median   max

connect:        1   56 398.3      2    3003

processing:    89 6331 2603.7   6293   14626

waiting:        2 1748 1485.9   1590    6284

total:         90 6388 2615.0   6302   14627

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

50%   6302

66%   7121

75%   8435

80%   9193

90%   9231

95%   9385

98%  11549

99%  12459

100%  14627 (longest request)

使用AB壓力測試工具進行系統壓力測試

ab是apache自帶的乙個很好用的壓力測試工具,當安裝完apache的時候,就可以在bin下面找到ab linux mac windows 1 我們可以模擬100個併發使用者,對乙個頁面傳送1000個請求 ab n1000 c100 其中 n代表請求數,c代表併發數 返回結果 首先是apache的...

ab工具進行壓力測試

簡介與安裝 ab apache benchmark,只要我們安裝了apache,就能夠在apache的安裝目錄中找到它.yum apt 安裝的apache ab的目錄一般為 usr bin 也可以通過 which ab 檢視 ab 不僅僅針對apache伺服器的 進行壓力測試,nginx tomca...

使用ab進行頁面的壓力測試

ab是apache自帶的乙個很好用的壓力測試工具,當安裝完apache的時候,就可以在bin下面找到ab 1 我們可以模擬100個併發使用者,對乙個頁面傳送1000個請求 ab n1000 c100 其中 n代表請求數,c代表併發數 返回結果 licensed to the apache softw...