PadhaiTime Logo
Padhai Time

Vertical and Horizontal Scaling

Suppose you have an Ecommerce website where you are selling some products and you get usual/normal traffic on your website. But as your website starts getting popular and a good amount of traffic starts coming to your website, then how are you going to handle this traffic? 

Pause your reading and Think about it?

What we can do is either we can add new machines (Horizontal Scaling) or we can add more CPU and RAM to the existing machines (Vertical Scaling).

This is called Scaling of a System. In simple words “the number of request systems can handle”.

 

There are two categories as mentioned above:

1) Vertical Scaling

2) Horizontal Scaling 

Let us look into both of them in detail:

  

1) Vertical Scaling:

Vertical scaling simply means that adding more resources (RAM/CPU/Disk etc.) to the existing machine (can be called as Node/ Server).

Vertical scaling keeps your existing infrastructure but adds more power to it. That means data lives in the single machine/node and scaling spreads the loads through CPU and RAM resources.

 

2) Horizontal Scaling:

Horizontal scaling simply means adding more machines to the resource pool rather than adding more power to the same machine.

Horizontal Scaling upgrades your existing infrastructure. That means data can be lived in multiple machines and scaling spreads loads through multiple machines.

 

Let us check some basic differences between Horizontal and Vertical Scaling:

 

Vertical Scaling:

  • Load Balancing not required (because we have only single machine) 
  • No data inconsistency Problem
  • Single point of failure  
  • Inter-process communication is used for exchanging useful information between threads in one or more processes
  • Limitation in scaling  
  • Cost tend to be lower 
  • Example Database is MySQL, Amazon RDS 

Horizontal Scaling:

  • Load Balancing is required (because we have multiple machines)
  • Data inconsistency problem
  • No single point of failure 
  • Remote Procedure Call (RPC) is used to exchange useful information between the machines
  • Scales well
  • Cost is relatively higher
  • Example Database is Cassandra, MongoDB

 

Take a look at below image to get better understanding of the architecture:

undefined

 

Now there can be a bigger question, Which is Preferred the most?

Horizontal Scaling is almost always more preferred over Vertical Scaling, because it is more flexible. Although in many cases Hybrid (combination of vertical and horizontal both) is being used.

Bengaluru, India
contact.padhaitime@gmail.com
  • We collect cookies and may share with 3rd party vendors for analytics, advertising and to enhance your experience. You can read more about our cookie policy by clicking on the 'Learn More' Button. By Clicking 'Accept', you agree to use our cookie technology.
    Our Privacy policy can be found by clicking here