Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auth: Do an ANY lookup for all types then filter #9007

Closed
wants to merge 8 commits into from
16 changes: 16 additions & 0 deletions docs/settings.rst
Expand Up @@ -307,6 +307,22 @@ compile-time.
Name of this virtual configuration - will rename the binary image. See
:doc:`guides/virtual-instances`.

.. _setting-consistent-backends:

``consistent-backends``
--------------------

- Boolean
- Default: no

.. versionadded:: 4.4.0

When this is set, PowerDNS assumes that any single domain lives in only one backend.
This allows PowerDNS to send ANY lookups to its backends, instead of sometimes requesting the exact needed type.
This reduces the load on backends by retrieving all the types for a given name at once, adding all of them to the cache.
It improves performance significantly for latency-sensitive backends, like SQL ones, where a round-trip takes serious time.
This behaviour will be enabled by default in a future release.

.. _setting-control-console:

``control-console``
Expand Down
2 changes: 2 additions & 0 deletions pdns/common_startup.cc
Expand Up @@ -245,6 +245,8 @@ void declareArguments()

::arg().set("max-generate-steps", "Maximum number of $GENERATE steps when loading a zone from a file")="0";

::arg().set("consistent-backends", "Assume individual domains are not divided over backends. Send only ANY lookup operations to the backend to reduce the number of lookups")="yes";

::arg().set("rng", "Specify the random number generator to use. Valid values are auto,sodium,openssl,getrandom,arc4random,urandom.")="auto";
::arg().setDefaults();
}
Expand Down
4 changes: 4 additions & 0 deletions pdns/dnsbackend.cc
Expand Up @@ -32,6 +32,9 @@
#include "pdns/packetcache.hh"
#include "dnspacket.hh"
#include "dns.hh"
#include "statbag.hh"

extern StatBag S;

// this has to be somewhere central, and not in a file that requires Lua
// this is so the geoipbackend can set this pointer if loaded for lua-record.cc
Expand Down Expand Up @@ -241,6 +244,7 @@ vector<DNSBackend *> BackendMakerClass::all(bool metadataOnly)
bool DNSBackend::getSOA(const DNSName &domain, SOAData &sd)
{
this->lookup(QType(QType::SOA),domain,-1);
S.inc("backend-queries");

DNSResourceRecord rr;
rr.auth = true;
Expand Down
1 change: 1 addition & 0 deletions pdns/pdnsutil.cc
Expand Up @@ -135,6 +135,7 @@ static void loadMainConfig(const std::string& configdir)
::arg().set("chroot","Switch to this chroot jail")="";
::arg().set("dnssec-key-cache-ttl","Seconds to cache DNSSEC keys from the database")="30";
::arg().set("domain-metadata-cache-ttl","Seconds to cache domain metadata from the database")="60";
::arg().set("consistent-backends", "Assume individual domains are not divided over backends. Send only ANY lookup operations to the backend to reduce the number of lookups")="yes";

// Keep this line below all ::arg().set() statements
if (! ::arg().laxFile(configname.c_str()))
Expand Down
1 change: 1 addition & 0 deletions pdns/test-ueberbackend_cc.cc
Expand Up @@ -335,6 +335,7 @@ struct UeberBackendSetupArgFixture {
extern AuthQueryCache QC;
::arg().set("query-cache-ttl")="0";
::arg().set("negquery-cache-ttl")="0";
::arg().set("consistent-backends")="no";
QC.cleanup();
BackendMakers().clear();
SimpleBackend::s_zones.clear();
Expand Down