Q16 · What are the signals that a system needs vertical scaling vs horizontal scaling?
Back to 24 Architecture Questions.
The question is not “cloud says scale out”. The axis it turns on: which resource is saturated, and whether the workload can be split at all. Scaling is a direction chosen against a measured constraint; the wrong direction buys hardware and changes nothing.
What the answer should contain
Diagnose the constraint before choosing a direction. CPU, memory, I/O, connections, locks: which one saturates first under load? Scaling out a memory-bound system multiplies the leak; scaling up a CPU-bound system wastes the money a second instance would have spent better. The saturation measurement is the entire basis of the decision.
Splittability is the real question for scale-out. The workload splits if requests are independent, state is shareable or partitionable by key, and no single-writer invariant demands one owner. Stateless services split trivially; stateful ones split only after the state is partitioned or moved out of the request path (session store, cache, database).
Vertical is a legitimate, temporary answer. No code change, minutes of work, and the right move for a state-bound single node or a small load. Its costs are the ceiling (the biggest box exists), the single failure domain, and price growth that stays linear while the box grows quadratically. Buy it knowingly, with a plan for what comes next.
Check the cheaper fixes first. The hot path is usually the problem, not the fleet size: an N+1 query, a missing index, an answer that could be cached, a call that could be async. Scaling is the most expensive fix and it should be last, not first, because it converts a code problem into a permanent bill.
Horizontal needs the ops story to match. A balancer, health checks, deployment automation, and a partitioning plan for whatever state remains. Half of scale-out is code; the other half is the operational machinery that makes N instances cheaper than one big box rather than more fragile than it.
Ideas worth mentioning out loud
- “Scaling is a purchase order signed against a measurement. Without the measurement, it is a donation to the cloud provider.”
- The pattern in the field: scale up to buy time, fix the split, then scale out. Staying on step one is how teams end up paying for the biggest box in the region.
- State is the enemy of horizontal scaling. Every kilobyte moved out of the request path repays itself in instances you no longer need.
Follow-ups to expect
- How do you handle stateful services? Partition by key, or externalize the state to a store whose job is holding it, and keep the service itself stateless.
- Sticky sessions or shared session stores? Shared store; sticky sessions pin load and make deploys fragile.
- Autoscaling? Splittability first, then warm-up time matters: an instance that joins cold is capacity that is not there yet, however many replicas it has.
Red flags in an answer
- Scaling out to fix a slow query.
- Horizontal instances against a memory leak: the leak, times N.
- “We scaled up because it was simpler”, at a load that already needs N+1.
- Nobody can name which resource saturates first.
Sources
- Design to scale out, Microsoft Azure Architecture Center: the platform-vendor version of the argument, notable because it immediately concedes the axis: scale out works when instances are stateless or state is partitioned, which is the splittability condition.
- Designing Data-Intensive Applications, Martin Kleppmann, O’Reilly: the partitioning chapters, for what splitting actually costs once you commit to it.