zerosleeps

Since 2010

DNS and CDN

Wednesday 30 November 2011

Let’s start with a problem: the latest iPhone software update was going to take an estimated 6 hours to download here in Sydney. By undoing a “performance” tweak I had made on my network, it downloaded in about 12 minutes.

Before I reveal the solution, let’s talk about those acronyms in the post title.

DNS

Okay, so Domain Name System (DNS) is like a phone book for the internet. When you type “zerosleeps.com” into your browser, there’s a little magic going on behind the scenes. Your computer or router will ask your DNS service for the IP address associated with zerosleeps.com, and DNS will respond accordingly, spitting out something nasty like “65.39.205.54”.

Now you might be able to remember “65.39.205.54”, but what about remembering that, and Google’s IP address, and BBC News, and Daring Fireball, and…? And with the deployment of IPv6 it would only get worse, with IP addresses of “2001:4860:0:1001::68”.

That’s why DNS was invented.

CDN

Right, what about Content Delivery Networks (CDNs)? Well these puppies are used to help deliver content to internet users worldwide. Now zerosleeps.com is hosted on one server, somewhere in the USA, and that’s just fine given the volume of traffic received. But take a service like the iTunes Store, which simultaneously delivers massive amounts of data to tens of thousands of users worldwide? CDNs help with this problem by storing the same data in lots of different geographic locations, and try to serve that data to users from the closest of those locations. That means that global network traffic is decreased, because instead of downloading that movie from Apple’s servers in California, there’s a good chance you’ll end up being served by a data centre much closer to home. It also means you’ll be watching the movie much faster.

So what’s my beef with all of this? Well there are oodles of DNS servers out there, all keeping themselves synchronised with each other so that when a new website comes online or moves, within minutes you’ll be able to access it without knowing or caring what that new site’s IP address is. For the vast majority of home internet users, the DNS service you use is your internet service provider’s (ISP) own service. Sometimes, ISP’s DNS services can be a bit slow, or out-of-date, or unreliable, so geeks like me can tweak our network settings and tell our computers to use a much chunkier DNS solution, such as the one provided by OpenDNS.

However, because OpenDNS don’t have any servers located in Australia, I end up being dealt with by a DNS service located in the USA or Singapore or somewhere. What this means is that when I request data from a CDN (i.e. buy a movie in iTunes), the CDN thinks I’m in the USA or Singapore, and directs my computer towards an iTunes server somewhere around there. See how everything is coming together now? Although OpenDNS provides me with faster DNS lookups than my own ISP, what actually happens on the rare occasion that my computer requests data from a CDN is that I end up with slower data transfers.