]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Make number of task threads configurable
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 21 Apr 2026 14:21:40 +0000 (16:21 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 27 Jul 2026 10:22:09 +0000 (12:22 +0200)
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
pdns/recursordist/rec-main.cc
pdns/recursordist/rec-main.hh
pdns/recursordist/rec-rust-lib/table.py

index 41318f1c497910437c9b95170d8f6c23246c8f43..9e7ff0de34681e4f43a583c22045c0b68a6ff72e 100644 (file)
@@ -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);
index 68cf50a611700e36780c55451f651dd5be2ca7ae..c47f6a59d75dc26332538a504de2ffb073a2ad2f 100644 (file)
@@ -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
index 04bb2835bbf4132440f5388782d0d3794c60a4af..cc3f369dc2629ef6a851aa142d3a27aed4bdb5fe 100644 (file)
@@ -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",