Search

Horizontal VS. Vertical Scaling: Which is Best for You?

Updated: Nov 4, 2020

When you develop a promising product or application, you can expect some traction towards it. Once your application draws significant attention, users expect seamless navigation. However, while seamless navigation is considered standard for trust and ease of use alike, achieving it is not always a simple task. Applications need to handle more demands and requests per minute as users expand. Yet, expansion does not wait for a system update. Thus, if developers do not prepare for this scenario from their project’s conception, the application is bound to fail. Your app performance will decrease, which can result in a reduction in regular users and revenue.


So why should you pay attention to the scalability of your application?


What is Application Scalability?

Application scalability refers to the potential of specific applications to grow in time. Whether it may be in terms of users or demands, whatever it is between the two, an ideal application has to efficiently handle more and more requests per minute (RPM). It is not performed by merely tweaking several buttons around the app or rebooting your device. This process requires a tedious litany of trial and error, involving going back to almost every single item in your stack, including both the hardware and software portions of the app.


When your application encounters issues, you can integrate additional CPUs or increase its memory capacities. This process can alleviate specific problems, but you’re just increasing the throughput, not the application performance. It cannot be as simple as sticking hardware systems when your application decreases performance. Scaling applications is not simple, so it is vital to have a clear understanding of your application.

What is the Difference Between Horizontal and Vertical Scaling?

Now that you understand scalability in applications, you might be wondering about horizontal and vertical scaling.


A significant difference between these approaches boils down to the integrated computing resources to your framework. Vertical scaling indicates that you need to implement additional power to your existing machine. On the contrary, horizontal scaling involves acquiring other resources into your system by adding more machines to your network. This application allows you to share your system’s processing and memory workload with multiple networks and devices.


Here are the advantages and disadvantages of vertical scaling and horizontal scaling for an exact comparison.


Advantages to Vertical Scaling

  • Vertical scaling tends to consume less power in comparison with running multiple servers.

  • Vertical scaling allows you to manage one unified system, which means that the administrative tasks are also minimizable.

  • The operating systems in vertical scaling implement inter-process communication mechanisms to transfer data from one process to another quickly.


Inter-process Communication involves processes interacting together to inform one another of the significant events that occurred. Synchronization between processes is vital to prevent any sort of barriers.

  • Unlike horizontal scaling, this does not need load balancing to redirect servers to one another if one fails.

Load balancing occurs when a balancer redirects the failed request to a new server. This failsafe ensures that the client request is reliable and sent to working servers.

  • Vertical scaling data resides in one system. Therefore, the data stays consistent.

Disadvantages to Vertical Scaling

  • Minimal hardware failure can compromise the entire process resulting in more significant outages.

  • Since vertical scaling runs on one system, the probability of upgrades is slim.

  • Implementing vertical scaling successfully requires large expenses so it can be difficult to utilize prior to an app generating significant revenue.

Advantages to Horizontal Scaling

  • Horizontal scaling is known for its improved resilience. As mentioned, horizontal scaling administers load balancing allowing distribution of load across multiple systems. This implementation will enable them to withstand potential system failure.

  • In comparison to vertical scaling, the process of horizontal scaling costs less.

  • Horizontal scaling is favored by many because they are can easily upgrade with no issue.

  • Horizontal scaling supports linear increases in capacity.

Disadvantages to Horizontal Scaling

  • Different machines manage various requests, which can potentially result in failures related to the synchronization of data.

  • For horizontal scaling to be successful, routers and switches need to be acquired.

Suppose we are going to look at the number of businesses that utilize each type of scaling. Most businesses choose to utilize horizontal scaling for its lower costs and improved resilience to system failure. These businesses also prefer horizontal scaling because the resources needed to complete it are always there.


Unlike horizontal scaling, vertical scaling requires you to take your server offline to scale up to a better one. On the other hand, horizontal scaling allows you to keep your existing computing resources pool as you integrate upgrades. Therefore, horizontally scaling your app provides you both with flexibility and efficiency.


Which One Should You Use?

Ideally, the choice depends on your specific situation and needs. Startups and small enterprises expect to have fewer users and data to accelerate. This expectation makes it ideal for them to vertically scale their app instead of horizontal scaling. In contrast, large businesses require horizontal scaling for their applications. They anticipate massive data and users, which can be efficiently handled by horizontal scaling.


However, there are also a handful of companies that wanted to enjoy the benefits of the two. Simply put, they integrated both systems to have the best of both worlds. They utilize the services of vertical scaling by incorporating exceptional machines when they begin to scale horizontally. This hybrid approach is a combination of the advantages of both vertical scaling and horizontal scaling. This scaling is through the implementation of speed and consistency from vertical scaling and the resilience and infinite scalability of horizontal scaling.

How To Achieve Effective Horizontal Scaling

Here are a few pointers to make your service compatible with horizontal scaling. First and foremost, it is integral to keep the server-side of your application as stateless as possible. Whenever your application has to rely on server-side tracking of what it’s doing at a given moment, that user session is tied inextricably to that particular server. On the contrary, multiple servers can pass session-related specifics situated on the browser-side seamlessly. The ability to pass down a single session (or multiple) across servers interchangeably is the primary essence of horizontal scaling.


Subsequently, you need to look into your squares in your sights. This method allows you to develop your app with a comprehensive service-oriented architecture. You have to make sure that your app is composed of self-contained but interacting logical blocks. The more you make it happen, the more you can scale every block independently. Moreover, this becomes convenient when your user-load demands increase.


Lastly, you must develop your app with independent web, application, caching, and database tiers. This factor is essential to consider if you want your project to be as inexpensive as possible. Without a reliable microservice architecture, you need to scale up every component of your app consistently. This process takes more effort, mainly because the demand levels of services tier tends to get hit the hardest.


Horizontal Scaling for ElasticSearch

What’s exceptional about Elasticsearch is that it allows you to design from the ground up, making it horizontally scalable. This process indicates adding more nodes to the cluster, allowing you to cultivate the same cluster’s capacity. Compared with vertical scaling, it requires you to integrate bigger and more expensive machines to achieve improved quality.


Elasticsearch performs horizontal scalability through sharding the index and assigning these shards to the nodes in a cluster. It utilizes the index located in the internal structure to store documents and efficiently search for them. Similarly, this equates to a book’s index. In this way, every node only needs to manage a portion of the index instead of the full document. Furthermore, Elasticsearch also has the concept of replicas, which are copies of shards. This system allows fault tolerance and redundancy, as well as increased throughput.


Horizontal scaling is ideal for Elasticsearch deployments that require a large amount of data to read. When you horizontally scale, data-nodes are also needed to integrate. These nodes take on the additional workload to make it more manageable.


Horizontal Scaling For Kubernetes

Kubernetes clusters include a built-in Horizontal Pod Autoscaler for seamless and automated horizontal scaling. This process is generally more powerful than vertical scaling, as it lets you customize and implement extensive features for your app.


HPA administers constant monitoring of resource usage across pods of a single deployment. For instances of encountering vanilla Kubernetes clusters, you can lean on CPU utilization. Utilize CPU across pods in single deployment until the average performance goes above the predetermined target. When this happens, you can finally horizontally scale. At the same time, when CPU utilization is below average, the deployment must be scaled down.


In summation, scaling is necessary for every system that anticipates growth at any level. However, when it comes to figuring out whether horizontal scaling or vertical scaling is better, it is best made for a company’s or entity’s specific needs. The volume of daily users, the level of privacy your users and information demand, your budget, and your system’s capacity will dictate whether horizontal or vertical scaling is best for you.


144 views0 comments

Recent Posts

See All