From: bert hubert Date: Fri, 5 Oct 2018 10:58:18 +0000 (+0200) Subject: dnsdist did not set TCP_NODELAY, causing needless latency X-Git-Tag: dnsdist-1.3.3~62^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=12894ed9b2d568e35c26a1afa14d2bb0a30e8ed3;p=thirdparty%2Fpdns.git dnsdist did not set TCP_NODELAY, causing needless latency Winfried and others noted that our TLS responses were super slow. This turned out to be caused by the Nagle algorithm which we failed to disable. https://en.wikipedia.org/wiki/Nagle%27s_algorithm --- diff --git a/pdns/dnsdist-tcp.cc b/pdns/dnsdist-tcp.cc index d7a6e80bd4..0ea59d7911 100644 --- a/pdns/dnsdist-tcp.cc +++ b/pdns/dnsdist-tcp.cc @@ -32,6 +32,7 @@ #include "threadname.hh" #include #include +#include using std::thread; using std::atomic; @@ -715,7 +716,7 @@ void* tcpAcceptorThread(void* p) continue; } #endif - + SSetsockopt(ci->fd, SOL_TCP, TCP_NODELAY, 1); // disable NAGLE if(g_maxTCPQueuedConnections > 0 && g_tcpclientthreads->getQueuedCount() >= g_maxTCPQueuedConnections) { close(ci->fd); delete ci;