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 weighted round-robin load balancing technique.
This technique is similar to the round-robin load balancer. But in the weighted round-robin load balancer, the network administrator assigns a numeric weight to all of the servers behind the load balancer. The weights can be assigned based on factors such as the server’s processing power or total bandwidth.
A server, say ServerA, with the most processing power will be assigned the maximum weight. It will also receive the maximum proportion of incoming requests from the load balancer.
A server, say ServerB, with half the processing capacity compared to ServerA will be assigned a weight that is half of the actual weight of ServerA. Additionally, it will receive the proportion of incoming requests from the load balancer accordingly.
A server, say ServerC, with the lowest specifications will be assigned the lowest weight, and it will receive the minimum proportion of incoming requests from the load balancer.
Note: The weighted round-robin load balancer is a static load balancer, as 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, ServerC— with weights (5, 2, 1) that are waiting to serve incoming requests behind the load balancer.
The load balancer will forward the first five requests to ServerA, the next two requests to ServerB, and then one request to ServerC.
If any of the other incoming requests arrive, the load balancer will forward those requests back to ServerA again for the next five incoming requests, then ServerB will get its turn, and after that the requests will be forwarded to ServerC. The cycle will continue on this way.
This cycle is shown in the illustration below:
i
: This is the request number that is processed. It is initially set to zero.Weights
: This is an array that holds the weights for all the servers.T
: This is the total number of servers that are available.Begin.
Assign a specific number of requests to i mod T
th server, according to its numeric weight Weights[i]
.
Increment the value of i
by value of 1
.
Repeat steps 2 and 3, until there are no more requests.
End.
This load balancing technique prevents a server from receiving a large number of incoming requests.
It utilizes fewer resources.
The request assignment is deterministic and it is easy to determine the assigned server.
The network administrator can set the numeric weight for the server. This is helpful for when we want some of our server’s resources to be available for other tasks.
The weighted round-robin load balancing technique is not a suitable choice for when we have incoming requests with extensive service time or for when the service time of each request is different.
Free Resources