From: Otto Moerbeek Date: Tue, 21 Apr 2026 14:21:40 +0000 (+0200) Subject: Make number of task threads configurable X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d1a71c4f1adf1e4668da024eaadacd35ece1f1f;p=thirdparty%2Fpdns.git Make number of task threads configurable Signed-off-by: Otto Moerbeek --- diff --git a/pdns/recursordist/rec-main.cc b/pdns/recursordist/rec-main.cc index 41318f1c49..9e7ff0de34 100644 --- a/pdns/recursordist/rec-main.cc +++ b/pdns/recursordist/rec-main.cc @@ -127,6 +127,7 @@ bool RecThreadInfo::s_weDistributeQueries; // if true, 1 or more threads listen unsigned int RecThreadInfo::s_numDistributorThreads; unsigned int RecThreadInfo::s_numUDPWorkerThreads; unsigned int RecThreadInfo::s_numTCPWorkerThreads; +unsigned int RecThreadInfo::s_numTaskThreads; thread_local unsigned int RecThreadInfo::t_id{RecThreadInfo::TID_NOT_INITED}; pdns::RateLimitedLog g_rateLimitedLogger; @@ -2254,6 +2255,7 @@ static int serviceMain(Logr::log_t log) RecThreadInfo::setNumDistributorThreads(::arg().asNum("distributor-threads")); RecThreadInfo::setNumUDPWorkerThreads(::arg().asNum("threads")); + RecThreadInfo::setNumTaskThreads(::arg().asNum("taskthreads")); if (RecThreadInfo::numUDPWorkers() < 1) { log->info(Logr::Warning, "Asked to run with 0 threads, raising to 1 instead"); RecThreadInfo::setNumUDPWorkerThreads(1); diff --git a/pdns/recursordist/rec-main.hh b/pdns/recursordist/rec-main.hh index 68cf50a611..c47f6a59d7 100644 --- a/pdns/recursordist/rec-main.hh +++ b/pdns/recursordist/rec-main.hh @@ -439,7 +439,7 @@ public: static unsigned int numTaskThreads() { - return 1; + return s_numTaskThreads; } static unsigned int numUDPWorkers() @@ -482,6 +482,11 @@ public: s_numDistributorThreads = n; } + static void setNumTaskThreads(unsigned int n) + { + s_numTaskThreads = n; + } + static unsigned int numRecursorThreads() { return numHandlers() + numDistributors() + numUDPWorkers() + numTCPWorkers() + numTaskThreads(); @@ -589,6 +594,7 @@ private: static unsigned int s_numDistributorThreads; static unsigned int s_numUDPWorkerThreads; static unsigned int s_numTCPWorkerThreads; + static unsigned int s_numTaskThreads; }; struct ThreadMSG diff --git a/pdns/recursordist/rec-rust-lib/table.py b/pdns/recursordist/rec-rust-lib/table.py index 04bb2835bb..cc3f369dc2 100644 --- a/pdns/recursordist/rec-rust-lib/table.py +++ b/pdns/recursordist/rec-rust-lib/table.py @@ -2964,9 +2964,9 @@ Maximum number of idle outgoing TCP/DoT connections per thread, 0 means do not k "section": "recursor", "type": LType.Uint64, "default": "2", - "help": "Launch this number of threads", + "help": "Launch this number of worker threads", "doc": """ -Spawn this number of threads on startup. +Spawn this number of worker threads on startup. """, }, { @@ -2980,6 +2980,17 @@ Spawn this number of TCP processing threads on startup. """, "versionadded": "5.0.0", }, + { + "name": "taskthreads", + "section": "recursor", + "type": LType.Uint64, + "default": "1", + "help": "Launch this number of async task threads", + "doc": """ +Spawn this number of asynchronous task threads on startup. + """, + "versionadded": "5.5.0", + }, { "name": "trace", "section": "logging",