We have the answers to your questions! - Don't miss our next open house about the data universe!

Horizontal Scaling: Definition, features and benefits

- Reading Time: 6 minutes
Horizontal Scaling: Definition, features and benefits

Horizontal scaling consists of adding additional machines to an infrastructure, to adapt to increased demand on an application or website. Find out all you need to know about this scaling method, how it differs from vertical scaling, and its use cases in the cloud or in Data Science!

The success of a site, web service or application depends heavily on the volume of network traffic it can support. It’s not uncommon to underestimate demand, and this can result in server crashes or a drop in quality of service.

In software engineering, capacity planning is essential. Even in the event of an unforeseen traffic peak on an application or website, adequate resources must be in place to support the load.

When demand rises, it’s necessary to increase accessibility, storage capacity and availability levels. However, it can be difficult to choose between horizontal and vertical scaling.

The choice depends on a number of factors, such as the rate of increase in request volume, or the degree of service degradation caused by growth peaks.

It is imperative to take all these criteria into account, as well as the particularities of the application concerned, when selecting the optimum method…

What is scalability?

Scalability is the elasticity of a system. It is often defined as a system’s ability to grow, but also includes its ability to shrink or expand horizontally.

In other words, it’s the system’s ability to adapt to change and demand. This helps to avoid downtime and ensure quality of service.

The scalability of an application is the number of requests it can support simultaneously. Its limit is the point at which the application can no longer support additional requests.

This limit is reached when an essential hardware resource is exhausted. It is then necessary to add additional machines, or opt for different ones.

Resource scaling can include the adjustment of various elements. For CPU and RAM, additional or different machines can be added. Hard disks can be increased in capacity or replaced by SSDs.

Network bandwidth, meanwhile, can be scaled by adding multiple network interface controllers or higher-capacity network interface cards. These different modifications can be combined as required.

Both horizontal and vertical scaling involve adding computing resources to the infrastructure. However, there are major differences between the two approaches in terms of implementation and performance.

What is horizontal scaling?

Horizontal scaling or scaling out is the addition of extra nodes or machines to an infrastructure, in response to a change in demand.

For example, if an application is hosted on a server that no longer has the capacity to handle the traffic, adding a server may be a solution to the problem.

This concept can be compared to distributing tasks among several employees, rather than entrusting all the work to a single person. However, while the advantages are obvious, this approach has the disadvantage of adding complexity to operations. It’s important to clearly define the role of each machine.

Horizontal or vertical scaling: what's the difference?

Horizontal scaling or “scaling out” involves adding more machines to the resource pool. Vertical scaling or “scaling up” is based on adding power to an existing machine, such as RAM or a better CPU.

One of the main differences between these two approaches is that horizontal scaling requires breaking down a piece of sequential logic into smaller parts. The aim is to be able to run them in parallel on multiple machines.

In general, vertical scaling is simpler because the logic doesn’t need to be changed. We simply run the same code on higher-performance machines.

However, there are many other minor differences to consider when determining the right approach, depending on the type of application to be scaled.

In database applications, horizontal scaling is usually based on data partitioning. Each node contains only part of the data. In vertical scaling, the data is on a single node, and cores are added to share the load between the machine’s RAM and CPU resources.

To avoid downtime, horizontal scaling is the best choice, as it avoids being limited to the capacity of a single unit.

Vertical scaling, on the other hand, relies on the capacity of a single machine, and may therefore involve downtime and a maximum limit.

These two approaches also differ when it comes to concurrent programming. In horizontal scaling, distributed programming involves distributing tasks between several machines on the same network. In vertical scaling, concurrent programming on multi-core machines is often carried out using multi-threading.

Sharing or updating data can be more costly in the horizontal mode, since multiple copies of the data need to be transferred. Vertically, multi-threading enables data to be shared within a common space.

Examples of horizontally scaling databases include Cassandra, MongoDB and Google Cloud Spanner. Vertical scaling databases include MySQL and Amazon RDS.

Advantages and disadvantages of horizontal scaling

Horizontal scaling has both advantages and disadvantages. Firstly, this approach simplifies scaling at hardware level. All that needs to be done is to add additional machines to the existing pool, and this eliminates the need to analyze the characteristics of the system to be upgraded.

This model also reduces downtime. To add a machine, it is not necessary to disable the others. Downtime can even be eliminated entirely, and customers are less likely to be impacted.

What’s more, resilience and fault tolerance are increased. Dependence on a single node for all data and operations means a high risk of losing everything in the event of failure. Distribution among several nodes eliminates this danger.

Finally, by using horizontal scaling to manage network traffic, the number of endpoints for connections increases, as the load is delegated between multiple machines. Performance is therefore enhanced.

On the other hand, the complexity of maintenance and operation can increase. It is more difficult to maintain multiple servers than a single machine, and load-balancing and virtualization software is required.

Backing up machines can also become more complex, and nodes need to be synchronized and communicate effectively. Finally, adding new servers is much more expensive than upgrading existing machines.

Scaling to the Cloud

Cloud scaling works in the same way as on-premise scaling. A cloud service provider can implement horizontal scaling based on hyper-converged infrastructure, or choose to use distributed virtual services.

Horizontal scaling relies on the deployment of new infrastructure, while vertical scaling relies on existing infrastructure.

In the cloud, this scalability is mainly achieved through virtualization capabilities on a cloud architecture.

Virtual machines are supported by a physical infrastructure with relatively crystallized characteristics and capabilities. The flexibility offered by VMs simplifies scaling.

For example, existing workloads can be moved to larger or smaller virtual machines as and when required. Applications and workloads stored and processed on these VMs can be transferred to one or more different servers simultaneously.

On most hybrid or private cloud solutions, the cloud provider supports scaling. So the organization’s IT team doesn’t have to worry about hardware requirements in the face of increasing demand.

Service providers like Azure and AWS offer automatic scaling, adapting in real time as demand rises or falls. This makes scaling much more efficient and cost-effective, and is one of the advantages of migrating to the cloud.

How do you choose between horizontal and vertical scaling?

When choosing between horizontal and vertical scaling, it’s important to take several factors into account. Depending on the use case and the constraints to be met, the ideal choice is not always the same.

First of all, in terms of performance, horizontal scaling enables you to combine the power of several machines within a single virtual machine. Performance is therefore not limited to the capacity of a single computer.

However, it is advisable to check whether the resources of a single machine are sufficient before considering scaling. This can help minimize costs.

In addition, horizontal scaling offers greater flexibility in the choice of configuration for optimizing costs and performance. With vertical scaling, a minimum price is defined by the hardware used.

Similarly, horizontal scaling makes it easier to add or modify individual pieces of code without having to temporarily disable the entire system. This approach enables continuous updates. Horizontal scaling also enables greater redundancy, and avoids the dangers of a single point of failure.

Horizontal scaling is mandatory when an application needs to be distributed across several geographical regions or data centers, to reduce latency, comply with regulations or simplify disaster recovery.

Generally speaking, it’s not always wise to choose between horizontal and vertical scaling. Alternating between these two models is often more appropriate. For data storage, for example, it is possible to alternate between a single local disk and a distributed system.

A flexible system on which certain application layers are run on vertically scaling machines and others on a horizontally scaling infrastructure can be difficult to design.

It is necessary to think of it from the outset as a set of decoupled services, and to simplify code transfer. This allows resources to be added as needed without breaking the links between code sets. Partitioning the application and data model also avoids sharing between parallel units.

The horizontally distributed approach is increasingly adopted in the software world, in the face of growing demand for redundancy and the rise of cloud and SaaS environments. Nevertheless, combining it with vertical scaling brings many advantages.

How do I take a Data Science course?

Horizontal scaling is an important concept in data science and data engineering. To master this concept, you can choose DataScientest.

Our training courses will enable you to acquire all the skills required for Data Science professions such as Data Scientist, Data Engineer, Data Analyst or Data Product Manager.

These courses introduce you to Python programming, Machine Learning, databases, CI/CD and automation techniques. Throughout the course, a common thread is a project that allows you to learn by doing.

Our certifying courses enable you to obtain a certificate from Mines ParisTech PSL Executive Education or Paris Dauphine-PSL, and to validate block 3 of the state-approved RNCP 36129 “Project Manager in Artificial Intelligence” certification. You can also obtain Amazon Web Services or Microsoft Azure cloud certification.

All our programs can be completed by distance learning, in continuing education or intensive BootCamp mode. Our organization is eligible for funding options. Discover DataScientest today!

You are not available?

Leave us your e-mail, so that we can send you your new articles when they are published!
icon newsletter


Get monthly insider insights from experts directly in your mailbox