Top 10 Facebook system design interview questions

TOP FACEBOOK SYSTEM DESIGN INTERVIEW QUESTIONS (PART 1) | Facebook Pirate Interview Round

Top 10 Facebook system design interview questions

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.

Functional requirements include:

  • Users should see posts from people, pages, and groups that they follow on the Newsfeed.
  • The service should append new posts for all active users as they arrive to the feed.
  • The service should support live commenting.
  • Non-functional requirements include:

  • The system should be able to generate any user’s newsfeed in real-time.
  • Minimum latency is desirable so users don’t experience a lag.
  • 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.

    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. design messenger facebook system design interview question

    Functional requirements include:

  • The service should support one-on-one conversations as well as group chats between users.
  • The service should support persistent storage of chat history.
  • Non-functional requirements include:

  • Minimum latency is needed to support real-time chat.
  • High consistency is needed so that users’ devices display the same chat history.
  • Availability should be high, but can be compromised as a tradeoff for high consistency.
  • 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:

  • How will clients maintain an open connection with the server?
  • How can the server track all opened connections to efficiently redirect messages to users?
  • How will the server handle messages sent to offline users?
  • 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. design instagram facebook system design interview

    Functional requirements include:

  • Users can upload, download, and view photos.
  • Users can follow other users. Non-functional requirements include:
  • High availability can take priority over consistency.
  • High reliability is needed so that no uploaded media is lost.
  • 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.

    How to answer system design interview questions

    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:

  • State what you know: State what’s known about the design problem you’ve been given.
  • Clarify and ask questions: Clarify the requirements of your system.
  • Identify and narrate tradeoffs at decision points: Narrate tradeoffs between system design components at all decision points. For example, reference CAP Theorem when you have tradeoffs between consistency and availability.
  • Discuss recent developments in technology: Show that you’re a next-gen engineer by discussing how you’d implement technologies such as machine learning into your system’s design.
  • Master these system design questions and more.

    Join the thousands that have leveled up with our popular system design interview 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. design tinyurl facebook system design interview question

    Functional requirements include:

  • The service should generate a unique short link for any URL it is given.
  • The service should redirect users from short link to original link.
  • Users can customize their short link.
  • Non-functional requirements include:

  • The system should be highly available so redirections don’t fail due to service interruption.
  • Minimal latency is needed for real-time URL redirection.
  • 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.

    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.

    The requirements for this system include:

  • Drivers should be able to regularly notify service of their current location and availability.
  • Customers should be able to see nearby available drivers.
  • Customers should be able to request rides and drivers should be notified.
  • 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.

    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.

    Functional requirements include:

  • Users can post tweets containing text, photos, or videos.
  • Users can follow other users.
  • Users can favorite and retweet tweets.
  • Non-functional requirements include:

  • The system should be highly available.
  • The system’s latency should be no greater than 200ms for timeline generation.
  • Consistency can take a hit as a tradeoff for availability.
  • 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.

    Related Posts

    Leave a Reply

    Your email address will not be published. Required fields are marked *