Design Zomato Restaurant Search | Design Proximity Service
Hard
Functional Requirements (FRs)
Users should be able to find nearby restaurants based on their location.
Users should be able to view the information about a restaurant by going to their page.
The system should return restaurants within a 20 km radius.
Restaurant admins can add/update/delete their information. The system does not need to reflect those changes to users in realtime.
Non-Functional Requirements (NFRs)
Daily-active users (DAU): 100M.
Number of restaurants: 500M.
Search requests per day: 10x of DAU.
Information updates per day: < 1% of #restaurants.
The search results should be returned very fast.
The system should be highly available and scalable.
How to solve the problem?
General:
Note everything you are discussing or thinking of in the text editor.
Draw everything that your interviewer needs to visualize on the whiteboard.
Be cognizant of how much time you've left and pace yourself (as required) so as to cover things that the interviewer wants to see you do based on the FRs and NFRs that were finalized.
Step 1: Think about the functional and non-functional requirements.
In an interview, the FRs and NFRs won't be provided.
You need to have a discussion with your interviewer to finalize these.
This step should take around 10-15 mins.
Step 2: For senior developers:
Note down the metric estimations.
The metrics would generally include read and write QPS, latency, storage, memory, bandwidth, etc.
Step 3: (Optional) Note down the APIs that you would need to support the functional requirements. Do it only if you've time.
Step 4: High-level design:
Propose and draw a very high-level design.
This design might have flaws and bottlenecks.
This design should just give a very high-level idea of the overall system.
Step 5: Deep-dive into the design:
Come up with the bottlenecks in the initial design and iteratively come up with a better design addressing the bottlenecks and trade-offs.
Update the design on the whiteboard as you are solving the bottlenecks.
Try to come up with multiple solutions for certain bottlenecks and mention the trade-offs and the reasons why you are picking up one over the others. If you don't have time, just mention them but don't note them.
If the interviewer asks, mention the DB schema as well. While practicing, make sure to add the DB schema.
Step 6: Overview:
Try to give an overview of the entire design specifically talking about the major decisions taken.