Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers 2

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.

share|improve this answer
    
Thanks for the short and sweet answer. That answers my question. –  nbolton Jul 4 '10 at 11:33
    
If it answered the question, you will want to accept the answer to give credit. –  Bart Silverstrim Jul 4 '10 at 12:20
add comment

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!

share|improve this answer
    
When you say "your requests will still be sent to that server" -- maybe this does not apply to all web browsers? It seems that the browser that I use (Chrome) is smart enough to fall back on a 2nd IP (as I mentioned in my question). Also, thanks for letting me know about HAProxy (probably overkill for me, but good to know). –  nbolton Jul 4 '10 at 11:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.