Vertical vs Horizontal Scaling
You'll learn to
- -Explain scaling up and scaling out using the supermarket-checkout picture
- -Say why vertical scaling is simple but has a ceiling and a single point of failure
- -Say what horizontal scaling needs, and why it also improves availability
- -Choose between the two for a given tier and justify the choice
Tip: the highlighter is on - just select any text below to mark it. Use the highlighter button up top to change color or turn it off. Highlights are saved on this device only. Log in to save them to your account instead.
Your single web server has been fine for months. Then traffic grows: the CPU sits near 95% at peak, pages slow down, and some requests time out. Something has to give, and you have exactly two directions to go: make that one machine more powerful, or add more machines next to it. These are vertical scaling (scale up) and horizontal scaling (scale out), and the choice between them shapes almost every architectural decision that follows.
An Analogy: The Supermarket Checkout
A supermarket has one checkout lane and the queue is out of the door. There are two ways to fix it. You can make the lane faster: a quicker scanner, a longer belt, the best cashier in the chain. That is scaling up. Or you can open more lanes and put someone at the front to point each shopper at a free one. That is scaling out.
- -Making the one lane faster is vertical scaling: more CPU, more memory, faster disks in the same machine. Nothing else in the shop has to change.
- -Opening more lanes is horizontal scaling: more identical servers sharing the work. The person pointing shoppers at lanes is the load balancer, the topic of the next chapter.
- -Shoppers carry their own basket, so any lane can scan any basket. That is statelessness: no lane needs to remember anything about you, so lanes can be opened and closed freely.
- -A lane that breaks stops only its own queue. With a single lane, a breakdown closes the shop.
Scaling Up: A Bigger Machine
Vertical scaling means upgrading what you have: from 4 CPU cores to 64, from 8 GB of memory to 256 GB, from a spinning disk to a fast SSD. Its great virtue is simplicity, because your software does not change. If it ran on one server yesterday, it runs on one server today, only faster. For a quick win, or for a component that is genuinely hard to split (a database is the classic one), it is often the right first move.
It has three limits. First, a ceiling: every machine has a largest size, and once you reach it there is nowhere left to go. Second, cost: the biggest machines are disproportionately expensive, so each extra bit of capacity costs more than the last. Third, a single point of failure: if that one big machine fails, everything stops. Upgrades also usually mean a restart, so scaling up often means downtime.
Scaling Out: More Machines
Horizontal scaling means running many ordinary servers side by side behind a load balancer. There is no practical ceiling (large companies run thousands of servers for a single service), cost grows in step with capacity, and you can add or remove machines as traffic rises and falls, for example scaling down at 3am when nobody is awake.
It also improves availability in a way vertical scaling cannot. With ten identical servers sharing the traffic, one failure leaves 90% of your capacity, so most users never notice. With one big server, one failure leaves 0%. Teams often provision one spare on top of what peak needs (called N+1) so that losing any single machine has no visible effect.
The price is complexity. You now need a load balancer, a way to deploy to many machines, and logs and metrics gathered in one place, since you cannot log in to every server. And, most importantly, your servers must be stateless.
Notice the dependency: horizontal scaling only works cleanly if your logic tier is stateless, which is the exact property HTTP gave you for free back in Module 1. Keep that idea in mind; the next chapter's load balancer and the following chapter's "stateless services" are both direct consequences of this choice.
Choosing Between Them
- -Logic (web and application) tier: scale out. It is the easy case, because these servers can be made stateless.
- -Database: scale up first. Splitting data across machines is difficult and hard to undo (a later chapter covers it), so use a bigger machine and read replicas for as long as that is enough.
- -In an emergency, scale up: it is the fastest relief because nothing needs redesigning. Then use the breathing space to plan the move to scaling out.
- -Plan for the ceiling: if your growth will outgrow the largest machine within a year or two, start the move to scaling out now, not on the day you hit it.
Neither is always right. A sound answer names the bottleneck first, then picks the cheapest move that relieves it.
In one line: scaling up is a bigger lane (simple, but it has a ceiling and one breakdown closes the shop); scaling out is more lanes (no ceiling and better availability, but it needs a load balancer and stateless servers).
Go Deeper
The Wiki card below goes further into scaling up, including what the very largest machines cost:
Make your single server bigger - more CPU, more RAM, faster disk.
Imagine you run a one-person tailor shop. Instead of hiring more tailors, you simply work longer hours and buy a faster sewing machine. You're "scaling up" yourself.
Vertical scaling means increasing the resources of an existing machine. You upgrade your 4-core CPU server to a 64-core monster, boost RAM from 8GB to 256GB, or swap HDDs for NVMe SSDs.
This is the simplest scaling strategy because your software doesn't need any changes. If your app runs on one server today, it still runs on one server after the upgrade - it's just a faster server.
The hard ceiling: every machine has a physical limit. You cannot add infinite CPU or RAM to one box. Once you hit the top-tier AWS r6a.48xlarge (192 vCPUs, 1.5TB RAM), there is literally nowhere to go - and that instance costs ~$10/hour.
Vertical scaling also creates a Single Point of Failure. If that one beefy server crashes, your entire system goes down. No redundancy. For mission-critical systems, this is a disaster waiting to happen.
- -Simple: no code changes, no data partitioning logic.
- -Limited: every machine has a hard physical ceiling.
- -Expensive at the top: high-end servers cost exponentially more for marginal gains.
- -Single point of failure: one server crash = total outage.
- -Downtime during upgrades: you need to halt the server to swap hardware.
And this one covers scaling out, including auto-scaling and the operational costs:
Add more servers instead of making one server bigger.
Instead of one super-fast tailor, you hire 100 ordinary tailors. They split the work between them. If one gets sick, 99 others keep working. That is horizontal scaling.
Horizontal scaling means deploying more instances of your application behind a load balancer, allowing you to distribute traffic across many small servers rather than one giant one.
This is the gold standard for web-scale systems. Netflix, Google, Facebook, and Amazon all scale horizontally - they run millions of commodity servers, not a handful of supercomputers.
The magic word here is statelessness. For horizontal scaling to work, each server must be interchangeable. Any request can go to any server. This means you cannot store session data on the server itself - you must push all state to external storage (Redis for sessions, PostgreSQL for data, S3 for files).
Adding more servers is theoretically infinite. AWS auto-scaling groups can grow from 1 to 1,000 instances in minutes based on CPU or request metrics. You can also remove instances during low-traffic periods (like 3am), cutting costs by 90%.
The downside is operational complexity. Now you need a load balancer, service discovery, distributed logging (you cannot SSH into every server), centralized metrics, and database connection pooling.
- -Theoretically unlimited scale - add as many servers as needed.
- -Requires stateless applications (no local session storage).
- -Introduces a load balancer as the traffic distributor.
- -Enables Zero-Downtime deploys via rolling updates.
- -High availability - losing one server doesn't bring down the system.
- -Cost-efficient via auto-scaling (pay only for what you use).
"Our single database server is struggling. Let's just upgrade it to the biggest instance size available." Good first move?
"Yes, bigger hardware is the simplest fix and avoids any application changes."
"As a short-term bridge, sure: it buys time with zero code changes. But it's a dead end: there's a largest instance size, and you'll hit it eventually. I'd treat it as buying time to build toward a horizontal solution (read replicas, then sharding) rather than the actual fix, especially if growth is fast enough that you'll be back at this ceiling again in months."
What is the essential difference between vertical and horizontal scaling?
Discussion0
Join the Discussion
Sign in to leave comments, reply to others, or like insights.
No comments yet. Be the first to start the thread!