[Ilugc] How does load balancing work?

  • From: rajasuperman@xxxxxxxxx (Raja Subramanian)
  • Date: Sat, 2 Jun 2012 18:43:49 +0530

On Sat, Jun 2, 2012 at 5:05 PM, Girish Venkatachalam
<girishvenkatachalam at gmail.com> wrote:

Load balancing involves promising a 100% uptime for a server application.

Load balancing only eliminates downtime due to server/application
being a single point of failure.

Even with full redundancy it's still not possible to provide 100%
uptime for any application. You may be sharing the same ethernet
switch, ISP connection, etc. In the very least the clustering software
is a single point of failure. If VRRP breaks then you'll end up with
a multi-master scenario where your cluster stop working.



But for the most common case, CARP or common address redundancy
protocol would do.

This is an adaptation of the Cisco VRRP protocol in which a virtual IP
address maps to a master
?and a slave IP address.

CARP is primarily on BSD. VRRP is no longer Cisco proprietary, many
vendors support VRRP and some even add their own enhancements.
You could in theory cluster routers from different vendors using VRRP
but I have never seen it in practice.

If you mention load balancing and clustering, it's essential to differentiate
between active/active clustering and active/standby clustering. In an A/A
cluster all members accept load from clients, in an A/S cluster, only the
active node is servicing requests while the standby node is not servicing
any requests. Only when the active node fails, the standby node is brought
into service. VRRP is A/S only.

Web and application servers can be easily A/A clustered. Most databases
are A/S. You'll need something like Oracle RAC, shared storage, etc to
make your DB A/A. IIRC MySQL, Postgre, Microsoft SQL server, etc are
all A/S.



If you ping the CARP IP, one of the machines in the CARP cluster will
respond.

CARP on a LAN is different from CARP on WAN (through a router). Key
difference is that CARP on WAN will need all inbound traffic to be received
by all nodes. This is because ARP load balancing cannot be done if
all traffic is forwarded by your local router. I can't think of many situations
where servers are deployed in the same subnet as clients, so OS clustering
is not a scalable load balancing architecture.

CARP also requires L2 switches to support "multi-port static MAC" or
no L3 switches "multi-port static ARP" in order to forward all inbound
traffic to all cluster nodes. Not all switches support this.

To overcome these limitations, nearly all large deployments use
dedicated L7 load balancers and do not depend on OS clustering.



You can do what is known as DSR which is a direct server return in
which the routing is
?asymmetric.

Packets reaching the server and on the way back follow different routes.

This is not recommended but may be useful.

This is very useful in a situation where the application downloads
lot of data to the client but there's very little upload. Eg. YouTube like
video streaming - client sends a small HTTP request, server returns
several MB of data. Avoiding the load balancer in the return path
reduces load and you can spec a lower bandwidth appliance and
reduce cost.


Load balancing and clustering is very interesting technology and is
quickly becoming an essential requirement for many organizations.
Great that you decided to write about it.

- Raja

Other related posts: