壓力測試工具記錄

Siege
Siege官網: https://www.joedog.org/siege-home/json

Siege是一個Linux系統下多線程http負載測試和基準測試工具。多線程

使用理由:可跟蹤詳細請求信息,信息比較全。併發

安裝app


wget http://download.joedog.org/siege/siege-latest.tar.gz
tar -xzvf siege-latest.tar.gz
./configure
make
make install
查看配置文件 /usr/local/siege/bin/siege -C高併發


Siege命令經常使用參數
-c 200 指定併發數200
-r 5 指定測試的次數5
-f urls.txt 制定url的文件
-i internet系統,隨機發送url
-b 請求無需等待 delay=0
-t 5 持續測試5分鐘
-r和-t通常不一樣時使用工具


經常使用的siege命令舉例
200個併發對http://www.google.com發送請求100次 
siege -c 200 -r 100 http://www.google.compost


在urls.txt中列出全部的網址 
siege -c 200 -r 100 -f urls.txt測試


隨機選取urls.txt中列出全部的網址 
siege -c 200 -r 100 -f urls.txt -igoogle


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輸出結果說明
Transactions: 總共測試次數
Availability: 成功次數百分比
Elapsed time: 總共耗時多少秒
Data transferred: 總共數據傳輸
Response time: 等到響應耗時
Transaction rate: 平均每秒處理請求數
Throughput: 吞吐率
Concurrency: 最高併發
Successful transactions: 成功的請求數
Failed transactions: 失敗的請求數

Siege使用的一些總結 發送post請求時,url格式爲:http://www.xxxx.com/ POST p1=v1&p2=v2 若是url中含有空格和中文,要先進行url編碼,不然siege發送的請求url不許確

相關文章
相關標籤/搜索