From: Otto Moerbeek Date: Wed, 13 Sep 2023 11:47:40 +0000 (+0200) Subject: Introduce setting recursor.tcp_threads. X-Git-Tag: rec-5.0.0-alpha2~58^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d11a5834732bec009da07daf0f6bcef33db12c15;p=thirdparty%2Fpdns.git Introduce setting recursor.tcp_threads. While working on this, I noticed that after changing table.py the new lib.rs is generated, but the Serde derives to not seem to get triggered until afert I do a make clean. To be investigated. --- diff --git a/pdns/recursordist/docs/settings.rst b/pdns/recursordist/docs/settings.rst index 23682e1a01..a6cda8236a 100644 --- a/pdns/recursordist/docs/settings.rst +++ b/pdns/recursordist/docs/settings.rst @@ -2744,6 +2744,18 @@ Maximum number of idle outgoing TCP/DoT connections per thread, 0 means do not k Spawn this number of threads on startup. +.. _setting-tcp-threads: + +``tcp-threads`` +~~~~~~~~~~~~~~~ + +- Integer +- Default: 1 + +- YAML setting: :ref:`setting-yaml-recursor.tcp_threads` + +Spawn this number of TCP processing threads on startup. + .. _setting-trace: ``trace`` diff --git a/pdns/recursordist/docs/yamlsettings.rst b/pdns/recursordist/docs/yamlsettings.rst index ccaa639cc3..895dbf0040 100644 --- a/pdns/recursordist/docs/yamlsettings.rst +++ b/pdns/recursordist/docs/yamlsettings.rst @@ -2955,6 +2955,18 @@ Can be read out using ``rec_control top-remotes``. A sequence of statistic names, that are prevented from being exported via SNMP, for performance reasons. +.. _setting-yaml-recursor.tcp_threads: + +``recursor.tcp_threads`` +^^^^^^^^^^^^^^^^^^^^^^^^ + +- Integer +- Default: ``1`` + +- Old style setting: :ref:`setting-tcp-threads` + +Spawn this number of TCP processing threads on startup. + .. _setting-yaml-recursor.threads: ``recursor.threads`` diff --git a/pdns/recursordist/rec-main.cc b/pdns/recursordist/rec-main.cc index 0d863ff354..dc192506f5 100644 --- a/pdns/recursordist/rec-main.cc +++ b/pdns/recursordist/rec-main.cc @@ -2129,10 +2129,10 @@ static int serviceMain(Logr::log_t log) log->info(Logr::Warning, "Asked to run with 0 threads, raising to 1 instead")); RecThreadInfo::setNumUDPWorkerThreads(1); } - RecThreadInfo::setNumTCPWorkerThreads(1); // XXX + RecThreadInfo::setNumTCPWorkerThreads(::arg().asNum("tcp-threads")); if (RecThreadInfo::numTCPWorkers() < 1) { - SLOG(g_log << Logger::Warning << "Asked to run with 0 tcpthreads, raising to 1 instead" << endl, - log->info(Logr::Warning, "Asked to run with 0 tcpthreads, raising to 1 instead")); + SLOG(g_log << Logger::Warning << "Asked to run with 0 TCP threads, raising to 1 instead" << endl, + log->info(Logr::Warning, "Asked to run with 0 TCP threads, raising to 1 instead")); RecThreadInfo::setNumTCPWorkerThreads(1); } diff --git a/pdns/recursordist/settings/table.py b/pdns/recursordist/settings/table.py index e57ea13940..d2b8a903aa 100644 --- a/pdns/recursordist/settings/table.py +++ b/pdns/recursordist/settings/table.py @@ -2583,6 +2583,16 @@ Maximum number of idle outgoing TCP/DoT connections per thread, 0 means do not k 'help' : 'Launch this number of threads', 'doc' : ''' Spawn this number of threads on startup. + ''', + }, + { + 'name' : 'tcp_threads', + 'section' : 'recursor', + 'type' : LType.Uint64, + 'default' : '1', + 'help' : 'Launch this number of threads listening for and processing TCP queries', + 'doc' : ''' +Spawn this number of TCP processing threads on startup. ''', }, {