]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Improve packet cache sizing.
authorOtto <otto.moerbeek@open-xchange.com>
Mon, 19 Apr 2021 14:44:43 +0000 (16:44 +0200)
committerOtto <otto.moerbeek@open-xchange.com>
Mon, 19 Apr 2021 14:46:20 +0000 (16:46 +0200)
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
pdns/recursordist/docs/settings.rst
pdns/recursordist/docs/upgrade.rst

index 72588567aca192ab90999c247147b006bf188454..0015f747f3b6fed201d6662278270e162b75ae64 100644 (file)
@@ -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!
index e5c01550d4ed9b87e23e1e77b755a1071a5bdb07..b90ed721524693b9405d68cfd15233470885f4d1 100644 (file)
@@ -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:
 
index 0548d67d335f0c2a69dd8e0df3503b827bc35553..3bf167dc7e2c185f11df22ca8018e1ec47702f9c 100644 (file)
@@ -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
 ^^^^^^^^^^^^^^^^