Algorithms behind load balancing
6 Must Know Load Balancing Algorithms.
Static Algorithms
- Round Robin
- Sticky Round Robin
- Hash
- Weighted Round Robin
Dynamic Algorithms
- Least Connections
- Least Response Time
Let’s look at each algorithm in a little more detail:
✅ Round Robin
- Requests are distributed sequentially across a group of servers.
- No guarantee that multiple requests from a user will reach the same instance.
✅ Sticky Round Robin
- A better alternative to round-robin
- Different requests from the same user go to the same instance
✅ Hash-Based
- The algorithm distributes requests based on the hash of a key value.
- The key can be the IP address or the URL of the request
✅ Weighted Round Robin
- Each server gets a weight value.
- This value determines the proportion of traffic.
- Servers with higher weight receive more traffic. Good for setups having servers at different capacity levels
✅ Least Connections
- A new request is sent to the server instance with the least number of connections.
- The number of connections is determined based on the relative compute capacity of a server
✅ Least Response Time
- A new request is sent to the server with the lowest response time in order to minimize the overall response time.
- Good for cases where response time is critical.
So - which load-balancing algorithms have you used?