Horizontal Scaling Vs Vertical Scaling

Mayur Agarwal
4 min readJul 2, 2021

I was understanding the concept for an interview, so I thought why not share what I’ve learned. So, at the end of the blog you’ll have a basic understanding of Scalability, Horizontal and Vertical scaling and differences between them.

Source — Bitpanda

What is Scalability ?

The scalability of an application can be measured by the number of requests it can effectively support simultaneously. When a system can no longer handle more request simultaneously, then it’s limit is reached. Now, we need to provide more resources to the the system, i.e. where scaling comes in. Vertical and Horizontal scaling means adding more computing resources to the present infrastructure.

Horizontal Scaling (scaling out) — means adding more machines to the existing infrastructure to meet the higher expectation.

Vertical Scaling (scaling up)— means adding more computing power to the existing system to meet the higher expectation. Eg. maybe increasing RAM of the system.

Difference between them-

  • Load Balancing —

In horizontal scaling, when there too many requests it’s important to direct those requests to different machines, so that the load on any single machines isn’t too high, otherwise there’ll be no point of horizontal scaling if we kept directing every request to the same machine.

In vertical scaling, there’s no need of load balancing as there we haven’t changed the number of systems, we’ve optimized or increased the processing capacity of the system.

  • Single Point of failure -

In case of horizontal scaling, there’s no single point of failure because there is more than one machine, if one of the server crashes than, the requests will be redirected to the other servers. So it doesn’t affect too much. There requests that were made to the crashed server will now be made on other servers.

In case of vertical Scaling, there’s only one machine, so if the server crashes then, there is no other machines where the requests can be made, so this is the single point of failure. Whole process stops if the server crashes.

  • Database —
Source — Hackernoon

In a database world, horizontal scaling is usually based on the partitioning of data (each node only contains part of the data).

Source — Hackernoon

In vertical scaling, the whole database resides on a single node, and the scaling is done through spreading the load between the CPU and RAM of the machine.

  • Network Calls —

In case of horizontal scaling, all the network calls between the servers (Remote procedure calls) will be over the network, and network calls are slow.

In case of vertical scaling, we have inter-process communication (a mechanism that allows processes to communicate with each other and synchronize their actions) and that’s fast.

  • Hardware limit-

In case of horizontal scaling, upgrades are easier, all you need to do is add an additional node. You can say that, an infinite number of nodes can be added.

In case of vertical scaling, there is limited scope for upgrades. A server can only be so big. What happens when your database can no longer fit on the largest available server?

  • Complexity —

In case of horizontal scaling, there is massive increase in complexity, as we now have other additional things to focus on, like load balancing, network calls between different servers, etc. So the chances of bugs also increase. So management of overall infrastructure becomes more complex.

In case of vertical scaling, it is easier to implement and administer , there’s a single server to manage, and that’s it. So we just have to focus on maintaining a single server.

  • Examples —

For horizontal scaling — MonogoDB, Cassandra and Google Cloud Spanner.

For vertical scaling — MySQL, AmazonRDS.

When choosing between the two, these are some points to focus on —

  • Performance — Horizontal scaling allows you to add the power of multiple powerful machines in one. But you should first check that whether a single machine meets your scalability needs.
  • Redundancy — In vertical scaling, there can be a problem like single point of failure. But horizontal scaling offers built-in redundancy.
  • Cost — large multi-core machines will still be cheaper then buying multiple machines, consider if the application can be usefully packaged in a single box and will meet your performance and scalability goals.
  • Complexity — If its easy and practical for you to use a single machine, and your application can work fine on a single machine, then buying multiple machines will only make things complex.
  • Flexibility — If you want the flexibility to choose the optimal configuration setup at any time to optimize cost and performance, scaling out might be a better option.

I hope this article helped you. 😃 👏

Also read about the topic on StackOverflow, if you want to know more about the topic.

If you have any suggestions, then please let me know. 🙌

--

--