Subject: Re: Adding TTL information to gethostbyname() and friends
To: Ian Lance Taylor <ian@airs.com>
From: Greg A. Woods <woods@weird.com>
List: tech-net
Date: 06/02/2003 17:25:38
[ On , June 2, 2003 at 10:16:54 (-0700), Ian Lance Taylor wrote: ]
> Subject: Re: Adding TTL information to gethostbyname() and friends
>
> In principle, I agree.  In practice, programs do not work that way.
> In particular, web browsers do not work that way, as I've established
> by looking at the Mozilla source code and by experimenting with IE.
> 
> Browsers do not always query a cache because for many people the DNS
> cache is on the other side of a slow modem link.  To use the resolver
> cache properly would imply a DNS query for every web page download.
> 
> The round trip time for the DNS query would add measurable time to the
> download.  To avoid that time, browsers maintain their own cache, but
> because they do not use the correct TTL, the cache is slightly
> incorrect.

Yuck.  What a horrible situation.  Clue-by-4 the browser authors.

DNS cache should always be "local" to the application -- i.e. within
reach by a very minimal RTT.

If you're talking about doing this only in NetBSD (and maybe the other
*BSDs) then the correct fix is always to eliminate all application
specific DNS caching in pkgsrc hacks and instead to simply turn on a
local DNS cache server by default.

If you're talking about proposing a fix that could generically work for
everyone then the correct fix is to implement a portable in-core-only
cache that can be placed invisibly in libbind/libresolv/libc/whatever
behind gethostbyname() and friends and still convince all application
authors to eliminate all DNS caching from their applications.

It is never "right" for an application to cache DNS information and thus
it is never "right" for an application to need the DNS TTL values.

(I know I've been bery bothered by this same idiocity in Squid for some
time now.)

-- 
								Greg A. Woods

+1 416 218-0098;            <g.a.woods@ieee.org>;           <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>