Dec 18, 2014

What is a Load Balancer? And How Does It Work?

LoadBalancer01What happens if your websites suddenly draw a lot of traffic? How about if traffic suddenly spikes? Or what if your sites get ‘slashdotted’?  This is where a link to your site pops up on a very popular site. While the additional exposure is great, if your infrastructure isn’t ready to handle a large influx of traffic, it can easily overwhelm your server.

Hosting your websites on one server is fine.  Until that server cannot handle the traffic or goes down.  Sooner or later, every server needs to be rebooted for system updates, software installation, or to try to fix an annoying problem.  So you reboot your server, get it patched and banish that transient problem or install your shiny new software. But wait, what about your websites?  What happened to them during that time? Well, if you’re hosting your websites on only one server, your websites were down.

Enter the load balancer

A load balancer is a hardware or software appliance designed to spread traffic across multiple servers. It gives you much more granular control over where traffic goes and how it’s handled. Load balancers can be deployed in a highly-available manner so there’s no single point of failure.

How do load balancers work?

LoadBalancer02Fundamentally, here’s how a load balancer works: Your domain name points to an IP address configured on the load balancer, and the load balancer starts to receive traffic from your users. When a load balancer is deployed, your servers sit ‘behind’ the load balancer, meaning that all traffic to your servers travels through the load balancer.  When a request arrives, the load balancer choses one of your servers to be the machine to service the request.  There are many ways of choosing which server will be selected, which is something that’s discussed with you prior to deployment.

Here’s an example: Suppose you have two servers, and a request comes in from one of your users looking to check out your website.  The load balancer in this case, decides that server ‘A’ is the server to use, so the request is routed there. Meanwhile, a second request comes in from another user.  The load balancer decides that server ‘B’ is a prime candidate, thus splitting the load on your site across multiple servers.

How do load balancers keep everything running smoothly?

Load balancers don’t just split your traffic, they also ensure that your servers are up and able to receive said traffic. As a load balancer is going about its regular housekeeping jobs, it also sends ‘health check’ requests to your servers.  If the server replies that all is well, the load balancer will happily send traffic to it.  If the server fails to respond (or says that all is NOT well), the load balancer will remove that server temporarily from the rotation until everything is running smoothly again.  When a server is removed from the rotation, site availability isn’t interrupted as other servers continue to process traffic.

This has the added bonus of giving you some control over which servers handle traffic.  If you want to take down server ‘A’ for maintenance, upgrades, et cetera you can cause the server to fail these health checks (thus removing it from the rotation) until you’re ready to bring it back online.

Get the benefits of load balancers

In short, a load balancer can make your server environment much more flexible, extensible, and resilient. We highly recommend that if you have two or more servers that you consider getting a load balancer.

Got a busy season coming up?  You can also use our On-Demand Hybrid Cloud in concert with your load balancer to temporarily handle an increased load.  By spinning up cloud servers and placing them behind your load balancer, you gain flexibility without needing an additional dedicated server.  Once your busy season is over, simply shut down the cloud servers.


Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedIn