siege壓力測試工具

1、siege
一款開源的壓力測試工具,可以根據配置對一個WEB站點進行多用戶的併發訪問,記錄每個用戶所有請

求過程的相應時間,並在一定數量的併發訪問下重複進行。

Siege是一個壓力測試和評測工具,設計用於WEB開發這評估應用在壓力下的承受能力:可以根據配置

對一個WEB站點進行多用戶的併發訪問,記錄每個用戶所有請求過程的相應時間,並在一定數量的併發

訪問下重複進行。 

安裝
[root@localhost www]# tar -zxvf siege-2.55.tar.gz
[root@localhost www]# cd siege-2.55
[root@localhost siege-2.55]# ./configure --prefix=/usr/local/siege

使用
使用
siege -c 200 -r 10 -f example.url
-c是併發量,-r是重複次數。 url文件就是一個文本,每行都是一個url,它會從裏面隨機訪問的。

---------
siege包含了一組壓力測試工具:
SIEGE (1) Siege是一個HTTP壓力測試和評測工具.
使用樣例: 
任務列表:www.chedong.com.url文件
http://www.chedong.com/tech/
http://www.chedong.com/tech/acdsee.html
http://www.chedong.com/tech/ant.html
http://www.chedong.com/tech/apache_install.html
http://www.chedong.com/tech/awstats.html
http://www.chedong.com/tech/cache.html
http://www.chedong.com/tech/click.html
http://www.chedong.com/tech/cms.html
http://www.chedong.com/tech/compress.html
http://www.chedong.com/tech/cvs_card.html
http://www.chedong.com/tech/default.html
http://www.chedong.com/tech/dev.html
http://www.chedong.com/tech/gnu.html
....

siege -c 20 -r 2 -f www.chedong.com.url
參數說明: 
-c 20 併發20個用戶 
-r 2 重複循環2次 
-f www.chedong.com.url 任務列表:URL列表

 

參數:
-c:指定併發的用戶個數  如:-c 200

-r:指定重複的次數      如:-r 300

-d:指定延遲時間        如:-d 5

-f:指定URL列表         如:-f /tmp/xxx.list

-i: 隨機 URL ,默認是從列表的上面到下面來打壓力

-b: 進行壓力測試,不進行延時

-t: 持續時間,即測試持續時間,在NUM時間後結束,單位默認爲分
---------
結果說明
Lifting the server siege… done.
Transactions: 3419263 hits //完成419263次處理
Availability: 100.00 % //100.00 % 成功率
Elapsed time: 5999.69 secs //總共用時
Data transferred: 84273.91 MB //共數據傳輸84273.91 MB
Response time: 0.37 secs //相應用時1.65秒:顯示網絡連接的速度
Transaction rate: 569.91 trans/sec //均每秒完成 569.91 次處理:表示服務器後臺處理的速度
Throughput: 14.05 MB/sec //平均每秒傳送數據
Concurrency: 213.42 //實際最高併發數
Successful transactions: 2564081 //成功處理次數
Failed transactions: 11 //失敗處理次數
Longest transaction: 29.04 //每次傳輸所花最長時間
Shortest transaction: 0.00 //每次傳輸所花最短時間

./siege -c 200 -r 300 -f abc.txt -b -i -t 1h
---------
輸出樣例: 

** Siege 2.59
** Preparing 20 concurrent users for battle. 這次“戰鬥”準備了20個併發用戶 
The server is now under siege.. done. 服務在“圍攻”測試中: 
Transactions: 40 hits 完成40次處理 
Availability: 100.00 % 成功率 
Elapsed time: 7.67 secs 總共用時
Data transferred: 877340 bytes 共數據傳輸:877340字節
Response time: 1.65 secs 相應用時1.65秒:顯示網絡連接的速度
Transaction rate: 5.22 trans/sec 平均每秒完成5.22次處理:表示服務器後臺處理的速度
Throughput: 114385.92 bytes/sec 平均每秒傳送數據:114385.92字節
Concurrency: 8.59 最高併發數 8.59
Successful transactions: 40 成功處理次數
Failed transactions: 0 失敗處理次數

注意:由於速度很快,可能會達不到併發速度很高就已經完成。Response time顯示的是測試機器和被

測試服務器之間網絡鏈接狀況。Transaction rate則表示服務器端任務處理的完成速度。 

輔助工具: 
增量壓力測試: 

爲了方便增量壓力測試,siege還包含了一些輔助工具:
bombardment (1) 
是一個輔助工具:用於按照增量用戶壓力測試: 
使用樣例: 
bombardment urlfile.txt 5 3 4 1
初始化URL列表:urlfile.txt
初始化爲:5個用戶 
每次增加:3個用戶 
運行:4次 
每個客戶端之間的延遲爲:1秒 

輸出成CSV格式: 
siege2csv.pl (1) 
siege2csv.pl將bombardment的輸出變成CSV格式: 
Time Data Transferred Response Time Transaction Rate Throughput Concurrency Code 200 

(note that this is horribly broken.) 
242 60.22 603064 0.02 4.02 10014.35 0.08
605 59.98 1507660 0.01 10.09 25136.05 0.12
938 59.98 2337496 0.02 15.64 38971.26 0.26
1157 60 2883244 0.04 19.28 48054.07 0.78
--

Siege測試指標部分描述:

Transactions:                 已完成的事務總數

Availability:                 完成的成功率

Elapsed time:                 總共使用的時間

Data transferred:             響應中數據的總大小

Response time:                顯示網略連接的速度

Transaction rate:             平均每秒完成的事務數

Throughput:                   平均每秒傳送的數據量

Concurrency:                  實際最高併發連接數

Successful transactions:      成功處理的次數

Failed transactions:          失敗處理的次數

Longest transaction:          最長事務處理的時間

Shortest transaction:         最短事務處理時間

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章