安装
git clone https://gitee.com/mirrors/wrk.git
参数
-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,添加http header, 比如. "User-Agent: wrk"
--latency Print latency statistics,显示延迟统计
--timeout, -T: <T> Socket/request timeout,超时的时间
-v, --version Print version details
例子
wrk -c 10000 -t 100 http://127.0.0.1:80/test -s wrk_keep.lua -d 20s -T2 --latency
Running 20s test @ http://127.0.0.1/test
100 threads and 10000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 146.36ms 253.95ms 2.00s 88.39%
Req/Sec 1.24k 298.79 3.61k 69.12%
Latency Distribution
50% 34.30ms
75% 176.93ms
90% 459.42ms
99% 1.16s
2484504 requests in 20.10s, 781.90MB read
Socket errors: connect 0, read 0, write 0, timeout 9316
Requests/sec: 123612.53
Transfer/sec: 38.90MB