Skip to content

Commit 8cb51ec

Browse files
authored
Change default max-in-flight and buffer-capacity (#753)
There are seperate settings for the default in-flight request limit and the proxy's buffer capacity, but we've chosen a single default. This change restores the buffer capacity to 10K while raising the in-flight request limit to 100K. This is intended to allow the proxy to support services that do not respond promptly that may legitimitately have <100K pending requests.
1 parent b4d9d03 commit 8cb51ec

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

linkerd/app/src/env.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,6 @@ const DEFAULT_RESOLV_CONF: &str = "/etc/resolv.conf";
189189
const DEFAULT_INITIAL_STREAM_WINDOW_SIZE: u32 = 65_535; // Protocol default
190190
const DEFAULT_INITIAL_CONNECTION_WINDOW_SIZE: u32 = 1048576; // 1MB ~ 16 streams at capacity
191191

192-
// 100_000 is arbitrarily chosen for now...
193-
const DEFAULT_BUFFER_CAPACITY: usize = 100_000;
194-
195192
// This configuration limits the amount of time Linkerd retains cached clients &
196193
// connections.
197194
//
@@ -213,9 +210,21 @@ const DEFAULT_OUTBOUND_ROUTER_MAX_IDLE_AGE: Duration = Duration::from_secs(5);
213210
const DEFAULT_INBOUND_MAX_IDLE_CONNS_PER_ENDPOINT: usize = std::usize::MAX;
214211
const DEFAULT_OUTBOUND_MAX_IDLE_CONNS_PER_ENDPOINT: usize = std::usize::MAX;
215212

216-
// By default, don't accept more requests than we can buffer.
217-
const DEFAULT_INBOUND_MAX_IN_FLIGHT: usize = DEFAULT_BUFFER_CAPACITY;
218-
const DEFAULT_OUTBOUND_MAX_IN_FLIGHT: usize = DEFAULT_BUFFER_CAPACITY;
213+
// These settings limit the number of requests that have not received responses,
214+
// including those buffered in the proxy and dispatched to the destination
215+
// service.
216+
const DEFAULT_INBOUND_MAX_IN_FLIGHT: usize = 100_000;
217+
const DEFAULT_OUTBOUND_MAX_IN_FLIGHT: usize = 100_000;
218+
219+
// This value should be large enough to admit requests without exerting
220+
// backpressure so that requests implicitly buffer in the executor; but it
221+
// should be small enough that callers can't force the proxy to consume an
222+
// extreme amount of memory. Also keep in mind that there may be several buffers
223+
// used in a given proxy, each of which assumes this capacity.
224+
//
225+
// The value of 10K is chosen somewhat arbitrarily, but seems high enough to
226+
// buffer requests for high-load services.
227+
const DEFAULT_BUFFER_CAPACITY: usize = 10_000;
219228

220229
const DEFAULT_DESTINATION_PROFILE_SUFFIXES: &str = "svc.cluster.local.";
221230
const DEFAULT_DESTINATION_PROFILE_IDLE_TIMEOUT: Duration = Duration::from_millis(500);

0 commit comments

Comments
 (0)