Dividing web traffic between servers

My website is growing too large for the one webserver that powers it to handle the traffic. Anticipating this, the code is perfectly capable of running in parallel, sharing a database, but I've never actually tried to split one IP address among several webservers. What kind of hardware or software do I need to divide up incoming TCP connections between multiple boxes? Bonus points if the system can detect that one or more boxes has gone offline.


You need a load balancer. There are two kinds : software and hardware.

  • hardware : You buy a box that usually has a web interface and will split the traffic evenly between web servers. They usually have many features that allow you to do many things such as 802.1Q support, SFP, Global load balancing, SSL Termination, so on and so forth. These are quite expensive and you can get them from Cisco, F5, Radware, Barracuda (cheaper).

  • software : You get a standard server and you install load balancing software. This is quite easy to do with Linux. You can use either HAProxy or ldirectord or Keepalived. There are quite a few to chose from. This is a cheaper method but without all the pretty web interfaces and fun features.

Any half decent load balancing system will detect an offline server. All the above do.


You could use Varnish for this, or Pound two good and robust systems and varnish will even cache your site like a king and speed things up.


To add to what Antoine said, I would recommend a hardware load balancer if your site really is getting large. Software Load Balancers have a tendency to add a lot of overhead traffic on your network. Hardware Load Balancers are also usually designed with failover in mind since if not it becomes a single point of failure. As Atnoine mentioned they usually are very expensive. If you are a smaller shop I would recommend looking into a Load Balancer by Kemp Technologies, they are well made and perform well for a price that is literally a 10th of the big boys listed above. We are currently using a pair to Load Balance our website, student portal, and online learning portal at the online university where I run where we quite a bit of traffic everyday.