Skip to content

grpc-benchmark: Add benchmark client and local runner#2737

Open
arjan-bal wants to merge 23 commits into
grpc:masterfrom
arjan-bal:grpc-benchmark-client
Open

grpc-benchmark: Add benchmark client and local runner#2737
arjan-bal wants to merge 23 commits into
grpc:masterfrom
arjan-bal:grpc-benchmark-client

Conversation

@arjan-bal

@arjan-bal arjan-bal commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Contributes to: #2666

This PR introduces the benchmarking client. It also adds a local runner binary that exercises the worker, server, and client within a single process, making it easy to run benchmarks locally.

Similar to gRPC-Java, the client uses the hdrhistogram crate for its histogram implementation. Because the Rust crate does not support a thread-safe, lock-free implementation natively, the client leverages a tokio::sync::watch channel and a tokio::sync::mpsc channel to coordinate between the worker task and the client RPC tasks when collecting stats. This design avoids the need to acquire a mutex lock when reporting the latency of each RPC.

@arjan-bal

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request implements the benchmark client and worker client execution logic for the gRPC benchmark suite, including support for collecting latency statistics using histograms and running smoke tests. The feedback highlights several important improvements: preventing empty authority overrides from failing gRPC requests, handling empty histograms to avoid reporting incorrect minimum latencies, adding a small delay in the unary call retry loop to prevent 100% CPU usage on failures, and replacing an unsafe .unwrap() with proper error handling when accessing the benchmark client.

Comment thread grpc-benchmark/src/client.rs
Comment thread grpc-benchmark/src/client.rs
Comment thread grpc-benchmark/src/client.rs
Comment thread grpc-benchmark/src/worker.rs Outdated
@arjan-bal arjan-bal closed this Jul 16, 2026
@arjan-bal arjan-bal reopened this Jul 17, 2026
@arjan-bal arjan-bal changed the title grpc-benchmark: Add benchmark client grpc-benchmark: Add benchmark client and local runner Jul 17, 2026
@arjan-bal

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a benchmark tool (bench) and implements the client-side benchmarking logic (BenchmarkClient) along with its integration into the worker service. It also updates the benchmark server to support dynamic port binding. The review feedback highlights two critical issues in client.rs: first, stale histogram reports from previous timed-out requests can corrupt benchmark statistics, which can be resolved by draining the receiver channel; second, if a streaming task fails, it exits prematurely, causing the stats aggregation to hang indefinitely. Re-establishing the stream on failure is recommended to prevent this hang.

Comment thread grpc-benchmark/src/client.rs
Comment thread grpc-benchmark/src/client.rs
@arjan-bal
arjan-bal force-pushed the grpc-benchmark-client branch from e39fe6e to 8dfa7d9 Compare July 20, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants