Information Technology Reference
In-Depth Information
special cookie when their most important customers log in and configure the load
balancer to detect that cookie and send their traffic to especially fast servers.
Someloadbalancersaretransparent:thesourceIPaddressoftherequestisunaltered.Most,
however, are not: the source IP address of each request the backend sees is the IP address
oftheloadbalanceritself.Thatis,fromthebackend'sperspective,itlooksasifallrequests
are coming from a single source, the load balancer. The actual source IP of the requests is
obscured.
WhenallrequestsappeartocomefromthesameIPaddress,debuggingandloganalysis
may be impossible at worst and confusing at best. The usual way to deal with this issue
is for the load balancer to inject an additional header that indicates the IP address of the
originalrequester.Backendscanaccessthisinformationasneeded.Theheaderiscalled X-
Forwarded-For: . The first proxy or load balancer adds the header, the original client
IPaddress,anditsownIPaddress.Additionalproxiesandloadbalancersappendtheirown
IP addresses. Although web servers generally log the client IP address, all the intervening
IP addresses can also be accessed by the application.
4.2.2 Load Balancing Methods
For each request, an L3, L4, or L7 load balancer has to decide which backend to send it to.
There are different algorithms for making this decision:
Round Robin (RR): The machines are rotated in a loop. If there are three replicas,
the rotation would look something like A-B-C-A-B-C. Down machines are
skipped.
Weighted RR: This scheme is similar to RR but gives more queries to the back-
ends with more capacity. Usually a manually configured weight is assigned to
each backend. For example, if there are three backends, two of equal capacity but a
third that is huge and can handle twice as much traffic, the rotation would be A-C-
B-C.
Least Loaded (LL): The load balancer receives information from each backend
indicating how loaded it is. Incoming requests always go to the least loaded
backend.
Least Loaded with Slow Start: This scheme is similar to LL, but when a new
backend comes online it is not immediately flooded with queries. Instead, it starts
receiving a low rate of traffic that slowly builds until it is receiving an appropriate
amount of traffic. This fixes the problems with LL as described in Section 1.3.1 .
Search WWH ::




Custom Search