What is Horizontal and Vertical Scaling in System Design? Scale Out vs Scale Up

Difference between Horizontal and Vertical scalability in System design

javinpaul
Javarevisited
9 min readMar 28, 2024

--

image_credit — DesignGuru.io

Hello guys , if you are preparing for System design interviews and looking for common System design interview questions and resources then you have come to the right place.

In the past, I have shared best System Design Courses, books, websites, and best Software architecture courses, as well essential System design topics and tips for interviews and in this article, I am going to answer one of the popular System design question on Scalability, the difference between Horizontal and Vertical scalability.

Along the way you will also learn what they are and how they work.

If you have given Java developer interviews then you may have come across questions like how do you scale your system? In particular how do you scale your Microservices?

This is a great question to ask any experienced Java developers because its not only open ended but it also gives an opportunity to candidate to express themselves and also interviewers to know more about their knowledge, experience, and thought process.

Thanks to my habit of reading blogs and articles, I feel I am little bit more familiar with new concepts and terms compared to my competition.

So, when I was first asked this question on senior Java developer role for a big Investment bank, and I mentioned that there are two ways to scale your application either horizontally or vertically then the interviewer was really impressed because he himself have never heard about the term, even though he may be familiar with the concept and process.

Now, you can say that I got lucky which is true but I was able to make a good impression because I read blogs and articles and I can use buzz words and demonstrate that I understand them.

In this article, I will tell you the exact difference between horizontal and vertical scaling also known as scaling out and scaling up and when to use one over other so that you can impress your interviews.

But before that’s let’s understand what they are and how they work.

By the way, if you are in hurry, and just want to learn System design for interviews then I suggest you go and join either ByteByteGo by Alex Xu, or DesignGuru.io, both of them are great resources to prepare for System design interviews, as well as learn Software design in detail.

What is Horizontal and Vertical Scaling or Scaling Out and Scale Up?

Horizontal scalability, also known as scale-out, scale your system by adding more nodes or servers to distribute the load across them.

Horizontal scaling is achieved by adding more identical machines to the existing system, which allows for better distribution of load and improved redundancy.

This approach allows your system to handle an increased number of requests without overloading individual nodes. Horizontal scaling is particularly useful in case of distributed systems because it provides a cost-effective way to manage fluctuating workloads and maintain high availability.

This was tough say 5 to 10 years ago when you have to manually acquire server and install all the software, create new configuration and deploy your application but now in this age of Cloud Computing and tools like Terraform, Ansible, and Puppet, you can easily add more machine for your application without much fuss.

On the other hand, vertical scalability, also known as scale-up, involves adding more resources (such as CPU, RAM, or storage) to a single node or server to handle increased load.

This approach allows for an increase in the capacity of an existing node, which can handle more requests.

Vertical scaling can help improve the performance of a system by allowing it to handle more workloads on a single node. However, this approach has limitations, as there is a physical limit to the amount of resources that can be added to a single machine, and it can also lead to single points of failure.

So, that was the basic difference, I will show you more difference in a while but if you are preparing for Microservice interview, this is one concept I like you to learn and learn better.

By the way, If you are preparing for System design interviews and want to learn System Design in depth then you can also checkout sites like ByteByteGo, Design Guru, Exponent, Educative and Udemy which have many great System design courses.

You can also use system design cheat sheets like this one from Exponent for quick revision of key System design concepts for interviews.

Difference between Horizontal and Vertical Scaling in System Design

Now, coming back to the topic, Horizontal scalability and vertical scalability are two approaches to scale any system including Microservices to handle increased load or to meet performance requirements.

The main difference between them lies in how they achieve scaling which we have seen in previous paragraph.

Here are some additional points that differentiate horizontal scalability from vertical scalability:

1. Scale up vs Scale out

Vertical scaling means adding more resources to single server while horizontal scaling means adding more instances that’s why vertical scaling is known as scale up and horizontal scaling is known as scale out.

2. Load Balancer

Horizontal scalability requires the use of load balancers to distribute incoming requests across multiple servers, while vertical scalability does not, which is often a deciding factor. If your architecture doesn’t permit load balancing then you only have to scale vertically.

3. Higher Scalability

Horizontal scalability can achieve higher levels of scalability as the number of nodes can be increased almost indefinitely, while vertical scalability has limitations due to the maximum capacity of a single node or server.

4. Architecture Preference

Horizontal scalability is commonly associated with distributed systems, while vertical scalability is usually associated with monolithic systems.

5. Handling Load

Horizontal scalability is more suitable for handling unpredictable or varying loads, while vertical scalability is more suitable for handling predictable loads.

6. Complexity

Horizontal scalability involves adding more nodes or servers to a system in order to handle increased load or traffic. However, horizontal scalability can be more complex to implement than vertical scalability, as it often requires more sophisticated load balancing and coordination mechanisms between nodes.

Additionally, horizontal scalability may not always result in a linear increase in performance, since additional nodes may introduce more overhead or communication delays.

On the other hand, Vertical scalability involves increasing the resources (such as CPU, RAM, or storage) available to a single server or instance in order to handle increased load or traffic.

The main advantage of vertical scalability is that it is often easier and less complex to implement than horizontal scalability, since it involves simply adding more resources to an existing system.

However, vertical scalability may be limited by the physical capacity of the hardware running the system, and may not be able to scale indefinitely.

Additionally, vertical scalability can be more expensive than horizontal scalability, since it often involves upgrading to more powerful or specialized hardware.

7. Example

An example of horizontal scalability is a web application that utilizes a load balancer to distribute incoming requests across multiple web servers. As traffic to the application increases, additional servers can be added to the cluster to handle the additional load.

Similarly, one example of vertical scalability is a database system that uses sharding to partition data across multiple disks or storage devices within a single server.

As the size of the database grows, additional storage devices can be added to the server to accommodate the additional data.

Horizontal or Vertical Scaling? Which one is better for Microservices in Cloud?

In general, horizontal scaling is considered better for microservices in the cloud because it allows you to add more instances of the service to handle increased load.

With horizontal scaling, you can distribute the workload across multiple instances, which helps to ensure that the service remains available even if one instance goes down.

Additionally, horizontal scaling is more cost-effective because it allows you to add resources on an as-needed basis, rather than requiring you to invest in more powerful hardware upfront.

Vertical scaling, on the other hand, can be more expensive and less flexible because it requires upgrading the resources on a single instance to handle increased load.

This approach can result in downtime if the instance needs to be taken offline for maintenance or upgrades, and it may not be sufficient to handle sudden spikes in traffic.

However, vertical scaling can be appropriate in certain situations where the workload is predictable and consistent, and it may be more straightforward to manage a single, more powerful instance than multiple smaller instances.

System Design Interview Preparation Resources

If you are preparing for System design interviews and want to learn System Design in depth then you can also checkout sites like ByteByteGo, Design Guru, Exponent, Educative and Udemy which have many great System design courses.

And, If you need free system design courses you can also see this article which is full of free system design courses.

image_credit — DesignGuru.io

That’s all about What is Scale out and Scale up in System Design, and difference between horizontal and vertical scaling in Microservices. Overall, both horizontal and vertical scalability have their own advantages and disadvantages, and choosing the right one depends on the specific requirements and constraints of the system being developed.

It is often a good idea to start with horizontal scaling and add more instances as needed, while keeping an eye on performance and costs.

Other System Design Tutorials and Interview Resources you may like

Thanks for reading this article so far. If you know any other excellent online resources like websites or programming platforms to learn System Design and Software Designing, especially for beginners, which you think complements these two websites, then feel free to share. Everybody loves great resources and happy learning System design.

P. S. — If you are looking for a best online course to learn System Design in depth then I also suggest you to checkout Frank Kane’s Mastering the System Design Interview course on Udemy. Frank is an ex-hiring manager and know what it takes to crack System design interview of those big FAANG companies .

Alternatively , you can also join Alex Yu’s System Design Interview — An insider’s guide and ByteByteGo for a complete System design Interview preparation.

--

--

javinpaul
Javarevisited

I am Java programmer, blogger, working on Java, J2EE, UNIX, FIX Protocol. I share Java tips on http://javarevisited.blogspot.com and http://java67.com