Introduction to Load Balancing Techniques
The core purpose of a load balancer is to distribute client access requests to servers, applications, and web services. Within this core function, numerous techniques and algorithms can be used to balance the load across server farms and geographic locations within data centers or across multiple cloud providers. The method chosen depends on the type of services or applications being delivered, and they increase in complexity and configuration granularity from simple techniques such as Round Robin, through to those with more in-depth knowledge of networking layers. If appropriate, information about the status of the servers, the status of the applications running on those servers, the health of the network infrastructure connecting the servers, and the level of congestion on the network, can all play a part in load balancer decision making.
The various techniques that can be employed by a load balancer are outlined below. Round Robin load balancing is the basic method. Other techniques build on the Round Robin foundation as required.
This is the simplest method of load balancing servers, or for providing simple fault tolerance. Multiple identical servers are configured to provide precisely the same services or applications. All are configured to use the same Internet domain name, but each has a unique IP address. The load balancer has a list of all the unique IP addresses that are associated with the Internet domain name. When requests for sessions on the servers associated with the Internet domain name are received, they are allocated in a random, or rotating sequential manner. For example, the first request gets the IP address of server 1, the second request gets the IP address of server 2, and so forth, with requests starting again at server 1 when all servers have been assigned an access request during a cycle.
Weighted Round Robin
Weighted Round Robin builds on the Round Robin load balancing method. In weighted Round Robin each server in the pool is given a fixed numerical weighting by the network administrator. The most efficient and powerful server could be assigned a weighting value of 100. A server with half as much processing capacity could be assigned a weighting of 50, and so forth for each server in the farm. Servers with a higher weighting get sent more requests. For example, a server with a weighting of 100 would get allocated twice as many requests as a server with a weighting of 50. Or 4 times as many requests as a server with a weighting of 25. The assignment of requests is still done on a cyclic basis though, with the servers that have higher weightings being assigned more sessions in each cycle.
Round Robin or Weighted Round Robin consider the current server loads when assigning requests. Sessions are allocated to the next server on the list, with the weighting taken into account. The Least Connection method does consider current server load and assigns the latest request to the server that is currently servicing the fewest number of active sessions at that time.
Weighted Least Connection
Weighted Least Connection builds on the Least Connection method, but as with Weighted Round Robin, each server is given a numerical value. The load balancer then uses this when allocating sessions to servers. If two servers have the same number of active connections, then the server with the higher weighting is allocated the new request. If the servers with the least number of connections all have the same weighting, then the weighting value is ignored.
Agent-Based Adaptive Load Balancing
Agent-Based Adaptive Load Balancing uses a smarter method for server load analysis. Each server in the farm has an agent that reports on its current load to the load balancer management software. Rather than just using a simple numerical count of the number of sessions each server is delivering, real-time load information is used to when deciding which server is best placed to handle a request. This method is used in conjunction with other techniques such as Weighted Round Robin and Weighted Least Connection.