Q: Why do we need to scale a system, what is Scaling and Scalability?
Answer: When we provide a software solution, inevitably at some point the number of users of that particular product will increase. Putting more pressure of the system in terms of hardware computational limits, size etc on the backend to fulfill the increased demand.
In such situation we definitely need to grow our backend system bigger to be able to meet those requirement. This is called scaling of the system. The effort needed to scale the solution is called Scalability, ie how easy/hard is it to scale the system. Now a well designed solution should be easily scalable.
Q: How do we actually Scale?
Answer: Now that we know what is scaling lets talk about how is it done in the real world software solutions. There are majorly two ways to scale a system. 1. Horizontal scaling 2. Vertical scaling.
1. Vertical Scaling: In this, you basically make your machine bigger, possibly by adding faster CPU, more memory or drive etc. To be able to handle more requests faster. But point is you stick to the same machine.
2. Horizontal Scaling: Here, you simply get one more machine in parallel and have both of the machines handle the requests.
Its like, if you want to lift more weight: You either build muscles to be able to lift that or you ask your friend to help you lift that weight.
Both of these strategies has give and take.
Answer: When we provide a software solution, inevitably at some point the number of users of that particular product will increase. Putting more pressure of the system in terms of hardware computational limits, size etc on the backend to fulfill the increased demand.
In such situation we definitely need to grow our backend system bigger to be able to meet those requirement. This is called scaling of the system. The effort needed to scale the solution is called Scalability, ie how easy/hard is it to scale the system. Now a well designed solution should be easily scalable.
Q: How do we actually Scale?
Answer: Now that we know what is scaling lets talk about how is it done in the real world software solutions. There are majorly two ways to scale a system. 1. Horizontal scaling 2. Vertical scaling.
1. Vertical Scaling: In this, you basically make your machine bigger, possibly by adding faster CPU, more memory or drive etc. To be able to handle more requests faster. But point is you stick to the same machine.
2. Horizontal Scaling: Here, you simply get one more machine in parallel and have both of the machines handle the requests.
Its like, if you want to lift more weight: You either build muscles to be able to lift that or you ask your friend to help you lift that weight.
Both of these strategies has give and take.
Pros and Cons of each approach.
- We need a Load balancer to distribute the load among the horizontally scaled system . Where as this problem doesn't exist in vertical scaling system.
- Horizontally scaled system are Resilient, ie. If one of the box/machine/computer fails due to hardware/software/power failure. other System can take charge to fulfill the requests. Where as in Vertically scaled system its the single point of failure, if your bigger and only machine dies, entire system is down!
- In Horizontally scaled system we have to deal with all of the complications of distributed systems, like data consistency which can be crucial when performing financial transactions etc. Where are in Vertically scaled system, there is only one computer and everything is happening within itself only. So no such challenges.
- Horizontal systems scale further more easily, its simply adding more machines. Vertically scaled systems at some point will reach the hardware limits of being able to handle requests.
So in real world, we use a hybrid solution i.e Buy single bigger machines vertically scaled and then have multiple of them in parallel to Horizontally scale the system!
Leave comments if you liked this read :)