Horizontal scaling vs vertical scaling: what’s the meaning of those concepts? Choosing the right solution can dramatically improve your performance or cost-effectiveness.
One of the most difficult things in system design and application hosting is trying to estimate the reach of your apps. This might come as a shock, but unfortunately, you can’t predict the future.
The best you can do is project what your future user base and hire computational power based on that projection.
But what if the projection goes wrong?
If you look at the first graph above, you can see that the server is getting overloaded in peak hours. This is highly inconvenient, to say the least.
The opposite case can also be an issue, as in the second graph, when the server is idle a considerable portion of the workday and usually won’t reach optimal usage, creating a situation in which you are paying for unused resources.
Having the ability to allocate more or fewer resources following your actual usage or expected growth is something of great importance. This resource allocation is known as scalability, which can require either horizontal vs vertical scaling.
The best way to scale your infrastructure is what will be addressed in this article, with a special focus on scaling up/out.
Horizontal Scaling vs Vertical Scaling: Advantages and Disadvantages
What is Vertical Scaling?
Vertical scaling (scale-up) is one way to scale, which adds more resources to the existing machine or single node, thus increasing its capacity.
The process of vertical scaling is straightforward and includes upgrading physical components (CPU power, RAM, disk space, or bandwidth) for your server.
In cloud environments, the extension of the resource allocation to that particular build through virtualization software, such as VMware, Red Hat Virtualization, or Oracle VM VirtualBox, would be another way to scale vertically. Software optimization can also be included in this category.
Vertical scaling is especially suited for small and medium-sized companies, whereas horizontal scaling can be better managed for larger enterprise-level organizations.
Advantages of Vertical Scaling
1. Lower Initial Cost
Generally, scaling up or vertically is more cost-effective due to several reasons:
- The hardware in terms of efficiency per unit is cheaper.
- Because there is only one machine, software licensing and implementation is less expensive.
- Maintenance costs, including power, server racks, and cooling is reduced.
2. Interprocess Communication
Communication between running processes within the same node is faster than network communication between machines. The communication path between apps and services is shorter, which translates to a more efficient execution because synchronization and information about events and requests are almost instant, as no external interaction is needed.
3. Data Consistency
Another great advantage of vertical scaling is that the data remains homogeneous. Synchronization and data consistency among nodes is not something to worry about when you have a single machine, which is not the case with horizontal scaling. Data consistency is especially relevant for high concurrency applications that rely on fast communication and applications that need to be synced instantly.
Disadvantages of Vertical Scaling
There are, of course, a few disadvantages to consider when vertically scaling that can be a breaking point.
1. Single Point of Failure
The number one disadvantage of having an application that resides on a single instance is that it represents a single point of failure. If, for some reason, the machine goes down, so does your application.
Hardware failures, corrupted software, malware or other types of malicious targeted attacks, or even physical accidents in the data center can lead to costly downtime, which can be remedied with horizontal scaling.
2. Hardware and Software Limitations
There is a limit to how much hardware can be added to a single machine. It becomes more expensive to reach a certain threshold in terms of cost-performance.
But apart from the economic side of the equation, there are also hardware and software limitations.
For example, if part of your software can’t be parallelized, then adding hardware will not improve execution time, as it will always take the part that can’t be optimized plus the execution time of the rest of the software. This is known as Amdahl’s law.
Because hardware changes are involved, it will, more often than not, translate into downtime. During the provision, the server might need to be shut down to add resources and for the software to recognize the new allocation.
If disk space is increased, another drive might need to be added.
Thus, there is a chance that disk synchronization will take additional downtime until the server is at full operational capacity again.
What is Horizontal Scaling?
Horizontal scaling adds an additional layer of abstraction. Instead of having a single server handling the whole operation, you have a set of multiple nodes forming a distributed network.
Simply put, scaling horizontally is adding more machines, thus creating a pool of interconnected resources.”
The main goal here is that the load can be distributed across the nodes equally. Frequently, this setup includes virtualization software, clustering, and load balancing.
You can create your own private cloud and optimize resource distribution, which is not possible through vertical scaling.
For giant operations and applications with high I/O concurrency, this is the preferred option because the load is distributed, the hardware’s lifecycle is longer, and the degradation is lowered.
Advantages of Horizontal Scaling
Horizontal scalability is a reliable option for those running high-level operations, and it’s the best regarding long-term viability.
1. Resilience and Redundancy
Given the nature of this solution, and because there is no single point of failure, distributed cloud environments or resource pools are resilient to the malfunction of a single instance.
Not only that, the risk of data loss is minimized, as it’s distributed across all nodes within the environment. That minimization is one of the reasons why private clouds are so beneficial to larger businesses and enterprises.
2. Easy to Scale
Since you are adding more power to an existing pool by setting up more machines, downtime is almost non-existent when horizontally scaling. There is virtually no limit in the number of instances that can be added.
Therefore, this option offers unlimited theoretical growth, depending on your infrastructure hardware.
The opposite is also true. If your demand decreases, you can just remove a few machines and are not stuck paying for peak traffic hardware. This is crucial for organizations looking to decrease operational expenditures (OpEx) through horizontal vs vertical scaling with leased or rented server infrastructure.
3. Additional Endpoints
Horizontal scaling provides additional endpoints for client connections. The load is distributed across all nodes, providing a better overall experience, increasing network performance and security, and avoiding heavy usage of the individual components.
Disadvantages of Horizontal Scaling
1. Additional Components
While horizontal scaling offers protection against single points of failure, the fact that there is more than one node can increase the complexity of the maintenance protocol. You will also need to include virtualization software and load balancing for a proper operation.
Due to increased complexity, initial costs tend to be higher when implementing this solution.
The below graph provides a better understanding of how the relationship between cost and performance behaves in each scenario.
2. Network Communication
Communication between processes and routines is deeply involved in your application’s performance. All communication is internal with a single node, which is ideal; however, cloud computing technologies rely on network communication or “Remote Procedure Calls (RPC).“
This protocol has been broadly refined, but regardless, RPC still adds complexity to the structure and is not as efficient as internal communication, which can be relevant in terms of data consistency (continuous synchronization of data between nodes).
Horizontal vs Vertical Scaling: Which Do You Choose?
Horizontal scaling can be useful for big operations and applications with high concurrency, providing distributed load, redundancy, and minimal downtime, among other benefits.
For small and medium-sized businesses, vertical scaling would be the go-to option, as it is a less complex environment, initially cheaper, and provides excellent performance for the price.
Having a private cloud can help you scale both horizontally or vertically, without much hassle.
VMware Private Cloud at Liquid Web
Private Cloud, powered by VMware and NetApp, adds the benefits of a traditional public cloud to the power, performance, and security of an isolated environment on enterprise hardware. See the latest Private Cloud plans at Liquid Web.
About the Author