System Design Concepts ( Part 1 : Horizontal Scaling vs Vertical Scaling )

Horizontal scaling means that you scale by adding more machines into your pool of resources whereas Vertical scaling means that you scale by adding more power (CPU, RAM) to an existing machine.

With horizontal-scaling it is often easier to scale dynamically by adding more machines into the existing pool - Vertical-scaling is often limited to the capacity of a single machine, scaling beyond that capacity often involves downtime and comes with an upper limit.

Lets understand the above concepts with an example :

Suppose if you have a normal bike and you are purchasing new sports bike because you want more horsepower that is vertical scaling because you have upgraded current bike with more better features. .
And if you have one bike and you purchased few more similar kind of bikes then that is horizontal scaling because you have added more similar kind of vehicles to you garage.

Advantage of vertical scaling is that it sports bike give more horsepower but it consumes extra petrol and poor average.Whereas in case of horizontal scaling you features remains the same but you have added more bikes to your garage which you can use at different situation.


Why Horizontal Scaling is  better than Vertical Scaling

When you are changing your bike from normal bike to sports bike in that case you are getting more horsepower but you average will be poor, bike will consume extra petrol. To purchase new sports bike you are selling your old bike , hence you are offline for sometime. There may be situation when  sports bike horsepower does not seems sufficient to you.  Then you will have to upgrade again , following the same process.

Horizontal scaling is almost always more desirable than vertical scaling because you don’t get caught in a resource deficit. Instead of taking your server offline while you’re scaling up to a better one, horizontal scaling lets you keep your existing pool of computing resources online while adding more to what you already have. When your app is scaled horizontally, you have the benefit of elasticity.

Other benefits of scaling out in a cloud environment include:

Instant and continuous availability
No limit to hardware capacity
Cost can be tied to use
You’re not stuck always paying for peak demand
Built-in redundancy
Easy to size and resize properly to your needs

See the below picture to make things more clear for Horizontal and Vertical Scaling:



This is all form my side regarding the horizontal vs vertical scaling . If you have any question , please comment below.


Comments

Popular posts from this blog

Deploy standalone Spring MVC Application in Docker Container

Refactor Code : Separate Query from Modifier

HTTP : Must known Protocol (Part 1)