As a web developer, you may know several ways to increase the scalability of your back-end system. But, as a back-end developer, there are two popular approaches known as scaling horizontally and vertically database.
The main differences among the two are that vertical scaling is usually referred to as ‘scale up’ approach. This approach attempts to increase the capacity of a single machine. There are many options that can be used to increase the capacity. For instance, add more processing power, more storage, more memory, etc. Oppositely, horizontal scaling means to add more machines or set up a cluster or a distributed environment for your software system. Therefore, it will require a load-balancer program. The load-balancer will distribute user requests among the various back-end systems/machines/nodes in the cluster.
By running a copy of software through each of these back-end machines, it is capable of servicing requests. This is just one of the various functions that load balancer may be performing. Moreover, load balancer will also check whether the serves are up and running fine. It works by using the “ping echo” protocol or exchanges heartbeat messages.
To distribute load, load balancer will maintain state of each machine. For instance, how many requests are being served by each machine or which machine is idle. In addition, load balancer will also check if the machine is over-loaded with queued requests etc. Hence, before redirecting the request to an appropriate server machine, the load balancing algorithm will consider such things.
The request-response can also be done in 2 different ways:
- Load Balancer always acts as an intermediary program for every response. So, any response from the server to the user will go through the load balancer.
- Load balancer does not act as an intermediary for the response coming from the server machine. This means once the server has received the request from load balancer, it responses directly to the client. In the other words, it bypasses the load balancer.
However, setting up cluster and load-balancer as a front-end interface to the client application is not enough. You may have many questions related to this approach. For instance, will this affect the overall properties of our system?
We should then make important design decisions by questioning ourselves, developing prototypes, and refining the design.
In conclusion, the differences between the two types are aimed for identifying what suits our requirements. Besides, you can also see if the application really matches with our work/business type.
From the above explanation, horizontal scaling is known as more complex and comes with overhead in the form of cluster setup, management, and maintenance costs. As a result it produces complex design and programming model changes.
So now before buying, you can check whether the requirements can be completed by increasing the capacity. Or is it possible to tune characteristics of a single machine? If it is not possible, you have two or three options as you can combine both of the options.