Skip to main content

Command Palette

Search for a command to run...

Scaling

Updated
β€’2 min read
Scaling

When thinking about system design one of the important points that comes into our mind is Scaling. Basically what is scaling?

Imagine a scenario where you have built a product and you got some customers as well. Everything was going well until you got a spike in the number of users and they expect a flawless, perfect application. If you are not prepared for this, the application performance will start degrading, and eventually, you will lose your audience and business. This is a critical problem for you and you want to solve it asap, otherwise, your product will become dead. How do you solve this problem?

  • The scaling of your system is based on several factors more specifically based on the behavior of traffic.

  • If the traffic is increasing gradually(linear growth) or if there is a sudden spike(exponential growth), or if the traffic is only increasing at a specific time, etc.

  • In software engineering, scaling simply means making a system capable of serving more users.

  • We can scale our system in two ways, we can either increase the processing power/size of the resources(like CPU, memory, etc) by purchasing a bigger machine or we can add more resources and use them in parallel. The former is called vertical scaling and the latter is called Horizontal scaling.

Vertical Scaling

  • In vertical scaling, we add more power(CPU, RAM, and DISK) to the existing server(buy a bigger machine). vertical scaling is very easy to achieve, the only thing to do is upgrade our server to have more processing power or memory or both. For example, if you are using an AWS EC2 instance just upgrade it to the next level.

  • The advantage is since we have only one machine to manage don’t need any complex design or architecture here. But there is a limit to vertical scaling, we can’t increase the power of a server beyond a limit, also this will become a single point of failure.

Horizontal Scaling

  • In horizontal scaling, we scale by adding more servers to the system(buying more and more machines) and dividing the load among them. Here the power of individual servers won’t be high but all these servers collectively improve the system throughput.

  • Unlike vertical scaling, there is no limit to horizontal scaling since we can have as many as servers we want and distribute the load among them. But the drawback of this is we need complex design and architecture to work the different machines together and share the traffic between these resources efficiently.


Do you want to connect with me I have started mentoring others for career and interviews at 𝐭𝐨𝐩𝐦𝐚𝐭𝐞.𝐒𝐨/𝐧𝐚𝐯𝐞𝐞𝐧𝐩𝐧

More from this blog

Naveen P.N's Tech Blog

94 posts

Scaling