The round-robin algorithm is often used as a simple-yet-effective method of distributing requests to a single-point-of-entry to multiple servers in the background. It’s used by DNS servers, peer-to-peer networks, and many other multiple-node clusters/networks.
In a nutshell, round-robin algorithms pair an incoming request to a specific machine by cycling (or, more specifically, circling) through a list of servers capable of handling the request. It’s a common solution to many network load balancing needs, even though it does not result in a perfectly-balanced load distribution, strictly speaking.
Weighted round-robin provides a clean and effective way of focusing on fairly distributing the load amongst available resources, verses attempting to equally distribute the requests. In a weighted round-robin algorithm, each destination (in this case, server) is assigned a value that signifies, relative to the other servers in the pool, how that server performs. This “weight” determines how many more (or fewer) requests are sent that server’s way; compared to the other servers on the pool.
Say you have three servers that have been individually benchmarked and configured that are to be deployed in a weighted round-robin environment. The
first can handle 100 req/sec, the second can do 300 req/sec, and the last can only do 25 req/sec (all on average, tested with an automated benchmark serving
the same data). Normally, with such a discrepancy in the servers’ performance, the third would be excluded from the setup entirely. But in a weighted round-robin, each server can be assigned as much as it can handle in the round-robin configuration script/file:
Resource Weight
——– ——
server1.fqdn 4
server2.fqdn 12
server3.fqdn 1
It’s pretty clear what happens next: for every 12 requests sent to server two, 4 will be sent to server one, and just 1 will be sent to server 3. The result is a more even, if less equal, load distribution.
So in a nutshell, Weighted Round Robin works in a similar way to Round Robin, but assigns more requests to nodes with a greater ‘weight’. Over a period of time, nodes will receive a number of requests in proportion to their weight.
Weights must be positive integer values; a node with a weight of ‘4’ will receive 4 times as many requests as a node with a weight of ‘1’.
Thanks for your explanation.
It’s clear.