There are many ways to make your websites redundant. The best way to do that is by using multiple websites with a load balancer, or with load balancing built in (Microsoft Load Balancing for instance). I've written about using HAProxy in the past for a cheap alternative to something like a Barracuda 340 Load Balancer.
Another popular method for load balancing is round-robin DNS. If you are unfamiliar with it, Wikipedia describes round-robin DNS as:
...a technique of load distribution, load balancing, or fault-tolerance provisioning multiple, redundant Internet Protocol service hosts, e.g., Web server, FTP servers, by managing the Domain Name System's (DNS) responses to address requests from client computers according to an appropriate statistical model.In short, instead of adding one IP address for a website in DNS, you add multiple IP addresses for a website.
In its simplest implementation, Round-robin DNS works by responding to DNS requests not only with a single IP address, but a list of IP addresses of several servers that host identical services. The order in which IP addresses from the list are returned is the basis for the term round robin. With each DNS response, the IP address sequence in the list is permuted. Usually, basic IP clients attempt connections with the first address returned from a DNS query, so that on different connection attempts, clients would receive service from different providers, thus distributing the overall load among servers.
There are some that don't like this method for load balancing, and rightfully so. For instance, Bob Plankers from The Lone Sysadmin writes:
On paper, round-robin DNS seems like an easy way to spread the load between multiple servers, but if one of those servers is down some clients will see outages as they are told to connect to the unavailable host. Round-robin DNS only works well with protocols and applications that have robust failover capabilities built in, and frankly, that isn’t too many of them.He is not wrong there, but there is a way to fix, or mitigate that problem by lowering your TTL value. According to Akadia.com:
We set the TTL low (to 60 seconds) to prevent any intervening caching DNS servers from hanging onto one sort order for too long, which will hopefully help keep the number of requests to each host more or less equal.Setting the low TTL number also makes it so that if one site is down, it only takes a few seconds or minutes for the client to clear their DNS cache and try another site that might be up.
So now you get the idea, you might be thinking that round-robin DNS still might not be a good solution. Well, there are several big name websites that currently use it, and use it effectively. Here are some of them:
- Twitter (TTL 30)
- Google (TTL 278)
- Reddit (TTL 300)
- Yahoo (TTL 382)
- Outlook (TTL 300)
If you want real redundancy, I wouldn't recommend relying totally on round-robin DNS though. You should have multiple web servers per site and have load balancing configured there. Using that in conjunction with round-robin DNS should give you considerable redundancy, and I'm sure that is exactly what the above sites are doing.
What do you think about round-robin DNS? Do you use it? Why or why not? Let us know in the comments.