安裝命令
git clone https://github.com/wg/wrk
ll
cd wrk/
ll
make
ll
cp wrk /usr/local/sbin/
- 幫助 wrk
使用方法: wrk <選項> <被測HTTP服務的URL>
Options:
-c, --connections <N> 跟服務器建立并保持的TCP連接數(shù)量
-d, --duration <T> 壓測時間
-t, --threads <N> 使用多少個線程進行壓測
-s, --script <S> 指定Lua腳本路徑
-H, --header <H> 為每一個HTTP請求添加HTTP頭
--latency 在壓測結束后诫欠,打印延遲統(tǒng)計信息
--timeout <T> 超時時間
-v, --version 打印正在使用的wrk的詳細版本信息
<N>代表數(shù)字參數(shù)及汉,支持國際單位 (1k, 1M, 1G)
<T>代表時間參數(shù),支持時間單位 (2s, 2m, 2h)
wrk -c1000 -t10 -d10 --latency "http://10.100.48.39:8898/find"
- 結果顯示
Running 30s test @ http://www.bing.com (壓測時間30s)
8 threads and 200 connections (共8個測試線程媳板,200個連接)
Thread Stats Avg Stdev Max +/- Stdev
(平均值) (標準差)(最大值)(正負一個標準差所占比例)
Latency 46.67ms 215.38ms 1.67s 95.59%
(延遲)
Req/Sec 7.91k 1.15k 10.26k 70.77%
(處理中的請求數(shù))
Latency Distribution (延遲分布)
50% 2.93ms
75% 3.78ms
90% 4.73ms
99% 1.35s (99分位的延遲)
1790465 requests in 30.01s, 684.08MB read (30.01秒內共處理完成了1790465個請求咳焚,讀取了684.08MB數(shù)據(jù))
Requests/sec: 59658.29 (平均每秒處理完成59658.29個請求)
Transfer/sec: 22.79MB (平均每秒讀取數(shù)據(jù)22.79MB)