zoukankan      html  css  js  c++  java
  • 接口压力测试工具之go-wrk

      go-wrk 是一个用Go语言实现的轻量级的http基准测试工具,类似于wrk,本文将简单介绍一下如何使用go-wrk实现接口的性能(压力)测试。

    github地址:https://github.com/tsliwowicz/go-wrk

    安装:

    go get github.com/tsliwowicz/go-wrk 

    使用:

    Usage: go-wrk <options> <url>
       Options:
        -H      header line, joined with ';' (Default )
        -M      HTTP method (Default GET)
        -T      Socket/request timeout in ms (Default 1000)
        -body      request body string or @filename (Default )
        -c      Number of goroutines to use (concurrent connections) (Default 10)
        -ca      CA file to verify peer against (SSL/TLS) (Default )
        -cert      CA certificate file to verify peer against (SSL/TLS) (Default )
        -d      Duration of test in seconds (Default 10)
        -f      Playback file name (Default <empty>)
        -help      Print help (Default false)
        -host      Host Header (Default )
        -http      Use HTTP/2 (Default true)
        -key      Private key file name (SSL/TLS (Default )
        -no-c      Disable Compression - Prevents sending the "Accept-Encoding: gzip" header (Default false)
        -no-ka      Disable KeepAlive - prevents re-use of TCP connections between different HTTP requests (Default false)
        -redir      Allow Redirects (Default false)
        -v      Print version details (Default false)
    ./go-wrk -c 80 -d 5  http://192.168.1.118:8080/json
    
    持续5秒中, 开启每秒80个并发请求
    
    返回结果:
    Running 10s test @ http://192.168.1.118:8080/json  
      80 goroutine(s) running concurrently  
       142470 requests in 4.949028953s, 19.57MB read  
         Requests/sec:        28787.47  
         Transfer/sec:        3.95MB  
         Avg Req Time:        0.0347ms  
         Fastest Request:    0.0340ms  
         Slowest Request:    0.0421ms  
         Number of Errors:    0  


    还有其他参数: -n 10000 就是模拟1w次请求
  • 相关阅读:
    解决“ 故障模块名称: clr.dll ”
    关于阿里云专有网络搭建FTP服务器的深坑
    电脑异常断电,IDEA崩溃
    Winform 出现“Win已停止工作”解决方法
    C# WinForm控件、自定义控件整理(大全)
    cmd获取管理员权限等
    检测笔记本电池状态
    单片机
    常用工具、焊接技术
    元器件
  • 原文地址:https://www.cnblogs.com/xingxia/p/go-wrk.html
Copyright © 2011-2022 走看看