ghz做grpc服务压测

搭建的grpc服务是线下的服务,但是要求qps比较高,那么自己先进行一下压测吧

准备

  1. ghz:https://github.com/bojand/ghz/releases直接下载对应的包,解压即可使用
  2. proto:安装proto,并且准备好proto的协议文件

压测脚本

# 2个线程,100次请求,慢慢扩大c和n的值,防止把服务打挂,一般来说c的大小是grpc服务指定max-works数
./ghz -c 10 -n 10000 \
--insecure \
# 指定.proto协议的位置
--proto inference.proto \
# 指定请求的方法
--call inference.Inference.request \
# 指定数据
-d '{"data":"数据"}' \
xxx.xxx.xxx.xxx:50050

结果

Summary:
  Count:        10000
  Total:        1.79 s # 10000次请求总耗时
  Slowest:      23.89 ms # 最慢耗时
  Fastest:      0.80 ms # 最快耗时
  Average:      1.73 ms # 平均请求耗时
  Requests/sec: 5586.08 # qps
 
Response time histogram:
  0.801 [1]     |
  3.109 [9834]  |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  5.418 [88]    |
  7.727 [15]    |
  10.036 [10]   |
  12.345 [6]    |
  14.654 [2]    |
  16.963 [9]    |
  19.272 [0]    |
  21.581 [0]    |
  23.890 [10]   |
 
Latency distribution:
  10 % in 1.20 ms
  25 % in 1.38 ms
  50 % in 1.62 ms
  75 % in 1.90 ms
  90 % in 2.21 ms
  95 % in 2.42 ms
  99 % in 3.40 ms
 
Status code distribution:
  [OK]            9975 responses
  [Unavailable]   25 responses
 
Error distribution:
  [25]   rpc error: code = Unavailable desc = the connection is draining
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值