Load balancing algorithms

07 April, 2020
Back

Load balancing distributes client requests to two or more servers to reduce the stress on one server.

Load balancing algorithms determine how each subsequent request is routed.

Algorithms

round robin

@jscapeus @Youtube

Round robin. In the diagram above, each server will receive equal requests alternately.

This works best for servers with similar specs.


weighted round robin

@jscapeus @Youtube

Weighted round robin. A predetermined weightage will be assigned for each server. In this configuration, Server 1 will receive five requests for every one that Server 2 receives.

This distributes load to servers with larger capacity.


least connections

@jscapeus @Youtube

Least connections. The server with less existing connections will be assigned the next incoming request.

Not all request sessions are the same. Some users may choose to stay on the site longer than others. This distributes the load of request durations.


weighted least connections

@jscapeus @Youtube

Weighted least connections. This one also has a predetermined weight for larger servers to the ratio equivalent of least connections.


random

@jscapeus @Youtube

Random. And there's always a random for almost any algorithms. I can't think of when you'd use it except to stress test the servers.


Back