Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Got a simple scenario with two web servers for redundancy and to scale.

But how do I make a two web-server setup fully redundant? I can think of two solutions;

  1. two web servers, one load balancer spreading the load. one extra machine for the load balancer. but how will the load balancer be redundant?

  2. two machines, each running the web server AND running a load balancer, spreading the load over. have a DNS entry point to both of the machines. no extra machines needed for load balancing.

How do you guys normally solve this kind of problem?

share|improve this question
What web server are you running? What OS are you running? – mrdenny Jan 12 '11 at 0:39

But how do I make a two web-server setup fully redundant?

Typically, you do not. Making the database fully redundant with seamless failover is hard. And full redundancy requires additional hardware, so it's often not implemented before the site grows to be a bit larger.

You must think about session state -- user login state, shopping cart contents, etc. How will this be handled?

If your service is completely state-less (fx static file serving with no customization for each user) then you could just use DNS Round Robin to publish 2 IP addresses for your site, one for each server.

If you need a little more control over how fail over is handled, you could consider 2 web servers, both sharing the same IP address through Windows NLB or on Linux using something like Linux-HA, Keepalived, etc (there are several possible solutions).

share|improve this answer

If you are limited to just two servers, you could do worse than DNS round robin with a load balancer on each machine pointing at each other. Traditionally, the load balancer is a tier by itself on its own servers with its own redundancy and failover.

share|improve this answer

Assuming hardware load balancers, they can usually be setup in an active/passive cluster for failover using their native configs. If you are using a software load balancer (not Microsoft NLB) then look for one that is VRRP compliant, and use VRRP to handle the fail over of the load balancer. If you are using Microsoft NLB then it runs on all the machines in the scale out cluster and handles machine failures automatically.

share|improve this answer

Install haproxy on both servers along with heartbeat. Haproxy will loadbalance to both webservers and heartbeat will provide failover taking over a virtual ip if one of the servers fail.

share|improve this answer

There are typically two ways to implement high availability/scalability failover solutions. The first one is to use short TTLs on a round robin DNS record, in conjunction with a load balancer, and the second is to use heartbeat monitoring and IP address failover with a hardware or software solution. Some solutions use a combination of these two approaches for additional reliability.

Not saying you should plunk down cash to do this, but check out Zeus' ZXTM and GLB solutions to get an idea of what is possible with a commercial solution. I've used them in the past with my own hardware, and with good results.

FWIW, You should be able to be fairly reliable by using short TTLs in your DNS records, and then programmatically pointing the DNS at a backup webhead if you lose the LB. You can use a service like Zerigo to do this, as they provide an API you can hit to change your records on the fly. If you are looking to optimize on cost, this is the way to roll.

There appear to be a few solutions for doing this with Linux, including a solution built on top of LVS:, but there may be limitations on where you can deploy it (like not on AWS) and additional costs of setting it up, monitoring it, and getting it implemented correctly.

share|improve this answer
DNS servers don't always notice the TTL and may cache them for longer, causing the system to go down. – Jacob Jan 28 '11 at 15:23

Your Answer


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.