About the Go language command line stress testing tool Wrk

藏色散人
Release: 2021-06-01 15:06:46
forward
2791 people have browsed it

The following tutorial column will introduce you to the Go language command line stress testing tool Wrk. I hope it will be helpful to friends in need! Go language command line stress testing tool Wrk

Download

git clone https://github.com/wg /wrk

make

sudo cp -R wrk /usr/local/bin/wrk

View version number

wrk -v
使用方法: wrk <选项> <被测HTTP服务的URL>                            
  Options:                                            
    -c, --connections <N>  跟服务器建立并保持的TCP连接数量  
    -d, --duration    <T>  压测时间           
    -t, --threads     <N>  使用多少个线程进行压测   
                                                      
    -s, --script      <S>  指定Lua脚本路径       
    -H, --header      <H>  为每一个HTTP请求添加HTTP头      
        --latency          在压测结束后,打印延迟统计信息   
        --timeout     <T>  超时时间     
    -v, --version          打印正在使用的wrk的详细版本信息
                                                      
  <N>代表数字参数,支持国际单位 (1k, 1M, 1G)
  <T>代表时间参数,支持时间单位 (2s, 2m, 2h)
Copy after login

Common request methods

wrk -t8 -c200 -d30s --latency "http://www.bing.com"

Custom request-s

wrk = {
    scheme  = "http",
    host    = "localhost",
    port    = nil,
    method  = "GET",
    path    = "/",
    headers = {},
    body    = nil,
    thread  = <userdata>
}
Copy after login
Liezi first use postman to test and then copy and set it directly from the post
wrk.method = "POST"
wrk.body   = "foo=bar&baz=quux"
wrk.headers["Content-Type"] = "application/x-www-form-urlencoded"
Copy after login

wrk -d3s -c2 -s scripts/post.lua https://httpbin.org/get

The above is the detailed content of About the Go language command line stress testing tool Wrk. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!