unsigned int worker = hash % g_numWorkerThreads;
/* at least one server has to be below the average load */
- while(load[worker] > targetLoad) {
- // cerr<<"worker "<<worker<<" is above the target load, selecting another one"<<endl;
- worker = (worker + 1) % g_numWorkerThreads;
+ if (load[worker] > targetLoad) {
+ ++g_stats.rebalancedQueries;
+ do {
+ // cerr<<"worker "<<worker<<" is above the target load, selecting another one"<<endl;
+ worker = (worker + 1) % g_numWorkerThreads;
+ }
+ while(load[worker] > targetLoad);
}
return /* skip distributor */ 1 + worker;
registerCounter64Stat("policy-result-nodata", policyResultNodataOID, OID_LENGTH(policyResultNodataOID));
registerCounter64Stat("policy-result-truncate", policyResultTruncateOID, OID_LENGTH(policyResultTruncateOID));
registerCounter64Stat("policy-result-custom", policyResultCustomOID, OID_LENGTH(policyResultCustomOID));
-
#endif /* HAVE_NET_SNMP */
}
addGetStat("policy-result-nodata", &g_stats.policyResults[DNSFilterEngine::PolicyKind::NODATA]);
addGetStat("policy-result-truncate", &g_stats.policyResults[DNSFilterEngine::PolicyKind::Truncate]);
addGetStat("policy-result-custom", &g_stats.policyResults[DNSFilterEngine::PolicyKind::Custom]);
+
+ addGetStat("rebalanced-queries", &g_stats.rebalancedQueries);
}
static void doExitGeneric(bool nicely)
^^^^^^^^^
counts all end-user initiated queries with the RD bit set
+rebalanced-queries
+^^^^^^^^^^^^^^^^^^
+.. versionadded:: 4.1.12
+
+number of queries balanced to a different worker thread because the first selected one was above the target load configured with 'distribution-load-factor'
+
resource-limits
^^^^^^^^^^^^^^^
counts number of queries that could not be performed because of resource limits
std::atomic<uint64_t> dnssecValidations; // should be the sum of all dnssecResult* stats
std::map<vState, std::atomic<uint64_t> > dnssecResults;
std::map<DNSFilterEngine::PolicyKind, std::atomic<uint64_t> > policyResults;
+ std::atomic<uint64_t> rebalancedQueries{0};
};
//! represents a running TCP/IP client session