
The TCP/IP Guide - Version 3.0 (Contents) ` 1044 _ © 2001-2005 Charles M. Kozierok. All Rights Reserved.
The problem is that last word: “eventually”. Both iterative and recursive resolution will get us
to the right server, but they take a long time to do it, especially if the name we are trying to
resolve is in a “deep” part of the DNS hierarchy (for example, “F.E.D.C.B.A.”). Since
resolution is done so often, it is helpful to define changes to the basic resolution process
that improve efficiency as much as possible.
The Motivation for Caching: Locality of Reference
A computer science principle called locality of reference describes two common
phenomena related to how computers (and networks) are used. The first, sometimes called
spatial locality of reference, observes that a resource is more likely to be referenced if it is
near another resource that was recently referenced. The second, temporal locality of
reference, says a resource is more likely to be accessed if it was recently accessed.
We can observe both of these phenomenon by using the example of browsing the Web. To
observe spatial locality of reference, notice what happens when you visit a site such as
http://www.tcpipguide.com. The initial request asks the server for the main index document
of The TCP/IP Guide. However, that document contains links to several images and other
items, all of which are also located at the domain “tcpipguide.com”. When your browser
asks for the main document, it will shortly thereafter also ask for a number of graphics. Of
course, as you navigate the site, you will click links to go to other Web pages. Again here,
most of these will also be at the same domain, “tcpipguide.com”.
What this means is that if we resolve a particular domain name, it is likely that we will need
to resolve it again very soon in the future. It would be silly to have to interrogate the same
domain server dozens of times, each asking it to resolve the same name.
The second phenomenon, temporal locality of reference, is one you have probably noticed
yourself. You are far more likely to access a resource you have used recently than one you
have not looked at in a year. This means that maintaining information about recently-used
resources can be inherently advantageous.
Name Resolver Caching
These two phenomena are the rationale for caching in the computer world in general, and
as we have seen, in DNS servers in particular. The same advantages applies to resolvers,
and so many of them perform caching also, in a way rather similar to how it is done in
servers. On a particular client computer, once a particular name is resolved, it is cached
and remains ready for the next time it is needed. Again, this eliminates traffic and load on
DNS servers. (Note however that not all resolvers perform caching.)
You might be wondering why we bother having caching on both resolvers and servers. This
is not “redundant”, as it may appear. Or rather, it's redundant, but in a good way. To under-
stand why, we much recognize that a fundamental trade-off in caching is that a cache
provides better performance the closer it is the requestor of the data, but better coverage
the further it is from the user.