Here are the few questions we always hear when we start designing a system:
- Is it scalable?
- What if the system goes down?
- Is it resilient?
- Can we decouple system components making it extensible?
- how do I integrate intelligent business decisions with this system?
Wowww!!!! For someone who is new to the world of system designing, this sounds like an abracadabra language.
Wait wait wait, It’s not over yet. Do you know about
- Vertical scaling
- Preprocessing and cron job
- Backups
- Horizontal scaling
- Microservices
- Distributed systems
- Load balancer
- Decoupling
- Logging and metrics
- Extensible
Believe me, In this one article and two more following up, we will be looking through all of these with a simple real-world example.
Let’ start!!
Imagine you have a passion for Baking and to pursue it to the next level, you started out a Bakery on your own. Your friends, family, and mutual friends became your client, and swiftly within one month, your Bakery became famous. More orders coming through and you couldn't keep up with the orders.
If you are the manager what will be the first thought which comes to your mind?
Well, If we are the manager the first idea will be to increase the salary, and work time of the employee and hence increasing the throughput of the process. The more the salary, the more happy our employee will be, efficiency will increase and will get our output. This is nothing but Vertical scaling. The ability to handle more requests by increasing the efficiency of the main system is referred as Vertical scaling
But here we are the employee as well, what else can we do? One more solution is to prepare some creams, base crust beforehand in the low traffic time. In general, we will be having fewer orders or no orders between 4 am to 8 am. In the meanwhile time, we can pre-prepare the items to reduce the work in peak hours. This is called Preprocessing and cron jobs in system design terms. The process of preprocessing some work and initiating the cron jobs to minimalize the work done in high traffic hours is referred to as Preprocessing and cron jobs.
Now since our product tastes so good and we deliver every order at the right time, more customers come in and now we really have an issue to work with. We are hiring one Employee who is as passionate as you are to keep the business going. Everything is going well until one day the employee calls you and he is really sick. You are worried about the employee and granted him leave for a week. Now, what will happen to our business? Should we close the Bakery also for a week? Not the best idea, is it?
We can hire a backup employee in this situation for this week. But getting a backup Employee in this city, on such short notice is very difficult. Also the cost we need to spend will be much higher. Taste matters too. So what will be the solution here?
Now since we are aware of the situation, and also learned a lesson the hard way. It is always best to maintain a backup employee. So there won't be a single point of failure. Our business won’t be dependant on a single member in this case. The same applies to system design. On the failure of the main server, we should have a backup server to avoid a single point of failure.
Concepts aren’t different from our real-world scenario, is it? More to come 😊. Stay tuned…