From: Wouter Wijngaards Date: Tue, 19 Jun 2007 12:06:02 +0000 (+0000) Subject: - nicer layout in stats.c, review 0.3 change. X-Git-Tag: release-0.4~71 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7be70582d21c3a2e2a336973ac0c3bd5cf26a3ad;p=thirdparty%2Funbound.git - 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 --- diff --git a/daemon/stats.c b/daemon/stats.c index afb1c1a23..0ba195141 100644 --- a/daemon/stats.c +++ b/daemon/stats.c @@ -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); } diff --git a/doc/Changelog b/doc/Changelog index 496a2e3b6..e5ad7df58 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -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. diff --git a/doc/example.conf b/doc/example.conf index 624dcfa6a..a8bf74c8d 100644 --- a/doc/example.conf +++ b/doc/example.conf @@ -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 diff --git a/doc/unbound.conf.5 b/doc/unbound.conf.5 index 74f131207..fdf6303fd 100644 --- a/doc/unbound.conf.5 +++ b/doc/unbound.conf.5 @@ -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 diff --git a/services/cache/infra.c b/services/cache/infra.c index 0a73f457e..fcae6b535 100644 --- a/services/cache/infra.c +++ b/services/cache/infra.c @@ -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); diff --git a/services/cache/infra.h b/services/cache/infra.h index a008b2057..e9c1b6c37 100644 --- a/services/cache/infra.h +++ b/services/cache/infra.h @@ -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). */ diff --git a/services/outside_network.h b/services/outside_network.h index fb4f1a43d..13a2cd257 100644 --- a/services/outside_network.h +++ b/services/outside_network.h @@ -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. */ diff --git a/util/configlexer.lex b/util/configlexer.lex index 8f3a42c42..5ef451a02 100644 --- a/util/configlexer.lex +++ b/util/configlexer.lex @@ -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;} diff --git a/util/configparser.y b/util/configparser.y index 919d3016e..73d82feef 100644 --- a/util/configparser.y +++ b/util/configparser.y @@ -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)); diff --git a/util/rtt.c b/util/rtt.c index f303e9809..bc31e4c91 100644 --- a/util/rtt.c +++ b/util/rtt.c @@ -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) { diff --git a/util/rtt.h b/util/rtt.h index 76be0b467..053f5d92a 100644 --- a/util/rtt.h +++ b/util/rtt.h @@ -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.