System Design: #1 Scaling
Welcome to the article on System Design’s concept: Scaling. Here I am sharing my learnings and understanding on concepts that I got from book called System Design Interview — An Insider’s Guide by Alex Xu.
In this article we will study how we can scale any system from zero to millions of users. Designing a system having support of millions of users is difficult but building a system for only one user should be simple. Let's start with constructing a simple system.
A simple system used for requesting a webpage from web server is shown as follows,
These above diagram helps us understand how the requests flow will be working. Now let us assume we are requesting to load the webpage for only one user, then our system won’t have any issues while executing this job. But with increasing number of users, we might get request timeout or even fail to connect to the server.
There are two types of scaling.
- Vertical Scaling: Vertical scaling is referred as “scale up” which means adding more power (CPU, RAM, etc.) to our servers. Vertical scaling can be a great option to choose if the user traffic is low on webpage but unfortunately it comes with some limitations like, we can’t unlimitedly keep increasing CPU’s or memory in single server. Along with this if the webpage is present in only single server and the server goes down then the webpage will also go down. For these reasons we use Horizontal Scaling.
- Horizontal Scaling: Horizontal scaling is referred as “scale out”, it allows you to scale by adding new servers to the pool of your resources. Horizontal Scaling is more desirable for large scale applications.
Along with using this scaling we can also separate the database task if present in system from the remaining computing part which is running on some servers. i.e., we can have separate servers which perform computation and storing/adding/removing/updating task of database on different server. This will allow the system to scale these two components separately.
That’s all for this article, don’t forget to check the next article on Load balancer, which will help us achieve the goal to allow many users to access the webpage simultaneously.
If you found the article insightful, please don’t forget to follow me on