Practice/Meta/Design a Contacts App
Design a Contacts App
System DesignOptional
Problem Statement
Design a news feed aggregator that collects articles from thousands of sources, ranks them based on user preferences and reading behavior, and delivers a personalized feed to millions of users with fresh content updated throughout the day. The system should learn from user interactions (clicks, read time, shares) to improve recommendations over time while ensuring users see breaking news and important stories even if they don't perfectly match historical preferences.
The challenge is to balance real-time content ingestion from diverse sources with personalized ranking at scale, while keeping feeds fresh without overwhelming users. Users expect to see new articles within minutes of publication, ranked intelligently based on their interests, and grouped or deduplicated to avoid redundancy. The system must handle traffic spikes during major news events and deliver feeds with low latency even as the catalog grows to millions of articles.
Key Requirements
Functional
- Content ingestion -- crawl and index articles from thousands of RSS feeds, APIs, and web sources in near real-time
- Personalized ranking -- generate a ranked feed for each user based on topic preferences, reading history, and engagement signals
- Feed serving -- deliver paginated feeds with sub-second latency that update as new content arrives
- Engagement tracking -- capture clicks, read duration, shares, and other signals to refine ranking models
- Deduplication -- identify and merge duplicate or near-duplicate articles from different sources
Non-Functional
- Scalability -- support 50 million active users and ingest 100,000 new articles per hour
- Reliability -- tolerate source failures and service degradation without losing user feeds
- Latency -- serve feed requests in under 200ms at p95, with new articles appearing within 5 minutes
- Consistency -- eventual consistency is acceptable; users may see slightly different views during updates
What Interviewers Focus On
Based on real interview experiences, these are the areas interviewers probe most deeply:
1. Content Ingestion Pipeline
Interviewers want to see how you handle continuous ingestion from heterogeneous sources at scale, including parsing, deduplication, and enrichment. This tests your understanding of distributed data processing, idempotency, and backpressure management.
Hints to consider:
- Use a task queue or stream processor to parallelize fetching from different sources without overwhelming them
- Store raw content and metadata separately from processed/enriched versions to enable reprocessing
- Implement content fingerprinting (e.g., SimHash or MinHash) early in the pipeline to detect duplicates before indexing
- Consider rate limiting and exponential backoff per source to handle flaky or slow endpoints gracefully
2. Personalization and Ranking at Scale
The ranking problem is central: interviewers expect you to design a system that combines content features, user preferences, and engagement signals into a scored feed without computing it from scratch on every request. This reveals whether you understand precomputation, feature engineering, and model serving tradeoffs.
Hints to consider:
- Precompute candidate sets (e.g., articles from followed topics or sources) and store them per user or user segment
- Use a two-stage funnel: retrieve top candidates cheaply, then apply an expensive ML model to rank the top 100-200
- Maintain user profiles (topic vectors, engagement history) in a fast key-value store for quick lookups during ranking
- Batch-update personalized feeds asynchronously (e.g., every few minutes) rather than recomputing on every read
3. Freshness vs. Cost Tradeoffs
Interviewers probe how you balance real-time updates with system cost and complexity. Constantly recomputing feeds for millions of users is expensive; serving stale feeds frustrates users. The design must find a middle ground.
Hints to consider:
- Partition users into tiers: active users get more frequent updates, dormant users refresh on-demand
- Use a hybrid push-pull model: push breaking news or high-priority updates immediately, pull-refresh the rest lazily
- Cache precomputed feeds with short TTLs (e.g., 5-10 minutes) and invalidate selectively when new high-value content arrives
- Consider incremental updates: append new articles to the top of cached feeds rather than recomputing from scratch
4. Handling Traffic Spikes and Breaking News
Major news events cause sudden spikes in both ingestion (many sources publishing the same story) and read traffic (users flooding the app). Interviewers want to see if your design degrades gracefully under load.
Hints to consider:
- Use load shedding and rate limiting at ingestion to prevent a surge of duplicate articles from overwhelming downstream services
- Implement circuit breakers and fallback logic: serve slightly stale feeds or default trending content if personalization services are overloaded
- Prioritize breaking news in a separate fast path that bypasses heavy personalization to ensure critical updates reach all users quickly
- Scale read replicas and leverage CDN caching for popular content to absorb traffic bursts