Skip to content

// System Design · 07

Horizontal vs Vertical Scaling

Vertical: bigger machineleads toHorizontal: more machines

Grow one thing bigger, or add more of the same thing.

How it fits together

Horizontal vs Vertical Scaling structureVerticalHorizontalApp serverone box, 32 vCPUone failure = outageLoad balancerApp 18 vCPU eachApp 28 vCPU eachApp 38 vCPU eachround-robin
uses / calls
  • Load balancer uses / calls App 1
  • Load balancer uses / calls App 2 (round-robin)
  • Load balancer uses / calls App 3

Spot it

  • Already on the largest instance size
  • The database is the only thing that cannot be cloned
  • Costs jump in big steps

It costs

Up is simple but has a ceiling and a single point of failure; out is limitless but needs stateless design.

Go deeperThe full explanation and what to ask for · 1 min readExpand

Vertical scaling needs no code changes, which is why it is the right first move more often than people admit.

Horizontal scaling needs the work to be divisible: stateless app servers are easy, a relational primary is hard and usually ends in replicas or sharding.

Sticky sessions are a sign of hidden state. They work until the instance holding your user dies.

Ask for it

  • scale up
  • scale out
  • stateless
  • partitioning
  • sticky sessions

Can this workload scale out instead of up? Identify the state that prevents running N instances and propose where to move it.