Trusted answers to developer questions

Scaling horizontally vs. scaling vertically

Free System Design Interview Course

Many candidates are rejected or down-leveled due to poor performance in their System Design Interview. Stand out in System Design Interviews and get hired in 2024 with this popular free course.

Horizontal scaling means that you can scale by adding more machines into your pool of resources, whereas vertical scaling means that you scaled by adding more power (CPU, RAM) to an existing machine.

This blog post by Abhinav is a fantastic explanation of what these terms mean. Similar to his process of recalling these terms, I see it as follows:

Horizontal Scaling - basically copy & pasting your current setup. You don’t improve the specifications in any way, you just have more of those instances by adding more machines.

Vertical Scaling- you can start with your current set up, but improve on it by adding more features and upgrading the specs.

Scaling Horizontally vs. Scaling Vertically
Scaling Horizontally vs. Scaling Vertically

Whilst Abhinav’s post focuses on databases, this terminology is used in many areas. For instance, one technology I hear scaling talked about a lot is with Kubernetes. This post by Mohamed Ahmed is a great overview of how different scaling methods are used with Kubernetes.

Deciding how to scale

The decision to scale horizontally vs. vertically depends on a number of factors.

With horizontal scaling, you can benefit by keeping your current resources running. A new machine can be brought online independently of the current infrastructure and be added to the resource pool when it is ready. This is not the case with vertical scaling as upgrading the current system will need a period of downtime to apply these changes.

While vertical scaling can benefit from a smaller physical footprint (which in turn may be more environmentally friendly), solely upgrading specs leads to a ceiling on scalability. In contrast, the limits of adding new machines lie more with cost ​than with capacity.

Which is right for you? That depends, but you should take great care when choosing how to scale. In particular, consider the long-term goals and how any decisions in the short-term can affect this plan.

If you enjoyed reading this post, consider reading some of my other definition posts:

If you enjoyed this type of content and would like to see more, feel free to check out my social media accounts:

Twitter: @sdrobertsCode

LinkedIn

GitHub

RELATED TAGS

scaling
resources
upgrading

CONTRIBUTOR

Stephen Roberts
Attributions:
  1. undefined by undefined
Did you find this helpful?