|
1 | | -# Benchmark |
| 1 | +# gRPC Benchmark |
2 | 2 |
|
3 | | -Benchmark implementation followed by [official spec](https://grpc.io/docs/guides/benchmarking/) |
| 3 | +Benchmark tools for testing gRPC performance. |
4 | 4 |
|
5 | 5 | ## Usage |
6 | 6 |
|
| 7 | +This project provides Mix tasks for running benchmarks: |
| 8 | + |
| 9 | +### Starting a Worker Server |
| 10 | + |
| 11 | +```bash |
| 12 | +mix benchmark.worker --port=10000 |
| 13 | +``` |
| 14 | + |
| 15 | +Options: |
| 16 | +- `--port` - Port to listen on (required) |
| 17 | + |
| 18 | +The worker will run until you send it a quit signal. |
| 19 | + |
| 20 | +### Running Benchmark Tests |
| 21 | + |
| 22 | +```bash |
| 23 | +# Use defaults (port 10000, 1000 requests) |
| 24 | +mix benchmark.test |
| 25 | + |
| 26 | +# Custom port |
| 27 | +mix benchmark.test --port=9999 |
| 28 | + |
| 29 | +# Custom number of requests |
| 30 | +mix benchmark.test --requests=5000 |
| 31 | + |
| 32 | +# Both options |
| 33 | +mix benchmark.test --port=9999 --requests=5000 |
7 | 34 | ``` |
8 | | -$ git clone https://github.com/elixir-grpc/grpc.git |
9 | | -$ cd grpc && git checkout -t origin/elixir-bench |
10 | | -$ git submodule update --init |
11 | | -$ export ELIXIR_GRPC_PATH= # elixir-grpc path |
12 | | -$ python tools/run_tests/run_performance_tests.py -l elixir |
| 35 | + |
| 36 | +Options: |
| 37 | +- `--port` - Server port (default: 10000) |
| 38 | +- `--requests` - Number of requests to send (default: 1000) |
| 39 | + |
| 40 | +### Legacy Scripts |
| 41 | + |
| 42 | +The original `bin/` scripts are still available for backward compatibility: |
| 43 | + |
| 44 | +```bash |
| 45 | +# Start worker |
| 46 | +elixir bin/worker.exs --port=10000 |
| 47 | + |
| 48 | +# Run test |
| 49 | +elixir bin/test.exs |
13 | 50 | ``` |
14 | 51 |
|
15 | | -## Result |
| 52 | +## Project Structure |
| 53 | + |
| 54 | +This project follows standard Elixir/OTP conventions: |
16 | 55 |
|
17 | 56 | ``` |
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 |
| 57 | +benchmarkg/ |
| 58 | +├── lib/ |
| 59 | +│ ├── benchmark/ # Core benchmark modules |
| 60 | +│ │ ├── application.ex # OTP Application supervisor |
| 61 | +│ │ ├── client_manager.ex |
| 62 | +│ │ ├── server_manager.ex |
| 63 | +│ │ └── ... |
| 64 | +│ └── mix/tasks/ # Mix tasks |
| 65 | +│ ├── benchmark.worker.ex |
| 66 | +│ └── benchmark.test.ex |
| 67 | +├── bin/ # Legacy scripts (preserved) |
| 68 | +├── proto/ # Protocol buffer definitions |
| 69 | +└── mix.exs |
47 | 70 | ``` |
| 71 | + |
| 72 | +See [REFACTORING.md](REFACTORING.md) for details on the migration from scripts to Mix tasks. |
| 73 | + |
0 commit comments