- Learn
- High Level System Design
- Load Balancing and Traffic Management
HLD-M04
Load Balancing and Traffic Management
Spreading traffic across machines and around the world: load balancers, L4 versus L7, balancing algorithms, reverse proxies, global routing and CDNs.
Horizontal scaling only works if something spreads the traffic. This module follows a request from the moment it reaches your edge: a load balancer picks a healthy server and routes around failures, layer 4 and layer 7 balancers trade speed for smarts, algorithms from round robin to power-of-two-choices decide where each request lands, and reverse proxies shield your servers from slow and messy clients.
Then it zooms out to the whole planet: steering users to the nearest healthy region with GeoDNS and anycast, and serving most bytes from content delivery networks at the edge so they never touch your servers at all.
Lessons
- HLD-04.01 What a load balancer does A load balancer spreads incoming requests across a pool of servers so no single server is overwhelmed and capacity can grow by adding servers. Beginner 10 min
- HLD-04.02 L4 vs L7 load balancing A layer 4 load balancer works on TCP or UDP connections and forwards packets based on IP and port without reading the content, which makes it extremely fast. Intermediate 10 min
- HLD-04.03 Load balancing algorithms Round robin sends requests to servers in turn; weighted round robin gives bigger servers more. Intermediate 12 min
- HLD-04.04 Reverse proxies (Nginx, Envoy, HAProxy) A reverse proxy sits in front of servers and handles requests on their behalf: it terminates TLS, compresses responses, caches content, buffers slow clients and pools connections to backends. Intermediate 8 min
- HLD-04.05 Global traffic: GeoDNS, anycast and GSLB Global traffic management sends each user to a nearby healthy region. Advanced 12 min
- HLD-04.06 Content Delivery Networks A CDN is a network of edge servers close to users that caches content from your origin. Beginner 12 min