From: Otto Moerbeek Date: Mon, 3 Apr 2023 09:14:00 +0000 (+0200) Subject: Change defaults to pdns-distributes-queries = no and reuseport = yes X-Git-Tag: rec-4.9.0-alpha1~7^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0395763008931e604e5d9fb2d28bcdd0f6d88715;p=thirdparty%2Fpdns.git Change defaults to pdns-distributes-queries = no and reuseport = yes --- diff --git a/pdns/recursordist/docs/settings.rst b/pdns/recursordist/docs/settings.rst index ec4c60e65f..ba22422f98 100644 --- a/pdns/recursordist/docs/settings.rst +++ b/pdns/recursordist/docs/settings.rst @@ -466,8 +466,7 @@ overloaded, but it will be at the cost of an increased latency. - Default: 1 if `pdns-distributes-queries`_ is set, 0 otherwise If `pdns-distributes-queries`_ is set, spawn this number of distributor threads on startup. Distributor threads -handle incoming queries and distribute them to other threads based on a hash of the query, to maximize the cache hit -ratio. +handle incoming queries and distribute them to other threads based on a hash of the query. .. _setting-dot-to-auth-names: @@ -1636,12 +1635,17 @@ you can try to enlarge this value or run with fewer threads. ``pdns-distributes-queries`` ---------------------------- - Boolean -- Default: yes +- Default: no If set, PowerDNS will use distinct threads to listen to client sockets and distribute that work to worker-threads using a hash of the query. -This feature should maximize the cache hit ratio. -To use more than one thread set `distributor-threads` in version 4.2.0 or newer. -Enabling should improve performance for medium sized resolvers. +This feature should maximize the cache hit ratio on versions before 4.9.0. +To use more than one thread set `distributor-threads`_ in version 4.2.0 or newer. +Enabling should improve performance on systems where `reuseport`_ does not have the effect of +balancing the queries evenly over multiple worker threads. + +.. versionchanged:: 4.9.0 + + Default changed to ``no``, previously it was ``yes``. .. _setting-protobuf-use-kernel-timestamp: @@ -1801,11 +1805,16 @@ A typical value is 10. If the value is zero, this functionality is disabled. ``reuseport`` ------------- - Boolean -- Default: no +- Default: yes If ``SO_REUSEPORT`` support is available, allows multiple threads and processes to open listening sockets for the same port. -Since 4.1.0, when ``pdns-distributes-queries`` is set to false and ``reuseport`` is enabled, every worker-thread will open a separate listening socket to let the kernel distribute the incoming queries instead of running a distributor thread (which could otherwise be a bottleneck) and avoiding thundering herd issues, thus leading to much higher performance on multi-core boxes. +Since 4.1.0, when `pdns-distributes-queries`_ is disabled and `reuseport`_ is enabled, every worker-thread will open a separate listening socket to let the kernel distribute the incoming queries instead of running a distributor thread (which could otherwise be a bottleneck) and avoiding thundering herd issues, thus leading to much higher performance on multi-core boxes. + +.. versionchanged:: 4.9.0 + + The default is changed to ``yes``, previously it was ``no``. + If ``SO_REUSEPORT`` support is not available, the setting defaults to ``no``. .. _setting-rng: diff --git a/pdns/recursordist/rec-main.cc b/pdns/recursordist/rec-main.cc index 52dfa60d22..7de44b7187 100644 --- a/pdns/recursordist/rec-main.cc +++ b/pdns/recursordist/rec-main.cc @@ -2739,7 +2739,7 @@ int main(int argc, char** argv) ::arg().set("ecs-add-for", "List of client netmasks for which EDNS Client Subnet will be added") = "0.0.0.0/0, ::/0, " LOCAL_NETS_INVERSE; ::arg().set("ecs-scope-zero-address", "Address to send to allow-listed authoritative servers for incoming queries with ECS prefix-length source of 0") = ""; ::arg().setSwitch("use-incoming-edns-subnet", "Pass along received EDNS Client Subnet information") = "no"; - ::arg().setSwitch("pdns-distributes-queries", "If PowerDNS itself should distribute queries over threads") = "yes"; + ::arg().setSwitch("pdns-distributes-queries", "If PowerDNS itself should distribute queries over threads") = "no"; ::arg().setSwitch("root-nx-trust", "If set, believe that an NXDOMAIN from the root means the TLD does not exist") = "yes"; ::arg().setSwitch("any-to-tcp", "Answer ANY queries with tc=1, shunting to TCP") = "no"; ::arg().setSwitch("lowercase-outgoing", "Force outgoing questions to lowercase") = "no"; @@ -2759,8 +2759,11 @@ int main(int argc, char** argv) ::arg().set("include-dir", "Include *.conf files from this directory") = ""; ::arg().set("security-poll-suffix", "Domain name from which to query security update notifications") = "secpoll.powerdns.com."; +#ifdef SO_REUSEPORT + ::arg().setSwitch("reuseport", "Enable SO_REUSEPORT allowing multiple recursors processes to listen to 1 address") = "yes"; +#else ::arg().setSwitch("reuseport", "Enable SO_REUSEPORT allowing multiple recursors processes to listen to 1 address") = "no"; - +#endif ::arg().setSwitch("snmp-agent", "If set, register as an SNMP agent") = "no"; ::arg().set("snmp-master-socket", "If set and snmp-agent is set, the socket to use to register to the SNMP daemon (deprecated)") = ""; ::arg().set("snmp-daemon-socket", "If set and snmp-agent is set, the socket to use to register to the SNMP daemon") = "";