DNS performance slowing you down?

Many of us access the same website dozens or hundreds of times a day, making the combined total time that we wait for page requests a huge bottleneck to our productivity.

One of the lesser considered reasons for lengthy page requests is DNS lookups. When you point your eyes to your browser status bar, and it reports "Looking up www.website.com", you're in the middle of a DNS lookup.

If you have any knowledge of DNS, you might ask, why isn't my Operating System's DNS cache working. I don't know the answer to that, but going back to the original issue – accessing a website frequently throughout the day – luckily, there's a solution.

It's called the local hosts file. This file is sort of like it's own Domain Name server. Your operating system will perform a lookup on the local hosts file before sending of the request to remote DNS servers beyond your control.

In windows, the hosts file is located at C:\Windows\System32\drivers\etc\hosts

In OS X, Linux /etc/hosts

Open up this file in a text editor. You'll likely already have at least one entry, called localhost. This line should demonstrate the basic syntax required to create an entry.

So, for example, if your website is served from a web server at IP address 55.66.77.88, you would place the following line in your hosts file:

55.66.77.88    www.mywebsite.com

Then, say good by to lengthy DNS lookups! At least from your PC.

Why follow me on Twitter?

  • I tweet about new technologies, services or libraries I find interesting
  • Yeah, sometimes I'll post a pet-peeve or rant about something trivial
  • If I discover something that made my web development life easier, I share it
  • I'll shout out any handy tip that I think might be useful to other devs
  • Very rarely anything promotional


Tagged .

Updated: 2011-09-30

Phil LaNasa follow us in feedly