压测工具wrk的编译安装与基础使用

Linux上编译安装:

[root@centos ~]#  cd /usr/local/src

[root@centos ~]#  yum install git -y

[root@centos ~]#  git clone https://github.com/wg/wrk.git

[root@centos ~]# cd wrk

[root@centos ~]# make

[root@centos ~]# ln -s /usr/local/src/wrk/wrk /usr/local/bin

参数说明:   -t 需要模拟的线程数    -c 需要模拟的连接数   -d 测试的持续时间   –timeout 超时的时间   –latency 显示延迟统计

wrk -t12 -c400 -d30s --latency http://www.baidu.com

输出:
Running 30s test @ http://www.baidu.com
threads and connections
Thread Stats Avg Stdev Max +/- Stdev
Latency .14ms .00ms .00s 77.56%
Req/Sec 24.77 15.65 121.00 70.04%
Latency Distribution
% .85ms
% .24s
% .56s
% .90s
requests in .10s, .83MB read
Socket errors: connect , read , write , timeout
Requests/sec: 271.82
Transfer/sec: .05MB

以上使用12个线程400个连接,对baidu首页进行了30秒的压测,并要求在压测结果中输出响应延迟信息。以下对压测结果进行简单注释:

Running 30s test @ http://www.baidu.com(压测时间30s)
threads and connections(共12个测试线程,400个连接)
Thread Stats Avg Stdev Max +/- Stdev
(平均值) (标准差)(最大值)(正负一个标准差所占比例)
Latency .14ms .00ms .00s 77.56%
(延迟)
Req/Sec 24.77 15.65 121.00 70.04%
(处理中的请求数)
Latency Distribution (延迟分布)
% .85ms
% .24s
% .56s
% .90s (99分位的延迟)
requests in .10s, .83MB read(.10秒内共处理完成了8181个请求,读取了121.83MB数据)
Socket errors: connect , read , write , timeout
Requests/sec: 271.82 (平均每秒处理完成271.82个请求)
Transfer/sec: .05MB (平均每秒读取数据4.05MB)
上一篇:PHP 两个多维数组根据某个键的值进行组合排序的几种思路(二)


下一篇:Java EE Expression Language