Pergunta de entrevista da empresa Pathao

Phase 2 (API Design/System Design) 5. We have a table with two columns: driver_id and phone_no. The table contains 1-10 Lakhs of data(by that he meant a huge deal). Given the driver_id as a parameter, design an API to send text messages to drivers. The api gets 5 calls/sec (which is huge according to him). Ans: i. As the driver_id is the primary key here, we can fetch the respective row from the database using that. ii. But the database is huge. So, is it good to call the DB everytime we get an API call? (Followup Question) iii. Okay in that case we can use caching to cache frequently called driver_ids. iv. How can we do that? (Followup Question) v. Well, maybe we can use a dictionary to save the frequently called driver_id, phone_no. vi. So, you mean in memory DB? (Followup Question) vii. Yes. viii. But maybe our service is running on three different servers. How would you handle that? (Followup Question) ix. Well, in that case maybe we can use a caching DB like Redis. So, we may be able to call it from any server. x. But the API gets a hit of 5/sec. It’ll still perform poorly. How can we solve this issue? (Followup Question) xi. After thinking for a moment I said, sorry, no idea. xii. Haven’t you used async programming? We can use async to handle multiple requests at a time! (Answered himself as I got stuck)