Skip to content

Commit 4d3b75b

Browse files
authored
Explain client::Config (#550)
`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.
1 parent 41754ed commit 4d3b75b

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

tarpc/src/client.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,23 @@ use tracing::Span;
3737
#[non_exhaustive]
3838
pub struct Config {
3939
/// The number of requests that can be in flight at once.
40-
/// `max_in_flight_requests` controls the size of the map used by the client
41-
/// for storing pending requests.
40+
/// When exceeded, subsequent requests are queued while
41+
/// existing requests are executed.
42+
///
43+
/// It is safe to set to a very large value like `usize::MAX`,
44+
/// if the user logic limits the number of requests in flight.
45+
///
46+
/// The default value for this parameter is 1000.
4247
pub max_in_flight_requests: usize,
43-
/// The number of requests that can be buffered client-side before being sent.
44-
/// `pending_requests_buffer` controls the size of the channel clients use
45-
/// to communicate with the request dispatch task.
48+
/// The the buffer size (in number of requests) between
49+
/// the client API and the task sending the requests to the network.
50+
///
51+
/// Too low value may decrease throughput.
52+
///
53+
/// High value does not block sending: a background task continuously
54+
/// flushes any buffered messages.
55+
///
56+
/// The default value for this parameter is 100.
4657
pub pending_request_buffer: usize,
4758
}
4859

0 commit comments

Comments
 (0)