Web性能壓力測試工具——Siege
阿新 • • 發佈:2018-07-23
ren 它的 install 參數 2.7 求100 under 網址 led
最近需要對Istio裏的bookinfo進行分析,老是手去刷新太慢了,就找了個自動點的工具——Siege
Siege是一款開源的壓力測試工具,設計用於評估WEB應用在壓力下的承受能力。可以根據配置對一個WEB站點進行多用戶的並發訪問,記錄每個用戶所有請求過程的相應時間,並在一定數量的並發訪問下重復進行。
Siege官網:http://www.joedog.org/
安裝siege
apt-get install siege
Siege命令常用參數
-c 200 //指定並發數200 -r 5 //指定測試的次數5 -f //urls.txt 制定url的文件 -i //internet系統,隨機發送url -b //請求無需等待 delay=0 -t 5 //持續測試5分鐘 //-r和-t一般不同時使用
urls.txt位於 /etc/siege/ 文件夾下,它的格式
[protocol://]host.domain.com[:port][path/to/file]
如果url中含有空格和中文,要先進行url編碼,否則siege發送的請求url不準確
常用的siege命令舉例
//200個並發對http://www.google.com發送請求100次 siege -c 200 -r 100 http://www.google.com //對urls.txt中的所有網址進行測試siege -c 200 -r 100 -f urls.txt //隨機選取urls.txt中列出的網址進行測試 siege -c 200 -r 100 -f urls.txt -i //delay=0,更準確的壓力測試,而不是功能測試 siege -c 200 -r 100 -f urls.txt -i -b //指定http請求頭 文檔類型 siege -H "Content-Type:application/json" -c 200 -r 100 -f urls.txt -i -b
Siege輸出結果說明
** SIEGE 2.72 ** Preparing 10 concurrent users for battle. The serveris now under siege.. done. Transactions: 300 hits //已完成的事務總署 Availability: 100.00 % //完成的成功率 Elapsed time: 0.08 secs //總共使用的時間 Data transferred: 0.94 MB //響應中數據的總大小 Response time: 0.00 secs //顯示網絡連接的速度 Transaction rate: 3750.00 trans/sec //平均每秒完成的事務數 Throughput: 11.79 MB/sec //平均每秒傳送的數據量 Concurrency: 8.50 //實際最高並發鏈接數 Successful transactions: 300 //成功處理的次數 Failed transactions: 0 //失敗處理的次數 Longest transaction: 0.01 //最長事務處理的時間 Shortest transaction: 0.00 //最短事務處理時間
此外還可以看siege的日誌
vi /var/log/siege.log
Web性能壓力測試工具——Siege