apache ab壓力測試及結果分析ab簡介及原理

2021-10-20 01:23:46 字數 2581 閱讀 3928

apache bench簡稱ab,它是apache自帶的壓力測試工具。ab非常實用,它不僅可以對apache伺服器進行**訪問壓力測試,也可以對或其它型別的伺服器進行壓力測試。

這裡主要講linux環境下,使用yum命令安裝

安裝完成後

ab -v
檢視ab的版本資訊如下圖

一般用法為ab -c 1000 -n 100000

輸出為

ab -c 100 -n 10000 

this is apachebench, version 2.3

licensed to the apache software foundation,

benchmarking 106.13.49.215 (be patient)

completed 1000 requests

^cserver software:

server hostname: 106.13.49.215 #請求的url主機名

server port: 6868 #請求埠

document path: / #請求路徑

document length: 5039 bytes #http響應資料的正文長度

concurrency level: 100 #併發使用者數,這是我們設定的引數之一

time taken for tests: 11.317 seconds #所有這些請求被處理完成所花費的總時間 單位秒

complete requests: 1097 #總請求數量,這是我們設定的引數之一

failed requests: 159 #表示失敗的請求數量

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

write errors: 0

total transferred: 5674622 bytes #所有請求的響應資料長度總和。包括每個http響應資料的頭資訊和正文資料的長度

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

requests per second: 96.94 [#/sec] (mean) #吞吐量,計算公式:complete requests/time taken for tests 總請求數/處理完成這些請求數所花費的時間

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

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

connection times (ms)

min mean[+/-sd] median max

connect: 1 516 1148.7 3 7077

processing: 4 212 415.3 27 2193

waiting: 3 178 339.1 26 1833

total: 6 728 1158.6 89 7445

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

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

66% 909

75% 1043

80% 1151

90% 2294

95% 3019

98% 4093 #98%的請求在4093ms內返回

99% 7024

100% 7445 (longest request)

-n :總共的請求執行數,預設是1;

-c: 併發數,預設是1;

-t:測試所進行的總時間,秒為單位,預設50000s

-p:post時的資料檔案

-w: 以html表的格式輸出結果

Apache ab 壓力測試結果分析

測試說明 模擬100個使用者,對伺服器發起總共1000次請求。測試命令 ab n 1000 c 100 測試報告如下圖 apache的版本資訊 測試完成度 benchmarking be patient completed 100 requests completed 200 requests co...

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...