]> git.ipfire.org Git - thirdparty/pdns.git/commit
dnsdist: Add a simple Packet Cache 3355/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 15 Feb 2016 08:49:36 +0000 (09:49 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 15 Feb 2016 08:49:36 +0000 (09:49 +0100)
commit886e2cf2ac4ac46b2f5e707d0ece5b24c967d8a9
treeb0352416877a1c8d73b88aa2302db67cc52dd49f
parent73affb1b9055093de3672d42180d5fd67341334a
dnsdist: Add a simple Packet Cache

Per-pool Packet Cache, using the whole query packet minus the id
has hashing key, to prevent issue related to:
* EDNS Payload size
* ECS
* DNSSEC

The packet cache is not enabled by default, and can be skipped
for specific queries using SkipCacheAction.
It's a per-pool cache, in case you have different responses, but
you can use the same cache for several pools if you want to.

We cache the whole response and age the TTLs when fetching the
response from the cache.

This commit also refactors a bit the way server pools are handled
to be able to have a per-pool cache, and to avoid scanning all
servers when looking for the ones in a given pool.

It is using a fixed-size unordered_map to prevent rehashing. It
is not very efficient with regard to cache cleaning, but I really
would like to use only a ReadLock on the fastpath, and using a
multi index container and moving cache entries to the back / front
on hit / miss would prevent that.

Health checks are moved to a different thread, to prevent them from
being impacted by the cache cleaning operation being slow.
17 files changed:
pdns/README-dnsdist.md
pdns/dnsdist-cache.cc [new file with mode: 0644]
pdns/dnsdist-cache.hh [new file with mode: 0644]
pdns/dnsdist-lua.cc
pdns/dnsdist-lua2.cc
pdns/dnsdist-tcp.cc
pdns/dnsdist.cc
pdns/dnsdist.hh
pdns/dnsdistdist/Makefile.am
pdns/dnsdistdist/dnsdist-cache.cc [new symlink]
pdns/dnsdistdist/dnsdist-cache.hh [new symlink]
pdns/dnsdistdist/test-dnsdistpacketcache_cc.cc [new symlink]
pdns/dnsparser.cc
pdns/dnsparser.hh
pdns/dnsrulactions.hh
pdns/test-dnsdistpacketcache_cc.cc [new file with mode: 0644]
regression-tests.dnsdist/test_Advanced.py