Patrick Niyongabo

Patrick Niyongabo

hit-or-miss: my miscellaneous projects and random ideas

20 Oct 2021

Vertical Scaling vs Horizontal Scaling

In the several years that I have been dealing with computer systems, the concept of scaling has kept coming up, especially in the last five years as cloud computing went mainstream. Depending on the type of conversation, or the context, scaling has often meant vertical scaling or horizontal scaling - sometimes interchangeably, often leading to confusion on my part. It is mostly my fault though, I should have paid more attention in my CS systems courses.

I am writing this post because I think I have finally found excellent definitions that explain the difference between vertical scaling and horizontal scaling. Out of all places, I found these eye-opening definitions on the MongoDB manual page on “Sharding”!

Below is how they define ‘vertical scaling’:

Vertical Scaling involves increasing the capacity of a single server, such as using a more powerful CPU, adding more RAM, or increasing the amount of storage space.

And this is their definition of ‘horizontal scaling’:

Horizontal Scaling involves dividing the system dataset and load over multiple servers, adding additional servers to increase capacity as required.

Based on these definitions above, you can see why modern distributed systems (cloud databases and other high-traffic systems) have embraced horizontal scaling. With vertical scaling, there is a limit to how much CPU/memory/storage can be added to a DB/compute instance. With horizontal scaling, systems can be built using commodity hardware; you don’t have to use the latest-gen infrastructure, instead you can chain multiple cheap server racks together. The added advantage of using this approach is that horizontal scaling improves the overall health of the system by providing fault-tolerancy in a case some of the instances crash or in a case of a network issue.

With all that said, horizontal scaling has its dis-advantages, the main one being that you will need to implement an efficient (sometimes complex) mechanism for up/down scaling and other related processes (creating and maintaing replicas for example).