Stage 1 · Lesson 5 of 10
Load balancers and balancing algorithms
A spreads requests across a group of servers and gives clients one stable address. It runs , small regular test requests, and stops sending traffic to servers that fail them. Layer 4 balancers work at the connection level: they route TCP connections by address and port, which is very fast.
Layer 7 balancers read the HTTP request itself. So they can route by path or header and terminate TLS, meaning they handle the encryption for your servers. The algorithm matters when requests differ in cost.
, taking servers in turn, is fine when every request costs about the same. Least connections, picking the server with the fewest open requests, suits long or uneven requests. sends the same key to the same server every time, which helps caches.
The load balancer itself must be redundant. It is usually a managed service or an pair, where one runs and the other stands by.
Common traplong-lived connections such as WebSockets piling onto old servers after a scale-out.
A question to check yourself, an AI practice session and 2 cheat sheet entries come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- CoursePaidGrokking System Design Fundamentals
Design Gurus · Beginner · Subscription
Load balancing, API gateway, proxies, caching, CAP and Bloom filters: week 1 of the plan in order
- GitHub repoFreeThe System Design Primer
Donne Martin · Intermediate
Free: its scalability, latency, availability, CDN, load balancer and cache sections
Keep handy
Also worth your time
Why CAP only describes partitions, and what PACELC adds for normal operation