Writing Scalable API is like making Khichdi

In a Cooking Pot of course.

Me: That’s right.

Now tell me how would you cook Khichdi for 10 guests in your home?Him: That’s so silly, Ashish.

Of course in a bigger containerMe: Well, you seem to be a real genius dude.

Could you tell, how would you cook the same Khichdi for 50 guests in your home?(He thought for a few seconds …)Him: Maybe I will need 3 or 4 bigger Cooking Pots to cook Khichdi for these many people in my Kitchen.

And also I may need a Sigdi which will be better to have 4 burners that will allow me to cook simultaneously in all the pots( Something like Multi-core processors isn’t? I was thinking …)Our discussion was going quite perfectly and we were heading in the right direction, I thought.

Now just to make him understand the real problem, I made my final point.

Me: Your approach for every question seems to be a pretty perfect dude, you have really answered the way I expected from you.

Now let me ask you one more question.

Imagine that for some reason you have been given the responsibility to cook the same khichdi for fifty thousand people for a really big feast, how would you cook it for so many people at a time?This time he hesitated before answering anything instantly.

Maybe he was imagining the resources needed to cook such a high quantity of food at a time.

He was confused and was thinking of the practical approaches for the solution.

Now he understood he can’t just say that he will need a very huge container to cook the food for 50k people simultaneously because practically there is a limit for increasing the size of the same container.

(After some 15–20 seconds for thinking)Him: I might need Many big burners and many big containers located around each other.

Each burner should be attached with a separate Fuel sourcecourtesy: hindustantimes.

comOur discussion went ahead and gradually, he might have started getting where I was heading to, he seemed to have gotten my analogy of cooking khichdi is linking to making scalable infrastructure for APIs.

My example of cooking Khichdi may not be 100% accurate with respect to designing server infrastructure and making APIs but up to a good extent, it makes the person understand some basic terminology.

When I asked him about cooking khichdi for 50K people at a time, it was like asking to design a system which responses to 50K-QPS load per second.

Whenever he said about increasing the size of Cooking Pot, he was unconsciously using vertical scaling in which specification of a server or its part is increased.

(Like increasing the RAM from 16GB to 64GB), When I substantially increased the number of people to eat the food to 50K at a time, he might have understood that there is always a limit for vertical scaling and that’s the reason why we need horizontal scaling.

Whenever he was talking about increasing number of burners and an increasing number of cooking pots.

it was actually like horizontal scaling in which numbers of servers are increased to serve the larger users traffic.

Writing App/API is like making delicious khichdi but writing a scalable app/API is like making own kitchen which if needed should allow us to run hundreds of burner together( Sometimes even hundreds of kitchens are needed which cooks food for millions of people, which is like having different data centers, am I exaggerating? Maybe)Becoming a good chef(programmer) takes time but once you become an expert in making delicious food(apps), users start rushing to your restaurant(site/API) and then you realize the real problem is not the ratio of salt and spice in your food but its that no one should go back hungry after coming to your restaurant.

And that’s the reason why you should take some extra care while designing the kitchen (infrastructure) for your restaurant (site/API).. More details

Leave a Reply