Maintained by: NLnet Labs

[Unbound-users] About the prefetch switch used in the unbound.conf.

Dave Warren
Mon Feb 23 04:51:15 CET 2015


On 2015-02-22 18:21, Hongyi Zhao wrote:
> Hi all,
>
> Currently, I use the latest release of unbound 1.5.2 compilled by 
> myself on the Debian wheezy.  I have some confusion of the using the 
> the "prefetch" option in the unbound.conf file.   Let me described it 
> as follows:
>
> 1- From the manual of unbound.conf, i.e., `man unbound.conf', I can 
> get the following
>     notes on this option:
>
>         prefetch: <yes or no>
>               If yes, message cache elements are prefetched before 
> they expire
>               to  keep  the  cache  up to date.  Default is no.  
> Turning it on
>               gives about 10 percent more traffic and load on the 
> machine, but
>               popular items do not expire from the cache.
>
> 2- From the following webpage: https://calomel.org/unbound_dns.html,
>     I can get the explanation on this option as follows:
>
>
>    # perform prefetching of close to expired message cache entries.  If a client
>    # requests the dns lookup and the TTL of the cached hostname is going to
>    # expire in less than 10% of its TTL, unbound will (1st) return the ip of the
>    # host to the client and (2nd) pre-fetch the dns request from the remote dns
>    # server. This method has been shown to increase the amount of cached hits by
>    # local clients by 10% on average.
>     prefetch: yes
> As you can see, the above two explanations on the mechanism of prefetching in unbound are not so
> well the same.  Could someone please give me some hints on the this thing?

To be completely honest, I don't see a conflict between the two 
explanations.

The description in the man unbound.conf is less comprehensive as it only 
mentions that this feature keeps the cache up to date, whereas the 
description from the webpage quoted explains the mechanism that is used 
to determine which records need to be prefetched.

If you're unclear, just read #2 above, it's more specific and therefore 
probably more useful to understand how the feature actually works, but 
be aware that it does increase the outbound queries slightly since, from 
an external perspective, it drops all TTLs about 10%, while internally 
it respects TTLs in a consistent and reliable fashion. I found this 
feature made a significant difference when we relocated and were stuck 
on the end of a high latency 3Mb line for some months, but it makes 
little noticeable-to-end-user difference now that we're back on a high 
bandwidth, low latency connection.

-- 
Dave Warren
http://www.hireahit.com/
http://ca.linkedin.com/in/davejwarren