Article development led by
Anyone can use a load balancer.
Using it properly is much more difficult.
BY THOMAS A. LIMONCELLI
A READER CONTACTED me recently to ask if it is better
to use a load balancer to add capacity or to make a
service more resilient to failure. The answer is: both
are appropriate uses of a load balancer. The problem,
however, is that most people who use load balancers
are doing it wrong.
In today’s Web-centric, service-cen-tric environments the use of load balancers is widespread. I assert, however,
that most of the time they are used incorrectly. To understand the problem,
we first need to discuss a little about
load balancers in general. Then we can
look at the problem and solutions.
A load balancer receives requests
and distributes them to two or more
machines. These machines are called
replicas, as they provide the same service. For the sake of simplicity, assume
these are HTTP requests from Web
browsers, but load balancers can also
be used with HTTPS requests, DNS
queries, SMTP (email) connections,
and many other protocols. Most modern applications are engineered to
work behind a load balancer.
There are two primary ways to use
load balancers: to increase capacity
and to improve resiliency.
Using a load balancer to increase
capacity is very simple. If one replica is
not powerful enough to handle the entire incoming workload, a load balancer can be used to distribute the workload among multiple replicas.
Suppose a single replica can handle
100QPS (queries per second). As long
as fewer than 100QPS are arriving, it
should run fine. If more than 100QPS
arrive, then the replica becomes overloaded, rejects requests, or crashes.
None of these is a happy situation.
If there are two machines behind a
load balancer configured as replicas,
then capacity is 200QPS; three replicas would provide 300QPS of capacity,
and so on. As more capacity is needed,
more replicas can be added. This is
Load balancers can also be used
to improve resiliency. Resilience
means the ability to survive a failure.
Are You Load