DNS round-robin and HTTP redundancy

I’ve always thought that if you specify multiple A records with the same host name in your DNS settings it will only serve to balance the load of your site across these IP addresses. This is done by your operating system randomly choosing one IP from the list and remembering it for a set period of time. This should be the TTL of the domain but there are rogue DNS servers out there that will remember them for longer.

This article, however, suggests that this technique can also be used for fail-over. In other words, your computer will try one IP, but if it fails to connect to it, fall back to another IP configured for the same name and the user will notĀ  see an error. It should also then remember that this IP is the valid one and use it in the near future. I got really excited after reading this, but remained skeptical, so I decided to try it myself.

My tests with IE7 and Firefox 3 were unsuccessful.

If you lower the TTL on the domain to around 60 seconds you will see something along these lines: Every 60 seconds (about) if you ping the host name it will give you a different IP address. Whichever IP ping returns is the same IP the browser tries. If this is the IP that is currently down it will fail. If you wait 60 seconds ping will return the other IP and the browser connection will work. You must sometimes also restart the browser to make it use the IP the OS is returning.

This tells me that the browser is just using whatever IP the OS is returning. It does not know that there are multiple IP’s and that it could be trying another IP. There may be browser plugins or configuration options that change this behavior. I was using the default configuration.

Now I’m back to thinking (knowing) that it simply does not work like this, whether I think it should or not.

DNS SRV records allows you to configure load balancing with weighting and programs using thisĀ  are also supposed to fail-over to other addresses configured in these SRV records. VOIP services work with SRV records but browsers do not make use of this. RFC 2782 actually tried to get this support in for HTTP but it expired in 2002 without being approved. That saddens me. Cheap fail-over for the masses using DNS remains a dream.

Leave a Reply