Horizontal Vs Vertical Scaling Compare And Guidelines

Today in this article, we will cover the guidelines for Horizontal Vs Vertical Scaling and understand the differences – Horizontal Vs Vertical Scaling.

Today in this article, we will cover below aspects,

Both in the world of Cloud and on-premise infrastructure, As your program grows in popularity, your servers will eventually reach their maximum capacity.

Before you get there, you need to think about how you’ll scale your application or database. Scalability is a broad concept that can be achieved in a variety of ways.

We’ll go through what scalability is, the different types of scaling, and which one you should use in this article.

What is Scalability?

Scalability refers to your Application’s (API or DataBase or UI ) ability to modify its resources to suit changing needs.

The original server resources, such as RAM, CPU, and hard discs, may not be sufficient when a project grows larger or traffic increases.

This is when you should begin scaling your Application database.

Scaling can be done momentarily if you predict a spike in traffic owing to some ad placements, or more permanently if your services’ popularity continues to rise.

In any case, the application/databases can be scaled in one of two ways: horizontally or vertically.

Vertical Versus Horizontal Scaling

Vertical Scaling

Vertical scaling refers to increasing the processing power of a single server or cluster by adding

  • CPU(s)
  • RAM
  • Disk I/O
  • Network I/O

Differences Horizontal Vs Vertical Scaling Horizontal Vs Vertical Scaling
  • Vertical scaling refers to expanding a single server’s or cluster’s processing power.

  • Applications or databases (relational and non-relational) can scale up, but the maximum processing power and throughput will eventually be reached.

  • Additionally, because costs do not scale linearly, scaling up to high-performance technology increases costs.

Example

YAML example with basic scale,

runtime: aspnetcore
env: flex

manual_scaling:
  instances: 1

resources:
  cpu: 1
  memory_gb: 1


YAML example with scale-up using vertical scaling approach.

runtime: aspnetcore
env: flex

manual_scaling:
  instances: 1

resources:
  cpu: 4
  memory_gb: 4

Above we have scaled up the same instance to the large size of CPU i.e 4 and RAM memory in i.e 4 GB

So in a nutshell below are the main highlights of Vertical scaling,

  • Resource Enhancement: In vertical scaling, the existing instance is upgraded with more powerful hardware or resources to handle the increased workload.

  • Scalability: Vertical scaling has limitations in terms of scalability as it relies on the capacity of a single instance. It may reach a point where further resource upgrades are not feasible or cost-effective.

  • Performance Boost: Vertical scaling can provide a significant performance boost to an application by increasing the resources available to a single instance.

  • Simplicity: Compared to horizontal scaling, vertical scaling is simpler to implement as it involves upgrading the existing infrastructure rather than managing multiple instances.

Horizontal Scaling

The technique of adding more servers or application instances to assist distribute the load is known as horizontal scaling, also known as scale-out.

Here instead of adding more hardware to the existing server, you create multiple Servers/Instances/Nodes of the same size typically(instead of moving to a larger instance size.)

Let’s take a simple example of API instances in the Cloud (Google, Azure, AWS)

  • It is easier to distribute the queries around different nodes.
  • Horizontal scaling is typically done through clustering and load-balancing.
  • You add more servers to a cluster and may expect a significant upfront cost but you set to achieve very much linear growth over time thereby reducing the cost of operation.

Example YAML file

runtime: aspnetcore
env: flex

manual_scaling:
  instances: 4

resources:
  cpu: 1
  memory_gb: 1

Above we are adding total 4 instances of the application and each instance is of fixed CPU of 1 and memory of 1 GB to support the on-demand scheduled and predicated traffic.

So in a nutshell below are the benefits of Horizontal scaling,

  • Resource Addition: In horizontal scaling, additional instances are added to handle increased traffic or workload.

  • Scalability: Horizontal scaling offers better scalability as it allows the application to handle a higher volume of concurrent requests by distributing the load across multiple instances.

  • Flexibility: It provides more flexibility in terms of adding or removing instances based on demand. Scaling can be done dynamically, allowing for quick response to changes in workload.

  • Fault Isolation: Horizontal scaling can provide better fault isolation since failures in one instance or component do not impact the availability of the entire system.

Horizontal or Vertical Which scaling is better?

If your application’s needs can be met by a single instance, vertical scaling is the easier, more straightforward option however once the application grows in size with more resource demand, hardware upgrades are just not plausible.

Horizontal scaling has a long-term advantage, whereas vertical scaling is good considering temporary or short-term advantages.

The reason for this is that you can typically add as many servers as you need to your infrastructure, but at some point, hardware upgrades are just not plausible.

However, everything hinges on your application and the use cases you are dealing with!

Most applications require both, as this gives you greater choice in satisfying your application’s throughput requirements.


When workloads surpass the capability of a single instance, horizontal scaling is required. You can typically add as many servers as you need to your infrastructure.

Horizontal scaling also assists in achieving data sovereignty while maintaining low latency in globally distributed systems.

When to Choose Horizontal Scaling:

  • When the workload is distributed and can be handled by adding more instances.

  • When fault tolerance, high availability, and scalability are essential requirements.

  • When the system is designed to be stateless or can handle shared states through external data stores or distributed systems.

  • When a cost-effective solution is needed, as horizontal scaling allows for the use of commodity hardware.

When to Choose Vertical Scaling:

  • When the application requires higher single-threaded performance or relies on the shared state that cannot be easily distributed.

  • When existing hardware can be upgraded to handle increased workload or demand.

  • When the cost of upgrading existing hardware is more feasible than adding multiple instances.

  • When the system can tolerate brief downtime or service interruption during hardware upgrades.

Ultimately, the choice between horizontal scaling and vertical scaling depends on the specific requirements, architecture, and constraints of the system or application.

In some cases, a combination of both approaches may be the most effective solution, leveraging the benefits of each method as needed.

Do you have any comments or ideas or any better suggestions to share?

Please sound off your comments below.

Happy Coding !!



Please bookmark this page and share it with your friends. Please Subscribe to the blog to receive notifications on freshly published(2024) best practices and guidelines for software design and development.



Leave a Reply

Your email address will not be published. Required fields are marked *