What is Horizontal & Vertical Scaling Made Easy

In this article, lets understand what is horizontal and vertical scaling in distributed computing with example and see which to use.

Scalability, though mostly associated with cloud architectures is a general term.

In vague terms, It means the ability to add or remove power as you require.

Let’s look at it with an example.

Imagine a hotel where you have a single chef serving dishes as ordered. Let’s say he can cater to 10 customers per hour in average, with the ingredients he has.

Imagine there’s a huge rush and the chef is now flooded with so many orders, more than the average he handles.

The chef goes beyond his limit and can’t handle anymore. So the orders are cancelled by the hotel instead of the customers.

In technology, we call this as “Throttling”. Server goes beyond its capacity and so starts refusing the requests. This causes downtime.

How to solve this?

There are two ways to solve:

  • Give the chef a bigger kitchen (ingredients, utensils) to work with so he can cook for more at once OR
  • Give the chef more assistants who can cook along side to serve more orders.

The first approach is called “Vertical Scaling”.

Give your server more power (more cpu, more memory) and expect it to handle better. ↕️

The second is called “Horizontal Scaling”. Add more similar servers, and expect the load be handled by them in parallel. ↔️

Which one is the best?

It basically depends, like in the case of a chef, giving him a better kitchen may not help if himself is exhausted.

Same with the server.

If your application can’t handle, it doesn’t make sense to give it more power and expect to work wonders. This is for Vertical Scaling.

For Horizontal Scaling, it’s beneficial because your application gets normal load but runs multiple copies across multiple servers.

But if your application has any stateful dependencies like sessions, or if multiple servers handle requests on the same entity, there could be issues.

So it depends on the application and the situations.That’s all about Scaling.

If you find it helpful, please do share with your friends 😁


Buy Me A Coffee

Found this article helpful? Please consider supporting!

Ram
Ram

I'm a full-stack developer and a software enthusiast who likes to play around with cloud and tech stack out of curiosity. You can connect with me on Medium, Twitter or LinkedIn.

Leave a Reply

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