Horizontal vs Vertical Scaling - Which one is better? - System Design
Updated: Dec 8, 2022
Scalability is a well-known problem that is tackled by so many software developers and system architects around the globe. If you are someone who wants to know What is system scaling? Why is system scaling required? Ways to scale a system? Difference between Horizontal and Vertical Scaling? When to use Horizontal and Vertical scaling? - This blog is for you.
Let's dive right in-
Table of contents
Which configuration is better? - Horizontal scaling or Vertical Scaling
1. What is meant by "Scaling a System" or "Scalability"?
Before diving into what is scaling, let's have a look at how a typical system works. It comprises a server having API endpoints exposed for its clients.
Suppose you have a service similar to the one above and you charge users for every request they make. Assume that this service starts becoming popular among users. The number of API requests this server gets starts to increase exponentially. This happens!
There's a limit to the number of requests any server can handle - after all, it's a physical system with limited cores. If the server is flooded with requests above its threshold limit, it will slow down the server, increase the response time of the requests, and can even bring the server down. This means none of the requests will succeed.
As a service provider, you don't want this to happen. You would want that all the requests are served properly. After all, these users are paying you for every request. More request means more profit.
This is where the concept of "Scaling a System" comes in. In software development, Scaling a System refers to the process of upgrading the server configurations to handle much larger loads of traffic and user demands. This "upgrading the server" can happen either by -
adding more servers
by using a bigger server to fulfill the server requests.
When it comes to scaling a system, there are mainly 2 ways to do it - Horizontal Scaling and Vertical Scaling. Let's have a look at both of them:
2. Vertical Scaling
What is Vertical Scaling?
Upgrading the server by replacing it with a bigger server (with more cores/threads etc.) is called vertical scaling. Having a bigger server means it can handle more requests at a faster speed.