Handling growth.
WHAT VERTICAL SCALING IS
A bigger machine.
What it provides: simplicity, and no change to the application.
What it costs: a limit, and a single point of failure.
WHAT HORIZONTAL SCALING IS
More machines.
What it provides: scale beyond one machine, and redundancy.
What it costs: the application must support it, and complexity increases.
WHAT MAKES HORIZONTAL SCALING POSSIBLE
Statelessness: any request handled by any instance.
WHAT TO DO ABOUT STATE
Keep it in shared storage, not in the instance.
WHAT A LOAD BALANCER DOES
Distributes requests across instances, and stops sending to unhealthy ones.
WHAT CACHING ACHIEVES
Avoiding repeated work, which is frequently the largest available improvement.
WHAT TO SCALE FIRST
Whatever is actually the constraint, measured.
WHAT IT USUALLY IS
The database.
WHAT TO DO ABOUT THAT
Indexes, query improvement, read replicas, caching — in that order, usually.
WHAT TO AVOID
Scaling before measuring Designing for scale you do not have
WHY
Most systems never reach the scale their designs anticipate.