A
on System Design: Load Balancer concepts
Topics Covered:
What is a Load Balancer ?
Benefits of a Load Balancer ?
Routing algorithms used in Load Balancing ?

Topics Covered:




What is a load balancer?
Load Balancer is a critical component of any distributed system which sits between a client and a server, accepts incoming requests, and routes them across a a cluster of servers to handle the load.
Load Balancer is a critical component of any distributed system which sits between a client and a server, accepts incoming requests, and routes them across a a cluster of servers to handle the load.

A load balancer keeps track of health status of all the servers connected.
If a particular server is unhealthy, then it will not send incoming requests to that server.
If a particular server is unhealthy, then it will not send incoming requests to that server.

Benefits of a load balancer:
Faster user experience
Less downtime and high throughput. If a particular server is down, LB takes care of routing the traffic to the ones which are up.







Routing algorithms used:
A load balancer can use any of the below algorithms to decide where to route the next incoming request.
The algorithm used depends on the use case:
A load balancer can use any of the below algorithms to decide where to route the next incoming request.
The algorithm used depends on the use case:





Route traffic to the server that is currently serving the least amount of traffic measured in megabits per second (Mbps).


Routes through a list of servers and sends each new request to the next server. When it reaches the end of the list, it starts over at the beginning.


The weighted round-robin scheduling is designed to better handle servers with different processing capacities. Each server is assigned a weight (an integer value that indicates the processing capacity)

Servers with higher weights receive new connections before those with less weights and servers with higher weights get more connections than those with less weights.
IP Hash:
Under this method, a hash of the IP address of the client is calculated to redirect the request.

Under this method, a hash of the IP address of the client is calculated to redirect the request.

I hope this can serve as a goto thread for learning Load Balancer concepts.
Let me know your thoughts in comments
Let me know your thoughts in comments
