Horizontal Scaling & Load Balancing
5 min read
Module Overview
What You’ll Learn
- Distinguish horizontal scaling from vertical scaling, and explain when each applies
- Explain why storing session state in memory breaks horizontal scaling, and why Module 3’s JWTs from Course 3 don’t
- Build a working load balancer, and observe requests distributed across multiple instances
💡 Why this matters: Module 2 ran multiple worker processes on one machine. Horizontal scaling is the same idea, taken further, multiple entire instances, potentially on different machines, with a load balancer deciding where each request goes, this is what actually lets an application handle real growth in traffic.
What’s Covered
- Horizontal versus vertical scaling, adding more instances versus making one instance bigger.
- Statelessness, why an application that stores state in local memory can’t be scaled horizontally without breaking.
- Load balancing algorithms, round robin, and what a real load balancer does beyond just distributing requests.
- Session affinity, the problem sticky sessions solve, and why avoiding the problem entirely is usually the better fix.
Hands-On
By the end of this module, you’ll have built a working load balancer in front of multiple running instances of the same application, and confirmed requests are actually distributed across them.
Next module: observability, actually finding out what a running, scaled application is doing.