Stackbook Logo
scalingestablished · medium operational burden

Horizontal vs Vertical Scaling

Also known as: scale-out-vs-scale-up

Intent

Choose between adding bigger machines or more machines to meet growing load.

Problem

A system outgrows its current capacity and the team must decide how to add more. Scaling up is simple but capped and risky, while scaling out demands that the application and data tier tolerate distribution.

Forces

  • •Single machines have hard hardware ceilings
  • •Distribution adds coordination and failure modes
  • •Stateful components are harder to spread
  • •Cost curves differ between large and commodity instances

Solution

Overview

Vertical scaling (scale up) gives one machine more CPU, memory or disk. Horizontal scaling (scale out) adds machines and spreads work among them. Most architectures use both, at different tiers.

How it works

Vertical:    [ 4 vCPU ]  ->  [ 32 vCPU ]            one bigger node
Horizontal:  [ node ]    ->  [ node ][ node ][ node ]   behind a load balancer

Horizontal scaling works when requests are independent. Any instance can serve any request if state lives elsewhere: sessions in Redis, files in object storage, data in a database. The load balancer then distributes by round robin or least connections.

Data is the hard part. Reads scale out through replicas, writes through partitioning, and both need a strategy for routing and rebalancing. Until that is necessary, a single large database with good indexes is often the cheapest and most reliable choice. Modern instances offer hundreds of cores and terabytes of RAM, which postpones distribution for many products.

Amdahl's law applies: if 10 percent of work is serial, no number of nodes gives more than a 10x speedup. Find the serial parts first, such as locks, a single queue or one database primary.

Pitfalls

  • Scaling out a service whose bottleneck is a shared dependency, only moving the queue.
  • Hidden state: in-memory caches, local uploads and sticky sessions.
  • Waiting until the vertical ceiling to plan the horizontal design.
  • Assuming linear gains. Coordination overhead reduces returns.

Key takeaways

  • Scale up for simplicity and stateful cores; scale out for stateless tiers and availability.
  • Remove local state before adding instances.
  • Locate the true bottleneck before choosing.
  • Begin the scale-out design well before the vertical limit.

✓ When to Use

  • •Vertical: early stage or a single-node database with headroom
  • •Horizontal: stateless web and API tiers
  • •Horizontal: workloads that need fault tolerance as well as capacity

✗ When Not to Use

  • •Horizontal scaling of a tightly coupled stateful monolith without redesign
  • •Vertical scaling when already near the largest instance size
  • •Either approach before measuring where the actual bottleneck is

Pros

  • +Vertical is simple and needs no architecture change
  • +Horizontal has no theoretical ceiling and improves availability
  • +Horizontal allows incremental, granular capacity

Cons

  • −Vertical creates a single point of failure and downtime on resize
  • −Horizontal adds network hops, consistency and operational complexity
  • −Large instances are priced nonlinearly

Cost Profile

Infrastructure

Vertical: premium per unit; horizontal: more nodes and balancers

Operational

Medium: horizontal needs fleet management

Cognitive

Medium: distributed state concerns

Failure Modes

  • Vertical resize requires restart and causes an outage

  • Horizontal scaling shifts the bottleneck to the shared database

  • Session affinity or local state breaks when instances are added

Real-World Examples

Alternatives

    Related Patterns

    • load-balancing
    • partitioning
    • read-replica

    Competency Domains

    economics evolutionrequirements constraints