Skip to content

Commit 2199e65

Browse files
authored
Configure the HTTP/2 connection window to 1MB (#400)
Currently, the proxy uses the protocol defaults for HTTP/2 connection window size (64K). Because this is the same as the stream window size, a single stream can consume the entire connection window, stalling other streams. This change alters the default connection window to be 1MB, supporting up to 16 stalled streams. While we primarily care about this setting for client (response) receiver windows, it seems like a good thing to open the server (request) receiver window as well (and the configuration is not currently distinguishable).
1 parent 3d4c813 commit 2199e65

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

linkerd/app/src/env.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ const DEFAULT_OUTBOUND_CONNECT_BACKOFF: ExponentialBackoff = ExponentialBackoff
181181
const DEFAULT_DNS_CANONICALIZE_TIMEOUT: Duration = Duration::from_millis(100);
182182
const DEFAULT_RESOLV_CONF: &str = "/etc/resolv.conf";
183183

184+
const DEFAULT_INITIAL_STREAM_WINDOW_SIZE: u32 = 65_535; // Protocol default
185+
const DEFAULT_INITIAL_CONNECTION_WINDOW_SIZE: u32 = 1048576; // 1MB ~ 16 streams at capacity
186+
184187
/// It's assumed that a typical proxy can serve inbound traffic for up to 100 pod-local
185188
/// HTTP services and may communicate with up to 10K external HTTP domains.
186189
const DEFAULT_INBOUND_ROUTER_CAPACITY: usize = 100;
@@ -302,8 +305,12 @@ pub fn parse_config<S: Strings>(strings: &S) -> Result<super::Config, EnvError>
302305
let tap = parse_tap_config(strings, id_disabled);
303306

304307
let h2_settings = h2::Settings {
305-
initial_stream_window_size: initial_stream_window_size?,
306-
initial_connection_window_size: initial_connection_window_size?,
308+
initial_stream_window_size: Some(
309+
initial_stream_window_size?.unwrap_or(DEFAULT_INITIAL_STREAM_WINDOW_SIZE),
310+
),
311+
initial_connection_window_size: Some(
312+
initial_connection_window_size?.unwrap_or(DEFAULT_INITIAL_CONNECTION_WINDOW_SIZE),
313+
),
307314
};
308315

309316
let outbound = {

0 commit comments

Comments
 (0)