wrk
是一个 c
语言写的压力测试工具
但是 ubuntu 的软件仓库没有收录 wrk,需要我们自己编译安装
安装教程
先安装必要的依赖
sudo apt install build-essential libssl-dev git unzip
从 github
拉取源代码
git clone [email protected]:wg/wrk.git
也可以使用 gitee
的镜像
git clone [email protected]:ponponon/wrk.git
使用 make
编译源代码
cd wrk
make
# 把生成的wrk移到一个PATH目录下面, 比如
sudo cp wrk /usr/local/bin
使用教程
使用 wrk
测试 nginx
─➤ ./wrk http://192.168.31.203
Running 10s test @ http://192.168.31.203
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 657.87us 761.70us 19.66ms 97.90%
Req/Sec 8.48k 743.41 9.74k 83.00%
168665 requests in 10.00s, 138.16MB read
Requests/sec: 16865.61
Transfer/sec: 13.82MB
使用 wrk
测试 gunicorn
─➤ ./wrk http://192.168.31.203:63000/upload/
Running 10s test @ http://192.168.31.203:63000/upload/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 10.91ms 7.41ms 93.90ms 79.23%
Req/Sec 486.49 92.10 797.00 64.50%
9692 requests in 10.01s, 3.47MB read
Non-2xx or 3xx responses: 9692
Requests/sec: 968.38
Transfer/sec: 354.63KB