下载安装 wrk
[root@aikaiyuan ~]# git clone https://github.com/wg/wrk.git
Initialized empty Git repository in /root/wrk/.git/
remote: Reusing existing pack: 463, done.
remote: Total 463 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (463/463), 976.15 KiB | 686 KiB/s, done.
Resolving deltas: 100% (154/154), done.
安装 wrk
[root@aikaiyuan ~]# cd wrk/
[root@aikaiyuan wrk]# make -j8
压力测试
[root@aikaiyuan wrk]# ./wrk -t12 -c40 -d30s http://www.aikaiyuan.com/index.html
Running 30s test @ http://www.aikaiyuan.com/index.html
12 threads and 40 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.18s 922.47ms 2.57s 44.85%
Req/Sec 282.84 398.67 1.50k 72.55%
96986 requests in 30.00s, 25.94GB read
Requests/sec: 3232.80
Transfer/sec: 0.86GB
-t12 使用 12 个线程
-c 使用 40连接
-d30s 请求30秒