天天看點

http壓力測試-siege

wget ftp://ftp.joedog.org/pub/siege/siege-2.70.tar.gz

tar zxvf siege-2.70.tar.gz

cd siege-2.70

./configure –prefix=/usr/local/siege

make

mkdir -p /usr/local/siege/etc/siegerc

make install

vi ~/.siegerc

調整:

verbose = false

concurrent = 50

delay = 1

internet = true

benchmark = true

參數介紹:

* -cNUM 設定并發的使用者(連接配接)數量,比如-c10,設定并發10個連接配接。預設的連接配接數量可以到~/.siegerc中檢視,指令為concurrent = x,前面咱們已經調整了預設并發連接配接為50。

* -rNUM(repetitions),重複數量,即每個連接配接發出的請求數量,設定這個的話,就不需要設定-t了。對應.siegerc配置檔案中的reps = x指令

* -tNUM(time),持續時間,即測試持續時間,在NUM時間後結束,機關預設為分,比如-t10,那麼測試時間為10分鐘,-t10s,則測試時間為10秒鐘。對應.siegerc中的指令為time = x指令

* -b (benchmark),基準測試,如果設定這個參數的話,那麼delay時間為0。在.siegerc中咱們修改為預設開啟。

* -f url.txt (file),這是url清單檔案。對應.siegerc配置檔案中的file = x指令

測試結果分析:

[root@bbs ~]# siege -c 500 -r 50 -f bbs.url       備注:bbs.url自己建立這個在裡面寫網站的位址

** SIEGE 2.67

** Preparing 500 concurrent users for battle.

The server is now under siege..      done.

Transactions:                  25000 hits

Availability:                 100.00 %

Elapsed time:                  65.52 secs

Data transferred:              83.65 MB

Response time:                  0.57 secs

Transaction rate:             381.56 trans/sec

Throughput:                     1.28 MB/sec

Concurrency:                  216.02

Successful transactions:       21707

Failed transactions:               0

Longest transaction:            5.83

Shortest transaction:           0.00

上面是用500并發重複測試50次bbs.url裡的url清單的結果,下面一條一條地分析測試結果:

Transactions: 25000 hits

意思是總共完成了25000次測試

Availability: 100.00 %

測試的有效性100%

Elapsed time: 65.52 secs

用時65.52秒

Data transferred: 83.65 MB

傳輸了83.65MB資料

Response time: 0.57 secs

響應時間

Transaction rate: 381.56 trans/sec

每秒傳輸381.56次

Throughput: 1.28 MB/sec

資料吞吐量每秒1.28MB

Concurrency: 216.02

實際并發通路

Successful transactions: 21707

成功的傳輸

Failed transactions: 0

失敗的傳輸

Longest transaction: 5.83

每次傳輸所花最長時間

Shortest transaction: 0.00

每次傳輸所花最短時間

這篇文章釋出于 2010年07月26日,星期一,6:

本文轉自holy2009 51CTO部落格,原文連結:http://blog.51cto.com/holy2010/402649

繼續閱讀