foundations
Scalability — horizontal vs vertical
9 min read
Fully authored
Two ways to add capacity, and why one usually wins at scale.
You need more capacity. Two directions to go: up (bigger box) or out (more boxes). The choice cascades through your whole architecture.
Trade-off matrix
| Dimension | Vertical | Horizontal |
|---|---|---|
| Complexity | Zero | Load balancer, service discovery, stateless design |
| Ceiling | Hardware max (~192 cores today) | Effectively unlimited |
| Cost curve | Super-linear ($10k → $200k per box) | Linear ($100/box × N) |
| Fault tolerance | Single point of failure | N-1 tolerance built in |
| Deploy risk | Bigger blast radius (whole box down) | Rolling deploys, no downtime |
| Best for | Databases (writes), monoliths, legacy | Web tier, workers, stateless microservices |
The senior insight — do both, in the right order
MVP: run monolith on the biggest machine you can afford (vertical). Scale writes are hard. When you hit ceiling: split OFF stateless components + scale them horizontally. Database stays vertical much longer. Sharding is the LAST resort — it changes your data model forever.
Practice what you just read
Every foundation concept has a companion quiz to close the loop.