Horizontal vs vertical scaling
Two ways to handle more traffic: make the machine bigger, or add more machines. What each one costs, where each one breaks, and why real systems end up using both.
In one sentence
Vertical scaling means a bigger server; horizontal scaling means more servers sharing the work. Vertical is simpler, horizontal goes further.
Two ways to grow
Your app is getting more traffic and the server is at 90% CPU. You can scale up (vertical: more CPU, RAM, faster disk on the same machine) or scale out (horizontal: more machines behind a load balancer).
Move the traffic slider, switch strategies, and kill a server to see what happens to capacity, cost and availability.
Vertical scaling (scale up)
Why it's great
- No code changes: same app, bigger box
- No distributed-system problems: one memory, one disk
- Perfect for databases, which are hard to split
Where it breaks
- There is a biggest machine, and you'll eventually hit it
- Top-end hardware costs more per unit of capacity
- Resizing usually means a restart
- Still a single point of failure
Horizontal scaling (scale out)
Why it's great
- Practically no ceiling: keep adding machines
- Failures only remove a slice of capacity
- Autoscaling: add servers at peak, remove them at night
- Many small machines are cheap
What it requires
- A load balancer in front
- Stateless servers: sessions and files live in Redis, a database or object storage, not in the server's memory or disk
- Dealing with distributed problems: consistency, network failures, deploys across many machines
What real systems do
| Layer | Usual approach |
|---|---|
| Web / API servers | Horizontal: stateless containers behind a load balancer, with autoscaling |
| Cache (Redis) | Vertical first, then a cluster split by key |
| Relational database | Vertical as far as it goes, then read replicas, then sharding |
| Static files and video | Object storage + CDN, which scale horizontally for you |
Netflix runs thousands of stateless service instances that scale out with demand, while each database tier is scaled with its own mix of bigger machines, replicas and partitioning.
Key takeaways
- 01Vertical = bigger machine: simple, limited, single point of failure.
- 02Horizontal = more machines: near-unlimited and resilient, but needs stateless services and a load balancer.
- 03Stateless app servers scale out easily; databases are usually scaled up first.
- 04Most systems combine both, layer by layer.
Check your understanding
1 of 3
What is vertical scaling?
Related concepts
Load balancers
A load balancer is the single entry point that receives every request and forwards it to one of many healthy servers, so no single server is overloaded and failures stay invisible to users.
8 min read →Sharding
Sharding splits one big database into several independent databases (shards), each holding a slice of the rows, so storage and writes scale with the number of machines.
8 min read →AWS Lambda
AWS Lambda runs a function only when an event arrives, scales to many copies by itself and bills per millisecond, but each run is capped at 10 GB of memory and 15 minutes.
8 min read →