Design a Real-Time Article Aggregation Platform
System DesignModel answerLast updated
Design a scalable system that continuously pulls articles from tens of thousands of publisher feeds, deduplicates and clusters related coverage, and serves personalized ranked feeds under 100ms.
Background
You are tasked with designing a web-scale article aggregation platform — think of it as a system that tracks breaking news across the entire internet. The platform continuously fetches content from publisher feeds, groups articles covering the same event into unified story clusters, and surfaces a personalized reading experience to millions of simultaneous users.
What You Need to Build
Functional Requirements
- Ingestion and Normalization: Pull articles continuously from a large set of registered publisher sources (RSS/Atom feeds, REST APIs, webhooks, and scrapers). Normalize inconsistent schemas into a unified article format. Track edits and revisions to articles over time.
- Deduplication and Clustering: Identify and collapse duplicate or syndicated articles (the same story republished across outlets). Group the remaining distinct articles by the real-world event they cover into a single multi-perspective story unit.
- Personalized Feed Serving: Return a paginated, ranked list of story clusters to each user. Rankings should reflect freshness, topic relevance to the user, source diversity, and coverage velocity. P95 read latency must stay under 100ms.
- Retractions and Takedowns: When a publisher retracts an article or submits a copyright takedown, remove the content from search indices and edge caches within approximately five minutes.
Non-Functional Requirements
- Read path availability: 99.99%
- Ingestion is resilient to individual source outages
- Crawlers must respect
robots.txt, crawl delays, and per-domain rate limits - Raw article archives must support full replay so that new clustering and ranking algorithms can be back-tested or a corrupted index can be rebuilt from scratch
Scale to Design For
| Dimension | Target |
|---|---|
| Registered publisher sources | 50,000 |
| Ingest rate | 10M articles/day (~120/s avg, ~1,000/s peak) |
| Daily active users | 50M |
| Feed read requests | 200M/day (~2,500/s avg, ~10,000/s peak) |
| Raw article retention | 5 years |
| Active serving window | 14 days |
Areas Expected in Your Answer
- High-level architecture: walk through the major subsystems — ingestion pipeline, processing workers, storage tiers, and the serving layer — and explain how data flows between them.
- Data model: describe how you store raw documents, article revisions, story clusters, and user interactions.
- Deduplication and clustering pipeline: explain the algorithm choices and the incremental vs. batch tradeoffs.
- Feed generation and caching: cover cache layers, the fan-out vs. pull-on-read decision, and how you keep feeds fresh while meeting the latency target.
Start by stating any clarifying assumptions you would make in a real interview before jumping into the design.
Hints
Hint 1
Before sizing anything, pin down two scope questions: how deep is personalization (per-user ML model vs. topic/locale affinity only), and is the five-minute takedown window a hard SLA or a soft target? These answers change the feed architecture and the deletion propagation design significantly.
Hint 2
For deduplication, think in two tiers: a cheap fingerprint check (SimHash or content hash) to catch syndicated copies, then a semantic embedding + ANN search to catch articles that cover the same event but were written independently. Running both in sequence keeps per-article cost low.
Hint 3
Fan-out-on-write to 50M inboxes is impractical when articles are shared across users. Instead, precompute small candidate pools (global, per-locale, per-topic) on a short refresh cycle, then do a lightweight per-user rerank at request time. This gives you personalization without the write amplification.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
1. Clarify Scope Before Designing
Two questions determine the architecture more than anything else.
How personalized is the feed? Assume moderate personalization: topic and publisher affinity stored in a user profile, with a lightweight reranking model at read time — not a deep neural tower trained per user.
Is the five-minute takedown window a hard SLA? Assume yes. This means the deletion path must be able to invalidate CDN surrogate keys and Redis entries on demand, not just wait for TTL expiry.
Back-of-Envelope
| Dimension | Number | Implication |
|---|---|---|
| Ingest peak | 1,000 articles/s | Queue-backed pipeline, horizontally scalable consumers |
| Raw storage | ~50 KB/article → ~500 GB/day, ~200 TB compressed over 5 years | Object store, not a database |
| Active window | 14 days, ~140M articles, ~10–20M clusters | Hot index fits in sharded search + vector tiers |
| Embeddings (384-dim int8) | 140M × 384 B ≈ 55 GB | HNSW indexes stay in memory across a few shards |
| Read peak | 10,000 requests/s at P95 < 100ms | Precomputed candidates + cheap online rerank |
2. API Surface
GET /v1/feed?cursor=<opaque>&locale=en-US
→ { stories: [StoryCard], next_cursor }
GET /v1/stories/{cluster_id}
→ { cluster_metadata, member_articles[] }
POST /v1/events body: { event_type: click|dwell|hide, cluster_id }
→ 202 Accepted
POST /internal/takedowns body: { article_id, reason }
POST /internal/sources body: { source_url, type: rss|api|webhook }
The cursor encodes a feed snapshot ID plus an offset. Pagination is stable even when rankings shift underneath, which avoids showing duplicate items across pages.
3. High-Level Architecture
Scheduler ──► Fetchers (RSS / API / scraper)
│ conditional GETs, per-domain rate limiting
▼
S3 (content-addressed raw archive)
│ pointer + metadata
▼
Kafka: raw-articles (keyed by source_id)
│
Normalizer workers
│
Kafka: articles (keyed by canonical URL hash)
│
┌─────────────┼──────────────────────┐
▼ ▼ ▼
SimHash/ Embedder Article store
MinHash (sentence (Cassandra)
dedup encoder)
└─────────────┴──────────────────────┘
│
Clusterer (online HNSW
+ hourly offline batch)
│
Kafka: cluster-events / tombstones
(log-compacted topic)
│
┌──────────┴────────────────┐
▼ ▼
Search + vector index Candidate builder
(OpenSearch + HNSW) (global / locale / topic pools)
│
Redis sorted sets
│
CDN / edge ◄──────── Feed API (rerank + diversity + tombstone filter)
Scheduler and fetchers maintain per-domain token buckets, honor robots.txt crawl delays, and use adaptive polling: active sources get shorter intervals, and sources returning 429 or 5xx get exponential backoff with jitter. Conditional GETs using ETag / If-Modified-Since dramatically cut bandwidth. Fetchers are stateless; a source outage only stalls that source's schedule.
Kafka as the backbone absorbs burst and fully decouples ingestion from processing. Raw content lives in S3; Kafka carries only pointers and metadata, keeping the log compact and cheap. This design is what makes full replay possible.
4. Data Model
Raw archive (S3): raw/{date}/{sha256}. Immutable, content-addressed. This is the five-year source of truth.
articles (Cassandra, PK: article_id): article_id = hash of canonical URL. Columns: canonical_url, source_id, title, summary, published_at, current_version, state, simhash, cluster_id, language, topics.
article_versions (PK: article_id, CK: version DESC): content_hash, raw_s3_key, fetched_at, change_type (minor edit | headline change | correction). A new version is created only when the content hash changes.
Article state machine: DISCOVERED → ACTIVE → UPDATED* → RETRACTED | TAKEN_DOWN | EXPIRED. Tombstone events propagate through Kafka on any terminal transition.
clusters (PK: cluster_id): centroid_embedding, representative_article_id, member_count, publisher_set, first_seen, velocity, topic_labels, algorithm_version.
cluster_members (PK: cluster_id, CK: score DESC): used to render the multi-perspective story page.
User profiles: interaction events (click, dwell, hide) stream to Kafka and land in a data warehouse for offline profile training. The resulting profile — topic weights, followed publishers, and a personal interest embedding — is written back to a KV store and fetched in a single lookup at read time.
5. Deduplication and Clustering Pipeline
Tier 1: Exact and Near-Duplicate Detection
Catches syndicated content — the same article republished across many outlets.
- Exact duplicates: canonical URL normalization (strip tracking parameters, follow
rel=canonical) plus a SHA-256 body hash. Duplicates are attached as "also published by" metadata on the original. - Near duplicates: compute a 64-bit SimHash over shingled body text. A Hamming distance ≤ 3 indicates a near-duplicate.
- Fast lookup: split the 64 bits into 4 16-bit bands. By pigeonhole, any pair within distance 3 must share at least one identical band. Store band → article_id in Redis and look up the four bands per incoming article. This reduces a global O(N) scan to a handful of Redis lookups.
Tier 2: Semantic Clustering
Catches independent articles covering the same real-world event.
- Embed the article title, opening paragraph, and extracted named entities using a sentence encoder (e.g., a 384-dimensional model).
- Query an HNSW index of cluster centroids from the past 72 hours, filtered to the same language.
- Assign the article to the nearest cluster if: cosine similarity > threshold τ, there is named-entity overlap, and publish times are within a reasonable window. Otherwise, create a new cluster and initialize its centroid.
- Update centroids incrementally using a running mean. This is O(log N) per article.
Offline Correction Pass
The online greedy pass drifts over time. An hourly batch job re-clusters the window using HDBSCAN, emitting cluster-remap events for merges and splits. All thresholds and model versions are stored in the algorithm_version field, so historical decisions are auditable.
6. Feed Generation and Caching
Why Not Fan-Out on Write
Writing 10M articles into 50M user inboxes generates 500 billion write operations per day. That is impractical. More importantly, most of this content is shared across users, so it should be computed once and reused.
Hybrid Pull Model
Step 1 — Precompute candidate pools (every 30–60 seconds):
A background job scores clusters by freshness decay, coverage velocity, source authority, and cluster size. It writes the top few thousand cluster IDs into Redis sorted sets keyed by pool:{global}, pool:{locale:en-US}, pool:{topic:tech}, and so on.
Step 2 — Online rerank (per request, target < 30ms):
- Fetch user profile from the KV store.
- Union ~500 candidates from the user's topic and locale pools.
- Score each candidate with a lightweight model (dot product against the user interest embedding, plus GBDT features like source diversity and recency).
- Apply diversity constraints (cap per publisher, cap per topic) and filter tombstoned or already-seen items.
- Write the ranked list to Redis as a feed snapshot under a TTL of ~10 minutes, so subsequent pagination requests are stable.
Cache Hierarchy
- CDN: caches non-personalized responses. Story pages and locale-level anonymous feeds use
s-maxage=30–60swith surrogate keyscluster:{id}andarticle:{id}. Takedowns trigger a surrogate-key purge, satisfying the five-minute SLA. - Redis: holds candidate pools, hydrated story cards (to avoid hot Cassandra reads), and user feed snapshots.
- Application cache: an in-process LRU holds the most popular story cards for the final few milliseconds of savings.
Cache Invalidation on Takedowns
On receiving a takedown request: (1) mark the article as TAKEN_DOWN in Cassandra, (2) emit a tombstone to the cluster-events Kafka topic, (3) issue a CDN surrogate-key purge, (4) remove the cluster or article from Redis candidate pools. Consumers of the cluster-events topic propagate the tombstone to the search index and the feed API's in-process filter within the five-minute window.
Common Mistakes to Avoid
- Skipping the two-tier dedup: using only SimHash misses exact syndication; using only embeddings is too expensive to run before dedup reduces volume.
- Fan-out on write: the write amplification is unworkable at this scale.
- Relying solely on TTL for takedowns: TTLs can be up to 60 seconds at the CDN alone; surrogate-key purging is necessary to hit the five-minute SLA.
- Single-pass clustering without a correction batch: the greedy online clusterer will drift and create duplicate clusters over hours; the hourly offline pass is not optional.
- Storing raw content in the message queue: Kafka is for events and pointers; raw HTML belongs in object storage to keep the log cheap and replayable.