System Design Mock Interview | GeeksforGeeks

GeeksforGeeks · Intermediate ·🏗️ Systems Design & Architecture ·3y ago

Key Takeaways

Conducting a System Design Mock Interview to help aspiring system designers

Full Transcript

yes hello so welcome to all the games so good evening and hello yeah welcome so good evening good evening okay so here we start I mean uh welcome to all the Geeks so as we promised uh after the success of lot of DSA mock interviews that you guys were asking that gfg should come up with the system design mock interviews right so after so much uh discussion and your demand this is the first time that we are coming up with the system design mock interview right and hi hi so please guys uh write in the chat that uh if you are interested for more such system design mock interviews right so as you all know this is a geek week going on right so uh it starts from uh 11th of October to 17th of October so during this time I mean we are going to have lot of uh a lot of good event right so first of all uh we are having uh coding contest like uh corn banega code we have uh lots of uh events on data science we have a lot of lots of event uh for all the students who are also preparing for date exam and uh those who are preparing for uh product based companies uh we are going to have streams like system design uh streams like uh SD sheet that uh we generally do five to six hour we solve uh very good problems from that sheet itself so a lot of good events are lined up right so this system design mock interview was uh scheduled uh yesterday but due to some reason people not uh continue it so today we are going to uh start with this session right so if you are interested uh if you want more suggestion then please uh write something on the chat so that we can uh we can get the idea if you are interested and if you're if you have any other doubt regarding uh the mock interviews how to apply for mock interviews or how to get into uh the high level design you can write all your doubts in the Google form that is pinned in the chat right it's also in the description okay so before we start I mean let me introduce you uh to uh my guest so I'll just uh introduce you to okay awesome awesome so I introduce you uh to one of our uh Mentor uh Jay so I'll just adding him into the stream meanwhile you can write your uh doubts in the uh chat or you can also write in the Google form if you are not into uh if you are feeling shy to ask in the public okay so hi Jay uh how are you he he has a lot of uh uh experience experience in the industry and uh uh he's also been associated with geeks for Geek since last I think more than a year and he has been uh teaching a high level design uh with us since last uh one year and and and uh a lot of uh he has taught a lot of students uh for high level design and today we requested him to join on this uh gig week three event and because you know a lot of student asked us uh because in the past we have conducted DSM of interviews but it is not there like it's not anywhere in the uh in the YouTube like there are few YouTube channels that do it uh but you know system design working is not that uh simple and straight like DSA mock because you need to be very given lots of discussion needs to be done so uh meanwhile I mean uh thank you uh Jack for joining us uh if you want to introduce yourself Jay I mean please go ahead I mean a student would love to know more about you who has not attended your classes in the past uh thanks Amit for this uh this kind introduction so hi guys uh I'm Jay and I have been associated with geeks for geeks for I think more than a year and a half now and would have taken around 15 plus system design batches uh this was a special request and I said that hey it would be great to come live and do this kind of uh uh one to one session so like system design from my perspective is like uh upsc within computer science so things could be from anywhere right so it could be from Network it could be from OS uh it could be from some complicated algorithms and all and uh there is no I would say length and breadth of the question it could be literally anything from the computer science domain so today uh what I suggested is that let's try to emulate a real world interview like how it goes into company in most of the company you get an R for interview but uh in those 1R we'll try to like shorten a bit and we'll try to finish up our interview and let's say 40 to 45 minutes that's a decent enough time to come up with a day Zero kind of an architecture and here we will start with a very small problem because uh system design interviews could go into a lot of depth and these interview questions are asked for let's say a three years experience person a six year experienced person or even a 10-year experienced person so I'm assuming that most of the people here would be lying in the range of two to five years of experience so I would pick up a problem which is simple enough as well as a bit complicated so that it fits your needs okay so that's about me I am hoping to have the candidate here I think it's Mohit right awesome so guys uh I will be adding uh Mohit into the stream so uh and since this is a simulation of a real life uh interview and Mohit was a kind enough uh to do it with us on live session uh so uh I mean feel free to give your suggestions in the uh in the live chat uh if something uh you don't understand I mean try write in the chat he will try to answer it even in the session uh in the at the end of the session and even after the uh after this session is over we will uh revert back to you if you fill the form that is given in the chat right yeah so uh so I will be leaving the screen for now and uh Jay and Mohit will take the session forward right so thank you guys and now stage is yours thank you thank you Amit thank you perfect so time of it uh yeah I'm hoping you are having fun and you have uh like extracted this time out for the smoke interview and I went through uh the details that were shared with me and I guess that you are having a good enough experience in backend as well as front end so yeah first of all I would like to ask have you taken any system design interview earlier uh so this is my first system design interview uh I have given only uh pressure level interviews or lesser experience interviews so I haven't encountered uh any system design interview before so and I just started designing systems and doing these things so I started like one month back not a problem so uh let's start right away you have experience in backend engineering right you have written certain uh like services and all perfect so let's say let's start with a very simple problem and during the course of the mock don't even consider that I am an interviewer think of it like a colleague whom we are talking okay and rather than a system design interview because this is your first interview you may be nervous so just think of it like you are discussing a feature you are trying to implement a feature in your company in your business and you're talking to a colleague so what are the trade-offs that you take how do you make decisions for certain element okay those are the things that we will try to debate here okay so let's start with that uh I don't know if I can share something okay so would it be okay you can share your screen and share a Google drive or any any like pad that you may have sure so are you able to see my screen I don't know me a moment no I don't think so please share it yeah now I guess it is being perfect perfect so let's say that you got bored in your present company and you switched job okay and then you joined a company which is building an entirely new product so let's say you joined certain traditional company who were never exposed to let's say web or software development so take any uh traditional company like let's say maruti okay and then you joined them as a senior engineer and they asked you that hey uh we sell car but nowadays there are good companies entering Indian market like there is mg Hector Kia Etc who offers a lot of features which are not available to us we are traditional we don't know about we don't know anything about software development and they said that we want to test out this market and we want to build a very very simple application where I can get information from my car and I can show those information to user okay this is the information that has been given to you and let's say you are the senior most person who has joined the company you have a very small set of people how would you go about designing the system like what are the precautions that you would take like what are the components that you will add and how would you convince the stakeholders that hey this is the choice that I'm going to make so uh so we are not talking about the technical uh software problem rather it's kind of uh adding features to car right uh I would not say that let's say the car has we add certain iot systems within car right okay and those could give us certain information like let's say a very simple feature could be I want to monitor the engine temperature so I can attach a sensor to the car which will periodically see that what is the engine temperature and then uh I as a car owner want to see whether my engine temperature is shooting certain threshold okay I can slow down my car I can park my car or I can check that if there are certain radiator or Etc which may need to fix up so that's the very very basic feature that we need to build okay okay so uh I need to add uh do the whole system design here or as I just mentioned okay so I'll start with functional requirements in that case okay so basically we want uh next 10 cars uh which basically could take an example of mg vector and maruti is not having some of the features so uh if I ask about the feature we would need a sensor base system to uh notify uh when car is nearby my next question would be uh what would be the area of proximity required so this is this is just one thing uh this is just one feature that uh you are trying to avoid Collision right okay this could be within the car itself okay now my idea here is uh that you can capture some of the metrics over time like I given you an example that I may want to monitor engine temperature I may want to monitor let's say uh tire pressure okay I may want to monitor let's say the engine oil level level of Angel oil or what is the engine oil left in my car okay so all those metrics could be captured via certain sensors within the car but then I also need to notify the user if certain threshold is Branched breached okay got it so we could have a speed based metrics as well like okay what's your average speed uh throughout your journey and uh where you could improve or you should slow down in in case of areas of hilly areas or some kind of rough areas so we could provide that metrics and also we could provide some metrics to give a better mileage because we maruti are usually has more Indian customers which considers mileage waste thing as well so we'll see good mileage so we could provide metrics to give better mileage right uh next thing which I I could uh consider is we should provide a notification as as in where the pressure tire pressure is less than the mini bare minimum like 30 to 34 you could provide that metric as well right so you can think of it like let's say we need to support n Matrix that could be extensible I have just given you example of one or two metrics it could be n number of metrics okay uh also we could provide Matrix regarding the uh car conditions of uh let's say if if car condition gets worse before the next service time so we could have that metric as well uh this is the bare minimum which I could think of right now okay so maybe we can move on to non-function okay so for non-functional I would say uh all the metrics should be reliable that is if if my car condition is bad it's so bad it doesn't show uh bad in case it's obviously also for tire pressure and it goes for the speed phase metrics and mileage metric as well so my picture free reliable okay and our system should be available all the time uh whichever the area we are in I mean it could be it should be reliable enough to handle all this requests you can say that uh it would be a bit difficult to comment because let's say you are driving your car in a no network Zone okay so how would you handle those scenario so in that case there could be some local uh storage unit which could be fit into the car and if the network is low it can store all the data until a good Network comes up okay but again if user stays for no network area for a very long time then we should handle those error scenarios as well because like we should notify that we might not be able to provide you the correct metric during this time zone because you have exceeded this time limit so you can okay uh Define a threshold uh apart from this uh if the system is highly available uh it should be uh secured enough uh so that no other person could uh hack into the system and mingle with uh any other activity like it should not uh mishandle the car and hack the car and to maybe create an accident or something like that so it's right you know so what we can try to do here is uh we can start with a simple problem statement and then we can try to expand onto it so the core requirement here is how do you track those metrics firstly how do you collect those metrics uh then how do you show that metrics to user let's target this first problem statement and then we can build on to it like we can add security we can add authentication Etc okay so we can make it as a nice to have feature yeah maybe to look at in the future shop now we'll go into the estimations so uh so the number of requests per second would be uh like very high I would say maybe like 10 000 even or even more let's say like let's try to estimate how many cars do you expect that maruti would be having or how many cars built by maruti would be flying on Indian roads okay so I was thinking like it it will be having only one car so okay so we need to consider all of all the cars yeah so it will be I think it will be more than uh 10 million requests yeah let's take 10 million let's take 10 million cars uh apart from this uh so the daily active users should also be considered right yeah so out of let's say those 10 million you have at any point in time let's say 10 of the users are active most of the time a car would be either like uh let's say standing in garage or parking lot so it would be only a certain fraction of time when you would do a driving car right okay what's up uh for the estimations this is only what I could think of right now so maybe we can move on to the diagram this is sure okay so before that I'll uh just write the components which I'll be using the first component which I could think of this yeah so basically if we are going to handle this many amount of request uh first of all I will have one API Gateway okay fine uh next thing uh the number of request is laws so single server won't be able to handle this many requests so we'll need load balancer and since I've worked with the AWS elv so I would prefer that will be needed to be stored and we might need some sharding uh in future so I'll prefer uh Amazon dynamodb okay so whatever you are writing so I would need a logic as to why these components are selected sure so the only reason for uh choosing a dynamodp I think the number of the data is stored uh will be very high and it will be able to scale that DB it will be very difficult at some point of time so we should be uh uh flexible enough to chart a DP into multiple uh servers horizontally because vertical scaling at some point at some point of time will become a little bit hectic is what I can we can we estimate the data like what would be the average data that would be generated for let's say a year or a five year mark so uh so we'll have a lot of metrics related to uh speed tire pressure and car condition let's start with one let's start with one uh let's start with just a simple Matrix that you are trying to capture engine temperature okay okay so uh for that uh I think for each and every car for every second it should be stored right so it might go on to uh for every day it will be like lots of lots of GBS and okay let's try to estimate estimate with a simple uh like let's say we estimated that we have around 10 million cars and out of that active cars at any point in time would be one million right so at any point in time I would have 1 million cars running on the road now out of this 1 million what is the data that you are going to store whether it is dynamodb whether it is whether it is SQL anything okay so what is the data that you're going to store through that we could try to estimate that what would be the data size that would be needed right how big my database would be okay so can you try that uh yeah so basically I would prefer to use all the data in the format of Json and uh so so the Json for 10 million user sorry 1 million user uh would go around like in GBS uh if I say about a day uh also and it could it could uh go on to like TVs if the data go uh if the data is stored for each and every second right so for single day I think it would be lots lots of GBS like maybe around 100 GB also okay so let let's do one thing let's do one thing uh we know that we have one million users okay great what would be the size of a single event let's try to compute that uh size of a single event and then we will try to compute what is the data size that we need okay because as of now it's every everything on a very very high level right right right so maybe we will need to Define keys right so if you are going to method and then temperature will have ID you will then have a the actual temperature okay and we'll have some uh silver enough separate table right so we'll have to map it to some user table let's say that is user ID okay yeah uh apart from this we might need to maintain some Flags right uh as in like if if it is in the threshold if it is a current If the previous ratio was right and if the current threshold was right so we can maintain some status Flags over there this is anything else that you would like to add I'm not able to think uh anything else apart from this won't you need timestamp okay so can we can we try a basic estimation as to what would be the size of one object very basic estimation high level uh it will be very less maybe it will be by uh less than a bite or I don't know uh now let's say 30 40 bytes yeah let's say 50 bytes 50 bytes would be more than sufficient so okay uh so you have user ID one user could have multiple cars right correct so I think it should be something like my vehicle ID okay now let's say as we agreed that let's say this data is around 50 bytes good right so then you multiply that by 1 million right there are 1 million events and per second so that would hardly be 50 megabytes of data that you are sending per second right per second correct 50 mb that that's not a huge number right okay uh but so uh if we go on for like a day so like for 60 minutes it will be like 120 uh sorry a 1.2 GB correct so you can multiply this by eight six four double zero right at the total number of seconds within a day or it would be 10 to the power 5. so that yeah like can we try a rough estimation that's around 10 million multiplied by 10 to the power 5 so that would be 10 GB and 100 GB I guess right for a day I might be wrong you can you can try a competition let's do that yeah it will be like 100 TV foreign so it's not a very big number right we have 100 GB of data per day okay and for how much time would you want to keep this data yeah that was the question that was I was going to ask next because uh two data for more than uh three months even three months I think of his quite large but we can uh refill that amount uh Whenever there is a new uh maybe new month or intern is refueled or something like that right so okay let's think it from other perspective why to even store this data for three months what is the end use of this data uh so if we just talk about the temperature uh it doesn't make sense to store for three months uh but if I talk about the metrics uh as in like I added fuel at this point of time and after three months uh these are my metrics so we might uh help that data right so so what is the end end goal that we are trying to achieve from here we want to send user certain notification correct right if something goes bad okay but those notifications would have certain time window right a notification would be okay only if you send it in more or less real time or let's say within five or ten minutes window so okay do you think we need to store this data for 30 days no uh so if the use case is just to prevent the notification uh we might not want to store data more than 24 hours okay so we'll need only 100 GB data not more than that okay so then do we need sharding no uh so in that case we can just use a simple SQL if we might not need to add postover servers okay so apart from this will need uh a microservice which could handle this logic right the sensor and conversion of data so I'm really bad at making conventions we have everyone is that's a challenging problem software engineering yeah every time I name a service somebody tell me why the name is right apart from this we might also need to we need a service to handle uh sensors but I would not add any other service because it could be handled from the temperature Source itself right so we will need sofa rather than can we call it as let's say Injection Service I'm giving a suggestion here okay it could be it could be any data right it could be temperature later on it could be pressure it could be anything so let's say something like data ingestion service okay perfect so now we have a very very high level idea that hey these are the components that we need to have in our system design uh question is how would you be sending the notification yeah that's the end goal right we need to send the notification to user correct so once this uh data is uh calculated so we might need a notification service to send that notification okay and for that we could use uh uh web sockets to send the notifications okay so the other approaches but I haven't used any other General circuits before so I'm not aware so you said that we we need certain computation right what is that competition and where would that competition take place so uh competition would be like uh calculating the metrics from the sensors and uh basically uh tell the user that this is my schedule and if if it gets over that I need to notify so it is a whole logic should be there in data ingestion surface is what I can okay can we take a concrete example like we have taken a concrete example there where we are measuring temperature or like where we are ingesting temperature okay so can you take a concrete example as to when would you notify a user that hey uh your temperature is up or or something like that a concrete example and then we will build our design on in and around that okay so maybe uh let me take an example uh where I am in India so temperature is always very high uh of the climatic temperature and uh some of my car parts are not properly uh fueled enough like the friction is very more so obviously the engine temperature this after the point of time so let's say uh I I the user is driving and in the middle of the driving the car engine temperature is way too high uh then how it should be so it will start that you're reading the uh part so at that point of time uh this calculation will be made that this is the bare minimum car temperature and it is going above this so I will notify the user and that can also okay let's let's write this example let's say that uh we send user notification when average engine temperature is more than 150 degree centigrade for last 10 minutes okay that's a concrete example right and it seems a feasible feasible one right let's try to solve this one and then we will try to expand onto our design uh so what is the threshold you mentioned 150 150 degree centigrade I guess this would be okay yeah it would be wave of this okay so more than 150 for last 10 minutes okay so this is what I could think of for the components uh shall we move it with the diagram yeah we can uh so I think rishit has a question and that's a very valid question you know uh you are seeing that question right I allowed to uh yeah that's fine I'm not able to find the question okay so let me read that out uh yeah so rather than storing the data could we just process the data stream as it is received by the backend because we only need to alert the user when the engine oil temperature crosses the threshold okay uh we could do that but what we're doing here is uh calculating the temperature for last 10 minutes if for the last 10 minutes this threshold breaks then only we do that because uh there could be some external Factor uh which could provide this insights like uh oh the temperature is high for maybe like for a second or two seconds so we don't want to uh bombard user research information only once the stable uh data is reached that would be like in 10 minutes then only we should notify user like since yeah I would also somewhat agree to this because we need let's say this just one use case in the other use case it may be like let's say pressure we don't fill up the like we do not like check the pressure quite often right so with different use cases the aggregation could be at a different level so my opinion would be that we can store it for some time like let's say the temperature here so we are getting an average of 10 minutes temperature we're going to store this information for one hour and then we could have certain other things which I am expecting it from you uh that how that processing pipeline will work right so and you can think of it like a temporary storage it's not a permanent storage where we are storing the information for a year or five year okay those are I don't think is required in this use case okay but yeah we need to store this information for some time correct okay so I am a bit confused here uh so let's say uh we are talking about storing data only for 10 minutes so do we need to store data for 24 hours you need to answer that yeah I mean I mean you are the designer temporary so so I think that we should not have any more DB we could have a uh I mean if you need further 10 minutes only we could have some other temporary storage or maybe cash to handle first okay good choice uh but my question is do we need uh data for 24 hours at all uh you can reason it out whether you need need that or not okay okay as per the present scenario do you need that would that be needed or can we do something better yeah I think I can think of only SQL DB because right now because even for uh one second we have some kind of data and for 10 minutes also it will be in uh GBS itself uh maybe you could store a data for 24 hours what was our calculation for 24 hours how much uh 100 GB 100 GB for 24 hours okay okay so I think single cash might not be able to understand obviously so caching might not be a good choice due to cash but again here we are talking about 24 hours right right let's say we have a cash uh for storing data for 10 minutes last 10 minutes you could have cash so that we can get better response time okay let's move forward because we are running out of time and it's a very very basic design as of now yet start reading the objects so I'll have my user here user maybe car yeah next let's let's name it vehicle because a user could have multiple vehicles okay I'll have my uh API Gateway and load balancer over here so I'm not adding API Gateway but first it will go through the API Gateway but I am writing writing load balancer directly that's fine our next component was my server and I'll have this data Injection Service let's call it di service yeah that's fine and I'll have my notification service okay another component foreign I will also have uh caching here why do we need cash as of now uh because the user will need 10 minutes data more frequently uh then the whole day would need 10 minutes data because we just need to notify user right we don't we are not giving them any data yeah but for the calculation itself so this service can take data from the cash for last 10 minutes why like it could query the DB right because then you would have to maintain the data two places right and caching is useful when you have read heavy system right got it here in the scenario it seems like it's a very very right intensive application right you are capturing a lot of events and one in let's say a million could turn into a notification got it my bad so uh so I I understood your point so let's say if you have a scenario like Facebook or any other we'll we'll need those kind of read heavy but here we are right heavy and doing read only like in 10 minutes yeah yeah sorry so in that case we'll have just one DB these other components right so we will try to Deep dive into each one of the component I don't think we have much of a time okay there are a lot of open questions here to be honest so let's firstly dig into the load balancer part okay so you have used elb right right but any kind of load balancer or any kind of a component would have certain threshold because at the end of it it would be limited by the hardware right got it right so in our use case we have around 1 million requests per second right right now if you see the pattern mostly Vehicles would be used by person who goes to office and come backs from office so even though on an average we may have 1 million requests per second but during the morning time and during the evening time there could be a huge Spike right right and for the sake of example let's say a single load balancer good Route 1 million request at any point in time okay and your Peak load could be let's say five to seven million per second okay so how do you handle that scenario you're getting my point right got it got it so what what a configuration Amazon elb has this we could use a multiple load balancers as well uh so let's say if you're using multiple load balancer uh so if yes we are seeing their uh like there's a single load balancer right so you can have multiple load balancer in place here I'm not trying it right now uh but yeah and if the one load transfer gets uh too heavy we could use consistent hashing uh to reroute our data to multiple load balances right and uh those multiple those load balances so my question here is like my question here is interesting yeah we could have yeah so go ahead so my question here is uh as of now we are breaching the limit of a single load balancer okay so I know that taking an assumption here that one load balancer could handle one million requests per second okay and my Peak threshold is seven million request so I'm pretty much sure that one load balancer would not be sufficient right okay and for the timing let's just think that you don't know about ALB okay even if you know then how would have that that component be built up okay yeah so you need at least seven concurrent load balancer right seven load balancer running in parallel right how would you route the request from vehicle okay so uh that's all I was saying that we'll have multiple load balances in place and for that we'll use DNS rerouting to handle all the requests uh and to maintain this pipe so if one load is more via DNS or any routing we can readout it to some other load balances so basically you would have a single endpoint and that would be backed by seven or eight like ten different load balances that's fine that's a great approach okay now let's also I think we discussed this use case where you don't have internet connectivity right so how would you handle that scenario uh yeah so for that we need one more DB mm-hmm it will be but there should be some kind of creepy some kind of an embedded database right right okay and it should restore data uh let's say for uh it can be stored it up to one hour I'm saying maybe a two amount of data but depending depending on the device uh like storage availability okay and how would your flow look like like let's say if my vehicle emits an event then what happens yeah so let's say if my vehicle emits an event it will store the data in the in this DB plus it will go via load balancer and store the data in this DB and uh um yeah yeah so because let's say if I'm unable to slow data into the actual uh TV uh in that case I I need to pull that data from this VP so for each and every hour I need to store the 1R data inside of the TV and the whole data should be stored uh here as well for each and every second right so don't you think that it's a huge additional overhead on the vehicle uh sensor itself it would be storing data it would be checking internet connection it would be sending the request and then like there are a lot of complication there so wouldn't it be okay like you treat that DB as a queue like when any event is emitted from the vehicle it is just dumped to the DB so the sensor part of the vehicle would be pretty fast it is storing information locally right right and then you could have certain listener on the DB which will try to send the data to your load balancer if it fails fair enough it will not delete the data from the queue if it doesn't fail that's fine if it fails the data resides in the DB wouldn't that be a a good example of separation of concern yeah I'm just handling one part right uh but that event listener will decide where will it be like in the vehicle itself right inside vehicle set there are there are two processes one is emitting event and dumping into DB another process listening to the DB and sending to the load balancer right right that would decouple both both the things okay okay yeah so we talked about load balancer we talked about DB decoupling at the at the local DB layer now you have this data ingestion service okay now the data ingestion service is capturing event at let's say one million requests per second that's something a number right that's a huge number right so at the DB front the backend DB so what are your understanding which kind of a DB would you prefer here and why uh I would prefer uh SQL DB over here okay uh just any reason yeah just because our data is more structured uh in a sense where we need to maintain all the vehicles and explore detain a bit so it will be easier to uh Implement that data in uh SQL and also the cost will be less for SQL than okay uh so one question here so have you heard about the storage engines within SQL uh or do you know the data structure which is used for storing all this information in databases what's the common data structure that is being used actually I'm not aware at this point of crying that's fine that's fine that's fine that's not a problem okay uh so like outside the system uh design interview there are a lot of uh different kind of DB that are suitable for this purposes uh you might have heard about time series databases and the data here seems like a Time series data okay so those would be a better choice than a SQL okay and there are other also other databases also which are very much efficient for storing information which are due to this High write throughput system so SQL might not be a very good choice here because we have very very huge number of writes per second okay that's fine that's fine we can discuss those now let's talk about the data transformation from this TI service to the notification service how how could you so uh once the data is collected from the sorry we can we can take this data from the vehicle so we don't need another component here uh so once that once we receive this data we'll we'll store the data from the timestamp right so let's say uh my data for last 10 minutes is reaching the threshold so what I will do is I'll uh pass this notification via notification so how do you know that the average has been breached where is that competition happening so inside of this DB I'll have the uh all the data right so why are the data I need to write the business logic in this di service okay it will calculate all the uh data for last 10 minutes timestamp and it will it will say that oh so so the average uh temperature limit is more than this particular limit so in that case don't you think that that's an additional overhead on the DI service it is already handling one million request per second so you should want to make the system pretty faster now if on every request you are querying the DB getting last 10 minutes data performing certain competition and then interacting with notification service that is bound to fail right that will not provide you the throughput that we need here right so can we do something better of so maybe we can transfer this uh all of these activities to notification service okay how would you do that so via notification service I'll call uh the TV and calculate all of this uh business logic and then send a data to this vehicle and this will be called every 10 minutes like or every last 10 minutes you will calculate every 10 minutes for all the vehicles yep just think think through it will create a lot of over here as well but we'll have we have this load balancer right so we'll have multiple servers uh attached to this for the API services so since we are having multiple servers all the load will be equally distributed right so that's okay so let's uh let me try to question like let me try to structure it from a different perspective so when you are just storing one information let's say it takes around 10 milliseconds or 100 millisecond but then if you are performing a lot of additional competition in the DI service itself like querying a database then performing certain analytics on top of it firstly there is a chance that your code could break at any point in time am I right got it when when you are performing a lot of operation it could break at any point in time and there could be discrepancies okay the second thing is that will shoot up your response time for every write request okay so for every write request uh let's say your response time shoots by 100 millisecond which means you are reducing the throughput of your di service by a factor of 2. you will need twice the number of uh this data Injection Service so that's an additional overhead here also uh another point to note here is that since we need notification at 10 minute interval do we even need to send all the notification per second from the vehicle it will be like in 10 minutes only about 10 minutes we could take certain Leisure threshold like we can take it from one minute or we can batch at vehicle at one minute and then send all the batch requests uh to my load balancer ndi service every minute okay so that could be another Choice uh but I would still be skeptical about Computing all of this at the DI service level so my like thought process here is like TI service should be there just for ingestion that's why it's a DI service later so can we do better or like do you think that there is an alternative approach uh alternative would be is to have one more Service uh we'll do this calculation or uh use it uh inside the notification service itself but since notification service again semantically does its own part so maybe if we can have a separate service which does this basic competition itself did you and how would they interact like if there is a another service let's say some competition service or notification competition service okay how would they interact how do the event which is stored in the database and how does does that service uh know that hey now I need to recompute so uh for that I think uh the new service which will be there uh it needs to have a websocket connection established so that both of them will be connected throughout their timeline right so wonderful could be polling but polling again has its own disadvantages so I think websocket would be better to implement the scenario sockets from where to where like where do you want that websocket to be placed so from vehicle to this uh new service computational service why like is there any two-way data transfer I I don't see that uh so basically we need to transfer data from server to vehicle right we just need to send a notification right once they reach that threshold so those notification could be let's say once in a month so why would you keep a websocket connection open for one month yeah just to send one notification makes sense so maybe a normal HTTP connection would be good like we have every other service and how this computational service okay service again and it will pass data from EA service some of the data again then TI service have two tasks it is dumping the data in the DV and it is sending the data to cic what is the logic mean and how would you get the data from DB to this competition service like is there any mechanism that you know of uh currently I don't know of anything else than uh calling this uh making a batch request or if some kind of event bus which will uh call this service every 10 minutes and it will fetch data for all the users and pass notifications here okay so uh obviously there are uh like better approaches to do this but I would say this was a very very nice attempt and we try to explore a lot of parts and to be honest uh rather than a system design it was like a knowledge sharing session okay so in real world interview you might not get this many hints and where most of the time the interviewer are dumb they would not provide you any hint so it was fun uh we are exceeding our time limit okay and obviously there are a lot of improvisation that we can make here in the design but it may be uh like let's say a very starting design and we can always do a lot better here okay so I guess that would be all Mohit it was really really nice interacting to you and I am glad that it was your first interview and you performed so well so thanks for that for uh helping me out as well because I this was my first system design uh this is very first time I've been designing like for such kind of problem uh so thank you for helping me out and it was quite a lot of knowledgeable session for me and maybe it's just the start for me uh improving yeah thanks mate okay so that would be all from us guys uh you were a really nice audience hi Amit welcome back hi hi I mean uh honestly speaking I love uh this discussion I was reading a chat as well as I was uh listening to the discussions because uh what happened that most of the times that uh we see that uh on internet we have scripted interviews right when interviewer no interviewer uh an interview both know the answer before these three but uh as as Mohit know that we did not discuss uh anything about the what uh it is going to be discussed today so so that it becomes a real uh interview experience and uh if we do this I mean the quality of discussion becomes uh very very good uh and thank you for being such a support I mean I understand it's very tough uh to go live and then and uh answering questions because because then everyone is judging you uh to be like real world because I have been giving uh most of the client interviews as well from a company and uh this would this kind of pressure I needed that uh because there's a lot of pressure when we work in IT industry uh so once we go live uh I'll be very much experienced in handling pressure as well so this one this was my main motive okay so I have one question uh from receipt uh he's asking like before Learning System design what we need to learn before uh that's a very interesting question Rishi uh so I'll answer that question uh my thought process here is system design like people have made hype out of it that hey there's a system designed round and you just like shatter by just listening to that I'm going to take a system design around so in general there are 20 15 to 20 components that you should be aware about like let's say you should be aware about load balancer we discussed briefly about load balancer there are caching mechanism there are databases there is DNS you should know about the internals of DNS we discussed that that how you scale load balancer using DNS routing okay then there is queuing mechanism there are CDN there are cash okay so there are 10 to 20 components which you should be aware about and then you should practice real world system design interview now once you have gone through the basic like basic level system design interview then you should try intermediate level system design interview where you should try to compare and contrast between databases right we tried deep diving into the database front but again like since it was a very basic problem we didn't uh went deep into it but let's say if you're three or four years experience five year experience then the interviewer would expect you to know about different kind of databases like SQL databases are generally based out of B plus three okay what is LSM tree okay what is time series database what is columnar database so the discussions could be around that then uh in some interview they can deep dive into the storage layer how a file is stored on the disk how can you build S3 how could you build Google Map okay so it should be a step-by-step process and it may take some time to comprehend the nitty-gritty details of each one of the component so just practice that out start a small and just be there okay and then I think you can crack system design review yeah thank you Jay uh so there are not many questions but uh Jay I have filtered out a very common question from system design that most of the especially college student or uh or the freshers who have just one year of experience as SD uh do you want to know whether in the call is they need to understand the high level Design Concepts because you know they are more into data structures algorithm learning programming languages as just coming to that uh so generally this is the trend that I have seen for fresher they don't directly ask system design questions okay so generally system design questions are asked when you are there in industry for at least uh two to three years okay so that is where system design kicks in but then if you ask this question to yourself what is system design it's not a computer science course right it is an amalgamation of uh let's say Operating Systems computer networks database systems and everything so that's a practical implementation of what you learn during your college Years okay so rather than just focusing on DSA because DSA is the first two two to three rounds that you have to do okay you should also be focusing on these Concepts you should be understanding how networks are how network works or what are the important concept of os and those would be then framed in a system design question so initially for the first two to three years beside databases try to like learn the basic concepts of computer computer computer engineering and then try like understanding the scalable components what are the scalable components in the market how do they work try to explore that so that would be my suggestion for people who are fresher or just graduating out of college or even one or two weeks one or two years experience people right right and and it's not always about uh giving interviews sometimes as a computer science engineer you need to understand how system works I mean uh I was wondering when a few days back Facebook was down and due to some DNS and and a lot of people were reading and sharing uh very useful information uh but I mean as an engineer if you want to understand things how uh things work behind the scene then obviously I mean you should have a curiosity uh just uh besides preparing for interview so uh thank you thank you so much uh Jay and thank you so much Mohit uh for giving your time uh today uh and uh to the audience I mean happy the Sarah enjoy the festival and uh if you have uh queries I mean feel free to uh fill the form that is given in the chat and if you're watching this stream after the live session I mean you can always go to the description form right and then uh share your queries okay so thank you guys thank you so much take care and bye thank you bye-bye have a great day

Original Description

Cleared all the basic concepts, mastered all the important topics, completed a project or two, but nervous to sit for a System Design Interview? Well, we have heard you and are always there for your help. Presenting: "System Design Mock Interview", which will not only help you get an idea about the types of questions asked but also clear some common queries which every aspiring system designer is worried about. So what's the hold up? Join along with Jay Chakra and get ready to ace your system design interviews. Happy Learning!! ANY DOUBT ? ASK: https://docs.google.com/forms/d/e/1FAIpQLSd8E-0jds_ZTn5oivksw7GTVNTDaoRJxfCKqSFKmwag3Gc4cQ/viewform Register now in this System Design Live Course-: https://practice.geeksforgeeks.org/courses/system-design-live 🚨 Don't forget to register for all the other webinars going LIVE this week- SDE Preparation in 4 Hours: https://bit.ly/3UN9v6p How is CP helping in SDE Roles: https://bit.ly/3LYJ9tV GATE Preparation Strategy: https://bit.ly/3BZECD1 Building an E-Commerce App using React: https://bit.ly/3LWICZs IMDB Data Analysis and Movie Recommendations: https://bit.ly/3LZ6hbV ------------------------------------------------------------------------------------------------------------------ 💻 Our courses : https://practice.geeksforgeeks.org/courses/?utm_source=youtube&utm_medium=courseteam_main_desc&utm_campaign=pre_geek_week 📲 Install our Android App: https://play.google.com/store/apps/details?id=free.programming.programming&hl=en ------------------------------------------------------------------------------------------------------------------ Follow On Our Other Social Media Handles: 📱 Twitter: https://twitter.com/geeksforgeeks 📝 LinkedIn: https://www.linkedin.com/company/geeksforgeeks 🌐 Facebook: https://www.facebook.com/geeksforgeeks.org 📷 Instagram: https://www.instagram.com/geeks_for_geeks 👽 Reddit: https://www.reddit.com/user/geeksforgeeks 💬 Telegram: https://t.me/s/geeksforg
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from GeeksforGeeks · GeeksforGeeks · 0 of 60

← Previous Next →
1 How I got into Walmart | Shailesh Sharma
How I got into Walmart | Shailesh Sharma
GeeksforGeeks
2 Upgrade yourself In 29 Days | GeeksforGeeks
Upgrade yourself In 29 Days | GeeksforGeeks
GeeksforGeeks
3 Learn AWS Fundamentals For Free
Learn AWS Fundamentals For Free
GeeksforGeeks
4 Conversation With Young Achievers | Meet the winners of Bi-Wizard Coding Contest | GeeksforGeeks
Conversation With Young Achievers | Meet the winners of Bi-Wizard Coding Contest | GeeksforGeeks
GeeksforGeeks
5 Meet The Winners Of Bi-Wizard Coding Contests | GeeksforGeeks
Meet The Winners Of Bi-Wizard Coding Contests | GeeksforGeeks
GeeksforGeeks
6 Interview Prep Strategies | PayPal
Interview Prep Strategies | PayPal
GeeksforGeeks
7 OLX Interview Preparation Strategies | Hukam Singh
OLX Interview Preparation Strategies | Hukam Singh
GeeksforGeeks
8 Meet Some More Winners Of Bi-Wizard Coding Contests | GeeksforGeeks
Meet Some More Winners Of Bi-Wizard Coding Contests | GeeksforGeeks
GeeksforGeeks
9 Live Mock DSA
Live Mock DSA
GeeksforGeeks
10 Microsoft Azure For Absolute Beginners
Microsoft Azure For Absolute Beginners
GeeksforGeeks
11 Python for Data Science | Data Science Master Bootcamp | Arpit Jain
Python for Data Science | Data Science Master Bootcamp | Arpit Jain
GeeksforGeeks
12 Getting Started with Data Analysis | Data Science Master Bootcamp | Ashish Jangra
Getting Started with Data Analysis | Data Science Master Bootcamp | Ashish Jangra
GeeksforGeeks
13 How to prepare theory subjects for SDE interviews | Geeks Summer Carnival 2022
How to prepare theory subjects for SDE interviews | Geeks Summer Carnival 2022
GeeksforGeeks
14 Get Your Tickets To The Geeks Summer Carnival | GeeksforGeeks
Get Your Tickets To The Geeks Summer Carnival | GeeksforGeeks
GeeksforGeeks
15 TED Talk Data Analysis Project | Data Science Master Bootcamp | Ashish Jangra
TED Talk Data Analysis Project | Data Science Master Bootcamp | Ashish Jangra
GeeksforGeeks
16 How I Secured AIR 9 in GATE'22 |  Tushar
How I Secured AIR 9 in GATE'22 | Tushar
GeeksforGeeks
17 Learn Java Backend Development | Geeks Summer Carnival | GeeksforGeeks
Learn Java Backend Development | Geeks Summer Carnival | GeeksforGeeks
GeeksforGeeks
18 How to Recognize which Data Structure to use in a question | Geeks Summer Carnival | GeeksforGeeks
How to Recognize which Data Structure to use in a question | Geeks Summer Carnival | GeeksforGeeks
GeeksforGeeks
19 Learn Data Structures and Algorithms | GeeksforGeeks
Learn Data Structures and Algorithms | GeeksforGeeks
GeeksforGeeks
20 Interview experience at Flipkart | GeeksforGeeks
Interview experience at Flipkart | GeeksforGeeks
GeeksforGeeks
21 Lets Prepare for GATE'23 the Right Way | Sakshi Singhal | GeekSummerCarnival
Lets Prepare for GATE'23 the Right Way | Sakshi Singhal | GeekSummerCarnival
GeeksforGeeks
22 Highest Paying Jobs in 2022 | Ishan Sharma | Geeks Summer Carnival 2022 | GeeksforGeeks
Highest Paying Jobs in 2022 | Ishan Sharma | Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
23 Geeks Summer Carnival 2022 | 5th April- 11th April | GeeksforGeeks
Geeks Summer Carnival 2022 | 5th April- 11th April | GeeksforGeeks
GeeksforGeeks
24 Preparing for SDE interviews | Soham Mukherjee | Geeks Summer Carnival 2022 | GeeksforGeeks
Preparing for SDE interviews | Soham Mukherjee | Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
25 Full Stack Development with React & Node | Utkarsh Malik | Geeks Summer Carnival | GeeksforGeeks
Full Stack Development with React & Node | Utkarsh Malik | Geeks Summer Carnival | GeeksforGeeks
GeeksforGeeks
26 Introduction to Open Source and Roadmap to GSOC 2022 | Geeks Summer Carnival 2022 | GeeksforGeeks
Introduction to Open Source and Roadmap to GSOC 2022 | Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
27 Web Scraping in Action | Geeks Summer Carnival 2022 | GeeksforGeeks
Web Scraping in Action | Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
28 Getting Hired at BITCS via GfG Job Portal | Get Hired With GeeksforGeeks
Getting Hired at BITCS via GfG Job Portal | Get Hired With GeeksforGeeks
GeeksforGeeks
29 How to build a faster landing Page | Geeks Summer Carnival 2022 | GeeksforGeeks
How to build a faster landing Page | Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
30 Geeks Summer Carnival | 5th To 11th April, 2022 | GeeksforGeeks
Geeks Summer Carnival | 5th To 11th April, 2022 | GeeksforGeeks
GeeksforGeeks
31 How to get ideas for Startup | Geeks Summer Carnival 2022 | GeeksforGeeks
How to get ideas for Startup | Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
32 Journey from Tier 3 to JusPay | GeeksforGeeks
Journey from Tier 3 to JusPay | GeeksforGeeks
GeeksforGeeks
33 Geeks Summer Carnival 2022 | GeeksforGeeks
Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
34 Dispelling Myths and Pre conceptions of Programming Languages
Dispelling Myths and Pre conceptions of Programming Languages
GeeksforGeeks
35 Must Do System Design Questions
Must Do System Design Questions
GeeksforGeeks
36 Understanding Sorting Techniques in an hour | Keerti Purswani | Geeks Summer Carnival
Understanding Sorting Techniques in an hour | Keerti Purswani | Geeks Summer Carnival
GeeksforGeeks
37 Get Hired at NEC | Job-A-Thon 8
Get Hired at NEC | Job-A-Thon 8
GeeksforGeeks
38 Journey from Tier 3 college to Microsoft | GeeksforGeeks
Journey from Tier 3 college to Microsoft | GeeksforGeeks
GeeksforGeeks
39 Get Hired with GeeksforGeeks at SuperK | Job A Thon 8
Get Hired with GeeksforGeeks at SuperK | Job A Thon 8
GeeksforGeeks
40 GeeksforGeeks: Redesigned
GeeksforGeeks: Redesigned
GeeksforGeeks
41 From Tier 3 to cracking multiple interviews | GeeksforGeeks
From Tier 3 to cracking multiple interviews | GeeksforGeeks
GeeksforGeeks
42 Live Mock DSA
Live Mock DSA
GeeksforGeeks
43 Youtube Data Analysis | Ashish Jangra | GeeksforGeeks
Youtube Data Analysis | Ashish Jangra | GeeksforGeeks
GeeksforGeeks
44 DSA Self-Paced Course Preview | Sandeep Jain | GeeksforGeeks
DSA Self-Paced Course Preview | Sandeep Jain | GeeksforGeeks
GeeksforGeeks
45 GATE Live Classes | Prepare for GATE CS 2023 | GeeksforGeeks
GATE Live Classes | Prepare for GATE CS 2023 | GeeksforGeeks
GeeksforGeeks
46 Journey from JIIT to Adobe
Journey from JIIT to Adobe
GeeksforGeeks
47 Life Is Unfair Ft. Shonty badmash | LIVE Discord Session | A GeeksforGeeks Exclusive
Life Is Unfair Ft. Shonty badmash | LIVE Discord Session | A GeeksforGeeks Exclusive
GeeksforGeeks
48 Interview Experience at Google | Tech Dose
Interview Experience at Google | Tech Dose
GeeksforGeeks
49 Live Mock DSA
Live Mock DSA
GeeksforGeeks
50 Interview Experience @ Amazon | GeeksforGeeks
Interview Experience @ Amazon | GeeksforGeeks
GeeksforGeeks
51 My journey through the tech world from India to US | Vidushi | GeeksforGeeks
My journey through the tech world from India to US | Vidushi | GeeksforGeeks
GeeksforGeeks
52 Complete Interview Preparation Course | GeeksforGeeks
Complete Interview Preparation Course | GeeksforGeeks
GeeksforGeeks
53 Live Mock DSA
Live Mock DSA
GeeksforGeeks
54 Getting Hired at FiftyFive Technologies | Job-a-thon 9.0
Getting Hired at FiftyFive Technologies | Job-a-thon 9.0
GeeksforGeeks
55 GFG Karlo, Ho Jayega | GeeksforGeeks ft. Khaleel Ahmed
GFG Karlo, Ho Jayega | GeeksforGeeks ft. Khaleel Ahmed
GeeksforGeeks
56 How I got job offers from 2 big companies : Arcesium & Microsoft | GeeksforGeeks
How I got job offers from 2 big companies : Arcesium & Microsoft | GeeksforGeeks
GeeksforGeeks
57 LINUX for Beginners | GFG x Itversity
LINUX for Beginners | GFG x Itversity
GeeksforGeeks
58 My interview experience at Walmart | GeeksforGeeks
My interview experience at Walmart | GeeksforGeeks
GeeksforGeeks
59 Get Hired at Speckyfox
Get Hired at Speckyfox
GeeksforGeeks
60 Live Mock DSA
Live Mock DSA
GeeksforGeeks

Related Reads

📰
Evaluating Hydration and Rendering Strategies for Optimal Web Application Performance
Learn how to evaluate hydration and rendering strategies for optimal web application performance and improve user experience
Dev.to · Pavel Kostromin
📰
Understanding Abstraction in C++: Abstract Classes, Pure Virtual Functions & Interview Questions
Learn how abstraction in C++ simplifies complex systems using abstract classes and pure virtual functions, essential for OOP and acing interviews
Medium · Programming
📰
Building a Secure MCP Bridge for ArcGIS Pro and ArcPy
Learn to build a secure MCP bridge for ArcGIS Pro and ArcPy to leverage Python's power in geospatial analysis
Dev.to · Muhammed Enes Duran
📰
Why I Treat the Curriculum Like a Software Architecture
Apply software architecture principles to curriculum design to improve scalability and effectiveness
Dev.to · Mostafa Fathy
Up next
Manufacturers Don't Have an ERP Problem - They Have a Decision Problem, There Is No One Size ERP Fit
Digital Transformation with Eric Kimberling
Watch →