Design a Real-Time News Aggregation Platform
System DesignModel answerLast updated
Design a scalable news aggregation system covering ingestion, deduplication, clustering, personalized feed serving, and operational concerns at global scale.
Design a Real-Time News Aggregation Platform
You've been asked to design the backend for a news aggregation product that collects articles from tens of thousands of publishers worldwide, groups related articles into stories, and serves personalized feeds to hundreds of millions of readers.
What to cover
Ingestion layer — spend most of your time here:
- Publisher onboarding, verification, and authentication
- Multiple ingestion modes: push (webhooks, WebSub), scheduled polling (RSS, news sitemaps), and crawling
- Scheduling strategy: adaptive poll intervals, conditional GETs, politeness and rate limiting,
robots.txtcompliance - Fetcher architecture: statefulness, parallelism, backfill vs. real-time queues
- Schema normalization and content enrichment: language detection, entity extraction, category tagging
- Deduplication at multiple levels (exact URL, near-duplicate, story clustering)
- Idempotency and retry strategies across a distributed pipeline
- Spam and abuse filtering
- Copyright compliance and takedown handling
Storage and serving:
- Article store and search index design
- Feed generation: top stories, topic pages, personalized ranking
- Freshness, caching strategy, and cache invalidation
- Multi-region deployment and partitioning
Throughout your answer:
- Define concrete APIs and data models
- State consistency guarantees and where you relax them
- Specify SLAs with actual numbers
- Provide capacity estimates (storage, QPS, bandwidth)
- Call out monitoring, alerting, and operational failure modes
What a strong answer looks like
A strong answer separates the write path (ingestion) from the read path (serving), explains where each consistency guarantee applies, handles the messy realities of external publishers (dirty data, outages, legal obligations), and makes deliberate trade-offs rather than defaulting to the most powerful tool for every problem.
Hints
Hint 1
Start by separating ingestion QPS (modest, ~100/s peak) from serving QPS (tens of thousands per second) — they have very different consistency and latency requirements, so keep them decoupled with a message queue in between.
Hint 2
Deduplication has three distinct levels with different tools: exact-match on canonical URL hash, near-duplicate detection via SimHash + banded LSH for syndicated wire stories, and semantic story clustering via ANN on embeddings — describe all three and when each fires.
Hint 3
Idempotency across HTTP and distributed workers can't be true exactly-once — commit to at-least-once delivery with idempotent effects instead: deterministic IDs, conditional upserts, and transactional Kafka consume-transform-produce patterns.
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
Approach
This problem has two very different halves. The ingestion side is write-heavy, externally-facing, and full of dirty data and legal constraints. The serving side is read-heavy and latency-sensitive. A strong design keeps them decoupled and is explicit about where consistency guarantees apply.
1. Requirements and Scale
Functional: onboard publishers, ingest via push and pull, normalize and enrich content, deduplicate, cluster related articles into stories, serve top-stories feeds, topic pages, personalized feeds, and search.
SLAs to state upfront:
- Freshness: p95 publish-to-visible under 5 min for push sources, under 15 min for polled ones
- Feed API: p99 latency under 200 ms, 99.95% availability
- Takedowns (DMCA,
robots.txtchanges): effective globally within 15 min
Capacity estimates:
| Dimension | Estimate |
|---|---|
| Publishers / feeds | 50K publishers, 200K feeds |
| New articles | ~1M/day (~12/s avg, ~100/s peak) |
| Feed polls | 200K feeds at avg 10 min intervals → ~330 req/s |
| Readers | 100M DAU × 10 feed loads → ~12K QPS avg, 40K peak |
| Raw HTML storage | 100 KB × 2M articles/day → ~70 TB/yr (tiered to cold after 30 days) |
| Normalized article store | ~10 KB × 1M/day → ~4 TB/yr hot |
Ingestion QPS is modest but correctness is hard. Serving QPS is high and depends heavily on caching.
2. APIs
# Publisher / ingestion side
POST /v1/publishers # onboard, returns verification token
POST /v1/publishers/{id}/verify # DNS TXT or meta-tag check
POST /v1/sources # register RSS / sitemap / crawl / websub URL
POST /v1/articles Idempotency-Key # push a single article (HMAC-signed)
DELETE /v1/articles/{id} # takedown request
# Reader side
GET /v1/feed?region=&lang=&cursor= # personalized or top-stories feed
GET /v1/stories/{cluster_id} # all coverage of one story
GET /v1/topics/{slug}?cursor=
GET /v1/search?q=&since=
POST /v1/events # batched impression/click signals
3. Data Models
- Publisher:
publisher_id,domain,verified,reputation_score,api_key_hash,status - Source:
source_id,publisher_id,type(rss|sitemap|websub|crawl),url,etag,last_modified,next_fetch_at,change_rate_ema,failure_count - Article:
article_id = hash(canonical_url),version = hash(content),publisher_id,title,snippet,lang,categories[],entities[],simhash_64,embedding_ref,published_at,ingested_at,robots_flags,status(live|tombstoned) - StoryCluster:
cluster_id,centroid_embedding,article_ids[],first_seen,velocity,top_entities - UserProfile:
user_id,followed_topics,blocked_sources,interest_embedding,region,lang
4. Ingestion Architecture
Push API / WebSub callbacks ──┐
├──> Kafka topic: raw-docs (keyed by host)
Scheduler → fetch tasks → Fetchers ─┘
│
Normalizer → Enricher → Dedup/Cluster → Article Store + Search Index
└──> DLQ / human review queue
Onboarding and auth. Verify domain ownership via DNS TXT record or HTML meta tag. Push requests carry API keys and HMAC body signatures. New publishers start with low reputation and get stricter spam thresholds and tighter rate limits until they establish a track record.
Scheduling. Each source has a next_fetch_at stored in a sharded priority queue (Redis sorted set or DB index). Intervals adapt using an exponential moving average of observed change rate, clamped between 1 and 60 minutes. WebSub-subscribed sources fall back to a slow safety poll. Conditional GETs (ETag, If-Modified-Since) mean most polls return 304 — this cuts bandwidth dramatically.
Politeness. Fetch tasks are partitioned by host, so one worker partition owns each host. Per-host token buckets are therefore local and cheap. Respect robots.txt Crawl-delay directives and default to 1–2 req/s per host. A per-host circuit breaker opens after repeated timeouts or 5xx responses.
Fetchers are stateless async workers. They write raw bytes to object storage keyed by content hash, then emit a pointer event to Kafka. Backfill jobs (new publisher history, sitemap catchup) run on a separate lower-priority queue with its own per-host budget, so they never starve real-time fetching.
Normalization and enrichment. Parse RSS, Atom, and news-sitemap formats. Resolve canonical URLs (follow rel=canonical, strip tracking params). Remove boilerplate, normalize timestamps to UTC. Detect language (fastText or CLD3), extract named entities, assign categories with a multi-label classifier (using the publisher's provided hint as a feature), compute a 64-bit SimHash and a dense embedding.
Deduplication — three levels:
- Exact:
article_id = hash(canonical_url). Ifcontent_hashis unchanged, the write is a no-op. Changed content hash means a new version of an existing article. - Near-duplicate: SimHash with Hamming distance ≤ 3, found via banded LSH tables. Catches wire-service syndication. The first-seen article becomes the primary; duplicates attach to it.
- Story clustering: ANN search on embeddings against clusters active in the past 48 hours. If cosine similarity exceeds a threshold and entity overlap is sufficient, the article joins that cluster; otherwise a new cluster is created. A periodic offline job re-clusters to merge or split drifted groups.
Idempotency. True exactly-once across HTTP is not achievable. Commit instead to at-least-once delivery with idempotent effects: deterministic IDs, conditional upserts (IF version != current), Kafka idempotent producers, and transactional consume-transform-produce within the pipeline. The push API deduplicates on Idempotency-Key with a 24-hour TTL window.
Retry policy:
| Condition | Action |
|---|---|
| 429, 503 | Honor Retry-After |
| Other 5xx / timeout | Exponential backoff with full jitter, capped at ~1 hour |
| 404, 410 | Mark source gone, no retry |
| 401, 403 | Alert publisher team, no retry |
| Parse failure | Send to DLQ with raw pointer for replay after parser fix |
Spam and abuse. Publisher reputation scores gate initial visibility. Classifiers flag clickbait, spun content, and SEO spam. Anomaly detection catches sudden publish-rate spikes (e.g., 100× baseline). Link-farm detection demotes duplicate-heavy publishers. Low-confidence items route to a human review queue rather than going directly to serving.
5. Storage and Serving
Article store: A distributed document store (Bigtable-style or Cassandra) keyed by article_id, with a secondary index on (publisher_id, published_at) for publisher lookups. Raw HTML lives in object storage with lifecycle rules.
Search index: Inverted index (Elasticsearch or a managed equivalent) for full-text search. Indexed fields include title, snippet, entities, categories, and publication time. Embeddings are stored in a separate ANN index (e.g., HNSW) for semantic retrieval and story clustering.
Feed generation: Top-stories feeds are pre-computed per region/language every few minutes and cached in a distributed cache. Personalized feeds blend the pre-computed baseline with user interest signals at query time using a lightweight reranker. Cursor-based pagination avoids count queries.
Caching strategy: CDN caches top-story feeds at the edge (TTL ~1 min). The article store has a read-through cache for hot articles. User profile data is cached in a regional Redis cluster. Cache invalidation for takedowns uses an explicit delete broadcast — this is where the 15-minute SLA comes from: pipeline detection + invalidation fan-out must complete in that window.
Multi-region: Ingestion workers run in every region but write to a single primary data store for each publisher shard (avoiding cross-region write conflicts). Reads are served from regional replicas. Publisher-to-region mapping is consistent-hashed on domain so politeness state stays local.
6. Common Mistakes to Avoid
- Treating deduplication as a single step. It operates at three distinct levels with different tools.
- Promising exactly-once semantics. State the actual guarantee: at-least-once with idempotent effects.
- Running backfill on the same queue as real-time fetching. Backfill will starve freshness.
- Ignoring
robots.txtas an edge case. It is a legal and trust requirement; model it explicitly with a TTL cache and pre-fetch checks. - Forgetting takedown latency as an SLA. Tombstoning an article in the store is not enough — CDN and feed caches must also be invalidated within the committed window.