Jex’s Note

壓力測試工具

Siege

設定檔 /etc/siege

  • siegerc : 設定檔, 可以將 verbose 改為 true, 預設就是 -v
  • urls.txt : 將 url 或 post 資料寫在裡面, 下指令可以不用指定 url, 預設會讀取這裡

Example

siege -c200 -t10S www.google.com -v
  • -c, –concurrent=NUM CONCURRENT users, default is 10
  • -t, –time=NUMm TIMED testing where “m” is modifier S, M, or H (ex: –time=1H, one hour test.)
  • -v, –verbose VERBOSE, prints notification to screen.

結果 :

Transactions:                    652 hits
Availability:                 100.00 %
Elapsed time:                   3.09 secs
Data transferred:               4.74 MB
Response time:                  0.14 secs
Transaction rate:             211.00 trans/sec
Throughput:                     1.54 MB/sec
Concurrency:                   29.20
Successful transactions:         734
Failed transactions:               0
Longest transaction:            0.60
Shortest transaction:           0.00
  • Response time 超過 2 秒就代表網站效能很慢了
  • Concurrency 是每秒能同步處理的 request

可搭配 htop 觀看 cpu 動態

boom

golang 寫的類似 siege 功能的壓力測試工具

Install

go get github.com/rakyll/boom

jex@jex:/tmp$ boom -n 1000 -c 100 http://example.com
1000 / 1000 Boooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo! 100.00 %

Summary:
  Total:        15.4117 secs.
  Slowest:      4.6350 secs.
  Fastest:      0.0971 secs.
  Average:      1.4694 secs.
  Requests/sec: 64.8857

Status code distribution:
  [200] 1000 responses

Response time histogram:
  0.097 [1]     |
  0.551 [34]    |∎∎
  1.005 [24]    |∎
  1.458 [284]   |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  1.912 [649]   |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  2.366 [4]     |
  2.820 [1]     |
  3.274 [1]     |
  3.727 [0]     |
  4.181 [0]     |
  4.635 [2]     |

Latency distribution:
  10% in 1.3187 secs.
  25% in 1.4365 secs.
  50% in 1.5051 secs.
  75% in 1.5825 secs.
  90% in 1.6727 secs.
  95% in 1.7552 secs.
  99% in 1.9030 secs.

Comments