done
p_config "total.num.queries" "total queries from clients"
p_config "total.num.cachehits" "cache hits"
+ p_config "total.num.prefetch" "cache prefetch"
p_config "num.query.tcp" "TCP queries"
p_config "num.query.ipv6" "IPv6 queries"
p_config "unwanted.queries" "queries that failed acl"
for x in thread0.num.queries thread1.num.queries thread2.num.queries \
thread3.num.queries thread4.num.queries thread5.num.queries \
thread6.num.queries thread7.num.queries total.num.queries \
- total.num.cachehits num.query.tcp num.query.ipv6 \
- unwanted.queries unwanted.replies; do
+ total.num.cachehits total.num.prefetch num.query.tcp \
+ num.query.ipv6 unwanted.queries unwanted.replies; do
if grep "^"$x"=" $state >/dev/null 2>&1; then
print_qps $x
fi
- s->svr.num_queries_missed_cache))) return 0;
if(!ssl_printf(ssl, "%s.num.cachemiss"SQ"%u\n", nm,
(unsigned)s->svr.num_queries_missed_cache)) return 0;
+ if(!ssl_printf(ssl, "%s.num.prefetch"SQ"%u\n", nm,
+ (unsigned)s->svr.num_queries_prefetch)) return 0;
if(!ssl_printf(ssl, "%s.num.recursivereplies"SQ"%u\n", nm,
(unsigned)s->mesh_replies_sent)) return 0;
if(!ssl_printf(ssl, "%s.requestlist.avg"SQ"%g\n", nm,
- s->svr.num_queries_missed_cache?
+ (s->svr.num_queries_missed_cache+s->svr.num_queries_prefetch)?
(double)s->svr.sum_query_list_size/
- s->svr.num_queries_missed_cache : 0.0)) return 0;
+ (s->svr.num_queries_missed_cache+
+ s->svr.num_queries_prefetch) : 0.0)) return 0;
if(!ssl_printf(ssl, "%s.requestlist.max"SQ"%u\n", nm,
(unsigned)s->svr.max_query_list_size)) return 0;
if(!ssl_printf(ssl, "%s.requestlist.overwritten"SQ"%u\n", nm,
stats->max_query_list_size = worker->env.mesh->all.count;
}
+void server_stats_prefetch(struct server_stats* stats, struct worker* worker)
+{
+ stats->num_queries_prefetch++;
+ /* changes the query list size so account that, like a querymiss */
+ stats->sum_query_list_size += worker->env.mesh->all.count;
+ if(worker->env.mesh->all.count > stats->max_query_list_size)
+ stats->max_query_list_size = worker->env.mesh->all.count;
+}
+
void server_stats_log(struct server_stats* stats, struct worker* worker,
int threadnum)
{
log_info("server stats for thread %d: %u queries, "
- "%u answers from cache, %u recursions",
+ "%u answers from cache, %u recursions, %u prefetch",
threadnum, (unsigned)stats->num_queries,
(unsigned)(stats->num_queries -
stats->num_queries_missed_cache),
- (unsigned)stats->num_queries_missed_cache);
+ (unsigned)stats->num_queries_missed_cache,
+ (unsigned)stats->num_queries_prefetch);
log_info("server stats for thread %d: requestlist max %u avg %g "
"exceeded %u", threadnum, (unsigned)stats->max_query_list_size,
- stats->num_queries_missed_cache?
+ (stats->num_queries_missed_cache+stats->num_queries_prefetch)?
(double)stats->sum_query_list_size/
- stats->num_queries_missed_cache : 0.0,
+ (stats->num_queries_missed_cache+
+ stats->num_queries_prefetch) : 0.0,
(unsigned)worker->env.mesh->stats_dropped);
}
{
total->svr.num_queries += a->svr.num_queries;
total->svr.num_queries_missed_cache += a->svr.num_queries_missed_cache;
+ total->svr.num_queries_prefetch += a->svr.num_queries_prefetch;
total->svr.sum_query_list_size += a->svr.sum_query_list_size;
/* the max size reached is upped to higher of both */
if(a->svr.max_query_list_size > total->svr.max_query_list_size)
size_t num_queries;
/** number of queries that had a cache-miss. */
size_t num_queries_missed_cache;
+ /** number of prefetch queries - cachehits with prefetch */
+ size_t num_queries_prefetch;
/**
* Sum of the querylistsize of the worker for
/** add query if it missed the cache */
void server_stats_querymiss(struct server_stats* stats, struct worker* worker);
+/** add query if was cached and also resulted in a prefetch */
+void server_stats_prefetch(struct server_stats* stats, struct worker* worker);
+
/** display the stats to the log */
void server_stats_log(struct server_stats* stats, struct worker* worker,
int threadnum);
/* first send answer to client to keep its latency
* as small as a cachereply */
comm_point_send_reply(repinfo);
- /* account the prefetch (used to be part of the cache-reply count) */
- /* TODO */
+ server_stats_prefetch(&worker->stats, worker);
/* create the prefetch in the mesh as a normal lookup without
* client addrs waiting, which has the cache blacklisted (to bypass
7 January 2010: Wouter
- Fixup python documentation (thanks Leo Vandewoestijne).
- Work on cache prefetch feature.
+ - Stats for prefetch, in log print stats, unbound-control stats
+ and in unbound_munin plugin.
6 January 2010: Wouter
- iana portlist updated.
.I threadX.num.cachemiss
number of queries that needed recursive processing
.TP
+.I threadX.num.prefetch
+number of cache prefetches performed. This number is included in
+cachehits, as the original query had the unprefetched answer from cache,
+and resulted in recursive processing, taking a slot in the requestlist.
+Not part of the recursivereplies (or the histogram thereof) or cachemiss,
+as a cache response was sent.
+.TP
.I threadX.num.recursivereplies
The number of replies sent to queries that needed recursive processing. Could be smaller than threadX.num.cachemiss if due to timeouts no replies were sent for some queries.
.TP
.I total.num.cachemiss
summed over threads.
.TP
+.I total.num.prefetch
+summed over threads.
+.TP
.I total.num.recursivereplies
summed over threads.
.TP