[Dnsmasq-discuss] Any plans on adding ability to store cachetodisk?

Nicholas Weaver nweaver at gmail.com
Tue May 15 19:05:45 BST 2012


On May 15, 2012, at 10:46 AM, Timothy Madden wrote:

> Nicholas Weaver wrote:
>> Speaking as just a general DNS guy (I'm not a DNSMasq developer):  Saving
>> cache state is stupid.
>> 
>> TTL dictates a MAXIMUM that data can remain in the cache, but doesn't
>> dictate a minimum, as any "minimum" could be enforced on the authority
>> side by simply ensuring that the answer is consistent.
>> 
>> The savings is also trivial:  It only saves one RTT to the recursive
>> resolver per lookup, since the recursive resolver should still have the
>> item in its cache.  And this should be a short RTT: if your ISP doesn't
>> have the recursive resolver within 30-40ms of your system, its either a
>> high latency link overall (in which case amdahl's law ensures that the RTT
>> for DNS lookups are still going to be irrelevant).
> 
> Exactly why should the recursive resolver have the site in its cache for the 
> entire TTL of the site name ?

Because memory is cheap, so early eviction of data is not going to be all that common.  And if memory is expensive, a simple LRU algorithm is going to keep the cache generally good for the stuff you'd fetch from the cache.

> And if it happens not to have it, a new lookup costs about 2 seconds in my 
> case.

If a new lookup costs you 2s, but the TCP RTT resulting from the lookup is <200ms, there is something wrong with either your network or the recursive resolver you are configured to use, as there is no reason a DNS lookup should take ~10 RTTs to complete.

In which case, I'd personally switch to Google Public DNS (8.8.8.8 and 8.8.4.4), which is aggressively anycasted, currently has a good privacy policy (yes, shocker), and doesn't manipulate DNS results.


If a new lookup costs you 2s, but the TCP connect resulting from the lookup takes >500ms (e.g. you're using a satellite link), Amdahl's law ensures that the latency for the DNS is going to be in the noise compared to the latency you are going to experience due to the high RTT for the TCP connections.




More information about the Dnsmasq-discuss mailing list