Build Facebook post reactions: rules, data model, APIs and counts at scale

Quick Overview

A product manager technical design question about implementing multi-type reactions on Facebook posts. It tests defining reaction rules, estimating load, choosing a data model and APIs, keeping per-type totals fast and accurate on viral posts, migrating existing Likes and planning a measured rollout.

Build Facebook post reactions: rules, data model, APIs and counts at scale

Company: Meta

Role: Product Manager

Category: System Design

Difficulty: medium

Interview Round: Other

Reactions on Facebook let a viewer answer a post with one of a small set of emotions instead of only a Like. As the product manager working alongside the engineering team, explain how you would implement Reactions. Define what the feature must do, then walk through a technical design an engineer could start from: what you store, which APIs the apps call, how per-type totals reach every feed at Facebook's scale, and how you would ship it. ```hint Follow one tap end to end Trace what happens when someone switches their reaction from one type to another: which stored records change, which totals move, and who else needs to hear about it. Then decide which of those updates must show instantly and which can lag a little. ``` ### Clarifying Questions - Which reaction types ship first, and should the set be hard-coded in the apps or delivered from the server so it can change later? - Does each person hold at most one reaction per post, which they can switch or remove, or can they leave several? - Are reactions limited to feed posts in the first release, or do comments, photos and messages get them too? - What becomes of existing Likes, and what should people on older app versions that only know Like see and be able to do? ### What a Strong Answer Covers - A precise feature definition: the rules for adding, switching and removing a reaction, and the visibility rules inherited from the post's audience. - A rough load estimate at Facebook scale that shapes the design, including how far reads of reaction summaries outweigh reaction writes. - A data model and API set that enforce one reaction per person per post and serve per-type totals, the viewer's own reaction and the list of who reacted. - How totals stay fast on viral posts, which reads may be eventually consistent, and how counting errors are detected and repaired. - Migration from Like, compatibility with old clients, and a staged rollout with success metrics and guardrails. ### Follow-up Questions - A celebrity's post collects millions of reactions within minutes. Where does your design strain first, and what do you change? - Feed ranking wants to weigh an Angry reaction differently from a Love. What must your system send to ranking, and what risks come with that weighting? - How would you run a controlled test of Reactions when people outside the test will see posts that test users reacted to?

Overview: A product manager technical design question about implementing multi-type reactions on Facebook posts. It tests defining reaction rules, estimating load, choosing a data model and APIs, keeping per-type totals fast and accurate on viral posts, migrating existing Likes and planning a measured rollout.

Meta logo
Meta
Jul 16, 2024
mediumProduct ManagerOtherSystem Design
0
0

Reactions on Facebook let a viewer answer a post with one of a small set of emotions instead of only a Like. As the product manager working alongside the engineering team, explain how you would implement Reactions.

Define what the feature must do, then walk through a technical design an engineer could start from: what you store, which APIs the apps call, how per-type totals reach every feed at Facebook's scale, and how you would ship it.

Clarifying Questions Guidance

  • Which reaction types ship first, and should the set be hard-coded in the apps or delivered from the server so it can change later?
  • Does each person hold at most one reaction per post, which they can switch or remove, or can they leave several?
  • Are reactions limited to feed posts in the first release, or do comments, photos and messages get them too?
  • What becomes of existing Likes, and what should people on older app versions that only know Like see and be able to do?

What a Strong Answer Covers Guidance

  • A precise feature definition: the rules for adding, switching and removing a reaction, and the visibility rules inherited from the post's audience.
  • A rough load estimate at Facebook scale that shapes the design, including how far reads of reaction summaries outweigh reaction writes.
  • A data model and API set that enforce one reaction per person per post and serve per-type totals, the viewer's own reaction and the list of who reacted.
  • How totals stay fast on viral posts, which reads may be eventually consistent, and how counting errors are detected and repaired.
  • Migration from Like, compatibility with old clients, and a staged rollout with success metrics and guardrails.

Follow-up Questions Guidance

  • A celebrity's post collects millions of reactions within minutes. Where does your design strain first, and what do you change?
  • Feed ranking wants to weigh an Angry reaction differently from a Love. What must your system send to ranking, and what risks come with that weighting?
  • How would you run a controlled test of Reactions when people outside the test will see posts that test users reacted to?