- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
These are 4 algorithms you must know if you want to distribute load wisely. #systemdesign
The 3 algorithms I discussed — Round Robin, Weighted Round Robin, and Least Connections — all work best for stateless requests. The load balancer does not care which server the user was on before. Every request is independent.
But what about stateful requests?
When your app stores cart data, login sessions, or user state locally on a server, you need the same user to always hit the same server. That is where IP Hash comes in.
How it works: The load balancer takes the user's IP address, runs a hash function on it, and maps it to a specific server. Same IP, same server. Every time.
Real scenario: User adds 3 items to cart on Server 2. Without IP Hash, the next request could land on Server 3. Cart is empty. User is confused. With IP Hash, every request from that user hits Server 2. Cart stays intact.
The downsides:
* If Server 2 goes down, all users mapped to it get rehashed and redistributed. Temporary session loss.
* If 500 employees in a corporate office share a similar IP range, one server gets hammered while others sit idle.
* Users behind VPNs or proxies share the same IP, creating the same hotspot problem.
When to use: Session-heavy apps where you cannot externalize state to Redis or a shared database. If you can use Redis for sessions, Least Connections is usually the better choice.
Quick cheat sheet: Round Robin — simple, equal, stateless Weighted Round Robin — matches server capacity, stateless Least Connections — picks least busy server, stateless IP Hash — session stickiness, stateful
Save this for your next system design round.
Видео These are 4 algorithms you must know if you want to distribute load wisely. #systemdesign канала Amit Vikram Awasthi
But what about stateful requests?
When your app stores cart data, login sessions, or user state locally on a server, you need the same user to always hit the same server. That is where IP Hash comes in.
How it works: The load balancer takes the user's IP address, runs a hash function on it, and maps it to a specific server. Same IP, same server. Every time.
Real scenario: User adds 3 items to cart on Server 2. Without IP Hash, the next request could land on Server 3. Cart is empty. User is confused. With IP Hash, every request from that user hits Server 2. Cart stays intact.
The downsides:
* If Server 2 goes down, all users mapped to it get rehashed and redistributed. Temporary session loss.
* If 500 employees in a corporate office share a similar IP range, one server gets hammered while others sit idle.
* Users behind VPNs or proxies share the same IP, creating the same hotspot problem.
When to use: Session-heavy apps where you cannot externalize state to Redis or a shared database. If you can use Redis for sessions, Least Connections is usually the better choice.
Quick cheat sheet: Round Robin — simple, equal, stateless Weighted Round Robin — matches server capacity, stateless Least Connections — picks least busy server, stateless IP Hash — session stickiness, stateful
Save this for your next system design round.
Видео These are 4 algorithms you must know if you want to distribute load wisely. #systemdesign канала Amit Vikram Awasthi
Комментарии отсутствуют
Информация о видео
9 марта 2026 г. 20:42:07
00:01:18
Другие видео канала
