I have installed dnscache (dnscache-run
) from Ubuntu repositories and I have increased the CACHESIZE and DATALIMIT to 256MB (268435456
).
Today I have tested it with one domain: google.es.
I have executed in console dig google.es
:
;; Query time: 86 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
I have repeated the query:
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
Correct.
After I have visited various websites with Firefox for at least 10 minutes and I've repeated the query:
;; Query time: 87 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
In 10 minutes of Internet surfing has it had to empty a cache of 256MB!? Furthermore, in those 10 minutes I've done several searches on google.es.
Based on these results so disappointing my question is obvious: Does dnsache really improve the surfing speed? Maybe something is wrong with my settings?
Short answer: No, not really.
Long answer: In my experience dnscache is very useful when it's installed to serve a number of different machines. Like for example on a router or a network gateway. It's not as useful for a lone machine, it's very likely that everybody in the middle (software, routers, etc...) is already doing dns cache, even firefox will do local DNS caching by default.
Now your results: Google.com dns record has TTL (Time-To-Live) of 298 seconds (now and for me). They are asking any dns cache not to keep they record for more time (they change IPs quite often), so dnscache should comply to this. If you try with some other domain with higher or 0 TTLs it shouldn't discard the cache so fast.
This is digg output, 298 is the TTL for google, 16522 for yahoo. You can repeat your check with yahoo and expect the cache to live for near 5 hours.