What is the least connections load balancing technique?

Overview

The purpose of load balancers is to improve the performance of applications and decrease the burden by "efficiently"Efficiency depends on server selection. distributing the incoming traffic across a group of servers. For user-facing applications, this will result in improved response times.

Note: Here, we will mainly talk about application load balancers.

Now, let’s jump right into the details of the least connections load balancing technique.

About the technique

The least connections load balancing technique takes into account the current number of active connections on each server. The load balancer forwards the new request to the server that is currently serving the lowest number of active connections.

Note: The least connections load balancer is a dynamic load balancer, as it takes into account the current state of the servers while distributing incoming traffic.

Example

Let’s understand this with the help of an example:

Suppose we have six requests connected to the servers behind the load balancer.

  • A server (say ServerA) is managing requests 1, 3, 5, a second server (say ServerB) is managing requests 2, 4, 6, and a third server (say ServerC) is managing requests 7, 8, 9.

  • But, after a certain amount of time, requests 1, 2, 3 are completed.

  • Now, ServerA is managing request 5, ServerB is managing requests 4, 6, and ServerC is managing the same number of requests, that is, 7, 8, 9.

  • If a new request (say 10) arrives, it should be forwarded to ServerA by the load balancer because it appears to have the lowest number of active connections.

  • Now, ServerA is managing two requests that are 5, 10, ServerB is also managing two requests that are 4, 6, and ServerC is managing the same number of requests 7, 8, 9.

This is shown in the slides below:

Servers managing assigned tasks
1 of 3

Algorithmic explanation

  1. Find the server/s with the lowest active connections.

  2. If there are multiple servers with the lowest active connections, then follow the round-robin method and assign the new request to the server that has its turn. Otherwise, if the server is exactly one, then assign the new request to this server.

Advantages

  • The least connections load balancing technique minimizes the chances of server overload, as it only sends requests to servers with fewer active connections. This is unlike the round-robin or weighted round-robin load balancing techniques that send requests to all the servers in a rotational manner.

  • It is more reliable and responsive.

Limitations

  • Since it is non-deterministic, the least connections load balancer is difficult to troubleshoot.

  • This algorithm for the least connections load balancing technique is complex and requires more processing.

  • It does not consider the capacity of the server when assigning a new incoming request. For example, consider the scenario in which a server (say ServerA) has a processing capacity of 100 and is managing 10 active connections and, at the same time, another server (say ServerB) has a processing capacity of 50 is managing 5 active connections. Even though ServerA has more processing capacity than ServerB, the load balancer will still assign the new request to ServerB, because it has the lowest number of active connections.

Real time load balancers

  • HAProxy

  • Incapsula

Free Resources

Copyright ©2024 Educative, Inc. All rights reserved