From 7b2084b554136d417044e3cf85abeb8a6acf3b7e Mon Sep 17 00:00:00 2001 From: Aviram Hassan Date: Tue, 4 Aug 2026 14:32:09 +0300 Subject: [PATCH] client: set TCP_NODELAY on the default connector The default client stack builds an HttpConnector without disabling Nagle's algorithm. Requests are small and each waits for its response, which is the pattern Nagle delays. It is most visible on long-lived streams carried over the connection. A request/response protocol running inside a port-forwarded stream stalls on delayed ACKs, adding tens of milliseconds to a fraction of its exchanges. --- kube-client/src/client/builder.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kube-client/src/client/builder.rs b/kube-client/src/client/builder.rs index 28582b03a..171fe49e1 100644 --- a/kube-client/src/client/builder.rs +++ b/kube-client/src/client/builder.rs @@ -116,6 +116,11 @@ impl TryFrom for ClientBuilder { fn try_from(config: Config) -> Result { let mut connector = HttpConnector::new(); connector.enforce_http(false); + // Requests over this connection are small and each one waits for its response, which is + // the pattern Nagle's algorithm delays. It is especially costly for long-lived streams + // carried over the connection, such as port-forwards, where a request/response protocol + // running inside the stream stalls on delayed ACKs. + connector.set_nodelay(true); #[cfg(all(feature = "aws-lc-rs", feature = "rustls-tls"))] {