A2 Hosting will soon start using Anycast for our DNS servers. What is Anycast, and why is it a useful technique to serve your DNS data? “Anycast” is a term which refers to routing one IP address to multiple locations. It is useful for DNS because of some problems inherent in the way computers traditionally look up IP addresses.
If you aren’t familiar with the Domain Name System (DNS), it is basically like a phone book by which someone can look up a name, and get a number used for calling them. When you go to a website you typically follow a link or type a domain into your browser’s address bar. Either way, your browser gets a domain name like www.a2hosting.com. In order to talk to the server that has www.a2hosting.com’s web page, it has to find that server’s internet IP address (the internet phone number). To get the address, your computer uses the DNS system, and does this by asking a special server called a resolver to convert the domain name into an IP address.
The resolver itself will have to talk to several other servers to find the address. Since there are so many domains, it would be very hard to keep all that information in one place. Instead, the information is broken up among many servers which take responsibility for only one part of a domain name. The internet has a handful of main DNS servers. These serve as the starting point to get to everything else, and are the first servers a resolver will contact. For example, the top level servers know who holds all the .com domains, the .com servers know where a2hosting is and a2hosting knows where www is. As you might have noticed, the resolver will work backwards from what you might expect. To a resolver, .com is the first part of the domain, and www is the last part.
So basically, a resolver goes through the following steps:
1. Contact the main name servers for the entire internet to find what servers hold the next part of the domain.
2. Ask every server it finds until it finds the server responsible for the last part of the domain name.
3. Ask the final server for the IP address of the domain, and give it back to whomever asked for it.
Where Anycast comes in handy is between steps 2 and 3. There are always at least a couple servers which know the IP addresses for your domain. For instance, a query for a2hosting.com can be answered by both 188.8.131.52 and 184.108.40.206. It is this way for every domain on the internet. Originally, this requirement was meant to provide redundancy in case one of the servers was unavailable. The problem with this is that when a server does have a problem, it can take 5-10 seconds to figure out that it isn’t responding before asking the next one. When you want people to enjoy using your website, making them wait 10 seconds to find your server isn’t desirable.
Anycast makes this situation much less likely to happen by making several separate servers look like one server. By clever use of internet routing protocols, we can have people go to any server we want. It would be like sending a letter to someone, and having the post office decide which would be the best place for them to receive it. If they were out having coffee, the letter would be delivered to them right at the coffee shop. In the case of servers, we control the routes for our IP addresses, and we know the state of our servers, so we can change whether a request goes to another part of the world, or simply to another server within the same data center. If one server is not answering, we simply send requests to another that is. The best part is that this is all automatic. Failed servers are taken out of the system almost immediately. Even if there aren’t any server problems, we can automatically send people to the closest or fastest server. In the end, the likelihood of a delay between step 2 and 3 up above is dramatically reduced.
All this works together to make the entire system much more stable, better for us to work with and hopefully more enjoyable for your visitors to use as well!