🎓 A1Learner
🔍

Home / Blog / System Design / Scalability

Horizontal vs Vertical Scaling: Which One, and When

System Design · Scalability · 5 min read

Vertical scaling makes one server stronger, horizontal scaling adds more servers; the right choice depends on state, failure, and growth.

The choice in one picture

Scaling means giving a system more capacity to handle more work. A server is one computer, or one virtual machine, that runs part of a system. Capacity is how much work that server can handle at once.

Vertical scaling makes that one server stronger. Horizontal scaling adds more servers and shares the work between them. The two approaches solve different problems, even though both add capacity.

A server that handled a small shop comfortably can feel crowded when a sale brings many visitors at once. The question is not which method is better in general. The question is what is limiting the system, and what breaks if one part fails.

What vertical scaling changes

Vertical scaling is also called scaling up. It adds processor power, memory, or storage to an existing server. Processor power is the server's ability to run instructions. Memory is fast temporary storage the server uses while it works.

Nothing about the shape of the system changes. The same program runs in the same place, on a larger machine. That simplicity is the main advantage. There is no new server to configure, no traffic to split, and no new way for parts of the system to disagree.

The limits are hard. Every machine has a largest size. Beyond that size, no upgrade is available. An upgrade can also need downtime, which is a period when the system is stopped for maintenance. A bigger server is still one server, so its failure is still a full outage for the work it carried.

What horizontal scaling changes

Horizontal scaling is also called scaling out. It runs the same service on several servers at once. A load balancer sits in front of them and sends each request to one of the servers. A request is one visitor action, such as opening a page or placing an order.

Capacity grows by adding servers, so there is no single largest machine to hit. If one server fails, the load balancer can send work to the others. That redundancy is often the real reason to scale out, even before capacity runs short.

The price is complexity. The service must work correctly when several copies run at the same time. A visitor's session is the remembered state of one visit, such as items in a basket. If that state lives only on one server, a later request sent to a different server will not find it. Shared state must therefore live somewhere every server can reach, such as a shared database or a shared store.

Why the database often decides the answer

Adding web servers is usually the easy half of horizontal scaling. The database is often the hard half. A database is the store that holds the system's lasting records, such as orders and accounts.

Many databases accept writes on one main copy. Adding more servers in front of that database does not add write capacity. It can even add pressure, because more servers send more requests to the same store.

That is why a common pattern is to scale the stateless parts first and the database second. Stateless means a part that holds no remembered state between requests, so any copy can serve any request. A stateless web tier scales out cleanly. A database may instead be scaled up first, given read copies for read-heavy work, or split later when writes truly demand it. Splitting a database, called sharding, divides records across several stores, and it is a larger change than adding a server.

Which one fits which situation

Vertical scaling fits when the workload is steady, the system is small, or the program cannot easily run on several servers. An internal tool used by a small team is an example. A larger machine may solve its problem for a long time, with little extra work.

Horizontal scaling fits when traffic is uneven, growth is open-ended, or the system must stay up while a server fails. A shop facing a short sale is an example. Extra servers can be added for the sale and removed after it, rather than buying one very large machine for a peak that lasts a day.

Three questions help decide. First, what is the bottleneck: processor, memory, storage, or the database. Second, can the service run on several servers without breaking shared state. Third, what happens if one server fails tonight. If the answer to the third question is a full outage, redundancy may matter more than raw capacity.

A practical way to decide

Most systems start vertically, because it is fast and simple. That is a reasonable first step, not a mistake. The signal to change is a ceiling or a risk: the largest machine is near, upgrades need awkward downtime, or one failure would stop the service.

Most growing systems end up using both. Individual servers are sized sensibly, and more of them are added as traffic grows. The database may be scaled up while the web tier scales out. The mix follows the bottleneck in each part, rather than one rule for the whole system.

Scale the part that is actually limiting the work, keep shared state in one reachable place, and protect against a single server failing. A choice made on those three points will hold up better than a choice made on size alone.

Questions readers ask

Is horizontal scaling always better than vertical scaling?

No. Horizontal scaling adds complexity, and it only helps if the service can run on several servers at once. Vertical scaling is simpler and often enough for steady, small workloads.

Does adding more servers always make a system faster?

Not always. If the database is the bottleneck, more web servers only send it more work. The limiting part must be found first, or extra servers add cost without speed.

Why does horizontal scaling need a load balancer?

A load balancer spreads requests across the available servers and stops sending work to a server that has failed. Without it, visitors would still land on one server, and the extra servers would sit idle.

Can a system use both kinds of scaling?

Yes, and most growing systems do. Servers are often sized up to a sensible level, then multiplied. Each part of the system can follow the approach that fits its own bottleneck.