]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- nicer layout in stats.c, review 0.3 change.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 19 Jun 2007 12:06:02 +0000 (12:06 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 19 Jun 2007 12:06:02 +0000 (12:06 +0000)
       - 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

daemon/stats.c
doc/Changelog
doc/example.conf
doc/unbound.conf.5
services/cache/infra.c
services/cache/infra.h
services/outside_network.h
util/configlexer.lex
util/configparser.y
util/rtt.c
util/rtt.h

index afb1c1a23e965b266abf07629079bb14054532dd..0ba195141340df9faf38a6a7b2d43207cc358236 100644 (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);
 }
index 496a2e3b62bbfa5ddfea911f89a956ff03835ad1..e5ad7df58c3913fda4deb64bb9685d403ef398c0 100644 (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.
index 624dcfa6a9cf101988f243a1d8614c44ca4850a4..a8bf74c8d95329c7b47707b78b8425bed22c77e0 100644 (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 
index 74f1312074598a190424588dfe358cbcdecc4889..fdf6303fd221ff8b897196b89754e510bda0e650 100644 (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
index 0a73f457ef6c24e9a3f9b4438b02f5f5e81448cd..fcae6b53542e9825cb040966c6375ef7a7eaafe4 100644 (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);
index a008b2057033194e86e38247b7007720f18912c7..e9c1b6c377f6c9cc0ec977f5ad0afdbe0f7a561d 100644 (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).
  */
index fb4f1a43d07afe221bd5c58b28dd9106615644ab..13a2cd257eeb2aa0b10d759796e89ce794289248 100644 (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. */
index 8f3a42c42ee2d53cf6890009bf2353e39b3a8d71..5ef451a02e747d4f7de011a15b4b78698b68bf75 100644 (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;}
index 919d3016ea9222449bfdaca71c0da145ecf9db42..73d82feef7bd18f49f9b4cb790b05d44333751c4 100644 (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));
index f303e9809c511a79c4f3d20e7390d0c5c12d37b3..bc31e4c91fa8f23bdfa83aa67e2a5e118fddd601 100644 (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)
 {
index 76be0b467032f9faeab7fdf1ce74e36cd7aa4820..053f5d92ac9740eb39453e8aaec15340ecb6a715 100644 (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.