System Design Atlas
LOCAL GUEST MODERead and practice without an account.

Your saved topics and reading progress stay in this browser. Sign in to sync supported profile and progress data.

Google News

One publisher floods the pipeline with duplicates and oversized media.

● HardSystem 132 min3 prerequisites
My progress
Topic tools

Layout updated

Explore the design, then rehearse the decisions without looking.

Problem statement

Design a news feed like Google News. Collect articles from publishers and show readers a personalized list they can scroll through.

Functional requirements

  • Fetch publisher articles and accept corrections or retractions.
  • Remove duplicates, group related stories, and index articles.
  • Serve and refresh a personalized feed with stable pagination.
  • Fall back to a basic feed when personalization is unavailable.

Non-functional requirements

  • Make new articles available within about 2 min.
  • Keep duplicates and bad publishers from blocking healthy input.
  • Aim for page under 250 ms.
  • A stale feed is allowed; unauthorized content is not.

Back-of-the-envelope estimates

Illustrative estimate
50k publishers polled every 5 minutes ≈ 167 fetches/s
5M articles/day × 2 KB metadata ≈ 10 GB/day
100M users × 10 page reads/day ≈ 11.6k ; 5× peak ≈ 58k
1M active sessions × 200 candidate IDs × 16 bytes ≈ 3.2 GB raw

Entities

Entity / logical owner
Article(articleId, publisherId, canonicalURL, contentHash, version, status)
Story(storyId, articleIds, clusteringVersion)
IndexDocument(articleId, version, locale, publishedAt)
Profile(userId, locale, interests, version)
FeedSnapshot(sessionId, viewerId, rankedIds, rankingVersion, expiresAt)
CandidateList(locale, category, generation, articleIds)

API design

Operation / inputResponse and retry contract
POST/publisher-events {publisherId, eventId, articleURL, version}202 after durable ingestion; signed webhook and replay protection.
GET/articles/{id}Canonical metadata/status and authorized media references.
RETRACT {articleId, expectedVersion, reason} canonical record and publish versioned removal intent.
GET/feed?locale=en-US&limit=20Return items, snapshotId, freshness and signed nextCursor.
GET/feed?cursor=...Bind cursor to viewer/; reject expiry or offer explicit refresh.
POST/feed/refreshCreate a new ranked ; do not mutate the old pagination order.

High-level design

How to draw this design

  1. Collect articlesPublishers, intake service, and Kafka
  2. Process updatesArticle workers, story clustering, and change events
  3. Store and indexPostgreSQL, Elasticsearch, and regional candidate caches
  4. Serve the feedFeed service, candidate ranker, and session cache

Ingest and version articles, then project them into search and feed candidates. Save ranked IDs for stable paging.

State ownership
PostgreSQL owns the canonical article version and publication status.
Scale
Partition ingestion and reuse regional candidate lists across readers.
Correctness
Ignore older projection updates and verify retractions before serving affected articles.
Failure and recovery
Fall back to a basic feed when personalization is unavailable and ask expired cursors to refresh.

Publisher ingestion and indexing

Follow a publisher update until the article is stored and its search and feed projections can see the new version.

Publisher ingestion and indexing
G pub->ing 1. Pass validated input ing->mq 2. Publish event mq->wk 3. Consume work wk->db 4. persist wk->media 5. thumbnails db->out 6. Publish event out->idx 7. index out->cl 8. group out->upd 9. update cl->upd 10. story event upd->cache 11. publish candidates pub 50K Publishers compute ing Publisher Ingestion compute mq → Kafka: Publisher Intake Topic messaging wk Processing Workers compute db PostgreSQL / Sharded Article DB state · durable media Object Storage + CDN state · durable out → Kafka: Article Changes Topic messaging idx Elasticsearch Article Index state · durable cl Story Clustering compute upd Feed Materializer compute cache Redis / Shared Feed Caches state · memory
  • Compute
  • Messaging
  • State

━━ Synchronous┄┄ Asynchronous···· Recovery / control▧ Fault

Select a component or follow a numbered connection.

Each arrow is one interaction. Request, background and recovery branches are not one linear transaction.

Read the 11 flow steps

Personalized feed serving and pagination

Pick up at the regional article index. The feed service finds candidates, ranks them, and saves the result so later pages keep their order.

Personalized feed serving and pagination
G cli->global 1. Submit request global->gw 2. Pass validated input gw->feed 3. GET /feed feed->prefs 4. lookup feed->shared 5. hot candidates feed->index 6. miss / fallback feed->rank 7. candidate set prefs->rank 8. features rank->snap 9. materialize active session snap->feed 10. 20 + cursor cdn->cli 11. images cli Web / Mobile Clients edge global Global Traffic Router edge gw Regional API Gateway edge feed Feed Service compute prefs PostgreSQL / User Profile DB state · durable shared Redis: Shared Candidate Cache state · memory index Elasticsearch Article Index state · durable rank Candidate Ranker compute snap Redis: Session Snapshot Cache state · memory cdn Media CDN state · durable
  • Edge
  • Compute
  • State

━━ Synchronous┄┄ Asynchronous···· Recovery / control▧ Fault

Select a component or follow a numbered connection.

Each arrow is one interaction. Request, background and recovery branches are not one linear transaction.

Read the 11 flow steps

High-level design component walkthrough

External dependency

50K Publishers

RSS, webhook / , web crawling

Why, tradeoff and connected operations

Treat another system as a separate failure and retry domain with a documented contract.

Tradeoff: Feed quality and publisher outages vary

Connected operations: Pass validated input

Backend service

Publisher Ingestion

Validate links and normalize metadata

Why, tradeoff and connected operations

Isolate this operation so it can scale and fail independently from storage.

Tradeoff: Input validation adds ingestion work

Connected operations: Pass validated input; Publish event

Queue / event stream

Kafka: Publisher Intake Topic

Buffer spikes; isolate slow processors

Why, tradeoff and connected operations

Kafka retained partitioned stream. Key events by the domain ordering key; replay and independent consumers motivate this choice. rows remain in the source database; a relay publishes after commit. Buffer independent producers and consumers, with bounded and replay semantics.

Tradeoff: Queue lag consumes freshness budget

Connected operations: Publish event; Consume work

Backend service

Processing Workers

Exact dedup, parse, safety checks

Why, tradeoff and connected operations

Isolate this operation so it can scale and fail independently from storage.

Tradeoff: CPU-heavy enrichment creates backlog

Connected operations: Consume work; persist; thumbnails

Relational database

PostgreSQL / Sharded Article DB

Authoritative article metadata; hash(articleId)

Why, tradeoff and connected operations

PostgreSQL owns article identity, metadata and publication state. Unique keys and transactions keep updates and downstream change intent consistent. suits canonical records; full-text retrieval is delegated to a search index.

Tradeoff: hot spots / eventual index lag

Connected operations: persist; Publish event

Object / blob storage

Object Storage + CDN

Serve thumbnail bytes independently

Why, tradeoff and connected operations

Object storage holds thumbnail bytes, and a serves nearby cached copies. This separates media bandwidth from article metadata traffic. Neither is the metadata database; remains responsible for article state.

Tradeoff: invalidation and egress charges

Connected operations: thumbnails

Queue / event stream

Kafka: Article Changes Topic

Reliable committed article events

Why, tradeoff and connected operations

Kafka retained partitioned stream. Key events by the domain ordering key; replay and independent consumers motivate this choice. rows remain in the source database; a relay publishes after commit. Buffer independent producers and consumers, with bounded and replay semantics.

Tradeoff: Consumers see events eventually

Connected operations: Publish event; index; group; update

Distributed database

Elasticsearch Article Index

By publisher, category, time, region

Why, tradeoff and connected operations

Elasticsearch indexes article text and filters for candidate retrieval. Its search structures support relevance queries without scanning the article database. Use a search index for discovery and for authority; this index can lag and be rebuilt.

Tradeoff: Write amplification and index lag

Connected operations: index

Stream / batch processing

Story Clustering

Async group related items by storyId

Why, tradeoff and connected operations

Compute derived state away from request handlers; checkpoints and govern recovery.

Tradeoff: Semantic grouping is costly/imperfect

Connected operations: group; story event

Stream / batch processing

Feed Materializer

Refresh shared category / breaking feeds

Why, tradeoff and connected operations

Compute derived state away from request handlers; checkpoints and govern recovery.

Tradeoff: Invalidation and rebuild spikes

Connected operations: update; story event; publish candidates

Cache / in-memory index

Redis / Shared Feed Caches

Hot category + global news candidates

Why, tradeoff and connected operations

Redis keeps hot category and regional candidate lists in memory. Shared lists reduce repeated search work across users. It is a derived cache, not another authoritative article database.

Tradeoff: Stale news until refresh/event

Connected operations: publish candidates

Client / user

Web / Mobile Clients

Refresh creates new feed; scroll uses cursor

Why, tradeoff and connected operations

An application or user-facing endpoint starts or receives this flow.

Tradeoff: Refresh resets pagination

Connected operations: Submit request; images

Gateway / routing

Global Traffic Router

Healthy nearby region; failover with headroom

Why, tradeoff and connected operations

Centralize admission and routing while keeping business-state ownership downstream.

Tradeoff: Failover adds latency/load to peers

Connected operations: Submit request; Pass validated input

Gateway / routing

Regional API Gateway

Auth, limits, route to Feed Service

Why, tradeoff and connected operations

Centralize admission and routing while keeping business-state ownership downstream.

Tradeoff: Rate limits can impact burst reads

Connected operations: Pass validated input; GET /feed

Backend service

Feed Service

Coordinate candidates, ranking, pages

Why, tradeoff and connected operations

Isolate this operation so it can scale and fail independently from storage.

Tradeoff: Ranking can make unpredictable

Connected operations: GET /feed; lookup; hot candidates; miss / fallback; candidate set; 20 + cursor

Relational database

PostgreSQL / User Profile DB

Interests, locale, preferences

Why, tradeoff and connected operations

PostgreSQL stores user interests and locale preferences. Indexed user lookups and transactional edits keep profile changes straightforward. fits durable user settings; derived feed candidates belong in separate serving stores.

Tradeoff: Privacy and dependency latency

Connected operations: lookup; features

Cache / in-memory index

Redis: Shared Candidate Cache

Category, region and breaking news lists

Why, tradeoff and connected operations

Redis caches shared candidate IDs for popular categories and regions. Reusing them reduces repeated search and ranking input work. It is a speed layer over the search/article stores, not the source of article truth.

Tradeoff: Hot keys and stale candidates

Connected operations: hot candidates

Distributed database

Elasticsearch Article Index

Fallback candidates and metadata lookup

Why, tradeoff and connected operations

Elasticsearch retrieves articles by text and structured filters. It supplies fallback candidates when a shared cache misses. A search index suits discovery better than scanning rows, but canonical articles still live in PostgreSQL.

Tradeoff: Index replication lag affects freshness

Connected operations: miss / fallback

Backend service

Candidate Ranker

Lightweight per-user ordering

Why, tradeoff and connected operations

Isolate this operation so it can scale and fail independently from storage.

Tradeoff: Compute cost; ranking volatility

Connected operations: candidate set; features; materialize active session

Cache / in-memory index

Redis: Session Snapshot Cache

Fixed ranked IDs and continuation cursor

Why, tradeoff and connected operations

Redis temporarily retains one session’s ranked IDs and cursor. Later pages can reuse that order without reranking everything. This is expiring pagination state, not a durable business record; expiry requires restarting the feed session.

Tradeoff: Per-session storage and expiry

Connected operations: materialize active session; 20 + cursor

Object / blob storage

Media CDN

Fast thumbnail delivery to clients

Why, tradeoff and connected operations

A serves nearby cached thumbnails and reduces repeated origin downloads. The underlying object store retains the original bytes. A is a delivery cache, not a second or database.

Tradeoff: Stale thumbnails and egress cost

Connected operations: images

Engineering control room

Deep dives — decisions, failures and recovery

Open a deep dive to follow the steps, try an example and see how recovery works.

Deep dive 1

Separate duplicate articles from related stories

Recognize retries using article identity; group related reporting separately.

Read the explanation and worked example
How it works

An exact duplicate means the same publisher article version arrived again. Use a stable publisher identity, canonical URL or content version to suppress that retry. A related story about the same event is a different problem and belongs in a separate clustering stage.

Walk through an example

Two newspapers report the same election result. Deleting one as a duplicate would confuse semantic similarity with repeated ingestion of the same article.

Failure and recovery

Retain the source identity and corrections history. Rebuild clusters independently so a ranking or similarity-model change cannot rewrite the authoritative ingestion facts.

Why this helps

Two publishers covering the same event are not the same article. Merging them as exact duplicates can lose corrections and source history.

What you give up

Story grouping can run later and be rebuilt after a model change. It should not rewrite which source articles were accepted.

Deep dive 2

Keep search and feeds repairable

Record article changes and publication work together; apply only newer versions.

Read the explanation and worked example
How it works

Commit the article version and a publication-intent row in the same source transaction. Relay that intent to indexing and feed consumers. Each projection applies only a newer article version, making repeats harmless and preventing an old retry from replacing a correction.

Walk through an example

Version 8 is indexed before a delayed version-7 event. Comparing versions at the projection keeps the corrected headline visible.

Failure and recovery

Track projection lag and failed records separately. Replay from the retained source history, quarantine invalid input, and rebuild into a new index generation before switching traffic.

Why this helps

Writing the database and search index independently can leave them permanently different after a crash.

What you give up

Search may temporarily lag. Durable events let workers catch up or rebuild the index without inventing a missing source article.

Deep dive 3

Do not let one publisher stop everyone else

Set per-publisher fetch, size and processing limits.

Read the explanation and worked example
How it works

Allocate fetch concurrency, payload limits and processing budgets per publisher. Bound decompression and media download sizes before expensive work. Separate work partitions or fair scheduling prevent a slow source from consuming the whole worker fleet.

Walk through an example

One publisher returns an endless compressed response and another floods duplicate updates. A single fleet-wide queue does not isolate either failure.

Failure and recovery

Cancel work at deadlines, quarantine repeated bad input and keep good publishers progressing. Recovery replay must respect the same budgets instead of releasing the entire backlog at once.

Why this helps

One slow connection or oversized response can use the whole fetch pool if every publisher shares an unlimited budget.

What you give up

Fair limits may delay a busy publisher. Set freshness targets with those limits in mind and reserve capacity for healthy sources.

Deep dive 4

Keep the feed quick and pagination stable

Rank a small candidate set once, then paginate through the saved order.

Read the explanation and worked example
How it works

Read regional lists by locale and category, mix a capped set of candidates with profile signals, and batch-load article metadata. Save the ranked IDs behind a short-lived ID. A cursor binds the user to that and the next position.

Walk through an example

An article moves from rank 24 to rank 2 after page one. Page two still reads the original order, so that movement does not make the article disappear from this session. A refresh starts a new order.

Failure and recovery

If profiles are slow, cap the wait and use category or locale defaults. If a expires, ask for a refresh. Recheck publication and access rules before returning each page.

Why this helps

Ranking the entire corpus is too slow and ranking again on page two can repeat or skip results.

What you give up

storage adds memory and expiry handling. Cursor-only pagination works when the ordering stays stable for the session.

Deep dive 5

Propagate corrections and retractions

Carry the canonical article version through indexing, candidate caches, and serving.

Read the explanation and worked example
How it works

Commit the article version and publication intent together. Projection consumers apply only newer versions. Keep retractions as explicit versioned records so replay cannot bring a removed article back.

Walk through an example

A retraction at version 8 reaches the index before a retry of version 7. The index ignores version 7. An existing feed cursor may still contain the ID, but the serving check filters it out.

Failure and recovery

Replay the change log to rebuild a broken projection. If a region cannot check the status required to serve a restricted or withdrawn article, withhold that item.

Why this helps

Messages can arrive out of order and a personalized can retain an article ID after it has been retracted.

What you give up

Invalidating a cache is fast when messages arrive on time. Checking authoritative status at serving time adds work but closes the gap for required removals.

Deep dive 6

Keep serving through a regional outage

Fail over serving and publisher intake independently using known replication progress.

Read the explanation and worked example
How it works

Keep one fenced ingestion owner per publisher and track the replicated source and projection versions. Route reads to a region with serving capacity and the required article status. Rebuild regional caches from versioned records.

Walk through an example

If the serving region disappears, the next region can show a basic feed while personalization warms. A cursor whose did not replicate gets a refresh response instead of silently changing its order.

Failure and recovery

Fence the old publisher owner before enabling the replacement. Resume at a known and replay stable IDs and versions. Keep freshness and removal guarantees separate.

Why this helps

A healthy feed server can still be backed by an index too far behind to honor required removals.

What you give up

Asynchronous copies keep the normal path fast but can lose recent writes when a whole region is lost. Cross-region durable acknowledgement costs latency and can reduce availability during a partition.

Tradeoffs and alternatives

DecisionTradeoff / alternative and recovery implication
Separate duplicate articles from related storiesStory grouping can run later and be rebuilt after a model change. It should not rewrite which source articles were accepted.
Keep search and feeds repairableSearch may temporarily lag. Durable events let workers catch up or rebuild the index without inventing a missing source article.
Do not let one publisher stop everyone elseFair limits may delay a busy publisher. Set freshness targets with those limits in mind and reserve capacity for healthy sources.
Keep the feed quick and pagination stable storage adds memory and expiry handling. Cursor-only pagination works when the ordering stays stable for the session.
Propagate corrections and retractionsInvalidating a cache is fast when messages arrive on time. Checking authoritative status at serving time adds work but closes the gap for required removals.
Keep serving through a regional outageAsynchronous copies keep the normal path fast but can lose recent writes when a whole region is lost. Cross-region durable acknowledgement costs latency and can reduce availability during a partition.

Production scars & failure modes

Failure investigation

One publisher floods the pipeline with duplicates and oversized media.

Look for: Measure lag and rejection rates by publisher, not just fleet totals.

Recovery and invariant: Enforce per-publisher budgets and payload limits, quarantine poison input and keep stable article/version identities through replay.

Component / failureImpactRecovery mechanismAlternative / tradeoff
Publisher unavailableNew material from that source stops; other sources should continue.Back off with , retain source cursors and resume from confirmed watermarks.Missing upstream content cannot be repaired by internal replication.
Processor crashes after DB commitThe same article may be delivered again. with source identity/version and replay committed ; do not duplicate feed entries.Dedup must cover supported replay.
Search index lostSearch/feed discovery becomes incomplete despite durable articles.Rebuild into a new generation from canonical metadata, tail changes and swap after verification.Rebuild competes for DB capacity; throttle it and expose index age.
Retraction arrives out of orderAn older create could resurrect removed content.Persist versioned tombstones and enforce version checks in index/feed consumers. costs space but protects replay correctness.
Profile service unavailablePersonalized ordering cannot be computed safely within budget.Serve nonpersonalized eligible regional candidates and identify freshness; circuit-break profile calls.Do not use stale profile data for authorization decisions.
Shared cache lostMany feed requests query the backing index at once. list rebuilds, cap index concurrency and use last-known-good lists within policy.Some responses become less fresh or smaller.
expiredThe previous page order is no longer available.Return an explicit refresh response; start a new with client dedup if desired.Strong pagination continuity requires longer .
Region failsRedirected readers may lose region-local snapshots.Replicate snapshots if required, or return a controlled refresh while serving healthy-region candidates.Preserving every session increases remote write cost.

90-second interview summary

I would separate publisher ingestion from the reader request path. Pollers and incoming publisher events feed a durable queue. Workers normalize updates, assign stable article IDs, and commit canonical metadata and versioned publication work together. Search indexes and regional candidate lists consume those changes independently.

For reads, a regional feed service fetches a bounded set of locale, category, and interest candidates. It ranks them once per refresh and stores the ordered IDs for a short time. The cursor stays tied to that order, so page two does not skip or repeat an article just because its rank changed.

I would protect ingestion with publisher budgets, keep serving a basic feed when profiles are slow, and preserve retractions through versioned updates. Cached candidates can be stale, but the service verifies article status before serving removals or access restrictions.

During a regional outage, I would reroute reads where the required source state is available and resume publisher ingestion under a new fenced owner. The tradeoff is bounded feed staleness and occasional refreshes in exchange for fast regional reads and independent recovery.

Explain it without looking

Explain separate duplicate articles from related stories

Reveal answer

Recognize retries using article identity; group related reporting separately.

Two publishers covering the same event are not the same article. Merging them as exact duplicates can lose corrections and source history.

Story grouping can run later and be rebuilt after a model change. It should not rewrite which source articles were accepted.

Explain keep search and feeds repairable

Reveal answer

Record article changes and publication work together; apply only newer versions.

Writing the database and search index independently can leave them permanently different after a crash.

Search may temporarily lag. Durable events let workers catch up or rebuild the index without inventing a missing source article.

Explain do not let one publisher stop everyone else

Reveal answer

Set per-publisher fetch, size and processing limits.

One slow connection or oversized response can use the whole fetch pool if every publisher shares an unlimited budget.

Fair limits may delay a busy publisher. Set freshness targets with those limits in mind and reserve capacity for healthy sources.

Explain keep the feed quick and pagination stable

Reveal answer

Rank a small candidate set once, then paginate through the saved order.

Ranking the entire corpus is too slow and ranking again on page two can repeat or skip results.

storage adds memory and expiry handling. Cursor-only pagination works when the ordering stays stable for the session.

Explain propagate corrections and retractions

Reveal answer

Carry the canonical article version through indexing, candidate caches, and serving.

Messages can arrive out of order and a personalized can retain an article ID after it has been retracted.

Invalidating a cache is fast when messages arrive on time. Checking authoritative status at serving time adds work but closes the gap for required removals.

Explain keep serving through a regional outage

Reveal answer

Fail over serving and publisher intake independently using known replication progress.

A healthy feed server can still be backed by an index too far behind to honor required removals.

Asynchronous copies keep the normal path fast but can lose recent writes when a whole region is lost. Cross-region durable acknowledgement costs latency and can reduce availability during a partition.

Revision checklist

Revision checklist

  • Reconstruct separate duplicate articles from related stories: Recognize retries using article identity; group related reporting separately.
  • Reconstruct keep search and feeds repairable: Record article changes and publication work together; apply only newer versions.
  • Reconstruct do not let one publisher stop everyone else: Set per-publisher fetch, size and processing limits.
  • Reconstruct keep the feed quick and pagination stable: Rank a small candidate set once, then paginate through the saved order.
  • Reconstruct propagate corrections and retractions: Carry the canonical article version through indexing, candidate caches, and serving.
  • Reconstruct keep serving through a regional outage: Fail over serving and publisher intake independently using known replication progress.
  • Name the authoritative state, boundary, retry identity and failure-domain durability guarantee.
  • Explain one alternative and exactly which guarantee you would relax.
  • Redraw the request and recovery paths without looking; mark what required a hint.

60-minute interview outline

60-minute interview walkthrough

TimeFocusWhat to cover
0–5 minIntroductionsIntroduce yourself briefly and confirm the interview format.
5–15 minScope and scaleScope publisher intake and reader feeds. Estimate article volume, feed reads, and freshness targets separately.
15–30 minHigh-level designTrace an article into durable storage and the search projection. Then trace one regional feed request and its cursor.
30–45 minDeep divesExplain versioned corrections and stable pagination. Choose where to check retraction or access status.
45–55 minFailure and recoveryWalk through a profile or serving region outage. Describe the fallback feed and how expired cursors are handled.
55–60 minWrap-upSummarize the design and its main tradeoff. Leave time for questions.
On this page
  1. Problem statement
  2. Functional requirements
  3. Non-functional requirements
  4. Back-of-the-envelope estimates
  5. Entities
  6. API design
  7. High-level design
  8. High-level design component walkthrough
  9. Engineering control room
  10. Deep dives — decisions, failures and recovery
  11. Tradeoffs and alternatives
  12. Production scars & failure modes
  13. 90-second interview summary
  14. Explain it without looking
  15. Revision checklist
  16. 60-minute interview walkthrough

Save & sync your Atlas progress

Sync your profile and topic progress across browsers, then return to the same study desk.

Google sign-in will appear here after its Azure provider is configured.

Architecture diagram