<aside>

This section is part of the 5-hour System Design Foundations course by Mukul Raina

SLIDE 48: Why Systems Fail Under Load

Section 5: Scaling

Every system works fine with 10 users. The challenge is making it work with 10 million. Scaling is the process of evolving a system’s architecture as traffic grows, and it follows a predictable progression. This section covers two things: the scaling strategies themselves (vertical, horizontal, caching, sharding), and the capacity estimation math that tells you when to apply each one.

What We’ll Cover:

  1. Vertical vs horizontal scaling
  2. The scaling progression from 1 user to 1 billion
  3. Back-of-envelope estimation (QPS, storage, bandwidth)

What Happens When a System Can’t Handle Load:

Stage 1: Slow responses
- Server CPU at 80%+, request queue building up
- P50 response time: 200ms → 2,000ms
- Users notice pages loading slowly

Stage 2: Timeouts and errors
- Server CPU at 95%+, memory pressure
- Some requests time out (504 Gateway Timeout)
- 5-10% of requests fail

Stage 3: Cascading failure
- Database connections exhausted
- Application servers crash and restart
- Load balancer health checks fail, traffic shifts to remaining servers
- Remaining servers now receive even more traffic, fail faster
- Entire system goes down

This progression can happen in minutes during a traffic spike.
The goal of scaling is to ensure you never reach Stage 1.

The Core Principle:

Scaling is not about building for 1 billion users on day one. It is about knowing what breaks next and having a plan for when it does. Over-engineering is as wasteful as under-engineering. The right architecture depends on your current scale and your expected growth rate.

<aside>

Mukul Raina | youtube.com/@mukulraina | slides.mukulraina.com | LinkedIn

</aside>


SLIDE 49: Vertical Scaling (Scale Up)

Vertical Scaling

Vertical scaling means upgrading to a more powerful machine: more CPU, more RAM, more disk, faster network. The application code doesn’t change. You just run it on better hardware.

Example:

Current server (AWS m5.large):
- 2 vCPUs, 8 GB RAM, 500 GB SSD
- Handles: 500 requests/sec
- Cost: $70/month

Upgraded server (AWS m5.4xlarge):
- 16 vCPUs, 64 GB RAM, 1 TB SSD
- Handles: 4,000 requests/sec
- Cost: $560/month

8x the capacity for 8x the cost. Linear cost scaling.