-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5448b05
commit f2035b4
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
+++ | ||
title = 'SD: Load Balancers' | ||
date = 2024-10-08T21:53:16-06:00 | ||
draft = false | ||
+++ | ||
|
||
Load Balancers (LB) are a crucial component for System Design. They are basically in charge of distributing incoming requests and traffic _evenly_ across multiple servers while avoiding the overload and downtime of servers. | ||
|
||
## Good places to put a LB | ||
|
||
- Between user and web servers | ||
- Between web servers and internal platform layer | ||
- Between platform layer and databases | ||
|
||
## How does a request get processed by a Load Balancer? | ||
|
||
- Request is received | ||
- Request then is evaluated: | ||
- LB determines which server or resource should handle the request | ||
- At this point, the Load Balancer Algorithm takes into account the following things: | ||
- Server capacity and response time | ||
- Number of active connections | ||
- Geographic location | ||
|
||
- LB forwards request to the server | ||
- Server responds back to the LB | ||
- LB processes response and sends it back to the user/client | ||
|
||
## Load Balancer Algorithms | ||
|
||
The algorithms listed here will be a good option in particular scenarios. | ||
|
||
In general, these algorithms will ensure efficient utilization of available resources, improve overall system performance and maintain high availability and reliability. | ||
|
||
### Round Robin | ||
|
||
Assigns incoming requests to servers in a cyclic order by following the [Round Robin technique](https://en.wikipedia.org/wiki/Round-robin_item_allocation). | ||
|
||
#### Uses | ||
|
||
- Suitable for environments where _**all servers have similar capacity and performance**_ | ||
- Good option for _**stateless**_ applications where each request can be handled independently | ||
|
||
### Least Connections | ||
|
||
Assigns incoming requests to the server with fewest active connections at the time of the request | ||
|
||
#### Uses | ||
|
||
- Suitable for environments where _**servers have different capacity and workload**_ | ||
- Good option for _**stateful**_ applications where maintaining the session state is mandatory | ||
- When traffic is highly variable and unpredictable |