Domain – DNS Round Robin: Multiple Nameservers VS Multiple A Records

domaindomain-name-systemfailoverhigh-availability

Note: This is a follow-up to my previous question regarding DNS Failover.

The Goal: to make the client's web browser select the next available server if one is down instantly.

I've read somewhere that multiple A records (while not the best solution) is the only "instant failover" solution possible for HTTP/browser-based applications.

Here's the scenario/example:

I have two servers A and B which contains exactly the same content.
The IP address of server A is 1.1.1.1 and 1.1.1.2
The IP address of server B is 2.2.2.1 and 2.2.2.2
I have a domain registered at Godaddy.
If I want to make use of DNS round robin, which method is best?

Method 1: Do I set my nameserver entries at Godaddy like this?

  1. ns1.serverA.com
  2. ns2.serverA.com
  3. ns1.serverB.com
  4. ns2.serverB.com

Method 2: Or do I make Godaddy as my nameserver and add A Records like this:

  1. A @ 1.1.1.1
  2. A @ 1.1.1.2
  3. A @ 2.2.2.1
  4. A @ 2.2.2.2

My question is, will DNS round robin work with either of the two methods? If not then what's the best method to achieve the goal?

Best Answer

The Goal: to make the client's web browser select the next available server if one is down instantly.

That's generally done by introducing a 3rd server, called a load balancer. The load balancer:

  1. Directs traffic to the 2 web servers.
  2. Monitors the health of the 2 web servers.
  3. Switches traffic to the remaining web server if one fails.

The load balancer itself can be made highly available by using 2 load balancers (LB), i.e. at least 4 servers (2 LB's, 2 webapp servers) in total. However, many smaller shops run with just one load balancer, because they are relatively simpler systems, and will often be very reliable.

Method 1: Do I set my nameserver entries at Godaddy like this? 1. ns1.serverA.com 2. ns2.serverA.com 3. ns1.serverB.com 4. ns2.serverB.com

Absolutely not. The name servers are only used for resolving the IP addresses of the web servers. Keep the name servers for the domain to your registrar/DNS host (GoDaddy) defaults.

Method 2: Or do I make Godaddy as my nameserver and add A Records like this: 1. A @ 1.1.1.1 2. A @ 1.1.1.2 3. A @ 2.2.2.1 4. A @ 2.2.2.2

When DNS Round Robin (DNS RR) is used as part of a high-end failover / high availability setup, then the IP addresses the DNS RR points to are highly available. In other words, each IP address is a virtual IP handled by 2 devices. As a pure high availability solution, without higly available server IPs, DNS RR doesn't work too well. The basic problem is that some clients may continue to use the 'dead' IP address, you're relying on the client doing 'the right thing', and not all clients do. Using a real HTTP load balancer is better.

That said, many small websites use DNS RR for load distribution only with good results. It's all about your expectations I guess.

In the DNS RR case, having 2 IP addresses per physical server gives you nothing, only extra complexity. So just use one IP for each server, in your notation:

A @ 1.1.1.1
A @ 2.2.2.1