The System Design Interview by Alex Xu tackles a lot of interesting topics from a conceptual perspective. It's not a reference manual, but rather a book that present ideas and solution schemes which others have had to face to be able to design some of the platforms that we currently use. In each chapter, a problem is presented and the solution is approached as a design process from scratch.
While my approach is more pragmatic and focused on gaining a deeper understanding, it is important to mention that the book's approach is to explain how to tackle a system design interview. Therefore, I will provide a brief summary of the techniques described in the book.
It is worth mentioning that this article is not meant to replace reading the book, I will not summarize the whole book.
The interview is a problem-solving simulation of a potential real problem where the interviewer and the interviewee collaborate to solve it and obtain a solution that fits the defined goals.
How to prepare a system-design interview?
In the book, there are four important phases described that have to be accomplished between 45 min and 1 hour. Each interview can differ for this reason, the way you have to face it can change too.
The four phases
1. Understand the problem and establish design scope.
In this phase, it is where the problem is established and where we have to ask all the questions to be able to gain the big picture. One of the most important characteristics expected from an engineer is to ask the right questions, make the correct assumptions, and be able to collect all the necessary information to carry on with the system design.
To outline the scope of the design and for both the interviewer and the interviewee to stay on the same page it is very important that the interviewee asks questions like the following:
- What do you want to build?
- What is the traffic volume? How many daily active users (DAU) will we have?
- How fast does the company anticipate to scale up? What are the anticipated scales in short, medium, and long-term?
- What is the company's technology stack? What systems are already available?
- What limitations and constraints will be? How the system should act under certain circumstances?
- How much time does the data have to persist in the system?
- What kind of data is going to be handled? Will it be public data or private data?
Each system is different and each system requires a different solution. For this reason, the questions that you will need to ask are different between one system and another. We should not try to do a design without specific answers to the problem defined. Hence, the importance of posing the right questions.
It's expected that this phase takes between 3 and 10 minutes.
2. Propose high-level design and get buy-in.
In this phase, it is expected that the interviewee creates a high-level system architectural design and obtains acceptance from the interviewer.
The interviewee should also work closely with the interviewer to create the initial draft of the design. During this phase, it is important that the interviewee makes assumptions and estimations based on the answers obtained in the previous phase.
Some self-questions to consider include:
- What kind of storage we will need: relational, key-value,...?
- How much latency can we tolerate? Do we need to use a cache system?
- What level of SLA can we commit to? Do we need to prioritize consistency or availability?
To make accurate estimations, it is recommended that the interviewee has a good understanding of storage and memory requirements, is familiar with the latencies of common operations, and has knowledge of third-party implementations that can aid in simplifying the design. This knowledge will help to quantify and justify decisions.
It's expected that this phase takes between 10 and 15 minutes.
3. Design deep dive.
In this phase, the interviewer and the interviewee have reached an agreement on the objectives and the scope is clear. At this point, the interviewee will need to thoroughly analyze the most critical components of the system. The interviewee will need to fit all the pieces together and provide proper justifications and explain the relationships established between them.
It's expected that this phase takes between 10 and 25 minutes.
4. Wrap up.
In this phase, the interviewer should ask follow-up questions or allow the interviewee to discuss any additional points. The interviewee should also suggest improvements and refinements to the design that can enhance scalability, reliability, consistency, availability, or any other aspect that can improve the system's performance.
It's expected that this phase takes between 3 and 5 minutes.
During all phases of the interview, the interviewee must speak loudly and engage with the interviewer as needed to create a sense of collaboration and ensure that solutions are mutually agreed upon and within the interviewer's expectations.
As I mentioned before, the approach that the book follows is not shared my expectations. However, we can extract important learnings at the time of designing a system: the problem-solving capacity and the resolution and reasoning capacity are key mindsets.
If you want to read and learn more about this book, this post references the “Chapter 2: Back-of-envelope estimation” and “Chapter 3: A framework for system design interviews”. You can get a copy here.