Skip to content

Commit aa79ede

Browse files
committed
add benchmark to README
1 parent 65e142e commit aa79ede

File tree

5 files changed

+76
-1
lines changed

5 files changed

+76
-1
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ Check [examples](examples) and [interop](interop)(Interoperability Test) for som
123123
- [x] Data compression
124124
- [x] Support other encoding(other than protobuf)
125125

126+
## Benchmark
127+
128+
1. [Simple benchmark](examples/helloworld/README.md#Benchmark) by using [ghz](https://ghz.sh/)
129+
130+
2. [Benchmark](benchmark) followed by official spec
131+
126132
## Sponsors
127133

128134
This project is being sponsored by [Tubi](https://tubitv.com/). Thank you!

benchmark/README.md

+36-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,41 @@ Benchmark implementation followed by [official spec](https://grpc.io/docs/guides
77
```
88
$ git clone https://github.com/tony612/grpc.git
99
$ cd grpc && git checkout -t origin/elixir-bench
10-
$ export ELIXIR_GRPC_PATH=$(dirname $(pwd))
10+
$ git submodule update --init
11+
$ export ELIXIR_GRPC_PATH= # elixir-grpc path
1112
$ python tools/run_tests/run_performance_tests.py -l elixir
1213
```
14+
15+
## Result
16+
17+
```
18+
# Elixir
19+
# Branch improve-perf
20+
I0707 13:04:20.222163000 4618786240 report.cc:82] QPS: 3070.4
21+
I0707 13:04:20.224064000 4618786240 report.cc:122] QPS: 3070.4 (255.9/server core)
22+
I0707 13:04:20.224079000 4618786240 report.cc:127] Latencies (50/90/95/99/99.9%-ile): 305.0/406.1/469.6/733.8/1730.8 us
23+
I0707 13:04:20.224088000 4618786240 report.cc:137] Server system time: 4.72%
24+
I0707 13:04:20.224097000 4618786240 report.cc:139] Server user time: 47.32%
25+
I0707 13:04:20.224104000 4618786240 report.cc:141] Client system time: 7.93%
26+
I0707 13:04:20.224112000 4618786240 report.cc:143] Client user time: 94.19%
27+
I0707 13:04:20.224119000 4618786240 report.cc:148] Server CPU usage: 0.00%
28+
I0707 13:04:20.224126000 4618786240 report.cc:153] Client Polls per Request: 0.00
29+
I0707 13:04:20.224134000 4618786240 report.cc:155] Server Polls per Request: 0.00
30+
I0707 13:04:20.224142000 4618786240 report.cc:160] Server Queries/CPU-sec: 5899.79
31+
I0707 13:04:20.224149000 4618786240 report.cc:162] Client Queries/CPU-sec: 3006.81
32+
33+
# Go
34+
# It seems there are some problems with Go's benchmark because there's no CPU related metrics
35+
I0707 12:36:06.782124000 4488484288 report.cc:82] QPS: 9525.8
36+
I0707 12:36:06.783670000 4488484288 report.cc:122] QPS: 9525.8 (793.8/server core)
37+
I0707 12:36:06.783688000 4488484288 report.cc:127] Latencies (50/90/95/99/99.9%-ile): 93.8/118.7/139.0/247.9/526.0 us
38+
I0707 12:36:06.783698000 4488484288 report.cc:137] Server system time: 0.00%
39+
I0707 12:36:06.783707000 4488484288 report.cc:139] Server user time: 0.00%
40+
I0707 12:36:06.783750000 4488484288 report.cc:141] Client system time: 0.00%
41+
I0707 12:36:06.783758000 4488484288 report.cc:143] Client user time: 0.00%
42+
I0707 12:36:06.783764000 4488484288 report.cc:148] Server CPU usage: 0.00%
43+
I0707 12:36:06.783771000 4488484288 report.cc:153] Client Polls per Request: 0.00
44+
I0707 12:36:06.783777000 4488484288 report.cc:155] Server Polls per Request: 0.00
45+
I0707 12:36:06.783783000 4488484288 report.cc:160] Server Queries/CPU-sec: inf
46+
I0707 12:36:06.783790000 4488484288 report.cc:162] Client Queries/CPU-sec: inf
47+
```

examples/helloworld/README.md

+27
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,30 @@ Change the config to:
3939
```elixir
4040
config :grpc, start_server: true
4141
```
42+
43+
## Benchmark
44+
45+
Using [ghz](https://ghz.sh/)
46+
47+
```
48+
$ MIX_ENV=prod iex -S mix
49+
# Now cowboy doesn't work well with concurrency
50+
$ ghz --insecure --proto priv/protos/helloworld.proto --call helloworld.Greeter.SayHello -d '{"name":"Joe"}' -z 10s --concurrency 6 --connections 6 127.0.0.1:50051
51+
# The result is for branch improve-perf
52+
Summary:
53+
Count: 124239
54+
Total: 10.00 s
55+
Slowest: 18.85 ms
56+
Fastest: 0.18 ms
57+
Average: 0.44 ms
58+
Requests/sec: 12423.71
59+
60+
# Go
61+
Summary:
62+
Count: 258727
63+
Total: 10.00 s
64+
Slowest: 5.39 ms
65+
Fastest: 0.09 ms
66+
Average: 0.19 ms
67+
Requests/sec: 25861.68
68+
```

examples/helloworld/config/dev.exs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use Mix.Config

examples/helloworld/config/prod.exs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
use Mix.Config
2+
3+
config :grpc, start_server: true
4+
5+
config :logger,
6+
level: :warn

0 commit comments

Comments
 (0)