DEV Community

Cover image for Scaling In System Design
Valentine Samuel
Valentine Samuel

Posted on

Scaling In System Design

As a follow-up to our last post, we are going to be looking at a system design concept called scaling.

Introduction

Imagine that we are organizing a school event like a graduation ceremony and we need to provide seating for all the students, parents and dignitaries. When we started planning the event, we estimated that we will need a certain number of chairs and tables to accommodate everybody. However, as the data of the event draws closer, more and more dignitaries, parents and even ex-students have RSVP'd for the graduation ceremony and it becomes apparent that we would need to increase the number of chairs and tables. We have just succeeded in scaling because we are adding more resources(tables) and chairs to handle the increased seating demand. However, there are two main types of scaling that we will be looking at in this article - vertical and horizontal scaling.

Scaling

The scalability of a system refers to the ability of a system to increase or decrease its computing power depending on the situation. Scalability is important to provide accessibility, availability, reliability, great user experience, power, presence etc. There are two types of scaling- vertical and horizontal scaling.
Vertical Scaling
By adding more resources, like memory, CPU, or disc space, a single node or instance's capacity can be increased. Although this strategy has several drawbacks, it may be utilized to enhance a single node's performance. As the demand for a system continues to grow, it will ultimately reach a point where adding more resources to a single node is no longer practical, and horizontal scaling will be required.

Horizontal Scaling

This entails adding more resources to the system, such as nodes or instances(physical servers), to disperse the load and boost the system's total capacity. A cluster of servers or a cloud-based system's instances may often be expanded to do this. Horizontal scaling has the advantage of allowing the system to withstand substantial increases in demand without requiring significant modifications to the current infrastructure. And this works better than the vertical scaling approach when paired with a load balancer. However, it is important to note that both vertical and horizontal scaling can be combined to maximize performance.

Layers of Scaling

Scaling can occur in different layers of a system. These include

  • Application scaling
  • Database scaling
  • CDN scaling

Application Scaling:

Application scaling is the process of raising an application's capacity and performance in response to rising demand. Adding more computational resources, such as servers or containers, boosting network bandwidth, improving application design, and leveraging caching to increase speed are all examples of how this may be done. The program can handle additional requests by scaling up without getting too busy or going offline.

Database Scaling:

Database scaling involves increasing the capacity and performance of your database system to handle the demands of increasing data volumes or increasing workloads. It adds other database resources such as servers, storage, and memory, optimizes the database architecture, distributes data across multiple nodes and implements database caching to improve query performance. By scaling your database, you can handle more data and queries without being overloaded or experiencing performance issues.

CDN Scaling:

CDN scaling is expanding the capacity and performance of a content delivery network to improve content delivery to end consumers. This can be accomplished by deploying more network resources, such as edge servers or caching nodes, improving network design, establishing load balancing, and employing caching to minimize latency and enhance content delivery. The CDN can handle more requests and provide material faster by scaling it, especially during high usage periods or in geographically separated locations.

Choice of Scaling Technique

This is a subjective decision and there is no right way or wrong way, it depends on the scenario. However, we would go over generic factors:

  • Load Balancing: If you do not intend to add a load balancer, it could be better to scale vertically as there is not more than one server to spread the traffic across.
  • Point of Failure: In a situation where you are experiencing very high traffic requests, it could be more beneficial to scale horizontally so that the other server can pick up if one of the servers crashes for any reason.
  • Speed: The vertical scaling could result in faster operations since the server communicates within itself and does not need to reach out to another service or server
  • Data Consistency: It takes extra work to make sure that data is consistent among all servers at all times if you scale horizontally but in a vertical scaling technique, the data is consistent because there is only one instance of the server
  • Hardware: The vertical system poses a limitation where you cannot scale further than a particular stage because of limited space. For example, you might fill up all the RAM slots and not be able to add more. In this case, the alternative is to scale horizontally.

Conclusion

A good system must be reliable, and available and have high system throughput and low response time. These factors are some of the factors that influence the choice of scaling technique. However, it is important to also know the pros and cons of both scaling techniques as well as the current situation so that you do not end up wasting resources or putting excessive pressure on existing resources that might push them to a breaking point.

Don't forget to leave a like or comment.

❤️❤️❤️

Resume Portfolio Twitter GitHub LinkedIn

Top comments (0)