Overview of Scaling: Vertical And Horizontal Scaling

06 Aug, 2020
Given architecture is an example of a client-server based system. In this, there is a client who sends requests to the server and then the client receives a response from the server accordingly but when the number of users/clients increases, the load on the server increases enormously which makes it difficult for the server to perform efficiently and hence becomes slow. Therefore, it is important to make the server scalable in a way such that the server capacity increases according to the increasing traffic without any sort of failure.
It can be defined as a process to expand the existing configuration (servers/computers) to handle a large number of user requests or to manage the amount of load on the server. This process is called scalability. This can be done either by increasing the current system configuration (increasing RAM, number of servers) or adding more power to the configuration. Scalability plays a vital role in the designing of a system as it helps in responding to a large number of user requests more effectively and quickly.
There are two ways to do this : 
Vertical Scaling Horizontal Scaling 
Vertical Scaling 
Horizontal Scaling 
It is defined as the process of increasing the capacity of a single machine by adding more resources such as memory, storage, etc. to increase the throughput of the system. No new resource is added, rather the capability of the existing resources is made more efficient. This is called Vertical scaling. Vertical Scaling is also called the Scale-up approach. 
Example: MySQL  
It is easy to implementReduced software costs as no new resources are addedFewer efforts required to maintain this single system
It is easy to implement
Reduced software costs as no new resources are added
Fewer efforts required to maintain this single system
Single-point failureSince when the system (server) fails, the downtime is high because we only have a single serverHigh risk of hardware failures
Single-point failure
Since when the system (server) fails, the downtime is high because we only have a single server
High risk of hardware failures
When traffic increases, the server degrades in performance. The first possible solution that everyone has is to increase the power of their system. For instance, if earlier they used 8 GB RAM and 128 GB hard drive now with increasing traffic, the power of the system is affected. So a possible solution is to increase the existing RAM or hard drive storage, for e.g. the resources could be increased to 16 GB of RAM and 500 GB of a hard drive but this is not an ultimate solution as after a point of time, these capacities will reach a saturation point.  
It is defined as the process of adding more instances of the same type to the existing pool of resources and not increasing the capacity of existing resources like in vertical scaling. This kind of scaling also helps in decreasing the load on the server. This is called Horizontal Scaling Horizontal Scaling is also called the Scale-out approach. 
In this process, the number of servers is increased and not the individual capacity of the server. This is done with the help of a Load Balancer which basically routes the user requests to different servers according to the availability of the server. Thereby, increasing the overall performance of the system. In this way, the entire process is distributed among all servers rather than just depending on a single server. Example: NoSQL, Cassandra, and MongoDB  
Fault Tolerance means that there is no single point of failure in this kind of scale because there are 5 servers here instead of 1 powerful server. So if anyone of the servers fails then there will be other servers for backup. Whereas, in Vertical Scaling there is single point failure i.e: if a server fails then the whole service is stopped.Low Latency: Latency refers to how late or delayed our request is being processed.Built-in backup
Fault Tolerance means that there is no single point of failure in this kind of scale because there are 5 servers here instead of 1 powerful server. So if anyone of the servers fails then there will be other servers for backup. Whereas, in Vertical Scaling there is single point failure i.e: if a server fails then the whole service is stopped.
Low Latency: Latency refers to how late or delayed our request is being processed.
Built-in backup
Not easy to implement as there are a number of components in this kind of scaleCost is highNetworking components like, router, load balancer are required
Not easy to implement as there are a number of components in this kind of scale
Cost is high
Networking components like, router, load balancer are required
For example, if there exists a system of the capacity of 8 GB of RAM and in future, there is a requirement of 16 GB of RAM then, rather than the increasing capacity of 8 GB RAM to 16 GB of RAM, similar instances of 8 GB RAM could be used to meet the requirements.  
System-Design
Advanced Computer Subject
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
System Design Tutorial
Docker - COPY Instruction
ML | Monte Carlo Tree Search (MCTS)
Getting started with Machine Learning
Markov Decision Process
How to Run a Python Script using Docker?
Basics of API Testing Using Postman
ML | Underfitting and Overfitting
Copying Files to and from Docker Containers
Clustering in Machine Learning