Skip to content

Commit

Permalink
feat:add compare for gin
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxuan520 committed Nov 25, 2024
1 parent c314ce1 commit f6189c0
Show file tree
Hide file tree
Showing 8 changed files with 240 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.out
bin
build
demo
pack
compile_commands.json
metrics*
Expand Down
12 changes: 10 additions & 2 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,16 @@ int main() {
- Requires cmake
- Requires a compiler that supports C++17
## Performance Testing
- Automatically run updates based on the code committed each time.
![](https://chenxuan520.github.io/cppnet/img/result.png)
- Automated testing is performed using ubuntu-latest from github action, with machine configuration [refer to](https://docs.github.com/zh/actions/writing-workflows/choosing-where-your-workflow-runs/choosing-the-runner-for-a-job#%E7%94%A8%E4%BA%8E%E5%85%AC%E5%85%B1%E5%AD%98%E5%82%A8%E5%BA%93%E7%9A%84-github-%E6%89%98%E7%AE%A1%E7%9A%84%E6%A0%87%E5%87%86%E8%BF%90%E8%A1%8C%E5%99%A8)
- 4 cores, 16GB of memory, and 14GB of hard disk
- Automatically run updated test results based on each commit's code, referring to the scripts in the bench folder, and the hash value will also be in the picture.
- Use [vegeta](https://github.com/tsenart/vegeta) for stress testing, testing at different QPS respectively
- Average response time
- p99 response time
- Accuracy
- Wait time
- Compare cppnet framework and go gin framework, and implement the same function with both
## More Demo
- More demo references can be found in the "demo" folder and the "test" folder.
### Create a TcpServer
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,15 @@ int main() {
- 需要 cmake
- 需要编译器支持 C++17
## 性能测试
- 根据每次 commit 的代码自动运行更新
- 使用 github action的ubuntu-latest进行自动化测试, 机器配置[参考](https://docs.github.com/zh/actions/writing-workflows/choosing-where-your-workflow-runs/choosing-the-runner-for-a-job#%E7%94%A8%E4%BA%8E%E5%85%AC%E5%85%B1%E5%AD%98%E5%82%A8%E5%BA%93%E7%9A%84-github-%E6%89%98%E7%AE%A1%E7%9A%84%E6%A0%87%E5%87%86%E8%BF%90%E8%A1%8C%E5%99%A8)
- 4核 16G 内存 14G 硬盘
- 根据每次 commit 的代码自动运行更新测试结果, 参考 bench 文件夹下脚本, 图片中也会有 hash 值
- 使用 [vegeta](https://github.com/tsenart/vegeta) 进行压力测试, 分别测试在不同QPS下
- 平均响应时间
- p99 响应时间
- 正确率
- 等待时间
- 使用 cppnet 框架 和 go gin 框架进行对比, 使用两者实现同样的功能
![](https://chenxuan520.github.io/cppnet/img/result.png)
## More Demo
- 更多demo参考 demo 文件夹和 test 文件夹
Expand Down
27 changes: 24 additions & 3 deletions bench/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ cd ../demo/simple-http-server
./build.sh
cd $path

echo -e "\nBegin bench test"
end=5500
begin=500
step=500

for ((i=500; i< 5000; i+=500)); do
echo -e "\nBegin cppweb bench test"

for ((i=$begin; i< $end; i+=$step)); do

cd ../demo/simple-http-server
# ./build.sh
Expand All @@ -21,7 +25,24 @@ for ((i=500; i< 5000; i+=500)); do
cat result${i}.bin | ./vegeta report
./vegeta report -type=json result${i}.bin > metrics${i}.json
done
./vegeta plot *.bin > plot.html
# ./vegeta plot *.bin > result.html

# build gin demo
cd ./gin-demo
go mod tidy
go build .
cd ..

echo -e "\nBegin gin bench test"

for ((i=$begin; i< $end; i+=$step)); do

./gin-demo/demo >/dev/null &

echo "GET http://127.0.0.1:8080/" | ./vegeta attack -name=${i}qps -rate=$i -duration=2s > result_gin_${i}.bin
killall demo
cat result_gin_${i}.bin | ./vegeta report
./vegeta report -type=json result_gin_${i}.bin > metrics_gin_${i}.json
done

rm *.bin
34 changes: 34 additions & 0 deletions bench/gin-demo/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module demo

go 1.18

require github.com/gin-gonic/gin v1.10.0

require (
github.com/bytedance/sonic v1.11.6 // indirect
github.com/bytedance/sonic/loader v0.1.1 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.20.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
86 changes: 86 additions & 0 deletions bench/gin-demo/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8=
github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
9 changes: 9 additions & 0 deletions bench/gin-demo/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package main

import "github.com/gin-gonic/gin"

func main() {
g := gin.Default()
g.StaticFile("/", "../demo/asset/index.html")
g.Run("127.0.0.1:8080")
}
86 changes: 67 additions & 19 deletions bench/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,90 @@
import json
import matplotlib.pyplot as plt
import numpy as np
import os
import subprocess

x_point = np.array([])
y_mean = np.array([])
y_mean_gin = np.array([])
y_p99 = np.array([])
y_p99_gin = np.array([])
y_right_rate = np.array([])
arr = []
y_right_rate_gin = np.array([])
y_wait = np.array([])
y_wait_gin = np.array([])

i = 500
while i < 5000:
begin = 500
end = 5500
step = 500

i = begin
while i < end:
# load metrics{i}.json file as json, append to arr
with open(f'metrics{i}.json', 'r') as f:
data = json.load(f)
arr.append(data)
with open(f'metrics_gin_{i}.json', 'r') as f:
data_gin = json.load(f)

x_point = np.append(x_point, i)

y_mean = np.append(y_mean, float(data['latencies']['mean'])/1e6)
y_p99 = np.append(y_p99, float(data['latencies']['99th'])/1e6)
y_right_rate = np.append(y_right_rate, float(data['status_codes']['200'])/float(data['requests']))
y_right_rate = np.append(y_right_rate, float(
data['status_codes']['200'])/float(data['requests']))
y_wait = np.append(y_wait, float(data['wait']/1e6))

y_mean_gin = np.append(y_mean_gin, float(
data_gin['latencies']['mean'])/1e6)
y_p99_gin = np.append(y_p99_gin, float(data_gin['latencies']['99th'])/1e6)
y_right_rate_gin = np.append(y_right_rate_gin, float(
data_gin['status_codes']['200'])/float(data_gin['requests']))
y_wait_gin = np.append(y_wait_gin, float(data_gin['wait']/1e6))

i += 500
# remove file
os.remove(f'metrics{i}.json')
os.remove(f'metrics_gin_{i}.json')

# draw and save to mean.png
fig, axs = plt.subplots(1, 2)
axs[0].plot(x_point, y_mean, label='mean')
axs[0].plot(x_point, y_p99, label='p99')
axs[0].legend()
axs[0].set_xlabel('QPS')
axs[0].set_ylabel('Latency(ms)')
axs[0].set_title('Latency vs QPS')
i += step

# get commit hash
result = subprocess.run('git describe --tags --always',
shell=True, capture_output=True, text=True)

# draw and save
fig, axs = plt.subplots(2, 2, figsize=(15, 12))
axs[0, 0].plot(x_point, y_mean, label='cppnet')
axs[0, 0].plot(x_point, y_mean_gin, label='gin')
axs[0, 0].legend()
axs[0, 0].set_xlabel('QPS')
axs[0, 0].set_ylabel('Latency(ms)')
axs[0, 0].set_title('mean time of request')

# draw p99
axs[0, 1].plot(x_point, y_p99, label='cppnet')
axs[0, 1].plot(x_point, y_p99_gin, label='gin')
axs[0, 1].legend()
axs[0, 1].set_xlabel('QPS')
axs[0, 1].set_ylabel('Latency(ms)')
axs[0, 1].set_title('99th percentile of request')

# draw right rate
axs[1].plot(x_point, y_right_rate, label='right rate')
axs[1].legend()
axs[1].set_xlabel('QPS')
axs[1].set_ylabel('Right Rate')
axs[1].set_title('Right Rate vs QPS')
axs[1, 0].plot(x_point, y_right_rate, label='cppnet')
axs[1, 0].plot(x_point, y_right_rate_gin, label='gin')
axs[1, 0].legend()
axs[1, 0].set_xlabel('QPS')
axs[1, 0].set_ylabel('Right Rate')
axs[1, 0].set_title('right rate of request')

# draw throughput
axs[1, 1].plot(x_point, y_wait, label='cppnet')
axs[1, 1].plot(x_point, y_wait_gin, label='gin')
axs[1, 1].legend()
axs[1, 1].set_xlabel('QPS')
axs[1, 1].set_ylabel('Wait Time(ms)')
axs[1, 1].set_title('wait time of request')

fig.tight_layout()
fig.text(0.54, 0.958, 'commit hash '+result.stdout, ha='center', fontsize=12)
plt.savefig('result.png')
# plt.show()

0 comments on commit f6189c0

Please sign in to comment.