1. 编写lua脚本,填写post的数据, 如 post.lua
wrk.method = "POST"
wrk.body = '{"userId": "10001","coinType": "GT","type": "2","amount": "5.1"}'
wrk.headers["Content-Type"] = "application/json"
function request()
return wrk.format('POST', nil, nil, body)
end
2. 执行wrk,开始压力测试:
wrk -t 16 -c 100 -d 30s --latency --timeout 5s -s post.lua http://localhost:8021/m/zh/order/new
wrk参数用法网上很多介绍,此处不再祥述