From: Wouter Wijngaards Date: Tue, 22 Jan 2019 13:20:06 +0000 (+0000) Subject: - unbound-control stats has mem.streamwait that counts TCP and TLS X-Git-Tag: release-1.9.0rc1~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8b18d1a0a4a957c8fd4046e66cddb4f78dbf51d5;p=thirdparty%2Funbound.git - unbound-control stats has mem.streamwait that counts TCP and TLS waiting result buffers. git-svn-id: file:///svn/unbound/trunk@5050 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/daemon/remote.c b/daemon/remote.c index 2c3e7ce5b..b25cf1798 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -789,7 +789,8 @@ print_longnum(RES* ssl, const char* desc, size_t x) /** print mem stats */ static int -print_mem(RES* ssl, struct worker* worker, struct daemon* daemon) +print_mem(RES* ssl, struct worker* worker, struct daemon* daemon, + struct ub_stats_info* s) { size_t msg, rrset, val, iter, respip; #ifdef CLIENT_SUBNET @@ -847,6 +848,9 @@ print_mem(RES* ssl, struct worker* worker, struct daemon* daemon) dnscrypt_nonce)) return 0; #endif /* USE_DNSCRYPT */ + if(!print_longnum(ssl, "mem.streamwait"SQ, + (size_t)s->svr.mem_stream_wait)) + return 0; return 1; } @@ -1088,7 +1092,7 @@ do_stats(RES* ssl, struct daemon_remote* rc, int reset) if(!print_uptime(ssl, rc->worker, reset)) return; if(daemon->cfg->stat_extended) { - if(!print_mem(ssl, rc->worker, daemon)) + if(!print_mem(ssl, rc->worker, daemon, &total)) return; if(!print_hist(ssl, &total)) return; diff --git a/daemon/stats.c b/daemon/stats.c index cff01d903..9a4afff4b 100644 --- a/daemon/stats.c +++ b/daemon/stats.c @@ -328,6 +328,7 @@ server_stats_compile(struct worker* worker, struct ub_stats_info* s, int reset) } lock_rw_unlock(&worker->env.auth_zones->lock); } + s->svr.mem_stream_wait = tcp_req_info_get_stream_buffer_size(); /* Set neg cache usage numbers */ set_neg_cache_stats(worker, &s->svr, reset); diff --git a/doc/Changelog b/doc/Changelog index 81a4edcbb..152e6011b 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,6 +1,8 @@ 22 January 2018: Wouter - Fix space calculation for tcp req buffer size. - Doc for stream-wait-size and unit test. + - unbound-control stats has mem.streamwait that counts TCP and TLS + waiting result buffers. 21 January 2018: Wouter - Fix tcp idle timeout test, for difference in the tcp reply code. diff --git a/doc/unbound-control.8.in b/doc/unbound-control.8.in index da042c816..f5944a75f 100644 --- a/doc/unbound-control.8.in +++ b/doc/unbound-control.8.in @@ -499,6 +499,10 @@ Memory in bytes in use by the iterator module. Memory in bytes in use by the validator module. Includes the key cache and negative cache. .TP +.I mem.streamwait +Memory in bytes in used by the TCP and TLS stream wait buffers. These are +answers waiting to be written back to the clients. +.TP .I histogram...to.. Shows a histogram, summed over all threads. Every element counts the recursive queries whose reply time fit between the lower and upper bound. diff --git a/libunbound/unbound.h b/libunbound/unbound.h index 90766b062..3fa5b13de 100644 --- a/libunbound/unbound.h +++ b/libunbound/unbound.h @@ -770,6 +770,8 @@ struct ub_server_stats { /** number of queries answered from edns-subnet specific data, and * the answer was from the edns-subnet cache. */ long long num_query_subnet_cache; + /** number of bytes in the stream wait buffers */ + long long mem_stream_wait; }; /** diff --git a/smallapp/unbound-control.c b/smallapp/unbound-control.c index b947198ef..dd00e4940 100644 --- a/smallapp/unbound-control.c +++ b/smallapp/unbound-control.c @@ -247,7 +247,8 @@ static void print_uptime(struct ub_shm_stat_info* shm_stat) } /** print memory usage */ -static void print_mem(struct ub_shm_stat_info* shm_stat) +static void print_mem(struct ub_shm_stat_info* shm_stat, + struct ub_stats_info* s) { PR_LL("mem.cache.rrset", shm_stat->mem.rrset); PR_LL("mem.cache.message", shm_stat->mem.msg); @@ -266,6 +267,7 @@ static void print_mem(struct ub_shm_stat_info* shm_stat) PR_LL("mem.cache.dnscrypt_nonce", shm_stat->mem.dnscrypt_nonce); #endif + PR_LL("mem.streamwait", s->svr.mem_stream_wait); } /** print histogram */ @@ -399,7 +401,7 @@ static void do_stats_shm(struct config_file* cfg, struct ub_stats_info* stats, pr_stats("total", &stats[0]); print_uptime(shm_stat); if(cfg->stat_extended) { - print_mem(shm_stat); + print_mem(shm_stat, &stats[0]); print_hist(stats); print_extended(stats); }