

Usage: wrk <options> <url>
Options:
-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
-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)数字参数:可以使用 1k、1M、1G 单位
grep processor /proc/cpuinfo |wc -l启动 2 个线程,保持 5 个 http 连接打开的状态下,持续压测 10s 的基准测试
wrk -t2 -c5 -d10s https://httpbin.org/get
qps 是 14.85
启动 16 个线程,保持 400 个 http 连接打开的状态下,持续压测 5s 的基准测试,并打印延迟统计数据
wrk -t16 -c400 -d5s --latency https://httpbin.org/get
qps 是 578.7
Running 5s test @ https://httpbin.org/get 压测时间5s
16 threads and 400 connections 共16个测试线程,400个连接,和上参数设置一样
Thread Stats Avg Stdev Max +/- Stdev
平均值 标准差 最大值 正负标准差的范围,越大表示值和平均值不会差很多,离散也不大,表示 Avg 相对可信
Latency 311.74ms 211.97ms 1.57s 90.79%
延迟
Req/Sec 47.86 31.17 170.00 66.79%
每个线程每秒的完成的请求数
Latency Distribution 延迟分布
50% 234.77ms
75% 244.43ms
90% 402.99ms
99% 1.26s 99% 的请求在 1.26s 内完成
2938 requests in 5.08s, 1.21MB read 5.08 s内共处理完成了 2938 个请求,读取了 1.21MB 数据
Socket errors: connect 166, read 0, write 0, timeout 1 Socket 成功连接 166个,超时 1 个
Requests/sec: 578.70 平均每秒处理完成 578.7 个请求,QPS=578.7
Transfer/sec: 243.05KB 平均每秒读取数据 243.05KB接下来对某个接口进行基准测试

qps:20504.3

qps:19948.69

qps:18811.35