下载
git clone https://github.com/wg/wrk
make
sudo cp -R wrk /usr/local/bin/wrk
查看版本号
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)
罕用申请形式
wrk -t8 -c200 -d30s –latency “http://www.bing.com”
自定义申请 -s
wrk = {
scheme = "http",
host = "localhost",
port = nil,
method = "GET",
path = "/",
headers = {},
body = nil,
thread = <userdata>
}
列子 先用postman测试之后 间接从post外面copy进去设置
wrk.method = "POST"
wrk.body = "foo=bar&baz=quux"
wrk.headers["Content-Type"] = "application/x-www-form-urlencoded"
wrk -d3s -c2 -s scripts/post.lua https://httpbin.org/get
发表回复