From: bert hubert Date: Wed, 4 Feb 2015 08:55:13 +0000 (+0100) Subject: fix up the wrong size of the 'remotes' ringbuffer with pdns-distributes-queries,... X-Git-Tag: rec-3.7.0-rc2^0 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f8f243b01215d6adcb59389f09ef494f1309041f;p=pdns fix up the wrong size of the 'remotes' ringbuffer with pdns-distributes-queries, fix up finally the wrong sizing of caches in case of pdns-distributes-queries and slightly adjust the number of available filedescriptors based on reality. Thanks AJ ;-) --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 96251311a..86f556e90 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -127,7 +127,7 @@ listenSocketsAddresses_t g_listenSocketsAddresses; // is shared across all threa __thread MT_t* MT; // the big MTasker -unsigned int g_numThreads; +unsigned int g_numThreads, g_numWorkerThreads; #define LOCAL_NETS "127.0.0.0/8, 10.0.0.0/8, 100.64.0.0/10, 169.254.0.0/16, 192.168.0.0/16, 172.16.0.0/12, ::1/128, fc00::/7, fe80::/10" // Bad Nets taken from both: @@ -1296,9 +1296,9 @@ static void houseKeeping(void *) DTime dt; dt.setTimeval(now); t_RC->doPrune(); // this function is local to a thread, so fine anyhow - t_packetCache->doPruneTo(::arg().asNum("max-packetcache-entries") / g_numThreads); + t_packetCache->doPruneTo(::arg().asNum("max-packetcache-entries") / g_numWorkerThreads); - pruneCollection(t_sstorage->negcache, ::arg().asNum("max-cache-entries") / (g_numThreads * 10), 200); + pruneCollection(t_sstorage->negcache, ::arg().asNum("max-cache-entries") / (g_numWorkerThreads * 10), 200); if(!((cleanCounter++)%40)) { // this is a full scan! time_t limit=now.tv_sec-300; @@ -1785,20 +1785,19 @@ static void checkLinuxIPv6Limits() } static void checkOrFixFDS() { - unsigned int availFDs=getFilenumLimit(); - if(g_maxMThreads * g_numThreads > availFDs) { - if(getFilenumLimit(true) >= g_maxMThreads * g_numThreads) { - setFilenumLimit(g_maxMThreads * g_numThreads); - L< availFDs) { + if(getFilenumLimit(true) >= g_maxMThreads * g_numWorkerThreads) { + setFilenumLimit(g_maxMThreads * g_numWorkerThreads); + L<(); - unsigned int ringsize=::arg().asNum("stats-ringbuffer-entries") / g_numThreads; + unsigned int ringsize=::arg().asNum("stats-ringbuffer-entries") / g_numWorkerThreads; if(ringsize) { t_remotes = new addrringbuf_t(); - t_remotes->set_capacity(ringsize); + if(g_weDistributeQueries) // if so, only 1 thread does recvfrom + t_remotes->set_capacity(::arg().asNum("stats-ringbuffer-entries")); + else + t_remotes->set_capacity(ringsize); t_servfailremotes = new addrringbuf_t(); t_servfailremotes->set_capacity(ringsize); t_largeanswerremotes = new addrringbuf_t(); t_largeanswerremotes->set_capacity(ringsize); - t_queryring = new boost::circular_buffer >(); t_queryring->set_capacity(ringsize); t_servfailqueryring = new boost::circular_buffer >(); diff --git a/pdns/rec_channel_rec.cc b/pdns/rec_channel_rec.cc index 117c7a5ea..aefce242d 100644 --- a/pdns/rec_channel_rec.cc +++ b/pdns/rec_channel_rec.cc @@ -587,8 +587,6 @@ static void doExit() static void doExitNicely() { - //extern void printCallers(); - // printCallers(); doExitGeneric(true); } @@ -641,7 +639,7 @@ vector* pleaseGetServfailRemotes() vector* ret = new vector(); if(!t_servfailremotes) return ret; - ret->reserve(t_remotes->size()); + ret->reserve(t_servfailremotes->size()); BOOST_FOREACH(const ComboAddress& ca, *t_servfailremotes) { ret->push_back(ca); } @@ -653,7 +651,7 @@ vector* pleaseGetLargeAnswerRemotes() vector* ret = new vector(); if(!t_largeanswerremotes) return ret; - ret->reserve(t_remotes->size()); + ret->reserve(t_largeanswerremotes->size()); BOOST_FOREACH(const ComboAddress& ca, *t_largeanswerremotes) { ret->push_back(ca); }