Scale Horizontally vs. Vertically2 min read

Scalability is the process of designing and configuring a system to be expanded and adjusted to meet the requirements when the complexity of a system increases. In other words, scalability means there should be a reasonable way to deal with the system when it grows.

For example, we have a server that handles 1000 requests per day, but a few weeks later, daily, we have roughly 10000 requests. With the current configuration, we run the server on our personal computer. Let’s say we have 16GB of RAM, CPU Intel Core i5, and 500GB of SSD storage. Let’s assume it works pretty fine with 1000 requests per day, but it starts lagging, and our server seems cannot handle all 10000 requests per day together. There are 2 things we can do to cope with the new amount of traffic, either we still use this server and upgrade our existing resources. Hence, we upgrade the CPU to Intel Core i7, increase the amount of RAM to 32GB and replace the physical storage with a 1000GB SSD. We basically don’t add a new server. We only update existing resources our server has. This is called “vertical scaling“. On the contrary, if we keep the existing server and add more servers to handle the traffic, this is called “horizontally scaling“.

With vertical scaling, the benefit it brings to the table is it’s easy to implement and maintain, and also, not much cost is added. However, there are some drawbacks to this approach. It’s not fault-tolerant because when our server dies, there is no resource available to handle incoming requests, the downtime is high, and there is a high disk of hardware failure. These properties lead to a bad user experience.

Horizontal scaling addresses all the drawbacks of the vertical scaling approach because multiple servers are available. If a server dies, the process of serving client requests will not be stopped since servers are available to handle the traffic, so horizontal scaling is fault-tolerant or resilient. With the help of a load balancer, the traffic will be will-dispersed to multiple servers available, which increases the throughput and decreases the latency, hence boosting user experience. In addition, the built-in backup will be available in case of system failure. However, it comes with a price. Of course, horizontal scaling is hard to implement and maintain, the cost is high, and usually, some kind of load balancers are required when your traffic is high.

Every support is much appreciated ❤️

Buy Me a Coffee