System Architecture Interview questions
Many people are afraid of system design interview as there's no certain pattern to prepare and the question is quite flexible and unpredictable. What's more, system design questions are usually open-ended so that there's no standard or correct answer, which makes the preparation process even harder.
I've covered this topic in detail in my blog and I'll also summarize here.
1. Get your hands dirty
The best way to prepare system design interview is always thru real projects and practices. Many people start their preparation process quite early like 6 months or 1 year in advance, then this is definitely an option for you. If you don't know what to work on, you can
- Build a small service/product to solve a real problem you have
- Contribute to a open source project at Github
- Find a topic that interests you like machine learning, network etc. and search for some projects you can work on.
What really matters is getting your hands dirty to work on some real life projects. It could take a long while before you can see your improvement, but at that point you will notice how straightforward those interview questions are. Also you will benefit a lot from this in the long run.
2. Be familiar with basic knowledge
As system design questions are open-ended and may cover many technical fields, the basic knowledge here is much more than data structure and algorithm.
First of all, there's no doubt you should be very good at data structure and algorithm. Take the URL shortening service as an example, you won't be able to come up with a good solution if you are not clear about hash, time/space complexity analysis.
There are also several other things you'd better be familiar with although it's possible that they may not be covered in your interview:
- Abstraction. You should be clear about how to abstract a system, what is visible and invisible from other components, and what is the logic behind it.
- Concurrency. It will be great if you can recognize concurrency issue in a system and tell the interviewer how to solve it.
- Operating system. Sometimes your discussion with the interviewer can go very deeply and at this point it's better to know how OS works in the low level.
- Machine learning (optional). You don't need to be an expert, but again some basic concepts like feature selection, how ML algorithm works in general are better to be familiar with.
3. Top down + modularization
This is the general strategy about solving a system design problem and ways to explain to the interviewer. The worst case is always jumping into details immediately, which can only make things in a mess.
Instead, it's always good to start with high level ideas and then figure out details step by step, so this should be a top down approach. Why? Because many system design questions are very general and there's no way to solve it without a big picture.
Let's use Youtube recommendation system as an example. I might first divide this into front end and backend (the interviewer may only ask for backend or a specific part, but I'll cover the whole system to give you an idea). For backend, the flow can be 3 steps: collect user data (like videos he watched, location, preferences etc.), offline pipeline that generating the recommendation, and store and serve the data to front end. And then, we can jump into each detailed components. For user data, we can list features that we think are relevant. (This is only an example solution, there can be better ones)
We can continue this analysis infinitely by going deeper and deeper, but the idea I want to explain here is that you should always have a big picture.
Another tip here is modularization. Like I illustrated above, it's better to divide a system into different components, which is also a good practice in real life projects.
4. Learn from existing system
This approach is what I usually suggest people to do. Whenever you are curious about some system, try to figure out how this system was designed. You can try to design by yourself first and then compare with how it is actually designed.
has a lot of good articles about how real world systems are designed. It might be a little overkilled for system design interview, but it's always good to know about them.
5. Mock interview
Quite honestly, it's not very easy to practice system design interview by yourself since there's no standard answer for it. So the suggestion is always doing this in front of some experienced engineers. Also thru this process, you'll spend majority of your time communicating and discussing with the interviewer, which is what system design interview mostly about.
With that in mind, we worked on building, which allows candidate have mock interview with experienced interviewers from Google, Amazon etc. and will get real feedback to help them improve.
Having system design interview is a lot of fun since it's much closer to real world products. The key to preparation is being clear about what's expected in the interview and spend enough time and effort on things that really matter.