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
66fe8627de2c8488b7808c7b342e6ceb51f65414)
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.
RUNTIME_CHECK(result == ISC_R_SUCCESS);
}
+ /* TCP high-water stats update. */
+ unsigned int curr_tcpquota = isc_quota_getused(&ns_g_server->tcpquota);
+ isc_stats_update_if_greater(ns_g_server->nsstats,
+ dns_nsstatscounter_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
dns_nsstatscounter_keytagopt = 56,
- dns_nsstatscounter_max = 57
+ dns_nsstatscounter_tcphighwater = 57,
+
+ dns_nsstatscounter_max = 58
};
/*%
server->tcpquota.used, server->tcpquota.max);
CHECK(putstr(text, line));
+ snprintf(line, sizeof(line), "TCP high-water: %" PRIu64 "\n",
+ isc_stats_get_counter(ns_g_server->nsstats,
+ dns_nsstatscounter_tcphighwater));
+ CHECK(putstr(text, line));
+
CHECK(putstr(text, "server is up and running"));
CHECK(putnull(text));
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");
#endif
#if ISC_STATS_USEMULTIFIELDS
- uint64_t curr_value = (stats->counters[counter].hi << 32) &&
+ uint64_t curr_value = ((uint64_t)stats->counters[counter].hi << 32) &&
stats->counters[counter].lo;
if (curr_value < value) {
(int64_t *)&curr_value,
value));
#else
- isc_rwlock_lock(&stats->counterlock, isc_rwlocktype_write);
+ /* This is not exactly thread safe, but we are ok with that on
+ * platforms without stdatomic support.
+ */
if (stats->counters[counter] < value) {
stats->counters[counter] = value;
}
- isc_rwlock_unlock(&stats->counterlock, isc_rwlocktype_write);
#endif
#if ISC_STATS_LOCKCOUNTERS
#endif
#if ISC_STATS_USEMULTIFIELDS
- curr_value = (stats->counters[counter].hi << 32) &&
+ curr_value = ((uint64_t)stats->counters[counter].hi << 32) &&
stats->counters[counter].lo;
#elif ISC_STATS_HAVEATOMICQ
#if defined(ISC_STATS_HAVESTDATOMICQ)