wrk-http压测

Catalogue

https://cloud.tencent.com/developer/article/1418087

1
2
3
4
5
6
# 压测: 12 个线程, 400连接数, 持续时间30s, 
wrk -t12 -c400 -d30s -R 40000 http://wslhost:2222/p2?content=zhangquanquan

# 其他参数.
# -s 选择 lua文件, 用于压测http请求.
wrk -t12 -c400 -d30s -s post.lua -R 4000 http://wslhost:8888/graphql

post.lua文件:

1
2
3
4
5
6
7
wrk.method = "POST"
wrk.body = '{"query": "query{ greeting }"}'
wrk.headers["Content-Type"] = "application/json"

function request()
return wrk.format('POST', nil, nil, body)
end
1
2
# 先用curl测试接口是否正常.
curl -H "Content-Type: application/json" -X POST -d '{"query": "query{ greeting }"}' "http://wslhost:8869/graphql"