apache效能測試

2021-06-07 16:59:20 字數 3170 閱讀 6309

apache效能測試

好久沒有更新部落格了,最近實在太忙,由於電腦配置比較好,一時衝動用ab測試了一把apache。得出一些資料,希望對大家有幫助。

ab是apache附帶的元件非常易於使用,ab可以直接再web伺服器上面使用,直接傳送請求到apache上。測試的響應時間正是伺服器的時間,不包括網路傳輸和本地使用者cpu的時間。

測試引數:

apache:

server version: apache/2.2.15 (unix)

linux:

linux version 2.6.31.5-127.fc12.i686.pae

cpu:

2010全新英特爾® 酷睿™ i5-520m 處理器(基本工作頻率2.40ghz,最高工作頻率2.93ghz, 2c/4t, 3mb l3快取)

memory:

4g併發數為10時的測試結果

ab -n1000 -c10

this is apachebench, version 2.3 <$revision: 655654 $>

licensed to the apache software foundation,

benchmarking 127.0.0.1 (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.2.15

server hostname:        127.0.0.1

server port:            80

document path:          /

document length:        44 bytes

concurrency level:      10

time taken for tests:   0.253 seconds

complete requests:      1000

failed requests:        0

write errors:           0

total transferred:      295176 bytes

html transferred:       44176 bytes

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

time per request:       2.527 [ms] (mean)

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

transfer rate:          1140.75 [kbytes/sec] received

connection times (ms)

min  mean[+/-sd] median   max

connect:        0    1   0.4      1       3

processing:     1    1   0.5      1       3

waiting:        0    1   0.5      1       3

total:          1    2   0.8      2       5

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

50%      2

66%      3

75%      3

80%      3

90%      3

95%      4

98%      4

99%      4

100%      5 (longest request)

對不同併發使用者吞吐率測試結果

併發使用者數

吞吐率(reqs/s)

請求等待時間(ms)

請求處理時間(ms)

4070.95

0.246

0.246

3434.99

0.582

0.291

4255.36

1.175

0.235

4836.95

2.435

0.243

8008.52

2.06

0.103

8297.79

3.979

0.133

8868.31

7.483

0.15

8373.04

9.998

0.14587.07

32.552

0.217

158.479

0.792

389.62

1283.305

2.567

329.42

3035.606

3.036

測試結果分析

通過檢視可以看出,隨著併發數的不斷增加,伺服器的吞吐量開始不段公升高,到達50時吞吐量最高,併發數大於50後吞吐量不斷下降,當大於100時吞吐量急極下降。

通過上圖可以看出使用者請求等待時間隨著併發數的增加的變化情況,併發在150之前等待時間變化不大,當大於150後時間不斷公升高。

從上面分析情況可以看出,在我本機測試時當使用者併發數達到100以上情況將不太理想,不過不同的硬體配置會有不同的結果。

不同場景下面可以測試結果不一樣,不過曲線圖走勢一樣。

apache雖然是非常成熟的web伺服器,後面可以考慮使用其他web伺服器

lighttpd,nginx可以能是比較好的代替品,到時我會再用資料分析下。

使用apache效能測試node

apache的ab的用法是 用tomcat裡的ab.exe來測試 需要進到目錄 usr bin 目錄裡 ab常用引數的介紹 n 總共的請求執行數,預設是1 c 併發數,預設是1 t 測試所進行的總時間,秒為單位,預設50000s p post時的資料檔案 w 以html表的格式輸出結果 root l...

Apache效能測試工具Apache Bench

ab是apache超文字傳輸協議 http 的效能測試工具。其設計意圖是描繪當前所安裝的apache的執行效能,主要是顯示你安裝的apache每秒可以處理多少個請求。概要ab a auth username password c concurrency c cookie name value d e...

開源apache效能測試工具介紹

apache ab 簡單介紹 apache ab 的全稱是apachebench,是apache 附帶的乙個小工具,專門用於http server 的benchmark testing,可以同時模擬多個併發請求。使用比較簡單 測試環境 安裝apache ab 格式 格式 引數 n requests ...