下载源码,编译
git clone https://github.com/wg/wrk.git cd wrk make cp wrk /usr/local/bin/
编辑post.lua文件
[hdfs@xydwtest01 ~]$ cat post.lua
wrk.scheme = "http"
wrk.method = "POST"
wrk.path = "/safetycodec/algo/decode"
wrk.headers["Content-Type"] = "application/json"
wrk.body ='{"sid":778658278485754135,"serverName":"pro_stress_check","data":"eyJtb2JpbGVUZXN0XzMiOiJhbmQ1WTNGNlEycG5kRzVWYzBaMGNGbE1WRU5LUVQwOWMwWjJabmxsWld4U2FVTXJXa1Z3UjFreVpYTkRVbWwwTkVwR1FsTjFWa2xMWkZScUwyZFhhMUE1UlQwPSIsIm1vYmlsZVRlc3RfNCI6ImFuZDVZM0Y2UTJwbmRHNVZjMFowY0ZsTVZFTktRVDA5YzBaMlpubGxaV3hTYVVNcldrVndSMWt5WlhORFpqa3ZNazlqUlhOT1ZXeHVURzlLYlM5dlVqQnBiejA9IiwibW9iaWxlVGVzdF81IjoiYW5kNVkzRjZRMnBuZEc1VmMwWjBjRmxNVkVOS1FUMDljMFoyWm5sbFpXeFNhVU1yV2tWd1Ixa3laWE5EVVhCRlpFSTJaMEpDY0V0cU4yeHBLMUJTVTBGaFVUMD0iLCJtb2JpbGVUZXN0XzEiOiJhbmQ1WTNGNlEycG5kRzVWYzBaMGNGbE1WRU5LUVQwOWMwWjJabmxsWld4U2FVTXJXa1Z3UjFreVpYTkRXa0l4U0VOUVRXRlJPV0lyTnk5MGNHOUxZVFV6TUQwPSIsIm1vYmlsZVRlc3RfMiI6ImFuZDVZM0Y2UTJwbmRHNVZjMFowY0ZsTVZFTktRVDA5YzBaMlpubGxaV3hTYVVNcldrVndSMWt5WlhORFVYWXdSelJUWjFCUlkwTnJOeTlqYTNoVlJXSlNNRDA9In0=","sign":"CC6078CB78B7A16167E88AB6E126139C"}'
执行命令
[hdfs@xydwtest01 ~]$ /usr/local/bin/wrk -t12 -c100 -d30s -T30s --script=post.lua --latency http://10.0.121.55:2363
Running 30s test @ http://10.0.121.55:2363
12 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 13.12ms 2.54ms 43.80ms 78.54%
Req/Sec 613.00 50.19 750.00 70.14%
Latency Distribution
50% 12.79ms
75% 14.22ms
90% 15.83ms
99% 22.69ms
219773 requests in 30.02s, 95.99MB read
Requests/sec: 7320.81
Transfer/sec: 3.20MB
来源:CSDN
作者:L13763338360
链接:https://blog.csdn.net/L13763338360/article/details/103457735