System Design Architecture -III

Aarthi K
4 min readJan 15, 2022

Hi all, today we will be continuing with our System Design Architecture and also the last blog on primer. If missed the last two parts, please feel free to check out the below links:
Part I: https://aarthikannan2103.medium.com/system-design-architecture-i-5ee4f2c48c6e
Part II: https://aarthikannan2103.medium.com/system-design-architecture-ii-7a19a0a20dbc

Now we have two different Bakery and the business is going well. We are routing the orders between these two shops. Every time a customer makes a request, we have to route the order between these two shops. But how are we going to do that?

The output we need is, the order should be delivered to the customer as soon as possible. So here the parameter we have to set for routing the order is the total time taken. This includes queue time+ make time+delivery time. When we receive the order we have to calculate which shops here will have the less total time and route according to it.

Let's go with an example, We received an order from a customer at peak time, now we are analyzing what might be the total time for that order to reach the customer.

Analysis:

Since shop 1 is so famous and in the center, the Queue time is much higher here at peak time. Shop 1 Queue time is 1 hour, It takes 10 min to make, and shop 1 is near the customer’s address, so the delivery time will be 10 min. The total time for shop1 to deliver the order is 1 hour+10 min+10 min = 1 hour 20 min.

On the other hand, shop 2 Queue time is much lesser than shop 1 Queue time at peak time. Shop 2 Queue time is 30 min, it takes 15 min to make, and shop 2 is far from the customer’s address, so the delivery time will be 20 min. The total time for shop 2 to deliver the order is 30 min+15 min+20 min = 1 hour 5 min.

When we want to make a decision here, shop2 will be the right choice now. So we will route the order to Shop 2. Depending on the time of order, the decision will vary. Who will make these decisions? We need a smart system to make Intelligent Business Decisions. Here comes our Load Balancer. In System Design, load balancing refers to the process of distributing a set of tasks over a set of resources, with the aim of making their overall processing more efficient. Load balancing can optimize the response time and avoid unevenly overloading some compute nodes while other compute nodes are left idle.

Load Balancer

Now we have in-house delivery persons to deliver the orders. But as orders increases, we have to scale the delivery persons too. But the cost is much higher here. We have to take care of vehicle costs, waiting costs, hourly wage, etc…We analyzed that there is no relationship between our delivery persons and the other employees. In other words, there is no inter-dependency between them. So there we have an idea, we can have a separate delivery service which is not our own. We can just pay a monthly fee to them and they will take care of Hiring the delivery persons, delivering the order, vehicle cost, etc…Here our job is just to hand over the monthly fee for their service. In other words, we are separating the responsibilities. Now the same manager doesn't need to take care of everything..This is called Decoupling in System Design terms. Decoupling is the process of separating previously linked systems so that they may operate independently.

Now let's say shop 1 has a faulty oven, the preparing time goes up. The delivery bike is faulty, delivery time goes up. This we have to properly log. We have to trace everything and keep a log separately on what goes wrong and what benefits us. We can analyze these logs later and prepare a sensible report from them to gear up our business. Metrics can be used to monitor performance, recognize events of importance, and facilitate the prediction of future lapses. The same applies to system design too 😲.

The last important topic is to keep our system extensible. We don't have to repeat everything again and again. If we are buying raw materials, we can use the same person to buy for two shops and keep it in our warehouse and from there, let the shop pick up their materials. We don’t need to make this purchase process repeatable. Same way since we already decoupled our delivery system, we can make use of them even if we open up our third shop. Making the system Extensible. In software engineering, extensibility is defined as the quality of being designed to allow the addition of new capabilities or functionality. It is a measure of the ability to extend a system and the level of effort required to implement the extensions.

That’s the wrap of our System Design Architecture primer. Hope it helps. Thanks, everyone.

--

--

Aarthi K

Hi All! I am Aarthi, a Software developer by profession and a budding technical blogger. I am here to feed my tech thirst 😁.