siege壓力測試工具安裝和介紹

前言

最近公司有個項目需要做一個短輪詢類推送服務器(推送服務器分爲三種,短輪詢,長輪詢,長連接),用戶量不大,但是爲了保險起見還是做一下壓力測試.用的工具是siege.

目錄

1.siege介紹

siege介紹 : 百度百科 : siege

輸入參數說明:

輸入名稱解釋說明
-V, –version打印版本信息
-h, –help打印幫助信息
-C, –config顯示配置信息
-v, –verbose打印冗餘配置信息。
-g, –get顯示HTTP交易。
-c, –concurrent=NUM設置併發用戶數
-u, –url=”URL”設置被測Web的URL
-i, –internet用戶模擬、隨機訪問URL
-b, –benchmark .基準測試。
-t, –time=NUM設置測試時間。
-r, –reps=NUM設置測試次數
-f, –file=FILE更改配置文件存檔
-R, –rc=FILE更改siegerc文件和環境變量
-l, –log測試日誌
-m, –mark=”text”標記測試日誌
-d, –delay=NUM設置時間延遲
-H, –header=”text”增加測試頭文件
-A, –user-agent=”text”設置代理測試請求


輸出參數說明:

輸出名稱解釋說明
Transactions:訪問次數
Availability:成功次數
Elapsed time:測試用時
Data transferred:測試傳輸數據量
Response time:平均響應時間
Transaction rate:每秒事務處理量
Throughput:吞吐率
Concurrency:併發用戶數
Successful transactions:成功傳輸次數
Failed transactions:失敗傳輸次數
Longest transaction:最長響應時間
Shortest transaction:最短響應時間

2.siege安裝

下載地址 : http://download.joedog.org/siege/ , 我用的版本 : siege-2.70.tar.gz

CaodeMacBook-Pro:local root# tar -xzvf siege-2.70.tar 
CaodeMacBook-Pro:local root# cd siege-2.70
CaodeMacBook-Pro:siege-2.70 root# ./configure
CaodeMacBook-Pro:siege-2.70 root# make 
CaodeMacBook-Pro:siege-2.70 root# make install
  • 1
  • 2
  • 3
  • 4
  • 5

安裝成功驗證 :

CaodeMacBook-Pro:siege-2.70 root# siege -version
siege: invalid option -- e
siege: invalid option -- e
SIEGE 2.70
Usage: siege [options]
       siege [options] URL
       siege -g URL
Options:
  -V, --version           VERSION, prints the version number.
  -h, --help              HELP, prints this section.
  -C, --config            CONFIGURATION, show the current config.
  -v, --verbose           VERBOSE, prints notification to screen.
  -g, --get               GET, pull down HTTP headers and display the
                          transaction. Great for application debugging.
  -c, --concurrent=NUM    CONCURRENT users, default is 10
  -i, --internet          INTERNET user simulation, hits URLs randomly.
  -b, --benchmark         BENCHMARK: no delays between requests.
  -t, --time=NUMm         TIMED testing where "m" is modifier S, M, or H
                          ex: --time=1H, one hour test.
  -r, --reps=NUM          REPS, number of times to run the test.
  -f, --file=FILE         FILE, select a specific URLS FILE.
  -R, --rc=FILE           RC, specify an siegerc file
  -l, --log[=FILE]        LOG to FILE. If FILE is not specified, the
                          default is used: PREFIX/var/siege.log
  -m, --mark="text"       MARK, mark the log file with a string.
  -d, --delay=NUM         Time DELAY, random delay before each requst
                          between 1 and NUM. (NOT COUNTED IN STATS)
  -H, --header="text"     Add a header to request (can be many)
  -A, --user-agent="text" Sets User-Agent in request

Copyright (C) 2010 by Jeffrey Fulmer, et al.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34


3.siege使用

我這邊是測試了一個server端的接口併發情況.

  • 接口地址是:http://118.212.149.xx:8080/xx/xx/xx
  • 請求類型 : POST
  • 請求參數 : {“accountId”:”123”,”platform”:”ios”}
  • 請求次數 :10次
  • 請求併發數量 : 200

請求 : (請求參數說明請參照上文中表格)

CaodeMacBook-Pro:siege-2.70 root# siege "http://118.212.149.xx:8080/xx/xx/xx POST {\"accountId\":\"123\",\"platform\":\"ios\"}" -r 10 -c 200
  • 1

返回 : (返回參數說明請參照上文中表格)

done.
Transactions:               2000 hits
Availability:             100.00 %
Elapsed time:              15.27 secs
Data transferred:           0.07 MB
Response time:              0.47 secs
Transaction rate:         130.98 trans/sec
Throughput:             0.00 MB/sec
Concurrency:               61.45
Successful transactions:        2000
Failed transactions:               0
Longest transaction:            8.17
Shortest transaction:           0.06
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

百度百科中也有提到siege測試無法體現出具體細節,我本人也並不是測試人員,後續做併發時候會再找找有沒有更好用的測試軟件推薦給大家.大家有什麼好用的推薦給我哈.

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