Can you design Netflix in 45 minutes?
What??? Are you serious ?? (I can watch it for the whole night but…). It’s impossible to explain even a single component of Netflix and you are asking me to design it within just 45 minutes of a short time??
Yes, this is what you are expected to do in your system design interviews if you want to get your dream job in big tech giant companies. You will have to give a clear explanation about designing these kinds of large scalable distributed systems (like Twitter, Messenger, Netflix, Uber, etc..) to the interviewer. This round may be a challenging and complex round for you because you are supposed to cover all the topics and tradeoffs within this limited time frame which seems to be impossible. We don’t want to make this round scary for you so we will discuss step by step how to clear this round and some useful tips to avoid common mistakes.
Let’s try to make it simple and discuss some key points before you start your preparation for this round.
- Consider your interviewer as a team member and take this round as an opportunity to work with him where you both are supposed to solve a real-world problem related to your company’s goal but here you need to take the ownership and lead everything.
- The main purpose of this round is to understand how capable you are building a large scale system and your thought process behind designing a service. Clarity of thoughts matter a lot because if you can explain it to the interviewer, you can do this in your team as well.
- One of the good things for you in this round is that you are supposed to come up with the best solution for all kinds of open-ended problems instead of accurate solutions. Your ability to articulate your thought matters more than the final design you present to them.
We hope that from the above points we have simplified a few things for you and make this round a little bit easier for you.
Okay, I got it but where to start, where to end, tell me the best way to cover everything step by step within this strict timeframe.
We know that it might be an overwhelming round for you so let’s start discussing step by step approach and try to make this round easier for you.
1. Understand the Goal and Gather All the Requirements
You need to first understand your end goal before jumping to the solution so gather all the basic requirements from your interviewer. Ask relevant questions to clear your doubts. Design questions are basically open-ended conversation which doesn’t have one correct solution so it’s good to start with some basic assumptions.
- What’s the end goal of the system or service?
- Who are the end-users? How they will use the service? What features your interviewer wants you to include and what exclude?
- What should be the input and its output or final outcome?
A product like Facebook, Twitter or Reddit is a well-known product so even if you know how to design such kind of system still it’s your responsibility to share your assumptions and discuss with the interviewer what features they care about and what they don’t. They may want you to include some features which don’t exist in this kind of systems or they may tell you to exclude some features. So make sure you have a better understanding of all the requirements and features.
Consider the example of designing twitter. Some of the questions are who can post a tweet? who can read the tweet? who can follow the user? like, comments, pictures, active users, total users and discuss other features your interviewer wants you to include.
2. System Interface Definition and Establish Scope
After the first step, you need to identify what kind of APIs your system needs to get the job done based on whatever features you have included. Also, discuss the scope and availability of the system, discuss some relevant questions like do you both care about only end-to-end experience or just the API?. Client support (mobile, web etc). Authentication, analytics, integration, performance, etc. Is the system going to work if the host is down or the entire data system is down? So discuss with the interviewer how much availability he/she care about the system. From both, the above two steps make sure you know the exact scope of the problem and the complexity of the system.
3. Scalability Estimation:
You design a service that works for a hundred users, but is it going to work for a thousand users or million users? Is it going to scale and work fine as we add more users or more requests? Basically you need to consider the same feature for different scales and it’s very important to get the right scale because different answer requires a different design. Scalability also helps in load balancing, caching and partitioning so you can ask questions like:
- What’s the limit of the data or network or bandwidth we need to care about?
- How much storage do we need?
- What’s the average response time?
4. Start with High-level Components then move to Detailed Design
Start to cover the end to end process based on your goal, so identify each component to solve the actual problem or to implement your complete system. How all the components come together to meet the actual requirement? Below are some quick points to guide you properly while explaining the components:
- Divide your complete system into 6-7 higher level or core components.
- Drill down further and discuss the role and responsibility of each component also how they are going to interact or communicate with each other. While explaining the components your interviewer may guide you towards 1-2 components and wants you to explain those components in depth. So there you need to further discuss that in detail.
- Discuss the frontend, backend, networking, caching, load balancing, queueing, database, external API calls, user interaction, offline processes, etc.
- Tell the interviewer what are the technologies or database you can use in your system.
5. Tradeoffs and Resolving Bottleneck
Design interviews are open-ended conversations so there is no single answer and every decision will have a tradeoff when you will present your architecture and your thought process to the interviewer. The complex system always requires compromises so you need to tell them different approaches, their pros, and cons, and why would you choose one over another.
- Which database is fit in your system and why?
- Why would you choose a specific technology in different layers or components.
- Which frameworks can be good for your design and which one you need to choose?
- What are the different security options available to keep your data safe and which one you would choose?
You also need to think and resolve the bottlenecks like what kind of failure can occur in your system and what’s the solution for that. Do you need to keep a backup or you will take the help of any other resources. Do you have any backup for your data in case your server crashes and you lose the entire data? How would you monitor the performance of the service? If any component fails then what’s the solution to run your system smoothly and properly? Basically you should have an organized and clear plan to deal with all these kinds of critical failures in your system.
- Try to follow 80-20 rule during your interview, where 80% of the time you will be speaking and explaining everything and 20% of the time your interviewer.
- Don’t use buzzwords and pretend to be an expert if you don’t know something. You read some blog posts or few topics today and tomorrow is your interview, during your interview if you throw some buzzwords like “No-SQL”, “Mongo DB” and “Cassandra” then it may backfire you. You can’t make fool to the interviewer who is an industry expert, always consider that your interviewer may ask for more details and justification so if you are using technology X or database Y then “why?”, prepare yourself for this kind of questions.
- Do not go into detail prematurely. Many times it happens when a candidate starts explaining one part of the system, they go into too much detail of the component and forget about the strict timeframe and other components. Maybe the interviewer wants you to stop somewhere where they don’t need too much detail. So to avoid this mistake wait for the interviewer’s feedback or response. They will give you some hints or will direct you whatever part of the system they want you to explain further.
- Don’t have a set architecture in mind like MVC or event-driven and try to fit the requirement somehow in that architecture. Maybe it’s not suitable as per the requirement. Requirements may change during the interview to test your flexibility so try to avoid this mistake.
- Be honest during your interviews and if you have never used technology X then you don’t need to be fake in that situation. Try to find common solutions and show them your honesty, confidence, and willingness to learn something. That will make a good impression on interviewer.
- Your practical experience, your knowledge, understanding of modern software system and how you express yourself clearly during your interview matters a lot to design a system successfully.
- System Design Course
- System Design Preparation Cheatsheet
- Top 10 System Design Interview Questions for Software Engineers
- System Design Cheatsheet