mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-01-09 08:12:54 -05:00
- stats reports tcp usage, of incoming-num-tcp buffers.
git-svn-id: file:///svn/unbound/trunk@3353 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
ab539746ff
commit
b87e7c90be
8 changed files with 35 additions and 2 deletions
|
|
@ -1070,7 +1070,7 @@ stats.lo stats.o: $(srcdir)/daemon/stats.c config.h $(srcdir)/daemon/stats.h $(s
|
|||
$(srcdir)/util/netevent.h $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h \
|
||||
$(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h \
|
||||
$(srcdir)/daemon/daemon.h $(srcdir)/services/modstack.h \
|
||||
$(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/outside_network.h \
|
||||
$(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/outside_network.h $(srcdir)/services/listen_dnsport.h \
|
||||
$(srcdir)/util/config_file.h $(srcdir)/util/tube.h $(srcdir)/util/net_help.h $(srcdir)/validator/validator.h \
|
||||
$(srcdir)/validator/val_utils.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \
|
||||
$(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h $(srcdir)/validator/val_kcache.h
|
||||
|
|
|
|||
|
|
@ -724,6 +724,8 @@ print_stats(SSL* ssl, const char* nm, struct stats_info* s)
|
|||
(long long)avg.tv_sec, (int)avg.tv_usec)) return 0;
|
||||
if(!ssl_printf(ssl, "%s.recursion.time.median"SQ"%g\n", nm,
|
||||
s->mesh_time_median)) return 0;
|
||||
if(!ssl_printf(ssl, "%s.tcpusage"SQ"%lu\n", nm,
|
||||
(unsigned long)s->svr.tcp_accept_usage)) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
#include "daemon/daemon.h"
|
||||
#include "services/mesh.h"
|
||||
#include "services/outside_network.h"
|
||||
#include "services/listen_dnsport.h"
|
||||
#include "util/config_file.h"
|
||||
#include "util/tube.h"
|
||||
#include "util/timehist.h"
|
||||
|
|
@ -140,6 +141,7 @@ void
|
|||
server_stats_compile(struct worker* worker, struct stats_info* s, int reset)
|
||||
{
|
||||
int i;
|
||||
struct listen_list* lp;
|
||||
|
||||
s->svr = worker->stats;
|
||||
s->mesh_num_states = worker->env.mesh->all.count;
|
||||
|
|
@ -174,6 +176,13 @@ server_stats_compile(struct worker* worker, struct stats_info* s, int reset)
|
|||
s->svr.key_cache_count = count_slabhash_entries(worker->env.key_cache->slab);
|
||||
else s->svr.key_cache_count = 0;
|
||||
|
||||
/* get tcp accept usage */
|
||||
s->svr.tcp_accept_usage = 0;
|
||||
for(lp = worker->front->cps; lp; lp = lp->next) {
|
||||
if(lp->com->type == comm_tcp_accept)
|
||||
s->svr.tcp_accept_usage += lp->com->cur_tcp_count;
|
||||
}
|
||||
|
||||
if(reset && !worker->env.cfg->stat_cumulative) {
|
||||
worker_stats_clear(worker);
|
||||
}
|
||||
|
|
@ -247,6 +256,7 @@ void server_stats_add(struct stats_info* total, struct stats_info* a)
|
|||
total->svr.rrset_bogus += a->svr.rrset_bogus;
|
||||
total->svr.unwanted_replies += a->svr.unwanted_replies;
|
||||
total->svr.unwanted_queries += a->svr.unwanted_queries;
|
||||
total->svr.tcp_accept_usage += a->svr.tcp_accept_usage;
|
||||
for(i=0; i<STATS_QTYPE_NUM; i++)
|
||||
total->svr.qtype[i] += a->svr.qtype[i];
|
||||
for(i=0; i<STATS_QCLASS_NUM; i++)
|
||||
|
|
|
|||
|
|
@ -129,6 +129,8 @@ struct server_stats {
|
|||
size_t unwanted_replies;
|
||||
/** unwanted traffic received on client-facing ports */
|
||||
size_t unwanted_queries;
|
||||
/** usage of tcp accept list */
|
||||
size_t tcp_accept_usage;
|
||||
|
||||
/** histogram data exported to array
|
||||
* if the array is the same size, no data is lost, and
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
- contrib/unbound_smf22.tar.gz: Solaris SMF installation/removal
|
||||
scripts. Contributed by Yuri Voinov.
|
||||
- Document that incoming-num-tcp increase is good for large servers.
|
||||
- stats reports tcp usage, of incoming-num-tcp buffers.
|
||||
|
||||
4 March 2015: Wouter
|
||||
- Patch from Brad Smith that syncs compat/getentropy_linux with
|
||||
|
|
|
|||
|
|
@ -322,6 +322,11 @@ less than this time. Because of big outliers (usually queries to non
|
|||
responsive servers), the average can be bigger than the median. This median
|
||||
has been calculated by interpolation from a histogram.
|
||||
.TP
|
||||
.I threadX.tcpusage
|
||||
The currently held tcp buffers for incoming connections. A spot value on
|
||||
the time of the request. This helps you spot if the incoming\-num\-tcp
|
||||
buffers are full.
|
||||
.TP
|
||||
.I total.num.queries
|
||||
summed over threads.
|
||||
.TP
|
||||
|
|
@ -355,6 +360,9 @@ summed over threads.
|
|||
.I total.recursion.time.median
|
||||
averaged over threads.
|
||||
.TP
|
||||
.I total.tcpusage
|
||||
summed over threads.
|
||||
.TP
|
||||
.I time.now
|
||||
current time in seconds since 1970.
|
||||
.TP
|
||||
|
|
|
|||
|
|
@ -879,12 +879,12 @@ comm_point_tcp_accept_callback(int fd, short event, void* arg)
|
|||
}
|
||||
|
||||
/* grab the tcp handler buffers */
|
||||
c->cur_tcp_count++;
|
||||
c->tcp_free = c_hdl->tcp_free;
|
||||
if(!c->tcp_free) {
|
||||
/* stop accepting incoming queries for now. */
|
||||
comm_point_stop_listening(c);
|
||||
}
|
||||
/* addr is dropped. Not needed for tcp reply. */
|
||||
setup_tcp_handler(c_hdl, new_fd);
|
||||
}
|
||||
|
||||
|
|
@ -902,6 +902,7 @@ reclaim_tcp_handler(struct comm_point* c)
|
|||
}
|
||||
comm_point_close(c);
|
||||
if(c->tcp_parent) {
|
||||
c->tcp_parent->cur_tcp_count--;
|
||||
c->tcp_free = c->tcp_parent->tcp_free;
|
||||
c->tcp_parent->tcp_free = c;
|
||||
if(!c->tcp_free) {
|
||||
|
|
@ -1528,6 +1529,7 @@ comm_point_create_udp(struct comm_base *base, int fd, sldns_buffer* buffer,
|
|||
c->tcp_byte_count = 0;
|
||||
c->tcp_parent = NULL;
|
||||
c->max_tcp_count = 0;
|
||||
c->cur_tcp_count = 0;
|
||||
c->tcp_handlers = NULL;
|
||||
c->tcp_free = NULL;
|
||||
c->type = comm_udp;
|
||||
|
|
@ -1578,6 +1580,7 @@ comm_point_create_udp_ancil(struct comm_base *base, int fd,
|
|||
c->tcp_byte_count = 0;
|
||||
c->tcp_parent = NULL;
|
||||
c->max_tcp_count = 0;
|
||||
c->cur_tcp_count = 0;
|
||||
c->tcp_handlers = NULL;
|
||||
c->tcp_free = NULL;
|
||||
c->type = comm_udp;
|
||||
|
|
@ -1639,6 +1642,7 @@ comm_point_create_tcp_handler(struct comm_base *base,
|
|||
c->tcp_byte_count = 0;
|
||||
c->tcp_parent = parent;
|
||||
c->max_tcp_count = 0;
|
||||
c->cur_tcp_count = 0;
|
||||
c->tcp_handlers = NULL;
|
||||
c->tcp_free = NULL;
|
||||
c->type = comm_tcp;
|
||||
|
|
@ -1691,6 +1695,7 @@ comm_point_create_tcp(struct comm_base *base, int fd, int num, size_t bufsize,
|
|||
c->tcp_byte_count = 0;
|
||||
c->tcp_parent = NULL;
|
||||
c->max_tcp_count = num;
|
||||
c->cur_tcp_count = 0;
|
||||
c->tcp_handlers = (struct comm_point**)calloc((size_t)num,
|
||||
sizeof(struct comm_point*));
|
||||
if(!c->tcp_handlers) {
|
||||
|
|
@ -1758,6 +1763,7 @@ comm_point_create_tcp_out(struct comm_base *base, size_t bufsize,
|
|||
c->tcp_byte_count = 0;
|
||||
c->tcp_parent = NULL;
|
||||
c->max_tcp_count = 0;
|
||||
c->cur_tcp_count = 0;
|
||||
c->tcp_handlers = NULL;
|
||||
c->tcp_free = NULL;
|
||||
c->type = comm_tcp;
|
||||
|
|
@ -1810,6 +1816,7 @@ comm_point_create_local(struct comm_base *base, int fd, size_t bufsize,
|
|||
c->tcp_byte_count = 0;
|
||||
c->tcp_parent = NULL;
|
||||
c->max_tcp_count = 0;
|
||||
c->cur_tcp_count = 0;
|
||||
c->tcp_handlers = NULL;
|
||||
c->tcp_free = NULL;
|
||||
c->type = comm_local;
|
||||
|
|
@ -1857,6 +1864,7 @@ comm_point_create_raw(struct comm_base* base, int fd, int writing,
|
|||
c->tcp_byte_count = 0;
|
||||
c->tcp_parent = NULL;
|
||||
c->max_tcp_count = 0;
|
||||
c->cur_tcp_count = 0;
|
||||
c->tcp_handlers = NULL;
|
||||
c->tcp_free = NULL;
|
||||
c->type = comm_raw;
|
||||
|
|
|
|||
|
|
@ -164,6 +164,8 @@ struct comm_point {
|
|||
/* -------- TCP Accept -------- */
|
||||
/** the number of TCP handlers for this tcp-accept socket */
|
||||
int max_tcp_count;
|
||||
/** current number of tcp handler in-use for this accept socket */
|
||||
int cur_tcp_count;
|
||||
/** malloced array of tcp handlers for a tcp-accept,
|
||||
of size max_tcp_count. */
|
||||
struct comm_point** tcp_handlers;
|
||||
|
|
|
|||
Loading…
Reference in a new issue