Ubuntu Siege 壓力測試工具

  • 安裝
$ sudo apt install siege
  • Siege命令經常使用參數
-c 200 指定併發數200
-r 5 指定測試的次數5
-f urls.txt 制定url的文件
-i internet系統,隨機發送url
-b 請求無需等待 delay=0
-t 5 持續測試5分鐘
# -r和-t通常不一樣時使用
  • 經常使用的幾個子
# 模擬10秒內每秒訪問20次
$ sudo siege http://web.meilapp.com/products -c20 -t10s

# 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 3.0.8
** Preparing 20 concurrent users for battle.
The server is now under siege...
Lifting the server siege...      done.

Transactions:		           2 hits                                # 總共測試次數
Availability:		      100.00 %                              # 成功次數百分比
Elapsed time:		        9.02 secs                            #  總共耗時多少秒
Data transferred:	        0.01 MB                              # 總共數據傳輸
Response time:		        2.73 secs                    # 等到響應耗時
Transaction rate:	        0.22 trans/sec                     # 平均每秒處理請求數
Throughput:		        0.00 MB/sec                       # 吞吐率
Concurrency:		        0.61                                     # 最高併發
Successful transactions:           9                                # 成功的請求數
Failed transactions:	           0                                       # 失敗的請求數
Longest transaction:	        5.40
Shortest transaction:	        0.00

Siegeweb

相關文章
相關標籤/搜索