From: Otto Moerbeek Date: Mon, 4 Apr 2022 11:10:56 +0000 (+0200) Subject: Merge pull request #11484 from omoerbeek/rec-syncres-tables3 X-Git-Tag: rec-4.7.0-beta1~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=459fa0a52ae372d1ef68cb61c074661c2a25a570;p=thirdparty%2Fpdns.git Merge pull request #11484 from omoerbeek/rec-syncres-tables3 rec: Use boost::mult-index for nsspeed table and make it shared. --- 459fa0a52ae372d1ef68cb61c074661c2a25a570 diff --cc pdns/recursordist/rec-main.cc index 009b0280a3,06c184be1d..aed5c66b7d --- a/pdns/recursordist/rec-main.cc +++ b/pdns/recursordist/rec-main.cc @@@ -1864,21 -1871,11 +1864,15 @@@ static void houseKeeping(void* Utility::gettimeofday(&now); // Below are the tasks that run for every recursorThread, including handler and taskThread - static thread_local PeriodicTask packetCacheTask{"packetCacheTask", 5}; - packetCacheTask.runIfDue(now, []() { - t_packetCache->doPruneTo(g_maxPacketCacheEntries / (RecThreadInfo::numDistributors() + RecThreadInfo::numWorkers())); - }); + if (t_packetCache) { + static thread_local PeriodicTask packetCacheTask{"packetCacheTask", 5}; + packetCacheTask.runIfDue(now, []() { + size_t sz = g_maxPacketCacheEntries / (RecThreadInfo::numWorkers() + RecThreadInfo::numDistributors()); + t_packetCache->setMaxSize(sz); // g_maxPacketCacheEntries might have changed by rec_control + t_packetCache->doPruneTo(sz); + }); + } - // This is a full scan - static thread_local PeriodicTask pruneNSpeedTask{"pruneNSSpeedTask", 100}; - pruneNSpeedTask.runIfDue(now, [now]() { - SyncRes::pruneNSSpeeds(now.tv_sec - 300); - }); - static thread_local PeriodicTask pruneEDNSTask{"pruneEDNSTask", 5}; // period could likely be longer pruneEDNSTask.runIfDue(now, [now]() { SyncRes::pruneEDNSStatuses(now.tv_sec - 2 * 3600);