In this post
Vertical vs. Horizontal Scaling: Which One to Choose
September 27, 2021
September 27, 2021
In this post
Individuals who work in the tech industry in any capacity would have almost certainly been exposed to the concept of scalability at some point or the other. Scalability in the Information Technology (IT) sector is measured with respect to the ability of applications or systems to handle requests simultaneously.
At the point where the application or system is unable to handle an increase in demand, it is said to have reached the limit of its scalability. Therefore, when system resources are fully occupied, and no free resources are available for further computing, scaling the application or system is the next logical step.
Let's, for a second, assume that your application in its current shape and form is capable of handling a maximum of 'x' number of requests simultaneously. The second the number of requests exceeds this number ('x+1'), critical hardware resources are exhausted, and your application is, therefore, unable to handle the additional requests. This is when scaling comes into the picture.
Scaling is a wide term that refers to the adjustments and adaptations that are made to system hardware resources to enable your business to grow and your application to handle increased traffic and requests. This could be in the form of adjustments to network bandwidth, upgrades to CPU capacity and physical memory, or even basic hard drive alterations. Alternatively, a business can also choose to simply replace existing system infrastructure with bigger, better, and faster options. Based on the approach that you decide to take, your scaling efforts can largely be categorized as either vertical scaling; also known as scaling up, or horizontal scaling; commonly referred to as scaling out. These approaches are discussed in greater detail below.
Vertical scaling or scaling up is a scaling method that involves the upgradation or addition of resources to the existing system infrastructure. Unlike scaling out, vertical scaling does not involve the addition of more machines to the existing resource pool but rather attempts to meet the increased demands by upgrading the resources of the existing system.
Vertical scaling could entail the addition of more processing power by upgrading CPUs, increasing system memory, scaling storage or network speed, and so on. It could also, in some cases, refer to a complete overhaul of the existing infrastructure with the old server being placed with a new and upgraded server capable of handling the increased demands.
Horizontal scaling or scaling out refers to the integration of additional server nodes or machines to your existing system infrastructure. This represents an approach that involves adding more nodes to an existing pool of resources in order to distribute the workload among several servers. A business that wishes to scale out will add one or more new server nodes every time it faces a situation wherein the existing servers are unable to handle the workload.
When you scale out, you are essentially delegating system functions to several units that need to work together in order to achieve the desired results instead of attempting to meet requirements by upgrading or replacing existing infrastructure, which is what vertical scaling entails.
There are several key differences between vertical and horizontal scaling that cannot be ignored while deciding the best scaling model for a particular system or application. Some of them have been described below in detail.
|Vertical Scaling||Horizontal Scaling|
|Databases||In terms of databases, vertical scaling involves multi-core upgradation of the system, and the information continues to remain on a single node.||Horizontal scaling involves the splitting of databases and partitioning of data that allows for information to exist on multiple nodes.|
|Downtime||Vertical scaling involves the upgradation of one machine or system that you are wholly dependent on for functionality. Since each machine has a fixed upper limit, scaling up might involve significant downtime.||Since horizontal scaling involves the addition of server resources to the existing server pool, you are not dependent on one machine or system, which makes it possible to scale with lesser downtime.|
|Concurrency||The workload in vertically scaled systems is usually handled with the help of multi-core machines through in-process message passing and multi-threading of tasks.||The workload in horizontally scaled server pools is distributed among several nodes and servers which requires the constant and concurrent working of the servers.|
|Message passing||Vertical scaling implies a shared address space where all computing resources exist within one system or server. This makes data sharing and message passing easier and less complicated.||Horizontal scaling involves distributed computing which lacks a shared address space. This means that the machines will have to communicate with one another and share data and since this involves copies of information, it could prove to be a costly affair.|
|Examples||Amazon RDS and MySQL||Google Cloud Spanner, Cassandra|
Once a sound understanding of the two scaling models has been achieved, the next step would be to choose one that is best suited for the system in question. While the decision that is made is largely influenced by the nature of the application and expected increase in server load and other such variables, there are three primary factors that need to be kept in mind.
Horizontal scaling or scaling out allows you to combine the computing power of multiple servers and machines into one resource pool. This will no doubt offer a significant and drastic improvement in performance as well as the capacity of your application to handle more requests. At the same time, if your scaling requirements can be fulfilled by a single machine, scaling up or vertical scaling might prove to be a simpler and more efficient choice.
Flexibility with respect to your scalability requirements is important if you are looking to make your expenses and performance more efficient. With vertical scaling, you are at all times bound by the minimum price that is predetermined by the machine that your application is running on which makes flexibility in terms of cost and performance optimization close to non-existent. By scaling out, you might be able to get access to servers that allow you to pay for what you use, which means that there is a lot more flexibility afforded to you to control costs based on your fluctuating server bandwidth needs.
With horizontal scaling or scaling out, you will need to add more servers to work in tandem with your existing ones in order to meet your performance requirements. This is more often than not an expensive affair. With more and more multi-core machines entering the market at lower price points, taking a vertical scaling approach and purchasing a single machine that is capable of fulfilling your requirements might prove to be the more cost-effective option.
Realistically, it is unlikely that you will be able to settle on one scaling model and stick to it perpetually. The needs and requirements of a growing business are liable to change, sometimes quickly and unexpectedly, and therefore, maintaining a level of flexibility that allows for the switching between the two models as and when required would be the smartest option.
Although the industry is slowly shifting to a predominantly horizontal scaling environment due to the flexibility that it offers in terms of optimum resource utilization and because it's cloud/SaaS-friendly, there are two factors to keep in mind that will help you ensure a seamless transition between the two scaling models. These are (a) design system architecture as a decoupled set of services from the get-go; this allows for the easier shifting of the code during scaling and (b) partition your data in such a way that parallel server units do not share any information. Although this requires a considerable amount of extra effort into server management, it offers flexibility and dynamism that is certain to pay off in the long run.
There is close to no business that begins operations without the intention to achieve growth and increased revenue. If a business successfully addresses a need, the chances that it will grow rapidly are extremely high and more often than not, some form of scaling at regular intervals is inevitable. This is why it is necessary for every business and organization to have a clear understanding of the two scaling models and also come to a consensus with respect to which one is more suitable for the functions and services that are being offered to customers and clients.
Both vertical scaling (scaling-up) and horizontal scaling (scaling out) have their pros and cons and there is no straight-jacket formula to determine which one is best suited for your business. The ideal approach, therefore, would be to do a cost-benefit analysis of both models as applicable to your business and then settle on the one that promises to best satisfy your requirements now and in the near future.