Why StreamHub needed a load balancer
At ~20K DAU, StreamHub's single API instance hit connection limits during peak evening viewing. Adding an Application Load Balancer (ALB) in front of four identical pods removed the bottleneck without code changes.
AWS ALB → EKS traffic path
StreamHub production architecture (AWS)
Load balancer responsibilities
- Distribute requests — round-robin, least connections, weighted, or hash-based.
- Health checks — remove unhealthy backends automatically.
- TLS termination — decrypt HTTPS at the edge, forward HTTP internally.
- Sticky sessions — route same client to same backend when needed.
- Path-based routing —
/api/*to API pool,/admin/*to admin pool.
Layer 4 vs Layer 7
| Aspect | L4 (Transport) | L7 (Application) |
|---|---|---|
| Routes on | IP + port | URL path, headers, cookies |
| Awareness | TCP/UDP only | HTTP headers, WebSocket upgrade |
| Examples | AWS NLB, HAProxy TCP mode | AWS ALB, NGINX, Envoy |
| StreamHub | Internal DB proxy (rare) | Public API entry point |
Routes on
L4 (Transport)IP + portL7 (Application)URL path, headers, cookiesAwareness
L4 (Transport)TCP/UDP onlyL7 (Application)HTTP headers, WebSocket upgradeExamples
L4 (Transport)AWS NLB, HAProxy TCP modeL7 (Application)AWS ALB, NGINX, EnvoyStreamHub
L4 (Transport)Internal DB proxy (rare)L7 (Application)Public API entry point
Most HTTP APIs use L7 balancers for path routing and header inspection.
The rest of this guide is part of Pro
Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.
Still to come · 5 sections
- Load balancing algorithms
- Health checks and graceful shutdown
- Sticky sessions
- TLS termination
- Scaling the load balancer itself
Test yourself
Answer these before moving on — recall is what makes it stick.