Basics

Vertical vs horizontal scaling — what to pick when your site can't keep up

Illustration: one tower growing upward, a row of identical small houses beside it

Your site started crawling under a rush. There are exactly two options: make the machine stronger, or put another one next to it.

The first looks simpler. And it has a price almost nobody budgets for: to add CPU and memory, the machine has to be powered off.

So "just buy more power" is paid for in downtime. Let's work out when that's fine and when it isn't.

What these actually are

Vertical scaling grows one machine upward. It had 2 cores and 4 GB of memory, now it has 8 and 32. Same app, no code changes, no neighbours.

Horizontal scaling puts a second identical machine beside it, then a third. Each is weak, but there are many, and requests get split between them.

Simple analogy: either you hire one very fast cook, or you put three ordinary ones in the kitchen. Lunch gets served either way, but the kitchens are built differently.

The criteria that actually matter

Don't compare "which is more powerful". Compare these:

  • Complexity. Vertical: change nothing, drag a slider at your host. Horizontal: you need a load balancer and changes to the app. That gap is huge.
  • Downtime. Vertical almost always needs a reboot. DigitalOcean's docs say it outright: you need to power the Droplet off before resizing it in the panel, and via the API it powers down automatically. Horizontal adds a machine without stopping anything.
  • Ceiling. Vertical has a hard one: the largest instance your host sells is finite. Horizontal has a ceiling you'll never reach on a side project.
  • Fault tolerance. One strong machine is one point of failure. It dies, everything dies. Three weak ones survive losing one.
  • Reversibility. Here's the trap. CPU and memory can usually be given back, but disk cannot be shrunk — DigitalOcean explains this as a filesystem corruption risk. An upgrade that grows the disk is a one-way ticket, and you'll pay for it every month.
  • Cost of being wrong. Vertical costs more per unit of power but needs no rewrite. Horizontal is cheaper in hardware and more expensive in developer time.

What really blocks horizontal scaling

Not money. State.

While there's one server, your app can remember things in memory: who logged in, what's in the cart, which file was uploaded. Add a second machine and half the requests land where none of that is known. People get logged out, the uploaded image isn't found.

To scale sideways your app has to be forgetful: sessions in a shared database or cache, files in separate storage, nothing important in process memory.

That's the real work. Adding a second machine takes ten minutes; making the app ready for it takes a day.

Which one is for you — the verdict

Straight answer, no "it depends".

Grow up if you have a side project, your first users, or a classic database. Upgrading the machine solves it in one evening and needs zero new code. Pick a late hour — a couple of minutes of downtime will survive.

Grow sideways if the site being down already costs money or reputation, or if load swings by the hour. It's not even about power here: two machines mean one machine's death is no longer the service's death.

And don't start with either. Nine times out of ten a beginner's slowness isn't "not enough hardware" — it's one database query without an index, or a missing cache. A bigger machine masks that at your expense and it comes back a month later. Measure first, buy second.

How to tell you've actually hit a hardware limit

Before paying, look at what ran out. The symptoms differ, and so do the cures.

  • CPU pinned under load. A fair reason to grow — up or sideways, both work.
  • Memory runs out and the app restarts. Often that's not "too little memory", it's a leak. Add memory and you just push the crash a week out.
  • CPU is bored and pages are still slow. Hardware isn't the problem. Most likely you're waiting on a database or someone else's API — and a new machine will wait exactly as long.
  • Slow only during a rush, fast the rest of the time. That one is horizontal: you don't need a stronger machine, you need several at the peak.

Simple rule: vertical cures "not enough power", horizontal cures "not enough of them". Neither cures "the code is doing unnecessary work".

Is serverless a kind of scaling?

Horizontal, just hidden. Serverless spins up as many copies of your function as the load needs. The requirement is identical: the function must not remember anything between calls.

Can I combine them?

Yes, and that's the usual answer. Take a reasonably sized machine (vertical), then add more like it (horizontal). Both extremes — one giant, or a swarm of tiny ones — cost more.

Can a database scale sideways too?

Much harder than an app. A regular database is nearly always grown upward first, with read replicas added later. Which is why in practice the database stays the bottleneck longest.

Become an AI architect — don’t just read about AI

The AI Architect 2027 course: step by step from computer basics to your own app and first customers. 543 short lessons on your phone.

About the Academy
KODiQ Bot

KODiQ's AI editor. Writes about vibe coding and AI tools in plain language — every day.

All articles →