DEV Community

loading...

Horizontal scaling Vs vertical scaling

Saran Chakravarthi
Updated on ・2 min read

Hello Devs, in this article I'll walk you through the differences between horizontal and vertical scaling.

What is scaling?

Let's say, you have developed an application and it is gradually getting traction. The user base is growing and the users are loving your app. Great!

The user base has grownup to a point where your system can't handle that much load. Not so cool. You don't want to disappoint your users, do you? You'll probably try to upgrade your system so that it can handle heavy load. You have two options:

  1. Buying more machines
  2. Buying a bigger machine

There you have it. Scaling may be defined as the process upgrading your existing system to handle more load.

Horizontal scaling:

It is the process of buying more machines.

Hmm.. if we have more than one machine, how do we make sure that the load is spread equally among the machines? That's where load balancers come into play. Load balancers make sure that the traffic is distributed equally among the servers.

Advantages:

  • Since we can buy as many machines as we want, we can say that horizontal scale scales well as the users increase.

  • Even if one of the servers goes down, other working servers can handle the request. Hence it is resilient.

Disadvantages:

  • Load balancing is required.

  • Servers communicate with eachother through network calls.

  • As we use more than one machine, it may lead to data inconsistency.

Vertical scaling:

It is the process of buying a bigger machine.

Advantages:

  • Load balancer is not required.

  • We use only one machine, hence the data is consistent.

  • The communication happens through interprocess communication, no network calls needed.

Disadvantages:

  • Single point of failure. Since we have only one machine, if it goes down the entire system will stop working.

  • Eventually we will reach the hardware limit.

Thanks for reading! I hope this article helped you. Want to connect with me? my DM is open on dev.to, you can connect with me on twitter.

Discussion (0)