10

Let's say I have 2 IPs for a given domain (round-robin DNS).
If one the IPs becomes unresponsive, will clients try to connect to the other IP? or they will just fail to establish comunication with the domain?

GetFree
  • 1,460
  • 7
  • 23
  • 37

3 Answers3

19

Using a Load Balancer will still leave a single point of failure. If your load balancer goes offline, your website goes down.

Conterary to the above answer, Most HTTP clients already DO support trying each IP address returned from a DNS query until one returns with a valid response. Please see here:

http://blog.engelke.com/2011/06/07/web-resilience-with-round-robin-dns/

It appears that the author has tested the following browsers and found them to work fine.

Chrome 11 on Windows 7
Firefox 4.0 on Windows 7
Internet Explorer 8 on Windows 7
Opera 11 on Windows 7
Safari 5 on Windows 7
Internet Explorer 7 on Windows XP (after noticeable delay)
Firefox 4.0 on Windows XP (after noticeable delay)
Android native browser on Android 2.3.3
iPhone native browser on iOS 4.3.3

Using round robin wont do all the features of a load balancing server, things like being able to monitor response times from both servers, and route more traffic to one, if the other is not responding as fast as it should). For resilience, I would say Round Robin DNS is probably a better solution as there is no longer a single point of failure.

Tony Weston
  • 291
  • 2
  • 2
14

DNS round robin is not a good substitute for a load balancer. The DNS server will continue to hand out the IP of the node that is down, so some of your users will get to your service and some of them will not.

When the client makes the DNS query, the DNS server returns all of the IP addresses associated with that name. The magic is done by the DNS server rotating the order of that list for every query. However, it is up to the application to implement the capability of "walking" through the list until it finds an IP that works. And most applications don't do that.

Windows Telnet, oddly enough, is one such application that is smart enough to walk the linked list of returned IPs. You can see this behavior yourself if you attempt to telnet to google.com, for example. You will notice that it takes a long time to finally fail. That is because google.com has a lot of IP addresses, and the telnet client was trying every one.

Ryan Ries
  • 55,011
  • 9
  • 138
  • 197
  • I understand that clients always get both IPs from the NS. It's just that by default they choose the first one in the list. But what if the first one is down? will they try with the second one? – GetFree Dec 27 '13 at 21:32
  • 13
    It totally depends on the application. If we're talking about web browsers for instance, most modern web browsers will walk the list until they succeed, some browsers (usually older ones) will just fail after the first unsuccessful IP is tried. More info: http://www.nber.org/sys-admin/dns-failover.html and http://blog.engelke.com/2011/06/07/web-resilience-with-round-robin-dns – Ryan Ries Dec 27 '13 at 21:40
  • According to the links you gave, it seems that it does work. At least for HTTP clients (which is what I care about right now). All modern browsers and even lower level HTTP clients fail-over to another IP in the list. – GetFree Dec 27 '13 at 22:47
  • Yep. Just wanted to give you the caveat that it depends on the application. YMMV, etc. – Ryan Ries Dec 27 '13 at 22:50
  • @RyanRies, Does the RFC give any recommendations with regards to client behavior? Is Telnet compliant when it tries out all the IPs instead of merely using the first one? – Pacerier May 14 '14 at 05:45
  • 2
    Most applications *do* try different IP addresses. – Fluffy Nov 18 '14 at 10:33
  • @Pacerier Much belated, but we recently discussed rr walking [here](http://serverfault.com/a/774411/152073). [RFC 6724](https://tools.ietf.org/html/rfc6724#section-2) seems to be the most explicit and current reference. – Andrew B May 17 '16 at 06:47
  • I think some Answerers are confused into thinking we want a Load Balancer. That's not what we want. I'm looking for when half the State of Georgia goes dark, taking down our datacenter with it, that our customers can still connect to some other datacenter in some other part of the world that so happens has NOT gone dark. Georgia can get ALL the Load 99% of the time, I don't care, so long as New York is available to pick up where we left off for that 1% should Georgia go dark. – UncaAlby Jul 01 '16 at 23:46
  • Quit misleading answer saying that Windows Telnet oddly enough walks the list of IP addresses when practically all browsers and `curl` also do the same. The answer could be improved by telling that browsers actually do this. – Nakedible Jul 23 '20 at 16:30
2

While round robin DNS does not typically have feedback into the status of the servers it is providing addresses for, it may help if you then have some sort of load balancer (including router-based tricks) for each of those addresses.

There are tricks to update DNS as things fail; if this happens, round-robin DNS with suitably short TTLs can be a pseudo-load balancer.

Michael Graff
  • 6,588
  • 1
  • 23
  • 36