From b214209c6fd945074d90060fa73146c33978fe0d Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Wed, 25 Mar 2026 05:19:23 +0000 Subject: [PATCH] Explain client::Config `max_in_flight_requests` parameter IMO is dangerously low. But for now try to explain the meaning of the parameter better. And add more explanations to another parameter while at it. --- tarpc/src/client.rs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/tarpc/src/client.rs b/tarpc/src/client.rs index 25e08808..a9ea9549 100644 --- a/tarpc/src/client.rs +++ b/tarpc/src/client.rs @@ -37,12 +37,23 @@ use tracing::Span; #[non_exhaustive] pub struct Config { /// The number of requests that can be in flight at once. - /// `max_in_flight_requests` controls the size of the map used by the client - /// for storing pending requests. + /// When exceeded, subsequent requests are queued while + /// existing requests are executed. + /// + /// It is safe to set to a very large value like `usize::MAX`, + /// if the user logic limits the number of requests in flight. + /// + /// The default value for this parameter is 1000. pub max_in_flight_requests: usize, - /// The number of requests that can be buffered client-side before being sent. - /// `pending_requests_buffer` controls the size of the channel clients use - /// to communicate with the request dispatch task. + /// The the buffer size (in number of requests) between + /// the client API and the task sending the requests to the network. + /// + /// Too low value may decrease throughput. + /// + /// High value does not block sending: a background task continuously + /// flushes any buffered messages. + /// + /// The default value for this parameter is 100. pub pending_request_buffer: usize, }