Time in cache
kcd at daimlerchrysler.com
Thu Jul 12 23:48:00 UTC 2007
> I use Bind9 and I perceived the cache don't keep the information in
> memory at the time imposed by master server of the remote zone. Example:
> # dig www.terra.com.br @ns1.terra.com.br
> ; <<>> DiG 9.3.4 <<>> www.terra.com.br @ns1.terra.com.br
> ;; ANSWER SECTION:
> www.terra.com.br. 7200 IN A 188.8.131.52
> I think this information must be kept in the local DNS cache by 7200
> seconds. However, if I call www.terra.com.br in the browser and I wait
> ten minutes and I try to access the URL again, the browser shows
> "searching www.terra.com.br". Why?
The TTL specifies the *maximum* amount of time that the record can be
considered valid in cache. There's nothing that says a caching resolver
*must* used cached data for that amount of time. Caching resolvers are
free to fetch new records any time they want, in fact resolvers aren't
required to cache at all, in which case they'd need to fetch the data
for every lookup.
Now, between your attempt to access www.terra.com.br in your browser,
and the data in the master, there may have been several levels of
caching -- your browser itself may cache, your OS may have a generic
"name" cache which isn't necessarily specific to DNS, then you might
have a local DNS resolver running, with its own cache, which then may be
part of a forwarding chain of indeterminate length, each forwarder doing
it's own caching as well. Any or all of these caching resolvers may
choose to fetch the information anew. Why this would result in the
"searching" message from your browsers, as you describe, I have no idea.
What kind of latency do you have on your network connection? Caching is
an *optimization*, it's not meant to compensate for latencies that cause
ordinary DNS queries to time out.
More information about the bind-users