Round‑robin load balancing is one of the simplest methods for distributing client requests across a group of servers. Going down the list of servers in the group, the round‑robin load balancer forwards a client request to each server in turn. When it reaches the end of the list, the load balancer loops back and goes down the list again (sends the next request to the first listed server, the one after that to the second server, and so on).
For more information about load balancing, see Load Balancing: Scalable Traffic Management with NGINX Plus.
The main benefit of round‑robin load balancing is that it is extremely simple to implement. However, it does not always result in the most accurate or efficient distribution of traffic, because many round‑robin load balancers assume that all servers are the same: currently up, currently handling the same load, and with the same storage and computing capacity. The following variants to the round‑robin algorithm take additional factors into account and can result in better load balancing:
- Weighted round robin – A weight is assigned to each server based on criteria chosen by the site administrator; the most commonly used criterion is the server’s traffic‑handling capacity. The higher the weight, the larger the proportion of client requests the server receives. If, for example, server A is assigned a weight of 3 and server B a weight of 1, the load balancer forwards 3 requests to server A for each 1 it sends to server B.
- Dynamic round robin – A weight is assigned to each server dynamically, based on real‑time data about the server’s current load and idle capacity.
How Can NGINX Plus Help?
NGINX Plus and NGINX are the best-in-class load‑balancing solutions used by high‑traffic websites such as Dropbox, Netflix, and Zynga. More than 400 million websites worldwide, including the majority of the 100,000 busiest websites, rely on NGINX Plus and NGINX to deliver their content quickly, reliably, and securely.
The NGINX Plus load balancer uses the round‑robin method by default, but includes a feature that improves performance and reduces the number of errors returned to clients: if a server fails to respond to a request, or returns an error, the NGINX Plus load balancer automatically re‑sends the request to another server, and does not send requests to the failing server for a defined time period (10 seconds by default). You can also configure both weighted and dynamic round robin, or one of the more sophisticated load‑balancing algorithms available in NGINX Plus. For more information about the algorithms, see Choosing a Load‑Balancing Method in the NGINX Plus Admin Guide.
To learn more about the benefits of using NGINX Plus to load balance your applications, download our ebook, Five Reasons to Choose a Software Load Balancer.