diff --git a/benchmark/Cargo.toml b/benchmark/Cargo.toml index 013aed50..c4cb4dba 100644 --- a/benchmark/Cargo.toml +++ b/benchmark/Cargo.toml @@ -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" diff --git a/benchmark/README.md b/benchmark/README.md index 2d360043..b8804669 100644 --- a/benchmark/README.md +++ b/benchmark/README.md @@ -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 @@ -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. diff --git a/benchmark/src/main.rs b/benchmark/src/main.rs index 3e25edbb..bea728d2 100644 --- a/benchmark/src/main.rs +++ b/benchmark/src/main.rs @@ -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, + #[arg(id = "driver_port", long)] + driver_port0: Option, + /// The port the worker should listen on. For example, 8080 + #[arg(id = "driver-port", long)] + driver_port1: Option, } 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)