Facebook Post Search

Design search over a social feed — let users find posts by keyword in near real time while respecting each post’s privacy/visibility settings.

00

Practice checkpoints

The requirements are open as a taste. From the numbers onward, the full guide opens in the app.

  1. 01
    Clarify scope
  2. 02
    Requirements + scale
  3. 03
    API + data modelUnlocks in the app
  4. 04
    Draw architectureUnlocks in the app
  5. 05
    Deep diveUnlocks in the app
  6. 06
    Trade-off decisionUnlocks in the app
01

Requirements that shape the design

Do not only state requirements. Ask for them. Each card pairs the design constraint with a clarification question you can say out loud before drawing the architecture.

Functional requirements

01What exactly are users searching — posts, people, everything?

Keyword search over posts only: type a word, get matching posts back. People, page, and group search are separate systems.

02How are results ordered?

The searcher picks one of two orders — newest first, or most-liked first — so the index must serve both orderings cheaply.

03Can new posts wait for a nightly index rebuild?

No: a post is findable within about a minute of being created, so the index updates incrementally — never by batch rebuild.

04Do likes move search results too?

Yes: like counts drive the most-liked ordering — a post that is blowing up should climb the results as its likes grow.

05Do old or unpopular posts stay findable?

Yes: every post stays discoverable — a ten-year-old post with three likes still returns, just from a slower storage tier.

06Can search leak a post I am not allowed to see?

Never: results are checked against the searcher’s visibility at query time, so a private post cannot surface through the index.

Out of scopeTypeahead/autocomplete — prefix matching is its own small low-latency index, not this pipeline · Personalized ML re-ranking and embedding/semantic retrieval (lexical keyword match first) · Media search — text posts only; images and video have separate indexes

Non-functional requirements

01How fast must a search feel?

Median under 500 ms — common keywords must answer from memory, because a disk seek per posting list blows the budget.

02How quickly is a fresh post searchable?

Under 1 minute end to end from post creation to appearing in results — freshness is a hard bound, not best effort.

03What write load must ingestion absorb?

About 110K write events/s — 10K posts plus 100K likes — against only 10K searches/s, so taming write amplification is the core scaling problem.

04Must the like ordering be exact?

Bounded staleness on the most-liked ordering is fine — it may trail true counts (milestones plus ~30 s batching), while the recency ordering stays exact.

05How much history stays searchable?

A decade of history: roughly 3.6 trillion posts (~3.6 PB raw, assuming ~15% posting growth over the decade) stay durable and discoverable, even after their index entries leave memory.

Keep asking — the interview is a conversation

Real interviews probe far more than a tidy list. These are the scope questions that separate candidates who interrogate the problem from those who recite it.

  • Is this public posts only, or must results respect each searcher’s friend and audience settings?
  • When a post is edited, deleted, or flipped to private, how fast must search stop returning it?
  • Is milestone-fresh like ranking acceptable, or does product need exact live counts?
  • Multi-word queries: AND semantics, OR semantics — and do we need exact phrases?
  • If one index shard is down, do we return partial results or fail the whole query?
01

Unlock the full playbook for Facebook Post Search

Numbers, architecture diagram, API and data model, deep dives, expected topics, self-check, whiteboard starter, and common mistakes unlock inside the app.

02

Numbers that force architecture decisions

Locked in the app

03

Architecture path

Locked in the app

04

API and data model

Locked in the app

05

Deep dive directions

Locked in the app

+Series

Practice the related series