DNS pre fetching

DNS pre fetch is something i have been looking into, but so far as in-browser DNS pre fetch tags go, its still a dream…

<link rel=”dns-prefetch” href=”http://working-thought.blogger.com”>

Mozilla and Chromium browsers should be able to perform DNS pre-fetching to reduce the overall page load time, however, testing this out doesn’t match the published behaviour.

  • MSIE simply does not pre fetch, as expected, perhaps IE9 will?
  • Google Chrome does pre fetch and it does seem to do it asynchronously (as per published specs), not surprising, see below.
  • Safari does not pre fetch.
  • FireFox should be able to pre fetch (see here) but i couldn’t make it go.

Meanwhile Google have re invented the DNS server with one that incorporates DNS pre fetch.

Normally when the ISPs DNS server goes back to the authoritative host to get the DNS record it just caches it without inspecting the TTL on the record. For our site that is 300 seconds, which is deliberately quite short. The next time a user requests the DNS record from their ISPs DNS server, only then does it inspect the TTL and if its expired then it will go back to the authoritative host.

Google found that their googlebot was spending more time looking up DNS records, than it was spidering pages. So they made their DNS server inspect the TTL of the record and before it expired fetch it again so the cache is kept hot.

If you give yourself a tight target like a “1 second homepage” then you may see 700ms wasted in DNS resolving. If that’s the case give the google DNS server a go. its available on 8.8.8.8 and 8.8.4.4 its quite shocking the difference it can make.

Stuart