From bf2f44e62f52a19358b9d714216bcc6340572ca6 Mon Sep 17 00:00:00 2001 From: Hexay <97907668+Hexay@users.noreply.github.com> Date: Thu, 29 Oct 2026 21:00:34 +0000 Subject: [PATCH] Enable TCP_NODELAY on webserver connections Responses are written as separate headers and body writes. With Nagle's algorithm on, the body waits for the client to ACK the headers, which the client delays by ~40 ms, so every keep-alive response stalls. Claude-Session: https://claude.ai/code/session_01TzWnhfE6xe8fyhLCsq3naM --- .../java/de/bluecolored/bluemap/common/web/http/HttpServer.java | 1 + 1 file changed, 1 insertion(+) diff --git a/common/src/main/java/de/bluecolored/bluemap/common/web/http/HttpServer.java b/common/src/main/java/de/bluecolored/bluemap/common/web/http/HttpServer.java index 6a671d3ae..223759c05 100644 --- a/common/src/main/java/de/bluecolored/bluemap/common/web/http/HttpServer.java +++ b/common/src/main/java/de/bluecolored/bluemap/common/web/http/HttpServer.java @@ -51,6 +51,7 @@ public HttpServer(String name, HttpRequestHandler requestHandler) throws IOExcep @Override public void handleConnection(SocketChannel connection) throws IOException { connection.socket().setSoTimeout(600000); // set a 10 min max idle timeout + connection.socket().setTcpNoDelay(true); // headers and body are separate writes, nagle + delayed-ack would stall each response ~40ms executor.execute(new HttpConnection(connection.socket(), requestHandler)); }