Ace your System Interview with these Strategies – Part 2
By Frank Kane
This article is an excerpt from our course, Mastering the Systems Design Interview. As part 2 of our series, this article will share strategies & skills to help you master your Systems Design Interview. In part 1, we went through how to ask the right questions to stand out in the interview. Click here to review part one.
Now let’s dive in. First and foremost, you want to let your interviewer see your thought process. As you’re thinking about different strategies and the pros and cons of them, don’t keep it inside your head where the interviewer can’t see it. Talk about it as you’re thinking through it. That will give the interviewer a chance to steer you in the right direction, which is only going to help you.
Start by repeating the question and then break it down into specific requirements.
- If I say “design Youtube,” you should say, “Okay, you want me to design Youtube. What part of YouTube do you want me to design? There are many components to YouTube, like recommendations, editing content, channels, advertisements, and managing payments to people.
- What piece do you want me to focus on?
- Is it just the storing and the serving of the videos themselves?”
Odds are they’ll say, “yeah, let’s just focus on that” because obviously, you’re not going to design all of YouTube in 20 minutes.
So, narrow the problem down to what they really want you to do. Then ask more clarifying questions. How many videos are we talking about? How much traffic are we talking about?
They might push back on you and say, “well, what do you think it is?” You might have to estimate that yourself. But just make sure you come to an agreement about what the scale of the problem really is, and what the requirements are in terms of latencies or availability. Those requirements will inform what tradeoffs you can make in your design.
You might also ask about the budget. Do I have infinite money and infinite servers to throw at this? Or do I have cost constraints to think about as well? Clarify those requirements upfront. As you start to think about what the implications of those requirements are, talk about it.
I’ve seen one other system design interview prep course, and the instructor’s advice
was to start off by saying, “okay, can I think about this for five minutes?” I think that’s a terrible idea. Don’t just sit there in silence for five minutes. It’s awkward, and the interviewer doesn’t get any insight into your thought process, which is what they really want to see. So, no, do not just sit there in silence for five minutes while you think about it. Think out loud, and let the interviewer see how you approach the problem.
Once you understand what those requirements are, a good idea is to work backward from the customer experience. It’s very tempting to start with your favorite technology and say, “oh, okay, I want to use Apache Spark and a deep neural network for this problem,” and work forwards from your favorite technologies in hopes that you end up with a solution that meets the customer requirements.
A better approach is to work backward from those customer requirements and figure out what technologies meet those requirements. For example, say we’re asked to design YouTube. You need to vend massive amounts of videos all around the world at very low latency and at a massive scale. That probably means you need to use a CDN for the most popular videos at least. Where does the data come from that feeds that CDN, and how is that data cataloged? How do I access it? Work backward from the end user to the CDN, to the distributed data store that feeds that CDN, to the systems that populate that data store. That’s working backward from the customer, as opposed to working forwards from the lowest level technology and hoping you arrive at the right place.
Working backward will gain you major points at Amazon in particular because it is a very core piece of their entire culture. You are routinely expected and evaluated on how well you work backward from the customer at Amazon. Simply saying during an interview, “I’m going to work backward from the customer experience here,” will earn you a ton of goodwill at an Amazon system design interview. But even outside of Amazon, working backward is the right way to do it. Most experienced interviewers will appreciate this approach.
Tying it back to our YouTube example again, we might start off by asking clarifying questions. How will users discover the videos? Do we need to think about building a search engine or a recommender engine or an advertising engine? Figure out what the customer experience is that you’re being asked to deliver. What piece of that experience are you being asked to design? Start by understanding what customer experience you’re being asked to deliver, and then work backward from that customer experience to the technical components that you need to deliver it.
You must first identify who the customers are.
- Are these people all around the world?
- Are they in one specific region primarily?
- Are they accessing your data at weird times, or are there weird peaks in traffic that we need to worry about?
- What are their use cases?
- What are they trying to do?
In our YouTube example, they’re trying to find a video and play it back in a reliable manner. They don’t want to see any buffering.
Which use cases do you need to concern yourself with? Don’t paint yourself into a corner where you’re trying to design all of YouTube in 20 minutes or all of Google or all of Amazon. Make sure you define upfront what piece of it they really want you to do.
Your first task in any system design interview is to clarify the requirements of what you’re being asked to design. Clarify them in terms of the customer experience whenever possible. Your interviewer is really trying to see that you can think about problems from a business perspective and not just a technical perspective. If you start with the customer experience and focus on that, that shows me that you can think about this like a business owner would. You’re thinking about how this technology will provide an experience to this company’s customers that can make them money down the road. Your job is not just about applying cool technology. It’s about finding solutions for delivering new compelling customer experiences.
Once you’ve defined the customer experience you’re trying to deliver, what do you ask about next?
You need to define the scaling requirements of the system you’re being asked to deliver. Nail down what the scale of the system really is. Are we talking about hundreds of users or millions of users? That makes a big difference as to what sort of technologies you will invoke. And it will inform you of the need for horizontal partitioning. If the scale is massive, then you know you need some sort of horizontally scaled solution. You can’t just throw one giant database at it or one giant web server. You need some sort of distributed system. And if it’s truly massive, maybe you need to rely on cloud storage solutions like S3, where somebody else is managing all that cost and complexity for us.
Also, understand how often the users are coming. What kind of transaction rates are we talking about that we need to support? Again, if it’s large rates of transactions, you will need many servers at the front end to manage those transactions. Think about how those transactions are distributed across different data centers and across the world.
Also, define the scale of the data. That data must come from somewhere, and it probably needs to be processed in some way. Are we talking about hundreds of videos, millions of videos, or billions of videos? If it’s a really big number, we need some sort of distributed system for processing and storing that data. You will need to employ every trick in the book for horizontally scaling your servers, your data storage, and your data processing.
But not every problem warrants that sort of approach. If you’re being asked to design some internal tool only used by some department within your company, you don’t need that level of complexity and expense. You should always prefer the simplest solution that will meet the requirements. But generally, if you’re being asked to design a system for a large company, they’re asking you to design something at a massive scale. Often, the answer will be some sort of horizontally scaled solution, but at least articulate that, ‘Hey, this is massive scale. I need to do horizontal scaling’.
In the off chance that you’re being asked to design something smaller, go for simplicity and explicitly say that’s what you’re doing. Say, “hey, I know we could throw a big Hadoop cluster at this problem or some big distributed Elasticsearch cluster, but I don’t need to. I don’t want to have to maintain all those services if I don’t need to. And I don’t want to be paying a big web services bill either, so why take on that complexity where I can just have a database and a backup database and a few web servers in front of it and be done with it? ”
Learn more strategies on how to Master your System Design Interview today with our Mastering the Systems Design Interview Course.
Click here to enroll: https://www.sundog-education.com/course/mastering-the-system-design-interview/