Does my BIND zone really provide redundancy and load balancing?

We have the following IP addresses (for example):

1.1.1.1
2.2.2.2

Each hosts the same website, but on a different server. We want to do some really simple load balancing by having web users visit a different IP address on each request. Our application fully supports this, so there's no technical issues with authentication, etc.

I think I've got this working, but I'm not sure. If I use nslookup to query the zone, then the IPs alternate in round-robin fashion, which is cool.

Addresses:  1.1.1.1
      2.2.2.2

...

Addresses:  2.2.2.2
      1.1.1.1

I have observed that if the http server is not available on the 1st IP, the web browser will just use the 2nd IP which is also pretty cool.

However, this seems to be really difficult to test, since once a browser has an IP (Chrome for instance), it'll stick with it. Maybe this is a good thing? So, just based on how I've explained this, does that sound like it'd work as a load balancer with redundancy?


DNS "load balancing" is not meant to balance the load to a single client, but among different clients (client A get first IP, client B get second IP, client C get first IP, an so on).

Resolving the same name to two different machine within the same browser session, could lead to unwanted behaviour, especially if you use session cookies or similar.


This is known as DNS round-robin, also known as "poor-man's load balancing". It's simple to implement but has major drawbacks as it does not provide health checking, does not take server load in consideration and, in major installations, it does not take geographical location in consideration.

For instance, if your browser/OS is stuck with one of the ips and the server behind that ip crashes, your requests will still be sent to that server.

From the wikipedia page, here are the major drawbacks:

Although easy to implement, round robin DNS has problematic drawbacks, such as those arising from record caching in the DNS hierarchy itself, as well as client-side address caching and reuse, the combination of which can be difficult to manage. Round robin DNS should not solely be relied upon for service availability. If a service at one of the addresses in the list fails, the DNS will continue to hand out that address and clients will still attempt to reach the inoperable service. Also, it may not be the best choice for load balancing on its own since it merely alternates the order of the address records each time a name server is queried. There is no consideration for matching the user IP address and its geographical location, transaction time, server load, network congestion, etc. Round robin DNS load balancing works best for services with a large number of uniformly distributed connections to servers of equivalent capacity. Otherwise it just does load distribution.

More info about DNS Round-Robin here.

If you're considering this for web applications, I'd recommend you to take a look at HAProxy, which can implement cheap but real redundancy.

Hope this helps!