System design concepts · Data and storage

Horizontal vs Vertical Scaling

Short answer

Vertical scaling, or scaling up, means giving one machine more CPU, memory, disk or network so it can take more load. Horizontal scaling, or scaling out, means adding more machines and spreading the load across them with a load balancer, partitioning or replication. Vertical scaling is simple because the software does not change, but it has a hard ceiling at the largest machine you can buy, gets expensive near that ceiling, and leaves one machine as a single point of failure. Horizontal scaling has a much higher ceiling and survives the loss of a machine, but it needs stateless services or partitioned data, and it brings network hops, coordination and consistency questions with it. In practice you scale stateless tiers out from the start and scale databases up until you have a reason not to.

Read the video transcript

Your server is running hot. There are two ways out. Make the machine bigger, or add more machines. Scaling up is the simple one. Give the same box more CPU, more memory and faster disks, and the software doesn't change at all. But there's a ceiling: the largest instance you can buy. The price climbs steeply near the top, and it's still one machine. If it fails, everything fails with it. Scaling out adds machines instead. A load balancer spreads requests across identical servers, and when one dies, you only lose a little capacity. Traffic spikes in the evening? Autoscaling adds servers, then removes them when it's quiet. The catch: the servers must be stateless, or the data has to be partitioned. And scaling out moves the bottleneck. Ten times the app servers still share one database, and now that's what saturates. So the usual order is: scale stateless tiers out from day one, scale the database up, add read replicas and a cache, and shard only when writes outgrow one primary.

Horizontal vs Vertical Scaling: comparison table

AspectHorizontal scalingVertical scaling
HowAdd machines and spread the loadMove to a bigger machine
CeilingMuch higher; limited by coordination and shared bottlenecksThe largest instance available
Software changesNeeds stateless tiers, a load balancer, partitioned dataUsually none
Failure behaviorLosing a node reduces capacityThe machine is a single point of failure unless replicated
ResizingAdd or remove nodes live, often automaticallyOften needs a restart or a failover
ConsistencyReplication lag and cross-node coordination to manageOne node, so simple
Good fitWeb and API tiers, caches, sharded stores, stream processorsA relational primary early on, in-memory workloads, small systems

When to use each

Scale out when

  • The service is stateless or can be made stateless.
  • Traffic swings during the day and you want capacity to follow it.
  • One machine failing must not take the service down.
  • Load has grown past what one machine can serve.

Scale up when

  • The component is hard to split, such as a relational primary with many joins.
  • There is clear headroom in larger instance sizes and the cost is acceptable.
  • You need a quick fix while a longer-term partitioning plan is built.
The verdict

Scale out when

The service is stateless or can be made stateless.

Otherwise

Scale up when

The component is hard to split, such as a relational primary with many joins.

The usual order for a database

A common sequence for a growing relational database is: tune queries and indexes, scale the primary up, add read replicas for read traffic, put a cache in front of hot reads, and only then shard. Each step is cheaper to undo than the next. Read replicas are themselves horizontal scaling, but only for reads; every write still goes to one primary.

A staircase: scale the app tier out, the database up, reads with replicas and cache, writes by sharding.

The application tier usually skips all of that and scales out from day one, because stateless servers behind a load balancer are cheap to add and remove.

Horizontal scaling moves the bottleneck

Adding app servers only helps until something shared saturates: the database, a cache shard, a lock, or a downstream API with its own rate limit. When you scale a tier out in an interview, name the next bottleneck before the interviewer does. That is usually the most valuable minute of the capacity discussion.

App servers multiply while the one shared database heats up.
Interview angle

How it comes up in a system design interview

This shows up during estimation. Work out whether the data and the traffic fit on one machine, then decide what has to scale out. Interviewers reward numbers here: storage per day, requests per second at peak, and what a single node can reasonably serve.

Where you will meet it

  • Will the URL mappings fit on one database for five years? If so, why shard at all?
  • The rate limiter runs on many API servers. Where do the counters live so the limit holds across them?
  • Video uploads spike in the evening. How does the transcoding fleet keep up without running at peak size all day?
  • What breaks first when you add ten times more app servers?
How a strong answer sounds
“The API tier is stateless, so we scale it horizontally behind the load balancer and autoscale on CPU. The database holds about a terabyte after five years, which fits on one large primary, so I would scale it vertically and add read replicas for the read-heavy traffic, and only shard if write volume outgrows the primary.”

Common mistakes

  • Sharding by reflex when the numbers show one machine is enough.
  • Scaling the app tier out without checking what it shares, so the database becomes the bottleneck.
  • Ignoring that read replicas do nothing for write throughput.

Frequently asked questions

Which is better, horizontal or vertical scaling?

Neither in general. Vertical is simpler and right until you hit its ceiling or need fault tolerance. Horizontal is required at large scale and for high availability, and it costs more design work.

Are read replicas horizontal scaling?

Yes, for reads. Replicas spread read traffic across machines, but all writes still go through one primary, so write capacity does not grow.

What is autoscaling?

Automatically adding or removing instances, usually based on CPU, request rate or queue depth. It is horizontal scaling run by a controller instead of a person.

What is diagonal scaling?

Combining both: scale each node up to a cost-effective size, then scale out by adding more of those nodes.

Learn and practise

Lessons

Problems where this choice matters

Knowing the trade-off is half of it

Practise saying it under follow-up questions: a timed system design interview with an AI interviewer that probes your choices and grades against a rubric.

Start a mock interview