System designInterview preparation
Advanced·Concept·2 min read

Vertical vs horizontal scaling?

Practice this question

Definition:

Vertical scaling adds resources to one machine, while horizontal scaling adds machines and distributes requests or data. Horizontal scaling improves capacity only if work can be shared without losing correct state coordination. Stateless request handlers are easier to spread, but databases, sessions and background work may still need special handling.

Key points:

  • Vertical: give one machine more CPU or memory.

  • Horizontal: add instances and distribute work.

  • Keep request-serving instances stateless; move shared durable state to suitable storage.

  • Doubling app instances also increases possible database connections and dependency traffic; budget shared resources across the fleet.

Interview point:

  • State which tier is being scaled and whether the bottleneck moves to another tier afterward.
Adapted from 07_SYSTEM_DESIGN_ARCHITECTURE.md · “Vertical vs horizontal scaling?”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.