From 5c367a7e8c69311998737914270386618eb9e1d2 Mon Sep 17 00:00:00 2001 From: Otto Date: Mon, 19 Apr 2021 16:44:43 +0200 Subject: [PATCH] Improve packet cache sizing. Since queries incoming over TCP are now also using the packet cache, there is now also one packet cache instance per distributor thread. Each cache instance has a size of max-packetcache-entries divided by (threads + distributor-threads). --- pdns/pdns_recursor.cc | 2 +- pdns/recursordist/docs/settings.rst | 4 ++-- pdns/recursordist/docs/upgrade.rst | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 72588567ac..0015f747f3 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -3577,7 +3577,7 @@ static void houseKeeping(void *) past = now; past.tv_sec -= 5; if (last_prune < past) { - t_packetCache->doPruneTo(g_maxPacketCacheEntries / g_numWorkerThreads); + t_packetCache->doPruneTo(g_maxPacketCacheEntries / (g_numWorkerThreads + g_numDistributorThreads)); time_t limit; if(!((cleanCounter++)%40)) { // this is a full scan! diff --git a/pdns/recursordist/docs/settings.rst b/pdns/recursordist/docs/settings.rst index e5c01550d4..b90ed72152 100644 --- a/pdns/recursordist/docs/settings.rst +++ b/pdns/recursordist/docs/settings.rst @@ -1038,8 +1038,8 @@ Maximum number of simultaneous MTasker threads. - Integer - Default: 500000 -Maximum number of Packet Cache entries. -This number will be divided by the number of worker threads to compute the number of entries per thread. +Maximum number of Packet Cache entries. Each worker and each distributor thread has a packets cache instance. +This number will be divided by the number of worker plus the number of distributor threads to compute the maximum number of entries per cache instance. .. _setting-max-qperq: diff --git a/pdns/recursordist/docs/upgrade.rst b/pdns/recursordist/docs/upgrade.rst index 0548d67d33..3bf167dc7e 100644 --- a/pdns/recursordist/docs/upgrade.rst +++ b/pdns/recursordist/docs/upgrade.rst @@ -53,6 +53,9 @@ Deprecated and changed settings - The :ref:`setting-minimum-ttl-override` and :ref:`setting-ecs-minimum-ttl-override` defaults have ben changed from 0 to 1. - The :ref:`setting-spoof-nearmiss-max` default has been changed from 20 to 1. - The :ref:`setting-dnssec` default has changed from ``process-no-validate`` to ``process``. +- The meaning of the :ref:`setting-max-packetcache-entries` has changed: previously there was one packet cache instance per worker thread. + Since queries incoming over TCP are now also using the packet cache, there is now also one packet cache instance per distributor thread. + Each cache instance has a size of :ref:`setting-max-packetcache-entries` divided by (:ref:`setting-threads` + :ref:`setting-distributor-threads`). Removed settings ^^^^^^^^^^^^^^^^ -- 2.47.2