Commit fbd3276e authored by Diego dos Santos Fronza's avatar Diego dos Santos Fronza Committed by Ondřej Surý

Added TCP high-water statistics variable

This variable will report the maximum number of simultaneous tcp clients
that BIND has served while running.

It can be verified by running rndc status, then inspect "tcp high-water:
count", or by generating statistics file, rndc stats, then inspect the
line with "TCP connection high-water" text.

The tcp-highwater variable is atomically updated based on an existing
tcp-quota system handled in ns/client.c.

(cherry picked from commit 66fe8627)
parent e60cd444
......@@ -11583,6 +11583,11 @@ named_server_status(named_server_t *server, isc_buffer_t **text) {
isc_quota_getmax(&server->sctx->tcpquota));
CHECK(putstr(text, line));
snprintf(line, sizeof(line), "TCP high-water: %u\n",
(unsigned)ns_stats_get_counter(server->sctx->nsstats,
ns_statscounter_tcphighwater));
CHECK(putstr(text, line));
if (server->reload_in_progress) {
CHECK(putstr(text, "reload/reconfig in progress"));
}
......
......@@ -234,6 +234,8 @@ init_desc(void) {
SET_NSSTATDESC(invalidsig, "requests with invalid signature",
"ReqBadSIG");
SET_NSSTATDESC(requesttcp, "TCP requests received", "ReqTCP");
SET_NSSTATDESC(tcphighwater, "TCP connection high-water",
"TCPConnHighWater");
SET_NSSTATDESC(authrej, "auth queries rejected", "AuthQryRej");
SET_NSSTATDESC(recurserej, "recursive queries rejected", "RecQryRej");
SET_NSSTATDESC(xfrrej, "transfer requests rejected", "XfrRej");
......@@ -315,6 +317,7 @@ init_desc(void) {
"QryUsedStale");
SET_NSSTATDESC(prefetch, "queries triggered prefetch", "Prefetch");
SET_NSSTATDESC(keytagopt, "Keytag option received", "KeyTagOpt");
INSIST(i == ns_statscounter_max);
/* Initialize resolver statistics */
......
......@@ -3465,7 +3465,6 @@ client_accept(ns_client_t *client) {
isc_result_t result;
CTRACE("accept");
/*
* Set up a new TCP connection. This means try to attach to the
* TCP client quota (tcp-clients), but fail if we're over quota.
......@@ -3516,6 +3515,12 @@ client_accept(ns_client_t *client) {
RUNTIME_CHECK(result == ISC_R_SUCCESS);
}
/* TCP high-water stats update. */
unsigned int curr_tcpquota = isc_quota_getused(&client->sctx->tcpquota);
ns_stats_update_if_greater(client->sctx->nsstats,
ns_statscounter_tcphighwater,
curr_tcpquota);
/*
* If this client was set up using get_client() or get_worker(),
* then TCP is already marked active. However, if it was restarted
......
......@@ -102,7 +102,9 @@ enum {
ns_statscounter_prefetch = 63,
ns_statscounter_keytagopt = 64,
ns_statscounter_max = 65
ns_statscounter_tcphighwater = 65,
ns_statscounter_max = 66,
};
void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment