Horizontal vs Vertical Scaling

Beginner
7 min read· Architecture & Design

Scaling is how a system handles more load. Vertical scaling (scale up) means giving one machine more CPU, RAM, or disk — simple, but capped by the biggest machine you can buy and a single point of failure. Horizontal scaling (scale out) means adding more machines behind a load balancer — near-limitless and fault-tolerant, but it requires stateless services and coordination. Modern cloud systems favour horizontal scaling, often automatically.

Think of a restaurant handling more diners

Vertical scaling is hiring one super-chef who works faster and buying a bigger stove — quick and simple, but there is a limit to how fast one person can cook, and if they call in sick the kitchen stops. Horizontal scaling is hiring more cooks and adding more stations, with a head waiter (load balancer) directing orders. It handles far more diners and survives one cook leaving, but the cooks must share recipes and coordinate.

Step by Step

1 / 5

Key Concepts

Scale Up vs Scale Out

Scale up (vertical) makes one machine bigger; scale out (horizontal) adds more machines. Up is simpler but limited; out is more scalable and fault-tolerant but needs coordination.

Statelessness

Keeping no request-specific state on the server so any instance can handle any request. It is the prerequisite for effective horizontal scaling and load balancing.

Load Balancer

The component that distributes incoming requests across multiple instances. It is what makes many machines look like one service and enables horizontal scaling.

Single Point of Failure

A component whose failure downs the whole system. A single vertically-scaled server is one; horizontal scaling with redundancy removes it.

Key Facts

  • Vertical scaling is the fastest fix in the short term (just resize the box); horizontal scaling is the answer for large, resilient, growing systems.
  • Stateless application servers scale out easily; databases are harder and usually scale reads with replicas and writes with sharding.
  • Horizontal scaling also improves availability — with redundancy, losing one node degrades capacity rather than causing an outage.

Real-World Applications

A growing web API

A stateless API scales out by running more instances behind a load balancer, with autoscaling adding capacity during peak hours and removing it overnight to control cost.

A database under read pressure

Rather than an ever-bigger single database (vertical), teams add read replicas (horizontal read scaling) and, when writes exceed one machine, shard the data across servers.

Frequently Asked Questions

What is the difference between horizontal and vertical scaling?

Vertical scaling (scale up) increases the resources of a single machine — more CPU, RAM, or disk. Horizontal scaling (scale out) adds more machines and distributes load across them with a load balancer. Vertical is simpler but limited and a single point of failure; horizontal is more scalable and fault-tolerant but requires stateless services and coordination.

Why do services need to be stateless to scale horizontally?

Because a load balancer may send each request to any instance, no instance can rely on request-specific data stored locally (like an in-memory session). Statelessness — keeping shared state in a database or cache — lets every instance serve any request, which is what makes adding machines effective.

When should I scale vertically instead of horizontally?

Scale vertically for a quick capacity boost, for workloads that are hard to distribute (some databases or legacy apps), or when you have not yet hit the limits of a single machine. Scale horizontally when you need high availability, elasticity, or capacity beyond what one machine can provide.

How do databases scale horizontally?

Reads scale by adding replicas that serve read traffic while the primary handles writes. Writes scale by sharding — partitioning data across multiple database servers by a shard key. Both are more complex than scaling application servers, which is why databases are often the hardest tier to scale out.

Related Topics