Unilag_logo

Vertical vs Horizontal Scaling

When designing data architectures, businesses must design their data infrastructures to accommodate increased workloads, user demands, and data volumes. This involves allocating extra resources with increased user engagement and otherwise reducing resource usage. This principle is known as scaling. There are two ways we can decide to approach scaling, these are the horizontal and the vertical scaling. In this article, we will look at these two approaches, their unique characteristics, their advantages and disadvantages, and when it is advisable to use them based on your requirements. 

 

Vertical Scaling

With vertical scaling, resource upgrade happens on a single server. The capabilities of the single server such as its CPU, RAM, storage, etc are improved to handle the increase in demand, this is in contrast to horizontal scaling where multiple servers are used and the workload is distributed across these servers. For example, I have a database that stores my time-series data and as my business grows I see an exponential increase in my data and if my database is left as it is, we won’t be able to store and process these large volumes of data without sacrificing performance. To be able to handle these volumes, I would increase the processing power and increase the storage capacity of a single node on my database. Likewise, I would upgrade my database hardware by adding more RAM, increasing my CPU cores, or opting for a faster storage system than I currently use. I could also decide to partition my database into smaller more manageable parts. We could also decide to use database indexing as it makes it easier to access frequently used data which significantly improves performance on large databases. With its advantages, there are still some limitations it poses. Let’s have a look at some advantages, disadvantages, and use cases it excels in.

 

 

 

5455

Advantages of Vertical Scaling

  1. It is cost-efficient: It is less expensive to implement when compared with horizontal scaling. 
  2. Simplicity: Upgrading hardware components within a single server is easier than configuring and managing a distributed system of multiple servers. 
  3. Immediate performance boost: Adding more CPUs, increasing RAM capacity, or upgrading storage drives provides an immediate boost in performance without the need for a complex reconfiguration. 
  4. Compatible with legacy systems: Vertical scaling is well-suited for legacy systems that are not compatible with distributed architectures, this allows companies to enhance the performance of existing infrastructure without requiring a complete overhaul of their technology stack.

Disadvantages of Vertical Scaling

  1. Finite scalability: Despite the immediate performance benefits, vertical scaling is subject to the physical limitations of hardware components. As the workload continues to grow, there comes a point where further vertical scaling becomes impractical or cost-prohibitive.
  2. Single Point of Failure: Relying on a single server for critical workloads introduces a potential single point of failure. If the server experiences hardware issues or downtime, the entire system may be impacted, leading to service disruptions and data loss.
  3. Cost Implications: Even though vertical scaling can provide a quick fix for performance bottlenecks, and is less expensive short-term, it may not always be the most cost-effective solution in the long run. Upgrading hardware components, especially to high-end enterprise-grade equipment, can incur significant expenses.

Vertical scaling remains a viable strategy for organizations seeking immediate performance enhancements and simplicity in managing their database systems. However, as the demands on infrastructure continue to evolve, it’s essential to carefully evaluate the scalability limits and consider alternative approaches such as horizontal scaling to meet future growth requirements effectively.

 

Horizontal Scaling

With horizontal scaling, data being stored in our databases becomes exponentially large, to handle this increase efficiently, we add a new node, partition, and share the data between the old and the new. The load is distributed across multiple servers. Let’s have a look at individual approaches we could use. We could use sharding, which is a strategy that partitions a large database into distributed pieces called shards. Having these shards distributed across different nodes, our database will be able to accommodate more data and requests. Likewise, we could use a load balancer to help distribute traffic across multiple databases, which would help ensure the workload is evenly distributed across the various nodes. Let’s look at the advantages of horizontal scaling, its limitations, and use cases where it excels.

 

Image source

 

Advantages of Horizontal Scaling

  1. Scalability: Horizontal scaling allows for unlimited scalability by adding additional servers to the system as needed. Hence, it is ideal for applications experiencing rapid or unpredictable growth
  2. High Availability: By distributing the workload across multiple servers, horizontal scaling enhances fault tolerance and ensures our application is always available for use. If one server fails, the remaining servers can continue to handle requests, minimizing downtime and service disruptions.
  3. Cost-effectiveness: Horizontal scaling often utilizes commodity hardware, making it a cost-effective solution for scaling out large-scale applications. Organizations can incrementally add servers based on demand, optimizing resource utilization and minimizing upfront investment.

Disadvantages of Horizontal Scaling

  1. Complexity: Managing a distributed system with multiple servers introduces complexity in terms of configuration, deployment, and maintenance. Ensuring data consistency, synchronization, and load balancing across servers requires careful planning and implementation.
  2. Data consistency: Managing data consistency across distributed servers can be challenging, especially in scenarios where transactions span multiple nodes. Implementing strategies such as distributed transactions or eventual consistency is necessary to ensure data integrity which is often challenging.
  3. Load Balancing: Efficiently distributing incoming requests across multiple servers is crucial for achieving optimal performance and resource utilization. Load balancing techniques such as round-robin DNS, hardware load balancers, or software-based load balancers play a critical role in achieving this, and most times small enterprises lack the skillset for these

Now, that we have a solid understanding of Horizontal and Vertical scaling, its advantages, disadvantages, and use cases we will look at some factors to consider when picking a scaling technique for your project. 

Speed: If speed is a major factor, you’re considering, then it is advisable to go with the vertical scaling system as it is faster when compared to horizontal scaling, since it has a single server and an interprocess communication –  that is, the server communicates within itself and it is fast whereas with horizontal scaling, the network calls two or more servers which are known as the RPC and generally RPCs are slow.

 

Point of failure: Horizontal scaling is generally safer, as it uses more than one server so in an incidence that a server crashes, it has another one to pick up the slack. This means there is no single point of failure which makes the system resilient as opposed to a vertical scaling system that has a single server, so once the server crashes everything goes offline.

 

Large data inflow: If you have a large data inflow with unpredictable growth patterns, it becomes advantageous to use horizontal scaling as with vertical scaling, we would incur a larger cost, and we would get to the point where we can’t scale any further but smaller businesses can make use of vertical scaling as it is optimal for small dataflows. 

 

Conclusion

In this article, we have been able to have a look at horizontal scaling and vertical scaling and as a business, you would know which is more suited to use. Having this background on scaling, in our next article will have a tutorial showing how we can implement scaling in our database, we will also have a use case showing implementation in a document-type database and implementation in a relational database. Till then, have fun!

 

Contact us

Reserve a space