This content has been automatically translated from Ukrainian.
When the system can no longer handle the increasing load, there are two basic ways to enhance its performance: vertical and horizontal scaling.
At first glance, these are IT terms, but in reality, the principle is very simple and is even found in regular construction.
In short:
Vertical scaling — make one component more powerful.Horizontal scaling — add more identical components.
Vertical Scaling
Vertical scaling (vertical scaling, or scale up) means increasing the power of an already existing component.
For example, we have a server with:
- 4 CPUs;
- 16 GB of RAM;
- 500 GB SSD.
The system starts to slow down. Instead of adding another server, we can install:
- 16 CPUs;
- 64 GB of RAM;
- a faster SSD.
The server remains one, but has become significantly more powerful.
This is vertical scaling.
Construction Example
Imagine a building that needs to withstand more load.
The vertical approach is to strengthen the existing structure:
- use thicker beams;
- increase the cross-section of columns;
- add reinforcement;
- make the foundation stronger.
We are not building a second house. We are making the existing house stronger.
Solar Energy Example
There is a solar system with one 5 kW inverter.
If more power is needed, the vertical approach might look like replacing it with a 10 kW inverter.
Was:
5 kW → 1 inverter
Now:
10 kW → 1 more powerful inverter
The same can be done with a battery: instead of a 5 kWh battery, install a larger one, for example, a 10 kWh battery.
Horizontal Scaling
Horizontal scaling (scale out) works differently.
Instead of making one component more powerful, we add new components.
For example, one server is already operating at its limits.
Instead of upgrading from 4 CPUs to 16 CPUs, we can add three more identical servers.
Was:
[ Server ]
Becomes:
[ Server ] [ Server ] [ Server ] [ Server ]
Each server individually may not be very powerful, but together they can handle significantly more requests.
Construction: Second House
Here, horizontal scaling is also easy to imagine.
Suppose one house is not enough to accommodate people.
The vertical option:
build a taller house or make it bigger.
Horizontal:
build another house.
For example, instead of one large warehouse of 10,000 m², you could have two warehouses of 5,000 m² each.
The advantage of this approach is that if one object fails, the other can continue to operate.
This property is very important in IT.
Solar Energy: More Panels or a More Powerful Inverter?
Here, the difference can be seen particularly well.
Imagine a system:
10 solar panels × 500 W = 5 kW
If we need more generation, there are two options.
Vertical Approach
Install more powerful panels.
For example:
10 × 700 W = 7 kW
The number of panels has not changed, but each has become more powerful.
This is analogous to scale up.
Horizontal Approach
Keep the 500 W panels, but add 4 more:
14 × 500 W = 7 kW
We have approximately the same installed capacity, but increased the number of components.
This is scale out.
Of course, in a real solar system, everything is more complicated: you need to consider string voltage, MPPT, maximum inverter current, roof area, panel orientation, and other constraints.
But the principle remains the same.
IT: The Most Obvious Example
Imagine a website that serves 100 requests per second.
One server is operating at 90% CPU.
Scale Up
We take this server and increase its power:
4 CPUs → 16 CPUs
Now one server can handle, for example, 400 requests per second.
The advantage is that the architecture remains relatively simple.
But there is a problem: the specific server has a physical limit.
You cannot infinitely increase the number of CPUs and RAM.
Scale Out
The other option is to add servers.
For example:
1 server × 100 requests/s
turns into:
4 servers × 100 requests/s = 400 requests/s
A load balancer is placed in front of the servers, distributing requests among them.
For example:
┌── Server 1
│
Users → Load Balancer ── Server 2
│
├── Server 3
│
└── Server 4
If the load increases even more, new servers can be added.
100 → 200 → 300 → 400 → 500 servers...
This is the main strength of horizontal scaling.
What Happens If One Server Fails?
This is one of the most important distinctions.
With vertical scaling, we often have one large point of failure.
Users ↓ [ BIG SERVER ]
If this server fails, the entire system may stop working.
With horizontal scaling:
┌── Server 1
├── Server 2
Users → LB ──┼── Server 3
└── Server 4
If Server 2 fails, the load balancer can stop directing traffic to it.
The other servers will continue to operate.
Therefore, horizontal scaling is often used not only for performance but also for fault tolerance.
But Horizontal Scaling Is More Complex
At first glance, it may seem that scale out is always better.
In reality, it is not.
If we have one server, the application can store data locally:
Application
↓
Local disk
When the number of servers increases to ten, the question arises:
where to store the data?
If a user uploads a file to Server 1, and the next request goes to Server 7 — Server 7 must somehow access that file.
Thus, with horizontal scaling, you often have to add:
- load balancer;
- shared storage;
- separate database;
- cache;
- message queues;
- sync mechanisms;
- monitoring;
- auto-scaling.
That is, we get more capabilities, but also more architectural complexity.
Why Not Use Only Horizontal Scaling?
Because not everything can simply be divided among several machines.
For example, a database may be more complex to scale horizontally than a web server.
If a site has 20 servers, it does not mean that you can just as easily set up 20 copies of the database and achieve 20 times the performance.
Therefore, real systems often use both approaches simultaneously.
For example:
Load Balancer
↓
┌────────────┼────────────┐
↓ ↓ ↓
Server Server Server
└────────────┼────────────┘
↓
Database
↓
Storage
Initially, you can increase the power of individual servers (scale up), and when that is no longer sufficient, you can add new servers (scale out).
The Simplest Analogy
Imagine checkout counters in a supermarket.
If one checkout cannot handle the customers, there are two options.
Vertical Scaling:
make one checkout faster — install a faster scanner, automate payment, etc.
Horizontal Scaling:
open 5 more checkouts.
In the first case, we improve one resource.
In the second, we increase the number of resources.
This difference underlies the concepts of scale up and scale out.
And although the terms are most often encountered in IT, the same principle can be seen literally everywhere: from servers and databases to houses, production lines, and solar power plants.
Like it?React
🧵
This post doesn't have any additions from the author yet.