From: bert hubert Date: Fri, 25 Sep 2015 07:54:18 +0000 (+0200) Subject: implement & document keeping track of authoritative latency distribution in the pdns_... X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11adfdd39fb619f59d8e4c777f0a905c38627af5;p=thirdparty%2Fpdns.git implement & document keeping track of authoritative latency distribution in the pdns_recursor, inspired by Allan Eising. Update to metronome forthcoming. --- diff --git a/docs/markdown/recursor/stats.md b/docs/markdown/recursor/stats.md index 469f6a5f69..0b4eb909d6 100644 --- a/docs/markdown/recursor/stats.md +++ b/docs/markdown/recursor/stats.md @@ -7,6 +7,11 @@ The `rec_control get` command can be used to query the following statistics, eit * `answers1-10`: counts the number of queries answered within 10 milliseconds * `answers10-100`: counts the number of queries answered within 100 milliseconds * `answers100-1000`: counts the number of queries answered within 1 second +* `auth-answers-slow`: counts the number of queries answered by auths after 1 second (4.0) +* `auth-answers0-1`: counts the number of queries answered by auths within 1 millisecond (4.0) +* `auth-answers1-10`: counts the number of queries answered by auths within 10 milliseconds (4.0) +* `auth-answers10-100`: counts the number of queries answered by auths within 100 milliseconds (4.0) +* `auth-answers100-1000`: counts the number of queries answered by auths within 1 second (4.0) * `cache-bytes`: size of the cache in bytes (since 3.3.1) * `cache-entries`: shows the number of entries in the cache * `cache-hits`: counts the number of cache hits since starting, this does **not** include hits that got answered from the packet-cache diff --git a/pdns/rec_channel_rec.cc b/pdns/rec_channel_rec.cc index a3a23ba730..55ab3cfa05 100644 --- a/pdns/rec_channel_rec.cc +++ b/pdns/rec_channel_rec.cc @@ -523,6 +523,12 @@ RecursorControlParser::RecursorControlParser() addGetStat("answers100-1000", &g_stats.answers100_1000); addGetStat("answers-slow", &g_stats.answersSlow); + addGetStat("auth-answers0-1", &g_stats.authAnswers0_1); + addGetStat("auth-answers1-10", &g_stats.authAnswers1_10); + addGetStat("auth-answers10-100", &g_stats.authAnswers10_100); + addGetStat("auth-answers100-1000", &g_stats.authAnswers100_1000); + addGetStat("auth-answers-slow", &g_stats.authAnswersSlow); + addGetStat("qa-latency", doGetAvgLatencyUsec); addGetStat("unexpected-packets", &g_stats.unexpectedCount); addGetStat("case-mismatches", &g_stats.caseMismatchCount); diff --git a/pdns/syncres.cc b/pdns/syncres.cc index acaab1ba71..7f1c4a88dd 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -1,6 +1,6 @@ /* PowerDNS Versatile Database Driven Nameserver - Copyright (C) 2003 - 2014 PowerDNS.COM BV + Copyright (C) 2003 - 2015 PowerDNS.COM BV This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published @@ -77,6 +77,20 @@ SyncRes::LogMode SyncRes::s_lm; bool SyncRes::s_noEDNSPing; bool SyncRes::s_noEDNS; +void accountAuthLatency(int usec) +{ + if(usec < 1000) + g_stats.authAnswers0_1++; + else if(usec < 10000) + g_stats.authAnswers1_10++; + else if(usec < 100000) + g_stats.authAnswers10_100++; + else if(usec < 1000000) + g_stats.authAnswers100_1000++; + else + g_stats.authAnswersSlow++; +} + SyncRes::SyncRes(const struct timeval& now) : d_outqueries(0), d_tcpoutqueries(0), d_throttledqueries(0), d_timeouts(0), d_unreachables(0), d_totUsec(0), d_now(now), d_cacheonly(false), d_nocache(false), d_doEDNS0(false), d_lm(s_lm) @@ -978,6 +992,7 @@ int SyncRes::doResolveAt(set nameservers, DNSName auth, bool flawedNSSe throw ImmediateServFailException("Query killed by policy"); d_totUsec += lwr.d_usec; + accountAuthLatency(lwr.d_usec); if(resolveret != 1) { if(resolveret==0) { LOG(prefix<