The purpose of load balancers is to improve the performance of applications and decrease the burden by
Note: Here, we will mainly talk about application load balancers.
Now, let’s jump right into the details of the round-robin load balancing technique.
The round-robin load balancing technique is the simplest way to distribute traffic across a group of servers. The load balancer forwards the incoming requests to dedicated servers sequentially (one by one mechanism).
Note: Round-robin is a static load balancer, because it does not modify the state of the servers while distributing incoming traffic.
Let’s understand this with the help of an example:
Suppose we have three servers —ServerA, ServerB, and ServerC— waiting to serve incoming requests behind the load balancer.
The load balancer will forward the first incoming request to ServerA, the second to ServerB, and the third to ServerC. When the fourth request arrives, the load balancer will forward this request back to ServerA. Similarly, the fifth and sixth requests will be forwarded to ServerB and ServerC respectively, and the cycle will continue on like this.
This cycle can be seen in motion in the illustration below:
i
: This is the request number that is processed. It is initially set to zero.T
: This is the total number of servers that are available.i mod T
th server.i
value by 1
.This load balancing algorithm is not adaptive, as it does not consider the existing load on servers to distribute incoming requests. For example, even when a server (say, ServerA) is already processing a large request, the load balancer will still forward the next request to ServerA if it is its turn. At the same time, the other servers may be idle, having already completed their assigned tasks. Ideally, the load balancer should forward the request to the server whose current state is idle, but it does not do this.
Round robin load balancing is the default technique that is used in Nginx.
LVS