压测工具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
  12 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   933.14ms  415.00ms   2.00s    77.56%
    Req/Sec    24.77     15.65   121.00     70.04%
  Latency Distribution
     50%  711.85ms
     75%    1.24s
     90%    1.56s
     99%    1.90s
  8181 requests in 30.10s, 121.83MB read
  Socket errors: connect 0, read 0, write 0, timeout 1545
Requests/sec:    271.82
Transfer/sec:      4.05MB

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

Running 30s test @ http://www.baidu.com(压测时间30s)
  12 threads and 400 connections(共12个测试线程,400个连接)
  Thread Stats   Avg      Stdev     Max   +/- Stdev
              (平均值) (标准差)(最大值)(正负一个标准差所占比例)
    Latency   933.14ms  415.00ms   2.00s    77.56%
    (延迟)
    Req/Sec    24.77     15.65   121.00     70.04%
    (处理中的请求数)
  Latency Distribution (延迟分布)
     50%  711.85ms
     75%    1.24s
     90%    1.56s
     99%    1.90s (99分位的延迟)
  8181 requests in 30.10s, 121.83MB read(30.10秒内共处理完成了8181个请求,读取了121.83MB数据)
  Socket errors: connect 0, read 0, write 0, timeout 1545
Requests/sec:    271.82 (平均每秒处理完成271.82个请求)
Transfer/sec:    4.05MB (平均每秒读取数据4.05MB)

 

posted @ 2019-06-05 09:31  知风阁  阅读(563)  评论(0编辑  收藏  举报