Load balancing algorithms
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
@jscapeus @Youtube
Round robin. In the diagram above, each server will receive equal requests alternately.
This works best for servers with similar specs.
@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.
@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.
@jscapeus @Youtube
Weighted least connections. This one also has a predetermined weight for larger servers to the ratio equivalent of least connections.
@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