Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ rand = "0.8"
rand_distr = "0.4"
rand_xorshift = "0.3"
futures-timer = "3.0"
clap = "4.5"
clap = { version = "4.5", features = ["derive"] }
log = "0.4"
slog = "2.0"
slog-async = "2.1"
Expand Down
3 changes: 3 additions & 0 deletions benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ $ git clone https://github.com/pingcap/grpc.git

3. Build benchmark

`grpc` and `grpc-rs` need to be in the same folder
```
$ cd grpc-rs
$ cargo xtask submodule
Expand All @@ -27,8 +28,10 @@ $ cargo build -p benchmark --release

```
$ cd ../grpc
$ git submodule update --init
$ python3 tools/run_tests/run_performance_tests.py -l rust
```
The recommended python version is 3.10

Checkout `python3 tools/run_tests/run_performance_tests.py --help` to see custom options.

Expand Down
10 changes: 7 additions & 3 deletions benchmark/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@ const LOG_FILE: &str = "GRPCIO_BENCHMARK_LOG_FILE";
///
/// ref http://www.grpc.io/docs/guides/benchmarking.html.
#[derive(Parser)]
#[group(required = true, multiple = false)]
struct WorkerCli {
/// The port the worker should listen on. For example, 8080
#[arg(long)]
driver_port: Option<u16>,
#[arg(id = "driver_port", long)]
driver_port0: Option<u16>,
/// The port the worker should listen on. For example, 8080
#[arg(id = "driver-port", long)]
driver_port1: Option<u16>,
Comment on lines +27 to +31
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why add a new port? what's difference between driver_port and driver-port?

Copy link
Author

@Dog-Du Dog-Du Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No difference, only one of them is not None, just to support both --driver-port and --driver_port.
we need --driver_port when running python3 tools/run_tests/run_performance_tests.py -l rust

}

fn main() {
let cli = WorkerCli::parse();
let port = cli.driver_port.unwrap_or(8080);
let port = cli.driver_port0.unwrap_or(cli.driver_port1.unwrap_or(8080));

let _log_guard = init_log(
env::var(LOG_FILE)
Expand Down