To prepare for a Facebook design system interview, study distributed systems concepts, scalability principles, and architectural patterns. Practice designing large-scale systems, emphasizing modularity, fault tolerance, and data consistency.
The system design interview is a necessary hurdle as you advance in your career as a software engineer. System design interviews assess your design skills by asking you to build a scalable system. Even seasoned engineers can struggle with this interview round, but you’re already ahead of the game if you’re here for interview preparation.
Today we’ll discuss the top system design interview questions asked at Facebook. These questions are also common fare for system design interviews at all top tech companies, including FAANG (Facebook, Apple, Amazon, Netflix, and Google).
Master these system design interview questions and more in our brand new course.
Facebook’s interview rounds begin remotely and progress to onsite interviews. The remote interviews consist of a phone screen with a recruiter and a technical phone screen with a software engineer. The onsite interviews are 45 minutes each and consist of the coding interview, system design interview, and behavioral interview. Facebook might allow you to choose between a system design or product design interview. While similar, product design may be relevant for roles handling a user-facing product, and system design for roles handling large-scale distributed systems.
Facebook’s system design interview is also referred to as the Pirate Interview Round.
Your interviewers will give you an open-ended question like, “How would you design Messenger?” You’ll spend most of your time asking questions, presenting your thought process, and diagramming at the whiteboard. There is no right or wrong answer to these questions. Your goal is to show your design skills and understanding of the many components that constitute a scalable system.
We recommend approaching your answer like this:
You may be asked to design Facebook Newsfeed, which displays a scrollable feed of status updates. These updates can contain photos, videos, or text. Users can post status updates or engage with status updates from accounts and pages they follow.
Similar services: Twitter Newsfeed, Instagram Newsfeed, Quora Newsfeed
Difficulty: Hard
Functional requirements include:
Non-functional requirements include:
At a high level, this problem can be split into two parts: feed generation and feed publishing. For feed generation, you’ll want to determine how many feed items to store in memory for a user’s feed as well as whether the newsfeed should be generated or kept in memory for all users. For feed publishing, you’ll want to consider whether to use a “Push” or “Pull” model to publish feed data to users.
Learn more about how to design a newsfeed here
You may be asked to design Messenger, an instant messaging service through which users send messages to each other. Messages can contain text or other media attachments.
Similar services: WhatsApp
Difficulty: Medium
Functional requirements include:
Non-functional requirements include:
At a high level, you’ll need a chat server to manage communication between users. Each message a user sends will go to the server before going to the recipient. The server will also store the message in its database.
Some questions you’ll need to address for this problem are:
You may be asked to design Instagram or a similar photo-sharing service. Instagram allows users to upload photos and share them with other users.
Similar services: Flickr, Picasa
Difficulty: Medium
Functional requirements include:
Redundancy and reliability are crucial to this system. You must ensure that no uploaded files are lost. You need to create redundancy to ensure that the system still runs in the event that one server fails. You’ll need to store multiple copies of each file across several storage servers. You’ll also have several replicas of services running in the system to protect your system from having a single point of failure.
See the design structure of Instagram in more detail here.
Join the thousands that have leveled up with our new system design course.
You may be asked to design TinyURL or a URL shortening service. These services create shorter aliases for long URLs. The short aliases are known as “short links” and redirect users to the original URL.
Similar services: bitly
Difficulty: Easy
Functional requirements include:
Non-functional requirements include:
You could use two solutions to ensure a short and unique key for a given URL: encoding actual URLs or generating keys offline. To scale your database, you’ll need to partition it to store information about billions of URLs. You could use either range-based partitioning or hash-based partitioning. You can also cache frequently accessed URLs so that application servers don’t always need to access backend storage.
Explore more about how to design TinyURL here.
You may be asked to design Uber or another rideshare service. Uber allows customers seeking rides to connect with available drivers in their proximity. The application has two types of users: drivers and customers.
Similar services: Lyft, Didi, Via, Sidecar
Difficulty: Hard
The requirements for this system include:
This system’s design can include load balancers, notification servers, aggregation servers, driver location servers, QuadTree servers, and a QuadTree index. You use server replicas in case the driver location or notification servers die. You can also store data in persistent storage like solid state drives (SSDs) to provide fast input and output. You can recover data from this storage in the event that both primary and secondary servers die.
Try your hand at designing Uber here.
You may be asked to design Twitter or a similar social network. Twitter allows users to publish short-form posts called “tweets.” Twitter users can post tweets, favorite and retweet tweets, and follow other users.
Difficulty: Medium
Functional requirements include:
Non-functional requirements include:
This will be a read-heavy system. At a high level, you’ll need multiple application servers with load balancers to serve these requests. You’ll need an efficient database that can store new tweets and support a large number of reads. You’ll also need file storage to store photos and videos.
Dive deeper into designing Twitter here.
You may be asked to design Ticketmaster or another online ticketing system. Ticketmaster is a booking system that allows customers to purchase theater seats for a specific movie screening. Customers can search for movie screenings in any location.
Difficulty: Hard
Functional requirements include:
Non-functional requirements include:
At a high-level, you can use web servers with load balancers to handle user sessions. Application servers can handle ticket management, storing data in the databases, and working with cache servers to process reservations.
An API rate limiter controls how many requests a sender can issue to an API in a specified time period. The limiter blocks requests once the defined cap is reached. Throttling is the process of controlling the usage of the APIs by users during a given period. Rate limiters protect against attacks that are typically generated by bots.
Difficulty: Medium
Functional requirements include:
Non-functional requirements include:
Rate limiting can be done with either a fixed window algorithm or rolling window algorithm. The fixed window algorithm defines the time window from the start of the time-unit to the end of the time-unit. The rolling window algorithm defines the time window as the fraction of the time at which the request was made plus the time window length.
Get hands on experience designing a rate limiter here.
A web crawler is a software program that visits sites across the web and reads them to gather information. Web crawlers are often used by search engines. Search engines download webpages to create an updated index of web content for faster searches.
Difficulty: Hard
A web crawling service needs to be designed with scalability and extensibility in mind. It’ll need to crawl the entire Web and fetch hundreds of millions of Web documents. Web crawling is difficult because of the sheer volume of pages that change frequently on the World Wide Web. The crawler can only download a fraction of web pages at a time, so it must be intelligent enough to prioritize download. You might also opt for a modular design with the expectation of adding new functionalities later. After all, with technology changing every day, there could be newer document types in the future that your crawler must download and process.
At minimum, a web crawler needs these components:
Continue learning how to design a web crawler here.
You may be asked to design YouTube or another video streaming service. YouTube allows users to upload, view, share, rate, report, and comment on other users’ videos. Users can also subscribe to other users’ accounts.
Similar services: Netflix, Vimeo
Difficulty: Medium
Functional requirements include:
Non-functional requirements include:
You’ll need to address important questions in this system such as where videos and thumbnails will be stored. You’ll also need to consider how to manage traffic effectively. This system will have a very high read load. Since you’ll have a large number of new videos each day, the data should be distributed across several machines to efficiently perform read/write operations.
Continue learning how to design Youtube here!
System design interviews have long been common practice for software engineering interviews, and they aren’t going away anytime soon! Once you master system design interviews, these interview rounds will be a breeze.
To help you level up in your career, we created the Grokking the System Design Interview course. You’ll learn about system design principles and examine complexities and solutions of several common system design questions, including the ones in this article.
Happy learning!
Free Resources