- nicer layout in stats.c, review 0.3 change.

- spelling improvement, review 0.3 change.
       - uncapped timeout for server selection, so that very fast or slow
         servers will stand out from the rest.
       - target-fetch-policy: "3 2 1 0 0" config setting.
	 and docs.



git-svn-id: file:///svn/unbound/trunk@395 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2007-06-19 12:06:02 +00:00
parent 5543bd63b6
commit 7be70582d2
11 changed files with 64 additions and 7 deletions

View File

@ -65,7 +65,7 @@ void server_stats_log(struct server_stats* stats, int threadnum)
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?
(double)stats->sum_query_list_size/
stats->num_queries_missed_cache:0.0,
(double)stats->sum_query_list_size/
stats->num_queries_missed_cache : 0.0,
(unsigned)stats->num_query_list_exceeded);
}

View File

@ -1,3 +1,10 @@
19 June 2007: Wouter
- nicer layout in stats.c, review 0.3 change.
- spelling improvement, review 0.3 change.
- uncapped timeout for server selection, so that very fast or slow
servers will stand out from the rest.
- target-fetch-policy: "3 2 1 0 0" config setting.
18 June 2007: Wouter
- same, move subqueries to slumber list when first has resolved.
- fixup last fix for duplicate callbacks.

View File

@ -118,6 +118,16 @@ server:
# the pid file.
# pidfile: "unbound.pid"
# the target fetch policy.
# series of integers describing the policy per dependency depth.
# The number of values in the list determines the maximum dependency
# depth the recursor will pursue before giving up. Each integer means:
# -1 : fetch all targets opportunistically,
# 0: fetch on demand,
# positive value: fetch that many targets opportunistically.
# Enclose the list of numbers between quotes ("").
# target-fetch-policy: "3 2 1 0 0"
# Stub zones.
# Create entries like below, to make all queries for 'example.com' and

View File

@ -123,6 +123,17 @@ The logfile is appended to, in the following format:
The process id is written to the file. Default is "unbound.pid". So,
kill -HUP `cat /etc/unbound/unbound.pid` will trigger a reload,
kill -QUIT `cat /etc/unbound/unbound.pid` will gracefully terminate.
.It \fBtarget-fetch-policy:\fR <"list of numbers">
Set the target fetch policy used by unbound to determine if it should fetch
nameserver target addresses opportunistically. The policy is described per
dependency depth. The number of values determines the maximum dependency depth
that unbound will pursue in answering a query.
A value of -1 means to fetch all targets opportunistically for that dependency
depth. A value of 0 means to fetch on demand only. A positive value fetches
that many targets opportunistically. Enclose the list between quotes ("").
The default is "3 2 1 0 0". Setting all zeroes, "0 0 0 0 0" gives behaviour
closer to that of BIND 9, while setting "-1 -1 -1 -1 -1" gives behaviour
rumoured to be closer to that of BIND 8.
.El
.Ss Stub Zone Options

View File

@ -477,7 +477,7 @@ infra_get_lame_rtt(struct infra_cache* infra,
if(!e)
return 0;
host = (struct infra_host_data*)e->data;
*rtt = rtt_timeout(&host->rtt);
*rtt = rtt_unclamped(&host->rtt);
/* check lameness first, if so, ttl on host does not matter anymore */
if(infra_lookup_lame(host, name, namelen, timenow)) {
lock_rw_unlock(&e->lock);

View File

@ -227,6 +227,7 @@ int infra_edns_update(struct infra_cache* infra,
* @param namelen: zone name length.
* @param lame: if function returns true, this returns lameness of the zone.
* @param rtt: if function returns true, this returns avg rtt of the server.
* The rtt value is unclamped and reflects recent timeouts.
* @param timenow: what time it is now.
* @return if found in cache, or false if not (or TTL bad).
*/

View File

@ -92,8 +92,8 @@ struct outside_network {
/**
* Array of tcp pending used for outgoing TCP connections.
* Each can be used to establish a TCP connection with a server.
* The file descriptors are -1 if its free, need to be opened for
* the tcp connection. Can be used for ip4 and ip6.
* The file descriptors are -1 if they are free, and need to be
* opened for the tcp connection. Can be used for ip4 and ip6.
*/
struct pending_tcp **tcp_conns;
/** number of tcp communication points. */

View File

@ -127,6 +127,7 @@ infra-cache-slabs{COLON} { YDOUT; return VAR_INFRA_CACHE_SLABS;}
infra-cache-numhosts{COLON} { YDOUT; return VAR_INFRA_CACHE_NUMHOSTS;}
infra-cache-numlame{COLON} { YDOUT; return VAR_INFRA_CACHE_NUMLAME;}
num-queries-per-thread{COLON} { YDOUT; return VAR_NUM_QUERIES_PER_THREAD;}
target-fetch-policy{COLON} { YDOUT; return VAR_TARGET_FETCH_POLICY;}
stub-zone{COLON} { YDOUT; return VAR_STUB_ZONE;}
name{COLON} { YDOUT; return VAR_NAME;}
stub-addr{COLON} { YDOUT; return VAR_STUB_ADDR;}

View File

@ -76,7 +76,7 @@ extern struct config_parser_state* cfg_parser;
%token VAR_RRSET_CACHE_SIZE VAR_RRSET_CACHE_SLABS VAR_OUTGOING_NUM_TCP
%token VAR_INFRA_HOST_TTL VAR_INFRA_LAME_TTL VAR_INFRA_CACHE_SLABS
%token VAR_INFRA_CACHE_NUMHOSTS VAR_INFRA_CACHE_NUMLAME VAR_NAME
%token VAR_STUB_ZONE VAR_STUB_HOST VAR_STUB_ADDR
%token VAR_STUB_ZONE VAR_STUB_HOST VAR_STUB_ADDR VAR_TARGET_FETCH_POLICY
%%
toplevelvars: /* empty */ | toplevelvars toplevelvar ;
@ -103,7 +103,8 @@ content_server: server_num_threads | server_verbosity | server_port |
server_rrset_cache_slabs | server_outgoing_num_tcp |
server_infra_host_ttl | server_infra_lame_ttl |
server_infra_cache_slabs | server_infra_cache_numhosts |
server_infra_cache_numlame | stubstart contents_stub
server_infra_cache_numlame | stubstart contents_stub |
server_target_fetch_policy
;
stubstart: VAR_STUB_ZONE
{
@ -377,6 +378,13 @@ server_infra_cache_slabs: VAR_INFRA_CACHE_SLABS STRING
free($2);
}
;
server_target_fetch_policy: VAR_TARGET_FETCH_POLICY STRING
{
OUTYY(("P(server_target_fetch_policy:%s)\n", $2));
free(cfg_parser->cfg->target_fetch_policy);
cfg_parser->cfg->target_fetch_policy = $2;
}
;
stub_name: VAR_NAME STRING
{
OUTYY(("P(name:%s)\n", $2));

View File

@ -71,6 +71,17 @@ rtt_timeout(const struct rtt_info* rtt)
return rtt->rto;
}
int
rtt_unclamped(const struct rtt_info* rtt)
{
if(calc_rto(rtt) != rtt->rto) {
/* timeout fallback has happened */
return rtt->rto;
}
/* return unclamped value */
return rtt->srtt + 4*rtt->rttvar;
}
void
rtt_update(struct rtt_info* rtt, int ms)
{

View File

@ -73,6 +73,14 @@ void rtt_init(struct rtt_info* rtt);
*/
int rtt_timeout(const struct rtt_info* rtt);
/**
* Get unclamped timeout to use for server selection.
* Recent timeouts are reflected in the returned value.
* @param rtt: round trip statistics structure.
* @return: value to use in milliseconds.
*/
int rtt_unclamped(const struct rtt_info* rtt);
/**
* Update the statistics with a new roundtrip estimate observation.
* @param rtt: round trip statistics structure.