Information Technology Reference
In-Depth Information
Userstalktotheloadbalancer asifitisawebserver;theydonotrealize itisafrontendfor
many replicas.
4.2.1 Load Balancer Types
There are many ways to create a load balancer. In general, they fall into three categories:
DNS Round Robin: This works by listing the IP addresses of all replicas in the
DNS entry for the name of the web server. Web browsers will receive all the IP ad-
dresses but will randomly pick one of them to try first. Thus, when a multitude of
web browsers visit the site, the load will be distributed almost evenly among the
replicas. The benefit to this technique is that it is easy to implement and free.
There is no actual hardware involved other than the DNS server, which already ex-
ists. However, this technique is rarely used because it doesn't work very well and
is difficult to control. It is not very responsive. If one replica dies unexpectedly,
clients will continue to try to access it as they cache DNS heavily. The site will ap-
pear to be down until those DNS caches expire. There is very little control over
which servers receive which requests. There is no simple way to reduce the traffic
sent to one particular replica if it is becoming unusually overloaded.
Layer 3 and 4 Load Balancers: L3 and L4 load balancers receive each TCP ses-
sion and redirect it to one of the replicas. Every packet of the session goes first
through the load balancer and then to the replica. The reply packets from the rep-
lica go back through the load balancer. The names come from the ISO protocol
stack definitions: Layer 3 is the network (IP) layer; Layer 4 is the session (TCP)
layer. L3 load balancers track TCP sessions based on source and destination IP ad-
dresses (i.e., the network layer). All traffic from a given source address will be sent
to the same server regardless of the number of TCP sessions it has generated. L4
load balancers track source and destination ports in addition to IP addresses (i.e.,
the session layer). This permits a finer granularity. The benefit of these load balan-
cers is that they are simple and fast. Also, if a replica goes down, the load balancer
will route traffic to the remaining replicas.
Layer 7 Load Balancer: L7 load balancers work similarly to L3/L4 load balan-
cers but make decisions based on what can be seen by peering into the application
layer (Layer 7) of the protocol stack. They can examine what is inside the HTTP
protocol itself (cookies, headers, URLs, and so on) and make decisions based on
what was found. As a result they offer a richer mix of features than the previous
load balancers. For example, the L7 load balancer can check whether a cookie has
been set and send traffic to a different set of servers based on that criterion. This is
how some companies handle logged-in users differently. Some companies set a
Search WWH ::




Custom Search