Note: This post was originally published on Hackernoon.
Designing Large Scale Distributed Systems has become the standard part of the software engineering interviews. Engineers struggle with System Design Interviews (SDIs), primarily because of the following two reasons:
- Their lack of experience in developing large scale systems.
- Unstructured nature of SDIs. Even engineers who’ve some experience building large systems aren’t comfortable with these interviews, mainly due to the open-ended nature of design problems that don’t have a standard answer.
Excellent performance in SDIs is highly rewarding since it reflects upon your ability to work with complex systems and translates into the position and compensation (salary & stocks) that the interviewing company will offer you.
If you are looking for resources to prepare for System Design Interviews, take a look at Grokking the System Design Interview.
At Educative.io, we’ve talked to hundreds of candidates who went through design interviews. As part of the process, we’ve compiled a list of most frequently asked System Design Interview Questions.
Following are the most frequently asked questions along with a few pointers to the things that interviewers want you to consider while designing the system.
1. Design TinyURL or bitly (a URL shortening service)
Given a (typically) long URL, how would how would you design service that would generate a shorter and unique alias for it?
Discuss things like:
- How to generate a unique ID for each URL?
- How would you generate unique IDs at scale (thousands of URL shortening requests coming every second)? *How would your service handle redirects?
- How would you support custom short URLs?
- How to delete expired URLs etc.?
- How to track click stats?
2. Design YouTube, Netflix or Twitch (a global video streaming service)
Videos mean that your service will be storing and transmitting petabytes and petabytes of data.You should discuss how to efficiently store and distribute data in away that a huge number of users can watch and share them simultaneously (e.g., imagine streaming the latest episode of a hit TV show like Games of Thrones).
Also, discuss:
- How would you record stats about videos, e.g., the total number of views, upvotes/downvotes, etc.
- How would a user add comments on videos (in real-time).
You can check out my previous post on "How NOT to design Netflix in your 45-minute system design interview"
3. Design Facebook Messenger or WhatsApp (a global chat service)
Interviewers are interested in knowing:
- How would you design one-on-one conversations between users?
- How would you extend your design to support group chats?
- What to do when the user is not connected to the internet?
- When to send push notifications?
- Can you provide end-to-end encryption? How?
4. Designing Quora or Reddit or HackerNews (a social network + message board service)
Users of the services can post questions or share links. Other users can answer questions or comment on the shared links. The service should be able to:
- Records stats for each answer, e.g., the total number of views, upvotes/downvotes, etc.
- Users should be able to follow other users or topics
- Their timeline will consist of top questions from all the users and topics they follow (similar to news feed generation).
5. Design Dropbox or Google Drive or Google Photos (a global file storage & sharing service)
Discuss things like:
- How would users be able to upload/view/search/share files or photos?
- How would you track permissions for file sharing
- How would you allow multiple users to edit the same document
6. Design Facebook, Twitter or Instagram (a social media service with hundreds of millions of users)
When designing a social media service with hundreds of million (or billions of users), interviewers are interested in knowing how would you design the following components
- Efficient storage and search for posts or tweets.
- Newsfeed generation
- Social Graph (who befriends whom or who follows whom — especially when millions of users are following a celebrity)
A lot of times, interviewers spend the whole interview discussing the design of the news feed.
7. Design Uber or Lyft (a ride sharing service)
While designing a ride-sharing service, discuss things like:
- The most critical use case — when a customer requests a ride and how to efficiently match them with the nearby drivers?
- How to store millions of geographical locations for drivers and riders who are always moving.
- How to handle updates to driver/rider locations (millions of updates every second)?
8. Design a Web Crawler or Type-Ahead (search engine related services)
For Type-Ahead, as the user types in their query, you need to design a service which would suggest top 10 searched terms starting with whatever the user has typed. Discuss things like:
- How to store previous search queries?
- How to keep the data fresh?
- How to find the best matches to the already typed string?
- How to handle updates, and the user is typing too fast?
For Web Crawler, we have to design a scalable service that can crawl the entire Web, and can fetch hundreds of millions of Web documents. Discuss things like:
- How to find new web pages?
- How to prioritize web pages that change dynamically?
- How to ensure that your crawler is not infinitely stuck on the same domain?
9. Design an API Rate Limiter (e.g., for Firebase or Github)
You are expected to develop a Rate Limiter services that can:
- Limit the number of requests an entity can send to an API within a time window, e.g., 15 requests per second.
- The rate limiting should work for a distributed setup, as the APIs are accessible through a cluster of servers.
- How would you handle throttling (soft and hard throttling etc.).
10. Design Yelp or Nearby Places/Friends (a proximity server)
This service would need to store locations for millions of people/places. Discuss things like:
- How would the users of the service be able to search nearby friends or places
- How to rank places (based on the distance, user reviews).
- How to efficiently store location data according to the population density (e.g., a block in New York City might have more places/people than a small city).
Interview Preparation Resources for Software engineers
Following are some resources that can help you prepare for software engineering interviews.
- System Design Interviews: Grokking the System Design Interview.
- Coding Interviews: Grokking the Coding Interview: Patterns for Coding Questions.
- Further readings: Anatomy of a System Design Interview
Happy interviewing!
Fahim is the co-founder of Educative. We are building the next generation interactive learning platform for software engineers and instructors. Learners learn by going through interactive courses. Instructors can quickly create and publish interactive courses using our course builder. If you are interested in publishing courses or knowing more, feel free to reach out.
*All product names, logos, and brands are the property of their respective owners.
Top comments (10)
What's the answer to each question?
This blog-post is more marketing than information. If you want the answer to these questions, the author is suggesting that you purchase the products he sells.
I'm not going to buy from someone who does not provide the value up front.
The real world answer to all of them...
Thanks for posting this, it was an interesting read. I recently went through a few loops where I've seen an increased appearance of such questions in interviews. To me, these are better than whiteboard coding, and in my opinion, companies should put more focus on these questions especially for senior candidates.
Biggest take from my experiences on how to answer such questions is to first figure out a running system before thinking about scaling it. I would start with building a service say Youtube on a single server, listing down how my service handles major workflows like uploading a video, encoding it, generating thumbnails, adding it to the search index, etc. Defining system interfaces (APIs) helps a lot during this phase. Later, focus on scale-out and handling system bottlenecks.
There is also a nice resource from Donne Martin regarding system design interviews:
github.com/donnemartin/system-desi...
Highly recommended!
P.S.
If anyone is interested in helping to translate this to polish ping me ;)
really nice repository. Feels like it's a full time job trying to apply for jobs that conduct such interviews, don't think they're feasible, in particular not for startups.
Interesting, thanks! As an interviewer I'm surprised by how similar a lot of these scenarios are (ie: solve a data flow / graphing / caching problem), although that makes researching possible answers easier :)
I would hope that there are also domain-specific questions that represent the challenges individual organisations need to address to retain their unique value proposition and stay in business. Identifying these values when creating interview questions is also a learning experience (how often do we ask "what is unique about us?" or "what are we striving to do best?").
We are professionals from FAANG companies who want to share our knowledge and learnings with others in the tech community. We have text and video content on the basic concepts of System Design and real-life examples of System Design Interview.
Youtube Channel: youtube.com/channel/UC_n-A84J0UcU5...
Basic Concepts of System Design: techtakshila.com/system-design/cha...
System Design Interview: techtakshila.com/system-design-int...
these designs are quite intensive, how realistic would you say they are ?