SYSTEM DESIGN
Vertical vs. Horizontal Scaling: Let’s Cook Some Biryani
Open full-size illustration ↗Suppose you’re cooking chicken biryani for five people.
One pot. One stove. Enough food for everyone.
The biryani turns out great. Your friends tell their friends, and suddenly thirty people want a plate.
Your cooking has fans now. Unfortunately, your pot still has the same capacity.
You could make people wait for several batches. But if you want to prepare more food at once, you have two options: upgrade your cooking station or add more stations.
That’s the basic idea behind vertical and horizontal scaling.
Vertical scaling: bring a bigger pot
You replace your five-serving pot with one that holds thirty servings. You upgrade the stove too, so it can handle the larger pot.
There’s still one cooking station, but it can do more work.
In software, this is vertical scaling, or scaling up: giving an existing server more resources.
For example, you might move your application from a machine with 2 CPU cores and 4 GB of RAM to one with 8 cores and 16 GB of RAM.
Same application. A more capable machine.
The resource you upgrade should match the problem. More RAM can help when memory is tight. More CPU can help when processing is the constraint. Larger storage gives you more room for data; faster storage can help with disk access.
A bigger pot helps when pot capacity is the problem. It won’t fix an empty gas cylinder.
Why not keep upgrading forever?
Eventually, you reach the biggest practical setup your kitchen can support, or the next upgrade costs more than you can justify.
Servers have limits too. Vertical scaling is often simpler to manage, but one machine cannot grow indefinitely. Depending on your infrastructure, resizing it may also require a restart.
And if that single cooking station breaks down, a bigger pot won’t keep dinner moving.
Horizontal scaling: add another cooking station
Now sixty people want biryani.
You already have a station that can prepare thirty servings. So you add another stove and another pot of the same size.
With enough ingredients and cooking help, both stations can work at the same time.
This is horizontal scaling, or scaling out: adding more machines or application instances to share the work.
For a web application, you might run the same backend on two servers instead of one. Each server handles a portion of the incoming requests.
You don’t need to split your application into microservices to do this. Two copies of the same monolithic application can also share traffic, provided the application supports running that way.
Two stations need someone to divide the orders
Imagine all sixty orders go to the first station while the second sits there doing nothing.
You’ve bought more equipment, but everyone is still waiting.
A helper who directs orders between the stations solves that problem. In a web application, a load balancer commonly does this job by distributing requests across available servers.
That doesn’t always mean an exact 50–50 split. The distribution depends on the routing strategy, server capacity, and health.
The image uses a load balancer to illustrate this coordination. Other systems can distribute work differently; background workers, for example, can pick up jobs from a shared queue.
More stations bring a little homework
Suppose one station writes orders in its own notebook. A customer walks over to the other station and asks about their order.
“What order?”
Applications can have the same problem. If a user’s login session exists only in one server’s memory, another server may not recognize it.
When running multiple copies of an application, you need a deliberate way to handle shared information such as sessions, uploaded files, and order data.
Horizontal scaling can also help availability: if one application server fails, another healthy one may keep serving requests. But that depends on routing, spare capacity, and shared dependencies staying available.
More servers give you options. Making them cooperate takes design.
Twice the stoves doesn’t always mean twice the output
What if you’re still the only person preparing the chicken?
Both stoves might spend their time waiting for you.
You’ve found a bottleneck: the part of the process that limits the whole system.
Software behaves similarly. Adding application servers may do little if every request is waiting on the same slow database query.
Also, cooking two batches at once increases how much food you can prepare. It doesn’t automatically make either batch cook faster. Likewise, more servers can increase total request capacity without making each individual request faster.
Which approach should you choose?
Start with what is limiting your application today.
| Question | Vertical scaling | Horizontal scaling |
|---|---|---|
| What changes? | Resources available to one machine | Number of machines or instances |
| Kitchen example | Bigger pot and stronger stove | More cooking stations |
| Main attraction | Often simpler to manage | Work can be spread across instances |
| Main challenge | Machine limits and upgrade costs | Coordination and shared state |
You can use both. Upgrade a small server when that solves the immediate problem, then add instances when the workload and application design call for it.
Before scaling, check CPU usage, memory, database queries, and where requests spend their time. Sometimes the right next step is fixing an inefficient query.
Find what’s slowing dinner down. Then decide whether you need a bigger pot, another station, or help preparing the chicken.
Thanks for reading.
Explore more articles