美文网首页
wrk - 一个HTTP基准测试工具

wrk - 一个HTTP基准测试工具

作者: 沐青之枫 | 来源:发表于2018-05-24 14:55 被阅读0次

    wrk是一款现代HTTP基准测试工具,能够在单个多核CPU上运行时产生显着负载。它将多线程设计与可扩展事件通知系统(如epoll和kqueue)结合在一起。

    基本用法

    使用12个线程运行30秒的基准测试,并保持400个HTTP连接处于打开状态

    wrk -t12 -c400 -d30s http://127.0.0.1:8080/index.html
    

    输出

    Running 30s test @ http://127.0.0.1:8080/index.html
      12 threads and 400 connections
      Thread Stats   Avg      Stdev     Max   +/- Stdev
        Latency   635.91us    0.89ms  12.92ms   93.69%
        Req/Sec    56.20k     8.07k   62.00k    86.54%
      22464657 requests in 30.00s, 17.76GB read
    Requests/sec: 748868.53
    Transfer/sec:    606.33MB
    

    测试Swoole对laravel5.5的加速个例

    brew install wrk   // 没有命令需安装
    
    wrk -t4 -c100  http://live.com   or   http://127.0.0.1:9501/
    

    带有FPM的Nginx

    Running 10s test @ http://live.com
      4 threads and 100 connections
      Thread Stats   Avg      Stdev     Max   +/- Stdev
        Latency     1.14s   191.03ms   1.40s    90.31%
        Req/Sec    22.65     10.65    50.00     65.31%
      815 requests in 10.07s, 223.65KB read
    Requests/sec:     80.93
    Transfer/sec:     22.21KB
    
    

    Swoole HTTP服务器

    Running 10s test @ http://127.0.0.1:9501
      4 threads and 100 connections
      Thread Stats   Avg      Stdev     Max   +/- Stdev
        Latency    11.58ms    4.74ms  68.73ms   81.63%
        Req/Sec     2.19k   357.43     2.90k    69.50%
      87879 requests in 10.08s, 15.67MB read
    Requests/sec:   8717.00
    Transfer/sec:      1.55MB
    

    相关文章

      网友评论

          本文标题:wrk - 一个HTTP基准测试工具

          本文链接:https://www.haomeiwen.com/subject/qmrsjftx.html