Horizontal versus vertical scaling: Which is right for you?
Horizontal scaling helps you scale up to your computing requirements by adding more machines or servers to your resource pool, while vertical scaling helps you do that by adding more power or computing resources (CPU, RAM) to your existing infrastructure.
Vertical scaling can essentially resize your server with no change to your code. It is the ability to increase the capacity of existing hardware or software by adding additional resources. Vertical scaling is limited by the fact that you can only get as big as the size of the server.
On the other hand, horizontal scaling offers the ability to scale wider to deal with traffic. It is the ability to connect multiple hardware or software entities, such as servers so that they work as a single logical unit. However, do note that this kind of scaling cannot be implemented at a short notice. An important advantage of horizontal scalability is that it can provide administrators with the ability to increase capacity on the fly.
Let’s take an easy everyday example to understand this concept better:
Assume you are going on a holiday trip with your team. There are 50 members of your team & your travel agent has sent only one bus having a capacity of 25 passengers. What will you do? For the trip, you need at least 2 buses. What you can do is either you can ask for two buses or you can ask for a double-decker bus which can carry 50 passengers at a time. The conclusion is you need to scale the basic resource (bus). If you choose the option of a double-decker, then it is called ‘Vertical Scaling’ as you haven’t increased the number of buses, but only increased the capacity of a bus. If you opted for two buses then it is ‘Horizontal Scaling’ as you have increased the number of buses (resources).