Skip to content

Blog

Horizontal and Vertical Scaling: advantages and differences

Aymane Abssi

What is the difference between horizontal and vertical scaling?

Horizontal scaling adds new instances of the system or new servers and spreads the load between them. Vertical scaling increases the processing power of a single instance. The first answers requests that grow in number; the second a load concentrated on one machine that has to bear more.

Do you know the difference between Horizontal and Vertical Scaling? Today we will tell you about these two different technical approaches used to increase the capacity and performance of a system, a topic that falls within the services offered by the dotenv team.

Each has its own advantages and disadvantages, and the choice of which approach to use depends on the specific needs and limitations of the system being developed.

Hardware and software scalability is a fundamental concept in technology and computing. Let’s start from here.

Definition and types of scalability

Scalability is the ability of a hardware or software system to adapt to an increase in demand or workload while maintaining its performance and functionality. A scalable system is able to grow without losing efficiency or quality: it adapts to the user’s growing needs, so as to handle an ever greater number of requests or amount of data without suffering slowdowns or interruptions.

Horizontal and Vertical Scaling: an analysis

Let’s analyse the two types of scalability mentioned earlier. Horizontal scaling consists of adding new instances of the system or of the servers to distribute the workload more efficiently. In this way, more requests can be handled without necessarily increasing the processing power of each single instance. Horizontal scalability is useful above all in contexts where the workload is highly distributed and uneven as, for example, in the case of web applications that handle traffic peaks at certain times of the day.

Horizontal and vertical scaling, dotenv blog

By contrast, vertical scaling consists of increasing the processing power of a single instance of the system or of the server. This kind of scalability is useful when the workload is uniform and concentrated in a single point; as a consequence, it requires greater processing power. Vertical scaling can be achieved by adding more RAM, CPU or GPU to the machine or by replacing the existing hardware with something more powerful.

Let’s look at a practical example to understand the difference between Horizontal and Vertical Scaling better

Suppose your application cannot handle more than n requests at the same time. The critical hardware resources run out as soon as this number exceeds the limit, making it impossible for the program to go on processing requests. At this point it is necessary to scale. Upgrading or adding resources to the current system architecture is known as vertical scaling, also called scaling up. The main difference from horizontal scaling is that the latter increases the number of computers in the resource pool.

Differences between Horizontal and Vertical Scaling

The way in which computing resources are introduced into the infrastructure makes the difference between these two scalability models. By increasing the CPU power or the RAM of the existing machines, vertical scaling (which is used, for example, for scientific applications or image and video processing solutions) gives power to the architecture of the current machine.

Here are some forms of vertical scaling:

  • Adjusting the network bandwidth
  • Upgrades to the CPU capacity and the physical memory
  • Basic changes to the hard disk

However, vertical scaling can involve some difficulties from the point of view of the hardware infrastructure (it can be limited by the maximum capacity of the machine), but also from an economic one (it can be expensive, since it often requires buying more powerful hardware or latest-generation graphics cards). To these is added the risk of having to temporarily stop the system or the service in order to implement the vertical scaling or when there is a need to carry out maintenance and hardware replacement.

Sometimes, however, what helps is not upgrading your own machine by adding an excessive, disproportionate architecture to meet your needs, but rather adding machines. Integrating other server nodes or computers into the current system infrastructure is described as horizontal scaling, or scaling out. It is, therefore, a matter of adding new nodes to an existing resource pool to distribute the load across several servers. This approach can be more cost-effective and allows virtually unlimited scalability. However, it also requires advanced techniques to manage the distributed system and guarantee uniform performance across all the nodes.

What is the best strategy for a company to adopt?

Horizontal and vertical scaling, the differences, dotenv blog

Horizontal and Vertical scaling are two different but complementary approaches, which can be used according to the specific needs of the system or the service. What is fundamental to understand is that resources need to be scaled appropriately if you want the company to expand, stay online and have lower latency. It is important to adopt an effective and reliable scalability strategy, capable of handling the needs of the service dynamically and flexibly, also for reasons to do with search engines (Google can penalise websites that have scalability problems, ranking them lower in the SERP) and SEO (hardware and software scalability can affect the visibility and reputation of a website or an online application).

Resources can be scaled by varying the hard disk capacity, the CPU and physical memory requirements and the network bandwidth: it will not take long to understand that the accessibility, uptime and capacity of an application need to be maintained.

If you have scalability problems, you are in the right place at the right time: the dotenv team takes care of optimising your online business through tailored services.

Book your consultation!

If these topics interest you, we also talk about them out loud.

Nessun Segnale is dotenv’s podcast: 41 episodes, with guests who build software and products.

Frequently asked questions

When is horizontal scaling needed?

When the load has to be spread: instances of the system or servers are added, and simultaneous requests stop depending on a single machine.

When is vertical scaling enough?

When the load concentrates on a single instance and its power can be increased. It has three declared limits: the maximum capacity of the machine, the cost, and the possibility of having to stop the system temporarily.

Do horizontal and vertical scaling exclude each other?

They are different but complementary approaches, chosen according to the specific needs of the system. On the vertical side you act on disk capacity, CPU, physical memory and network bandwidth.