Bugs & Fixes: DNS prefetching can cause Safari problems
Apple added a significant new feature to Safari in version 5.0.1. It hasn’t garnered much attention and you may not have heard about it. It’s called DNS prefetching, and its purpose is to speed up the loading of Web pages.
As described in detail on The Chromium Projects site, DNS (Domain Name System) prefetching kicks in when you load a webpage that contains links to other pages. As soon as the initial page is loaded, Safari 5.0.1 (or later) begins resolving the listed links’ domain names to their IP addresses. This DNS resolution happens in the background without you needing to do anything—even before you click any of the links. The result is that, if and when you do click a link, the resolution has hopefully already been completed—thus saving time in loading the selected Web page. The amount of time saved per link will range from a few milliseconds to several seconds—depending upon the specific domain and the current level of Internet traffic.
Sounds great. However, as reported in a recent Apple support article, this prefetching can occasionally result in “slow performance, partially-loaded pages, or webpage ‘cannot be found’ messages.”
This can happen if your DNS server (or router) does not play well with DNS prefetching. If you have any of the symptoms, and suspect prefetching is the cause, Apple offers two work-arounds.
The first is to switch to a different DNS service, one that presumably works better—such as OpenDNS. How to switch is covered in another Apple support article. Briefly, you go to Network System Preferences and, from the Advanced section of the connection service you are using, add the name of the new server to the DNS listing.
If this doesn’t have any beneficial effect, your second option is to disable DNS prefetching altogether. To do this, launch Terminal and type the following:
defaults write com.apple.safari WebKitDNSPrefetchingEnabled -boolean false
After you quit and relaunch Safari, prefetching will no longer be active.
If either of these work-arounds resolve the issue, the likely long-term fix is to get a new router. Specifically, check if your Internet Service Provider offers an updated router/modem that supports DNS prefetching. If so, get it.
Product mentioned in this article