Lesson 10 of 16
6. Vertical vs Horizontal Scaling

6.9 So when do you choose which?

3 min read+10 XP

In the kitchen: A new café starts with one good chef. As it grows, it hires more chefs for the cooking, but keeps one carefully run pantry as long as it can, because splitting the pantry is a big, risky job.

In the system: In practice you use both, for different parts:

PartUsual choiceWhy
Web and app serversScale out, at least 2 from day oneStateless, cheap to add, survives failures
DatabaseScale up first, then replicas, shard lastState is hard to split; one big machine goes far
Cache (Redis)Up, then out (a cluster)Simple until memory runs out (Chapter 13)
Background workersScale out on queue lengthEach job is independent

Rules of thumb:

  • Always at least two of anything users depend on, even when one is enough for the load, so one failure isn't an outage.
  • Scale up when it's cheap and quick, especially early and for stateful parts.
  • Design for scale out in the stateless tiers from the start; it costs little to begin with and saves a painful rewrite later.
  • Let the numbers decide (Chapter 2): a few hundred requests a second rarely needs anything clever.

Memory code: "Scale up to start, scale out to grow, and always keep two."