wrk
- usage
HTTP benchmarking tool.
More information: https://github.com/wg/wrk. - param
1
2
3
4
5
6
7
8
9
10
11
12Options:
-c, --connections <N> Connections to keep open //连接数
-d, --duration <T> Duration of test //测试时间
-t, --threads <N> Number of threads to use //线程数
-s, --script <S> Load Lua script file //lua脚本
-H, --header <H> Add header to request //添加头信息
--latency Print latency statistics
--timeout <T> Socket/request timeout
-v, --version Print version details //版本信息
Numeric arguments may include a SI unit (1k, 1M, 1G)
Time arguments may include a time unit (2s, 2m, 2h)
examples
- 测试go-zero demo中的check接口
1
wrk -t10 -c1000 -d30s --latency "http://localhost:8888/check?book=go-zero"
- 结果
1
2
3
4
5
6
7
8
9
10
11
12
13Running 30s test @ http://localhost:8888/check? book=go-zero
10 threads and 1000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 128.84ms 60.10ms 593.00ms 77.53%
Req/Sec 794.67 304.69 1.95k 69.54%
Latency Distribution
50% 115.23ms
75% 153.24ms
90% 203.13ms
99% 339.48ms
233390 requests in 30.10s, 29.60MB read
Requests/sec: 7754.33
Transfer/sec: 0.98MB
ubuntu下使用
- 安装
1
2
3
4
5
6
7
8git clone https://github.com/wg/wrk.git
// 构建可执行文件
cd wrk
make
// 软连接
ln -s 绝对路径/wrk /usr/local/bin(任意在PATH中的路径都可以)