The TCP/IP Guide - Version 3.0 (Contents) ` 287 _ © 2001-2005 Charles M. Kozierok. All Rights Reserved.
Sure, sending one extra message may not seem like that big a deal, and the frame doesn't
have to be very large since it contains only a network layer address and some control infor-
mation. However, when we have to do this for every hop of every datagram transmission,
the overhead really adds up. For this reason, while basic dynamic address resolution as
described in the previous topic is simple and functional, it's usually not enough. We must
add some intelligence to the implementation of address resolution to reduce the impact on
performance of continual address resolutions.
The Benefits of Caching
Consider that most devices on a local network send to only a small handful of other physical
devices, and tend to do so over and over again. This is a phenomenon known as locality of
reference, and is observed in a variety of different areas in the field of computing. If you
send a request to an Internet Web site from your office PC, it will need to go first to your
company network's local router, so you will need to resolve the router's layer two address. If
you later click a link on that site, that request will also need to go to the router. In fact,
almost everything you do off your local network probably goes first to that same router
(commonly called a default gateway). Having to do a fresh resolution each time is, well,
stupid. It would be like having to look up the phone number of your best friend every time
you want to call to say hello. (Reminds me of that sketch on Saturday Night Live where the
guy had no short-term memory—but I digress.)
To avoid being accused of making address resolution protocols that are, well, stupid,
designers always include a caching mechanism. After a device's network layer address is
resolved to a data link layer address, the link between the two is kept in the memory of the
device for a period of time. When it needs the layer two address the next time, the device
just does a quick lookup in its cache. This means instead of doing a broadcast on every
datagram, we only do it once for a whole sequence of datagrams.
Caching is by far the most important performance-enhancing tool in dynamic resolution. It
transforms what would otherwise be a very wasteful process into one which most of the
time is no less efficient than direct mapping. It does, however, add complexity. The cache
table entries must be maintained. There is also the problem that the information in the table
may become stale over time; what happens if we change the network layer address or the
data link layer address of a device? For this reason, cache entries must be set to expire
periodically. The topic on caching in the TCP/IP ARP protocol shows some of the particulars
of how these issues are handled.
Other Enhancements to Dynamic Resolution
Other enhancements are also possible to the basic dynamic resolution scheme. Let's
consider again our example of sending a request to the Internet. We send a request that
needs to go to our local router, so we resolve its address and send it the request. A moment
later the reply comes back to the router to be sent to us, so the router needs our address.
Thus, it would have to do a dynamic resolution on us even though we just exchanged
frames. Again: stupid. Instead, we can improve efficiency through cross-resolution; when
device A resolves the address of device B, device B also adds the entry for device A to its
cache.