If I type 208.100.26.199 instead of boards.straightdope.com, then there is a little less wait, right?
Nobody has to look up the number, because I supplied it.
I’m not saying it’s much, but doesn’t it apply to each and every item on the page? Every header image and button image and post file url and sig file url, and even smilies?
So if I created a Host file and put the number there, would it speed up my viewing?
Not appreciably. It’s a good idea, but in practice the difference is so negligible.
The DNS request to lookup the IP address only goes out on the network once, and is thereafter cached by your operating system (for a little while.) This cache lookup will not be appreciably faster or slower than a hosts file lookup.
At least one ISP (Comcast) has had some pretty serious issues with their DNS at times. So if the DNS you normally use is having a slow response day, the time saving could be appreciable.
Remember, this practice will only lead to tears and seat-wetting if the 'Dope changes IPs.
You mean like it did a couple weeks ago?
On the other hand, provided that Pliny remembers what he did, he can change that entry as quickly as he wants, without having to wait (potentially) days for the DNS servers to be updated.
Assuming that he can find out the new number by other means before DNS servers are updated. (Since, in a way, disseminating info about IP address changes is one of the functions of DNS.)
After you have made an initial DNS lookup, your PC caches the result, so there is no advantage after that first lookup.
And your ISP will cache lookups, too.
In the end, DNS replaced hosts files because of ease-of-use, scalability, reliability and management issues. Trading that for a shortterm perceived gain is a backwards step, IMHO.
If your ISP has a slow DNS infrastructure, you could try opendns.org. However, you may have issues with dynamically configured devices trying to set this up.
Si
There has to be a limit on the amount of time the cache entry will last without a recheck, though, or you’d never get notified of a DNS change.
The TTL (Time To Live) controls this - at least for Backbone DNS. This defines how long it takes for a DNS update to propagate - generally 2xTTL.
Client side caching is shorter though (on the order of minutes, as I recall), but there will not be a DNS lookup for the same address for each reference on a web page, for example. Plus much material will be dragged out of the local browser cache.
My point is that there is almost no advantage to be gained by hostfiling a server after the initial lookup, and the disadvantages outweigh the gain.
Si
Another thing to consider is that many websites (usually those hosted with cheap hosting plans) may share the same IP - the server software looks at the hostname embedded in the incoming request to determine which site to send you.
If you try to visit a site like this with the IP alone, it won’t work.
I’m not all that confident of the browser caching anything.
Well, I know it wastes a lot of disk space cachiing Temporary files, but they never seem to be reused.
On every single thread I look at, I watch it going out to find and reload all the headers and buttons for the hundreth time in an hour.
I’m 99% certain that it’s the OS that does the caching, not the browser.
There’s a few different things going on here.
-
Your OS is responsible for making the network work and that includes looking up DNS names. It is the OS that caches the results of DNS lookups.
-
Your web browser is responsible for the high-level communication between itself and a web server, and it caches images, CSS files, and so on. It’s extremely unlikely that Pliny’s browser is fetching these items over the network on every page request, unless he has deliberately turned all caching off. (I’m not even sure if that’s an option for most browsers.)