From 254d7e4c174cff954b5c5db5b3964213b4a30c00 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 20 Oct 2016 12:41:11 +0200 Subject: [PATCH] dnsdist: Change the default max number of queued TCP conns to 1000 With the existing default value of 0, we could consume an unlimited number of file descriptors if the queued connections kept piling up. --- pdns/README-dnsdist.md | 8 ++++---- pdns/dnsdist-tcp.cc | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pdns/README-dnsdist.md b/pdns/README-dnsdist.md index 5c82ecafb..765195180 100644 --- a/pdns/README-dnsdist.md +++ b/pdns/README-dnsdist.md @@ -915,9 +915,9 @@ The maximum number of threads in the TCP pool is controlled by the increased to handle a large number of simultaneous TCP connections. If all the TCP threads are busy, new TCP connections are queued while they wait to be picked up. The maximum number of queued connections -can be configured with `setMaxTCPQueuedConnections()`, and any value other -than 0 (the default) will cause new connections to be dropped if there -are already too many queued. +can be configured with `setMaxTCPQueuedConnections()` and defaults to 1000. +Any value larger than 0 will cause new connections to be dropped if there are +already too many queued. When dispatching UDP queries to backend servers, `dnsdist` keeps track of at most `n` outstanding queries for each backend. This number `n` can be tuned by @@ -1476,7 +1476,7 @@ instantiate a server with additional parameters * `setTCPRecvTimeout(n)`: set the read timeout on TCP connections from the client, in seconds * `setTCPSendTimeout(n)`: set the write timeout on TCP connections from the client, in seconds * `setMaxTCPClientThreads(n)`: set the maximum of TCP client threads, handling TCP connections - * `setMaxTCPQueuedConnections(n)`: set the maximum number of TCP connections queued (waiting to be picked up by a client thread) + * `setMaxTCPQueuedConnections(n)`: set the maximum number of TCP connections queued (waiting to be picked up by a client thread), defaults to 1000. 0 means unlimited * `setMaxUDPOutstanding(n)`: set the maximum number of outstanding UDP queries to a given backend server. This can only be set at configuration time and defaults to 10240 * `setCacheCleaningDelay(n)`: set the interval in seconds between two runs of the cache cleaning algorithm, removing expired entries * `setStaleCacheEntriesTTL(n)`: allows using cache entries expired for at most `n` seconds when no backend available to answer for a query diff --git a/pdns/dnsdist-tcp.cc b/pdns/dnsdist-tcp.cc index 21f43570d..73d915831 100644 --- a/pdns/dnsdist-tcp.cc +++ b/pdns/dnsdist-tcp.cc @@ -67,7 +67,7 @@ struct ConnectionInfo ClientState* cs; }; -uint64_t g_maxTCPQueuedConnections{0}; +uint64_t g_maxTCPQueuedConnections{1000}; void* tcpClientThread(int pipefd); // Should not be called simultaneously! -- 2.40.0