rpc压测思路

rpc 压测调试可以参考wrk这个试一下 , ab 默认走的HTTP/1.0 



**wrk压测**

安装

```
git clone https://github.com/wg/wrk.git
cd wrk
make
# 将可执行文件移动到 /usr/local/bin 位置
sudo cp wrk /usr/local/bin
```

```
wrk -t4 -c600 -d60s --script=post.lua --latency http://live-service/v1/batch
```

post.lua
```
wrk.method = "POST"
wrk.headers["Content-Type"] = "application/x-www-form-urlencoded"
wrk.headers["X-GAIA-HELIOS-VERSION"] = "0.4.1"
wrk.headers["X-GM-Path"] = "/connect/"
wrk.headers["X-GM-Rpc-Method"] = "live/demo/debug_sleep"
wrk.body = 'requests=[{"method":"live/demo/debug_sleep","params":{"unique_id":"0","sleep_seconds":3},"environment":{"client_info":null,"passport":null,"l5d_path":""},"session_key":null,"timeout":120}]'


logfile = io.open("wrk.log", "w");
local cnt = 0;

response = function(status, header, body)
logfile:write("status:" .. status .. "\n");
cnt = cnt + 1;
logfile:write("status:" .. status .. "\n" .. body .. "\n-------------------------------------------------\n");
end

```

 

 

作者:含笑半步颠√

博客链接:https://www.cnblogs.com/lixy-88428977

声明:本文为博主学习感悟总结,水平有限,如果不当,欢迎指正。如果您认为还不错,欢迎转载。转载与引用请注明作者及出处。

 

posted @ 2021-02-18 09:46  含笑半步颠√  阅读(286)  评论(0编辑  收藏  举报