Apache ab 壓力測試結果分析

2021-10-25 07:57:48 字數 3904 閱讀 6390

測試說明:模擬100個使用者,對伺服器發起總共1000次請求。

測試命令: ab -n 1000 -c 100

測試報告如下圖:

apache的版本資訊

測試完成度

benchmarking ***.***.*** (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:        nginx/1.15.11
被測主機名

server hostname:        ***.***.***
被測主機的服務埠號

server port:            80
請求的具體檔案

document path:          /
求的檔案大小

document length:         2426 bytes
併發級別,也就是併發數,請求中-c引數指定的數量

concurrency level:      100
本次測試總共花費的時間

time taken for tests:   14.708 seconds
表示總請求數量

complete requests:      1000
表示失敗的請求數量,這裡的失敗是指請求在連線伺服器、傳送資料等環節發生異常,以及無響應後超時的情況。如果接收到的http響應資料的頭資訊中含有2xx以外的狀態碼,則會在測試結果中顯示另乙個名為「non-2xx responses」的統計項,用於統計這部分請求數,這些請求並不算在失敗的請求中。

failed requests:        848

(connect: 0, receive: 0, length: 848, exceptions: 0)

non-2xx responses: 848

表示所有請求的響應資料長度總和,包括每個http響應資料的頭資訊和正文資料的長度。注意這裡不包括http請求資料的長度,僅僅為web伺服器流向使用者pc的應用層資料總長度。

total transferred:      814854 bytes
表示所有請求的響應資料中正文資料的總和,也就是減去了total transferred中http響應資料中的頭資訊的長度。

html transferred:       492560 bytes
吞吐率,計算公式:complete requests/time taken for tests

requests per second:    67.99 [

#/sec] (mean)

使用者平均請求等待時間,計算公式:time token for tests/(complete requests/concurrency level)。

time per request:       1470.800 [ms]

(mean)

伺服器平均請求等待時間,計算公式:time taken for tests/complete requests,正好是吞吐率的倒數。也可以這麼統計:time per request/concurrency level。

time per request:       14.708 [ms]

(mean, across all concurrent requests)

表示這些請求在單位時間內從伺服器獲取的資料長度,計算公式:total trnasferred/ time taken for tests,這個統計很好的說明伺服器的處理能力達到極限時,其出口寬頻的需求量。

transfer rate:          54.10 [kbytes/sec] received
這幾行組成的**主要是針對響應時間,也就是第乙個time per request進行細分和統計。

connect:網路鏈結

processing:系統處理

waiting:等待

min:最小值

mean:平均值

[+/-sd]:標準差(standard deviation) ,也稱均方差(mean square error),表示資料的離散程度,數值越大表示資料越分散,系統響應時間越不穩定。

median:中位數

max:最大值

需要注意的是表中的total並不等於前三行資料相加,因為前三行的資料並不是在同乙個請求中採集到的,可能某個請求的網路延遲最短,但是系統處理時間又是最長的呢。所以total是從整個請求所需要的時間的角度來統計的。這裡可以看到最慢的乙個請求花費了7106ms,這個資料可以在下面的表中得到驗證。

connection times (ms)

min mean[

+/-sd] median max

connect: 0 0 0.6 0 10

processing: 237 1271 619.7 1074 7106

waiting: 225 1270 619.8 1073 7106

total: 237 1271 619.6 1074 7106

這個表第一行表示有50%的請求都是在1074ms內完成的,可以看到這個值是比較接近平均系統響應時間(第乙個time per request: 1470.800 [ms] (mean))

以此類推,80%的請求是小於等於1179ms的。剛才我們看到響應時間最長的那個請求是7106ms,那麼顯然所有請求(100%)的時間都是小於等於7106毫秒的,也就是表中最後一行的資料肯定是時間最長的那個請求(longest request)

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

50% 1074

66% 1099

75% 1112

80% 1179

90% 1894

95% 2669

98% 3344

99% 4014

100% 7106 (longest request)

apache ab壓力測試

以前安裝好apache總是不知道該如何測試apache的效能,現在總算找到乙個測試工具了。就是apache自帶的測試工具ab apache benchmark 在apache的bin目錄下。格式 ab options http hostname port path 引數 n requests num...

Apache AB 壓力測試

apache ab 壓力測試 安裝 安裝工具 yum install httpd tools 使用c 併發量 n 請求數結果示例 this is apachebench,version 2.3 revision 655654 licensed to the apache software found...

Apache ab壓力測試

apache手工編譯安裝 解包 安裝手工編譯軟體包 yum install gcc gcc c pcre devel pcre zlib devel make y 執行configure make編譯 make make install 安裝完成之後建立一條軟鏈結 配置apache主配置檔案 vim...