DEV Community

Akshay Kumar
Akshay Kumar

Posted on

System Design - Scaling


What is Scalability?

Number of requests a system can handle simultaneously. For this we can either add more resources to infrastructure or make our current infrastruction advanced.

Scaling is basically increasing the capability of our system to handle large number of requests.

How to scale our system?

Well, there are two ways a system can be scaled —

  1. Vertical scaling
  2. Horizontal scaling

Vertical Scaling —

In vertical scaling, we make our infrastructure bulky hence making it more capable to handle more requests. This can be done by introducing more CPU, GPU, RAM, Disks etc.

Vertical scaling must be the first step to scale a system, because it is less expensive than horizontal scaling and its better to utilise the maximum capacity of current infrastructure.

Vertical scaling is also called Scaling Up.

Horizontal Scaling —

In Horizontal scaling or Scaling out , we add more machines to the current infrastructure. This can be done by adding more servers, databases, load balancers, etc to handle more requests.
Adding a whole new machine is expensive compared to increasing the machine’s capability(Vertical Scaling). So the best way to scale a system is first scaling it vertically and then going to horizontal scaling further.

In case of horizontal scaling, we need a load balancer to forward the requests to other machines.

With horizontal scaling we can enable our application to scale infinitely.

Lets take a scenario where we need to scale our database.

Scaling our Database —

Firstly, we vertically scale our database and make it

Press enter or click to view image in full size


now, we can create read replicas to handle read requests from users.


The primary database here can also be called a master db. Its job is to write the updates to the read replicas.
So the read requests can be served by the read replicas, and write requests by the master node. Hence, not overwhelming the master node with read requests.

If our application is read intensive then this design is fine, if it is write intensive as well, we can create a replica for write db too.

Top comments (0)