]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Keep track of the recursive clients highwater
authorAydın Mercan <aydin@isc.org>
Mon, 22 Apr 2024 14:01:16 +0000 (17:01 +0300)
committerAydın Mercan <aydin@isc.org>
Fri, 10 May 2024 09:08:52 +0000 (12:08 +0300)
The high-water allows administrators to better tune the recursive
clients limit without having to to poll the statistics channel in high
rates to get this number.

bin/named/server.c
bin/named/statschannel.c
lib/ns/include/ns/stats.h
lib/ns/query.c

index 908eb4de5dde05a1f5cb3d69540a6ce5ce3b6a3b..f972dce906c76f10aeb5d61890614ad7bf787454 100644 (file)
@@ -12184,6 +12184,12 @@ named_server_status(named_server_t *server, isc_buffer_t **text) {
                 isc_quota_getmax(&server->sctx->recursionquota));
        CHECK(putstr(text, line));
 
+       snprintf(line, sizeof(line), "recursive high-water: %u\n",
+                (unsigned int)ns_stats_get_counter(
+                        server->sctx->nsstats,
+                        ns_statscounter_recurshighwater));
+       CHECK(putstr(text, line));
+
        snprintf(line, sizeof(line), "tcp clients: %u/%u\n",
                 isc_quota_getused(&server->sctx->tcpquota),
                 isc_quota_getmax(&server->sctx->tcpquota));
index 494b3c6c82848b8c24d285a1cb0c0531c130fe8c..b9b85e0594fc6c07959f81813c3ca706e0694c30 100644 (file)
@@ -327,6 +327,8 @@ init_desc(void) {
        SET_NSSTATDESC(updatebadprereq,
                       "updates rejected due to prerequisite failure",
                       "UpdateBadPrereq");
+       SET_NSSTATDESC(recurshighwater, "Recursive clients high-water",
+                      "RecursHighwater");
        SET_NSSTATDESC(recursclients, "recursing clients", "RecursClients");
        SET_NSSTATDESC(dns64, "queries answered by DNS64", "DNS64");
        SET_NSSTATDESC(ratedropped, "responses dropped for rate limits",
index c904d7f38cec84b88568928b8a79d652f2d92fff..766ba37a56dd49bb28d5f10d22c2bd23199ec17f 100644 (file)
@@ -112,7 +112,9 @@ enum {
 
        ns_statscounter_updatequota = 67,
 
-       ns_statscounter_max = 68,
+       ns_statscounter_recurshighwater = 68,
+
+       ns_statscounter_max = 69,
 };
 
 void
index ee88495dfb8fe61eb683a4e62a859fa9081c418f..2827fc0e0b2ae5446c1777ebe81a3c0de6de45a3 100644 (file)
@@ -2483,6 +2483,7 @@ free_fresp(ns_client_t *client, dns_fetchresponse_t **frespp) {
 
 static isc_result_t
 recursionquotatype_attach(ns_client_t *client, bool soft_limit) {
+       isc_statscounter_t recurscount;
        isc_result_t result;
 
        result = isc_quota_acquire(&client->manager->sctx->recursionquota);
@@ -2505,8 +2506,12 @@ recursionquotatype_attach(ns_client_t *client, bool soft_limit) {
                return (result);
        }
 
-       ns_stats_increment(client->manager->sctx->nsstats,
-                          ns_statscounter_recursclients);
+       recurscount = ns_stats_increment(client->manager->sctx->nsstats,
+                                        ns_statscounter_recursclients);
+
+       ns_stats_update_if_greater(client->manager->sctx->nsstats,
+                                  ns_statscounter_recurshighwater,
+                                  recurscount + 1);
 
        return (result);
 }