Most developers, even today, find a System Design Interview (SDI) very challenging, primarily because of:
- Their lack of prior experience in designing and implementing large scale systems.
- How unstructured a System Design Interview usually is. Even engineers with years of professional experience in building DS aren’t comfortable with SDIs because most design problems have open-ended solutions that are subjected to the interpretation of the reader.
Ensuring an exceptional performance in SDIs is crucial to your job prospects as it significantly reflects upon your ability to manage complex systems, and translates into the responsibilities you’re entrusted with when hired. In some cases, your expertise in System Design also affects the remuneration (and stocks/equity) that you’re offered.
Let’s go over the most frequently asked questions in SDIs and a few pointers that you, a Software Engineer, should keep in mind while designing the system.
Common System Design Interview Questions
1. Design a URL shortening service that’s similar to Bitly or TinyURL
In this scenario, you’re expected to create a system/service that not only shortens a (typically) long URL but also generates a unique alias for the same.
Points of discussion:
- How can you ensure that each URL has a unique ID?
- If you were to generate unique IDs for hundreds and thousands of URLs in a short period of time – how’d you handle all the URL shortening requests that you’re going to be bombarded with every second?
- How will your system handle URL redirects?
- Is it possible for your designed system to support custom short URLs? If yes, how?
- How can you delete expired URLs?
- How do you keep a track of all the metrics related to click-through-rates (CTR)?
A good SD question can sometimes feel ambiguous because usually there are no strictly right or wrong answers—the reason being that these questions are an opportunity for you to demonstrate your knowledge/expertise on the problem space and any bottlenecks that may arise. Therefore, don’t hesitate from asking clarification questions to narrow down the scope of the problem, understand user expectations, define potential bottleneck areas, and offers you a sense of direction.
2. Design a global video streaming system like YouTube, Twitch or Netflix.
In order to accommodate videos, your system is expected to sometimes store and transmit petabytes of data. The end-goal is efficiently storing and distributing data in a way that a large number of users can both watch and share videos simultaneously (for example, imagine that you’re streaming the latest episode of a popular TV show like Stranger Things).
Additionally, consider touching the following discussion pointers:
- How are you planning to record relevant (and accurate) stats about videos, including but not limited to the total (and unique) number of views, and audience sentiment analysis?
- How can a user post comments in real-time on videos?
3. Design a global chat service like Whatsapp or Facebook Messenger.
Your system should answer the following questions for the interviewers:
- How’re you ensuring one-on-one communication between users?
- How can your System Design (SD) to support group chats?
- How does your SD respond when a user loses their internet connection when they’re chatting?
- Is end-to-end encryption is possible for your SD? If yes, how?
- How can your SD leverage push notifications to encourage repeat users?
There are many things that you should consider while tackling a new system. For example, who are the users of the system, what’s the scale you’re working with, and how you plan to handle versioning, amongst others. Formulating a set of criteria before starting will not only accelerate your decision-making process but also helps you systematically break down the problem into individual components. A good exercise is to practice designing a coffee ordering service before your interview.
Once you answer the above questions, you can finally form a complete picture in your head about what your coffee ordering service looks like.
4. Design a social network and/or a message board service like Reddit, Quora or HackerNews
In this case, your SD should:
- Allow users to post questions and share links that other users can comment on.
- Keep a record of important metrics like upvotes/downvotes, the total number of views, etc.
- Let users follow topics of interest and other like-minded users on the platform.
- Display an algorithmically-curated timeline (or newsfeed) that highlights a user’s top answers/posts and the topics they follow.
Remember, the main purpose of this question is to gauge your capability in building large-scale systems and what your thought process is like when you’re designing any kind of system. How you convey your thoughts to the interviewer also matters a lot – after all, if you can explain your concept to a handful of people, it’s assumed that you’d be able to replicate the same while leading a team.
Preparing for a technical interview? Here’s a foolproof guide to help you ace it.
5. Design a global file-sharing/storage SD that’s similar to Dropbox or Google Drive.
Interviewers are interested to know the following about your SD:
- How can users upload/search/share/view files?
- What is the process of keeping track of file-sharing permissions?
- How can multiple users edit the same document?
6. Design a social media service (like Twitter, Instagram or Facebook) that can handle hundreds of millions of users at once.
When designing an SD for this particular use-case, most interviewers are more interested in knowing how you incorporate the following components:
- Newsfeed generation.
- Efficient storage and search for posts or tweets.
- A Social Graph that outlines who engages with whom or who follows whom. Especially, when you have millions of users following an influential public figure.
Many times, the interviewers spend the entire System Design Interview evaluating the design of the newsfeed. This is because, although platforms like Facebook and Twitter are well-known, there are always going to be features that interviewers care more about than the others. Sometimes, they’d even want you to include or exclude certain features, so remember to share your assumptions with the interviewer.
7. Design a search engine that’s either a Web Crawler or Type-Ahead:
For a Type-Ahead System Design, when the user enters a query, they’re immediately shown the top 10 searched terms that are related to the said query. Here, you should be ready with the following discussion points:
- How does your SD store previous search queries?
- What is the process of ensuring that the data is always fresh?
- How can you discover the best matches to a previously typed string?
- How to manage updates when a user is typing faster than what the SD is used to?
For Web Crawler, interviewers will expect a scalable SD. It should be able to crawl the entire internet to fetch hundreds of millions of relevant web pages.
Common discussion pointers, in this case, include:
- What is the process of finding new web pages?
- How can you prioritize web pages that are subjected to change dynamically?
- How can you prevent your crawler from being infinitely stuck in the same domain?
You are likely to get one of these questions in your next system design interview. And to find opportunities for the role of a System design engineer, try Workship.