mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-22 18:19:42 +00:00
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.
This commit is contained in:
parent
a544e2e300
commit
66fe8627de
@ -11447,6 +11447,11 @@ named_server_status(named_server_t *server, isc_buffer_t **text) {
|
|||||||
isc_quota_getmax(&server->sctx->tcpquota));
|
isc_quota_getmax(&server->sctx->tcpquota));
|
||||||
CHECK(putstr(text, line));
|
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_status != NAMED_RELOAD_DONE) {
|
if (server->reload_status != NAMED_RELOAD_DONE) {
|
||||||
snprintf(line, sizeof(line), "reload/reconfig %s\n",
|
snprintf(line, sizeof(line), "reload/reconfig %s\n",
|
||||||
server->reload_status == NAMED_RELOAD_FAILED
|
server->reload_status == NAMED_RELOAD_FAILED
|
||||||
|
@ -241,6 +241,8 @@ init_desc(void) {
|
|||||||
SET_NSSTATDESC(invalidsig, "requests with invalid signature",
|
SET_NSSTATDESC(invalidsig, "requests with invalid signature",
|
||||||
"ReqBadSIG");
|
"ReqBadSIG");
|
||||||
SET_NSSTATDESC(requesttcp, "TCP requests received", "ReqTCP");
|
SET_NSSTATDESC(requesttcp, "TCP requests received", "ReqTCP");
|
||||||
|
SET_NSSTATDESC(tcphighwater, "TCP connection high-water",
|
||||||
|
"TCPConnHighWater");
|
||||||
SET_NSSTATDESC(authrej, "auth queries rejected", "AuthQryRej");
|
SET_NSSTATDESC(authrej, "auth queries rejected", "AuthQryRej");
|
||||||
SET_NSSTATDESC(recurserej, "recursive queries rejected", "RecQryRej");
|
SET_NSSTATDESC(recurserej, "recursive queries rejected", "RecQryRej");
|
||||||
SET_NSSTATDESC(xfrrej, "transfer requests rejected", "XfrRej");
|
SET_NSSTATDESC(xfrrej, "transfer requests rejected", "XfrRej");
|
||||||
@ -322,6 +324,7 @@ init_desc(void) {
|
|||||||
"QryUsedStale");
|
"QryUsedStale");
|
||||||
SET_NSSTATDESC(prefetch, "queries triggered prefetch", "Prefetch");
|
SET_NSSTATDESC(prefetch, "queries triggered prefetch", "Prefetch");
|
||||||
SET_NSSTATDESC(keytagopt, "Keytag option received", "KeyTagOpt");
|
SET_NSSTATDESC(keytagopt, "Keytag option received", "KeyTagOpt");
|
||||||
|
|
||||||
INSIST(i == ns_statscounter_max);
|
INSIST(i == ns_statscounter_max);
|
||||||
|
|
||||||
/* Initialize resolver statistics */
|
/* Initialize resolver statistics */
|
||||||
|
@ -29,9 +29,9 @@
|
|||||||
#define ISC_STATS_VALID(x) ISC_MAGIC_VALID(x, ISC_STATS_MAGIC)
|
#define ISC_STATS_VALID(x) ISC_MAGIC_VALID(x, ISC_STATS_MAGIC)
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(_WIN64)
|
#if defined(_WIN32) && !defined(_WIN64)
|
||||||
typedef atomic_int_fast32_t isc_stat_t;
|
typedef atomic_int_fast32_t isc__atomic_statcounter_t;
|
||||||
#else
|
#else
|
||||||
typedef atomic_int_fast64_t isc_stat_t;
|
typedef atomic_int_fast64_t isc__atomic_statcounter_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct isc_stats {
|
struct isc_stats {
|
||||||
@ -39,7 +39,7 @@ struct isc_stats {
|
|||||||
isc_mem_t *mctx;
|
isc_mem_t *mctx;
|
||||||
isc_refcount_t references;
|
isc_refcount_t references;
|
||||||
int ncounters;
|
int ncounters;
|
||||||
isc_stat_t *counters;
|
isc__atomic_statcounter_t *counters;
|
||||||
};
|
};
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
|
@ -3400,7 +3400,6 @@ client_accept(ns_client_t *client) {
|
|||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
|
|
||||||
CTRACE("accept");
|
CTRACE("accept");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set up a new TCP connection. This means try to attach to the
|
* 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.
|
* TCP client quota (tcp-clients), but fail if we're over quota.
|
||||||
@ -3451,6 +3450,12 @@ client_accept(ns_client_t *client) {
|
|||||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
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(),
|
* If this client was set up using get_client() or get_worker(),
|
||||||
* then TCP is already marked active. However, if it was restarted
|
* then TCP is already marked active. However, if it was restarted
|
||||||
|
@ -102,7 +102,9 @@ enum {
|
|||||||
ns_statscounter_prefetch = 63,
|
ns_statscounter_prefetch = 63,
|
||||||
ns_statscounter_keytagopt = 64,
|
ns_statscounter_keytagopt = 64,
|
||||||
|
|
||||||
ns_statscounter_max = 65
|
ns_statscounter_tcphighwater = 65,
|
||||||
|
|
||||||
|
ns_statscounter_max = 66,
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user