paint-brush
I Led Dozens of Meta System Design Interviews, Here's The Right Way to Prepby@fahimulhaq
209 reads

I Led Dozens of Meta System Design Interviews, Here's The Right Way to Prep

by Fahim ul HaqAugust 5th, 2024
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

After conducting system design interviews for dozens of candidates at Meta (as well as Microsoft and Educative), I've seen the good and the bad. Today, I'll share the tips I wish I could've given other candidates, and break down 9 common System Design Interview problems a SWE candidate applying to Meta might face.
featured image - I Led Dozens of Meta System Design Interviews, Here's The Right Way to Prep
Fahim ul Haq HackerNoon profile picture

When coordinating your interview at Meta (formerly Facebook), you'll be asked whether you want to do a System Design Interview ("Pirate") or a Product/API Design Interview ("Pirate X").


As a systems engineer myself, I chose the System Design Interview. Since you're here, I'm guessing that's your choice, too.


After conducting system design interviews for dozens of candidates at Meta (as well as Microsoft and Educative), I've seen the good and the bad — as well as the common factors behind success in these interviews. Today, I'll share a complete system design guide for success I wish I could've given other candidates, and break down 9 common System Design Interview problems a SWE candidate applying to Meta might face.


Let's get started.

What happens in the system design interview at Meta

After some introductions, the system design interview begins with a design problem. The question will be broad, asking you to design a large-scale distributed system for an application or software system (e.g., Design Uber).


Since the question is vague, you'll be expected to ask follow-up questions to understand the problem, define its scope, and determine the requirements and possible constraints.


You'll then start with your design. After discussing functional and non-functional requirements, you'll select major components and their interactions in a high-level design. Following the high-level design, you'll provide a storage schema for data and define API models.

After this, you can begin the detailed design, wherein you'll discuss each component and addressing any deficiencies in the high-level design. This can involve discussing data structures, algorithms, communication protocols, or implementation details.


Devising an efficient solution for a system design problem is challenging as it involves various skills, including the basics of networking, distributed systems, databases, architecture, etc. However, interviewers aren't unrealistic about your skill set or experience, and expectations are certainly lower for junior engineers than for senior engineers.


The highest-performing candidates have excellent communication skills.


System design interviews are highly discussion-based, so you should be sure to communicate your thought process as you go. You'll be expected to respond to follow-up questions to discuss other design aspects, evaluate already-defined requirements, and highlight distinctive features. These are opportunities to demonstrate your depth of knowledge to your interviewer and prove that you have the appropriate knowledge for your desired role/level.


This being said, you can expect much discussion at the end while you're evaluating and getting feedback on your final design. This makes time management important. Your interview will be approximately 45 minutes long, with 5 minutes for introductions. You should budget no more than 30 minutes for the design process so you can have enough time for discussion at the end.

The process for the system design interview at Meta


Interested in cracking design interviews at other top companies? Check out another blog, Beginner’s guide to system design interviews at FAANG/MAANG, for more insider tips about how to navigate system design interviews in big tech.


Now that you know what to expect, let's discuss some common questions in system design interviews at Meta.

Common system design problems asked in interviews at Meta

For each design problem below, we'll discuss the starting points for their detailed design: their functional/ nonfunctional requirements and high-level design.


1) Design a system for the chess game

Problem statement: Design a two-player online chess game. It needs to be fast, reliable, and support 100 million monthly active users (MAU) playing one game a week.


I’ll stick to the following requirements for the system of chess game:


  • Functional requirements:
    • Create a game: The system should be able to create a game for two online players. It will also enable the white side to start first. The ranking and rating algorithms will select and direct these players to the same board.
    • Record each player’s status: The system should be able to store game information, each player’s moves, and statistics, such as win, loss, best, and worst openings.
    • Valid moves: The system should ensure each move is valid via an accurate chess program. Also, none of the players can undo or cancel a move.
    • Display each move: The system should display each move to both players.
    • Game termination: The system should ensure the game termination states such as checkmate, resignation, forfeit, or stalemate.


  • Nonfunctional requirements:
    • Latency: The system’s latency should be within 100 ms to ensure smooth gameplay and quick response time.
    • Reliability: The system should continue functioning correctly even if any parts fail.
    • Scalability: The system should support a large number of users, at least 100 million MAU.
    • Consistency: The data accessed by different players should be accurate and reflect the latest state of the game.


The high-level design of the chess game

The chess game’s high-level design contains API gateways, load balancers, and different services. Players are logged in to the system via application servers, and they can start a match using the game engine. The game engine performs various tasks, including move validation, game state management, and rule enforcement. Similarly, the game engine manager manages the life cycle of game engine instances and distributed load among various game engines to ensure scalability. The WebSocket servers are responsible for real-time communication between the players and move broadcasting during a game. Similarly, all states are logged into the persistent layer during the game.

The high-level design of the chess game

2) Design a comments moderation system

Problem statement: Design an automated comments moderation system to review and manage user comments before they appear on published content. (A similar problem might be: Designing a live commenting system).


The following are the requirements for the design of the moderation system:


  • Functional requirements:
    • User login: A user authentication service is needed to authenticate users on a large scale.

    • Comments submission: The system should allow users to submit comments on published posts.

    • Automated comment moderation service: The system should be able to automatically review and manage user comments.

    • User notification: The system should notify users about the actions taken on their comments if they are published or rejected by the system due to privacy violations.

    • User reporting: The system should allow users to report comments to be reanalyzed by the moderation service.


  • Nonfunctional requirements
    • Availability: The comment moderation system should be highly available to filter the comments submitted by users.
    • Scalability: The system should also be scalable to handle many comments.
    • Reliability: The system should work properly despite failure in one or more components.
    • Consistency: The comment moderation system should be consistent, and all users should see the same state of the comment at any time.


The high-level design of the comments moderation system

The high-level design of the comments moderation system includes a user authentication service, comment service, comments moderation service, and AI/ML engine. Load balancers are also required to distribute the load evenly on servers. The comment service uses the pub-sub to forward user comments to the comments moderation service. The purpose of the AI/ML engine is to review and filter comments. Similarly, the persistent layer stores users’ data, comments, and metadata.

The high-level design of the comment moderation system


3) Design a recommendation engine

Problem statement: Design a recommendation engine that provides millions of users with recommendations about short videos (reels).


The following are the requirements for designing a recommendation engine:


  • Functional requirements:
    • User profiles: The system should be able to create and manage user profiles. This involves capturing user demographics, interests, preferences, ratings, reviews, and past interactions.

    • Search and browse: Users should be able to search for specific videos or browse recommendations through various categories or filters.

    • Personalization: The system should customize and adjust recommendations for individual users based on their feedback.

    • Real-time updates: The system should update recommendations dynamically as users interact with the platform. This could involve incorporating real-time data on user behavior and video availability.

    • Offline processing: The system might require background processes for tasks like data preprocessing, model training, and recommendation generation. This ensures efficient response times for user interactions.


  • Nonfunctional requirements:
    • Scalability: The system should handle a growing number of users, items, and recommendations without compromising performance.
    • Low latency: The system should be performant enough to provide real-time recommendations.
    • Privacy: The system should handle users’ data securely and implement data anonymization and encryption techniques.
    • Security: The system should implement techniques to prevent data from being unauthorizedly accessed and breached.


The high-level design of the recommendation engine

The recommendation engine’s high-level design comprises a load balancer, application servers, a recommendation service, a data collector, big data processing systems, databases, and an off-grid AI system. The recommendation service stores the users’ data and preferences in databases. Also, it takes the recommendations from the AI system and reflects them via application servers to the users on their screens. The data collector ingests data into the big data processing system, where the data is analyzed and useful insights are derived. Similarly, the processed data is fed to the off-grid AI system, where predictive models are trained offline to enhance the performance and accuracy of user recommendations.

The high-level design of the recommendation engine

4) Design Dropbox

Problem statement: Design a scalable and secure system for Dropbox that allows users to store, share, and access files across devices. (A similar problem might be: Designing Google Drive and a collaborative document editing system (Google Docs).)


I’ll consider the following requirements for the Dropbox system:


  • Functional requirements:
    • Upload files: The users should be able to upload files to the storage servers.
    • Download files: The system should allow users to download files from the storage servers.
    • Share files: The system should allow users to share files with other users with different access rights.
    • Create and delete directories: Users should also be able to create and delete directories from the storage servers.
    • Files synchronization: The system should synchronize files across different devices and users.


  • Nonfunctional requirements
    • Durability and reliability: The system should ensure that users never lose their data and should perform the intended function correctly.
    • Availability: Users should be able to access their data anytime, anywhere they want, provided they have a good internet connection.
    • Scalability: The system should support unlimited storage and many users’ read and write requests.
    • Security: The system should prevent unauthorized access to the files apart from those with access rights.


The high-level design of Dropbox

Dropbox’s high-level design consists of load balancers, application servers, chunk servers, cloud storage, metadata servers, messaging queues, and sync servers. The files are uploaded or downloaded to the cloud storage via the chunk servers. The metadata associated with each user and file is handled by the metadata servers and is stored in the metadata database. Similarly, The sync servers are responsible for syncing files across multiple devices. These services send updates to users that are made to files on the cloud storage or any change made to the metadata.

The high-level design of Dropbox

5) Design CamelCamelCamel


Problem statement: Design a scalable, reliable, and efficient price tracker system like CamelCamelCamel (C3).


I’ll consider the following requirements:


  • Functional requirements:
    • Search product: The C3 system should allow users to search for a specific product.

    • Price timeline: The system should allow users to obtain a price timeline of the products.

    • Add to price watch: The user should be able to add a product to the price watch list by defining the target price and getting notifications when the product’s price drops.

    • Get watch list: The user can add multiple products to the price watch list, and the service should allow users to see their price watch list.


  • Nonfunctional requirements
    • Availability: The service’s availability is imperative because several users continuously interact with and depend on the C3 service for product prices.
    • Reliability: The product’s data and price drop alerts should be as accurate as possible to provide reliable service to the users.
    • Scalability: The system should scale seamlessly to handle increasing users and marketplaces.
    • Low latency: The system’s latency should be as low as possible.


The high-level design of CamelCamelCamel

The high-level design of C3 mainly consists of two services: search services and product services. Apart from these two services, the C3 system is connected to other Amazon services via an API gateway to provide up-to-date data to potential customers. The pub-sub decouples all these services and enables communication between these services. The search service enables customers’ search queries, while the product service recommends products to users and communicates price changes to customers via the pub-sub.

The high-level design of the CamelCamelCamel

6) Design Instagram


Problem statement: Design a scalable and robust social media platform like Instagram that enables users to share photos and videos, follow other users, like or dislike posts, and receive real-time updates.


I’ll focus on the following requirements:


  • Functional requirements:
    • Post photos and videos: The users should be able to post photos and videos on Instagram.

    • Follow and unfollow users: The users should be able to follow and unfollow other users on Instagram.

    • Like or dislike posts: The users can like or dislike posts of the accounts they follow.

    • Search photos and videos: The users can search photos and videos based on captions and location.

    • Generate news feed: The users can view the news feed with photos and videos.


  • Nonfunctional requirements:
    • Scalability: The system should be scalable to handle many users.
    • Reliability: The system should be able to tolerate hardware and software failures.
    • Latency: The latency to generate a news feed should be low.
    • Availability: The system should be highly available.
    • Durability: Any uploaded content (photos and videos) should never get lost.


Dive deep into the detailed design of Instagram.


7) Design WhatsApp

Problem statement: Design a highly scalable and secure messaging system like WhatsApp. (A similar problem might be: Design Facebook Messenger).


I’ll consider the following requirements for the WhatsApp design:


  • Functional requirements
    • Conversation: The system should support one-on-one and group conversations between users.

    • Acknowledgment: The system should support message delivery acknowledgment, such as sent, delivered, and read.

    • Sharing: The system should support sharing media files, such as images, videos, and audio.

    • Chat storage: The system must support the persistent storage of chat messages when a user is offline until the messages are successfully delivered.

    • Push notifications: The system should be able to notify offline users of new messages once their status becomes online.


  • Nonfunctional requirements
    • Scalability: The system should be highly scalable to support a large number of users and messages per day.
    • Security: The system must be secure via end-to-end encryption.
    • Low latency: Users should be able to receive messages with low latency.
    • Consistency: Messages should be delivered in the order they were sent. Moreover, users must see the same chat history on their devices.
    • **Availability:**The system should be highly available. However, the availability can be compromised in the interest of consistency.

Dive deep into the detailed design of WhatsApp.


8) Design a web crawler system


Problem statement: Suppose you have access to millions of computers. Design a web crawler system that can download all the content from those computers without detection.


I’ll focus on the following requirements for a web crawler system:


  • Functional requirements:
    • Crawling: The system should start crawling all the computers from a queue of seed URLs provided initially by the system administrator.

    • Storing: The system should be able to extract and store the content of a URL in a blob store.

    • Scheduling: Since crawling is repeated, the system should have regular scheduling to update its blob stores’ records.


  • Nonfunctional requirements:
    • Scalability: The system should inherently be distributed and multithreaded because it has to fetch data from millions of computers.
    • Consistency: Since our system involves multiple crawling workers, having data consistency among all of them is necessary.
    • Performance: The system should be smart enough to limit its crawling to a domain, either by time spent or by the count of the visited URLs of that domain.


Dive deep into the detailed design of a web crawler.


9) Design a distributed cache system


Problem statement: Design a scalable and fault-tolerant distributed cache system that improves the performance of web applications by providing fast access to frequently requested data.


I’ll consider the following requirements for designing a distributed cache system:


  • Functional requirements:
    • Insert data: A distributed cache system user must be able to insert an entry into the cache.

    • Retrieve data: The user should be able to retrieve data corresponding to a specific key.


  • Nonfunctional requirements:
    • High performance: The primary reason for the cache is to enable fast access to data retrieval.
    • Scalability: The cache system should be able to manage an increasing number of users (requests).
    • Availability: The cache system should be highly available to provide uninterrupted services to users and applications.
    • Consistency: Data on the cache servers should be consistent, whether retrieved from the primary or secondary servers.


Dive deep into the detailed design of the__distributed cache__.


How to get hired at Meta

System design interviews are a crucial stepping stone in your trajectory as a software engineer, lead, or even an engineering manager. Your ability to perform well in them can mean the difference between landing your dream job or getting down-leveled (offered a job lower than the level to which you applied).


I'm hoping this article helped you feel more confident about what to expect from the interview, but more so, I hope you put in diligent interview prep. Competition is high, and preparation is your biggest guarantor of success.


At Educative, where I am the CEO and co-founder, we have dozens of hands-on System Design courses written by industry experts, PhDs, and ex-FAANG engineers, wherein you can get a stronger understanding of system design fundamentals and hands-on practice with real-world problems. Check out a few of my personal favorites below:


Happy learning!