hard meta · part of Practice Questions · Senior SWE Roadmap
Requirements to clarify
- Functional: post content, follow users, view a feed of posts from people you follow, ranked or chronological.
- Non-functional: feed reads must be fast (low latency on open), write volume from popular accounts can be huge (celebrity/fan-out problem), eventual consistency is acceptable (a slightly stale feed is fine).
Core components
- Fan-out on write (push): when a user posts, immediately push the post into every follower’s precomputed feed — fast reads, but expensive/slow writes for accounts with millions of followers.
- Fan-out on read (pull): feed is assembled at read time by merging recent posts from everyone you follow — cheap writes, slower reads, doesn’t blow up for celebrity accounts.
- Hybrid approach: push for most users, pull (merge in at read time) for celebrity accounts — the standard real-world answer.
- Ranking: a separate scoring service (recency, engagement, affinity) if the feed isn’t purely chronological.
Key tradeoffs
- Fan-out on write trades write cost for read speed; the celebrity problem is the concrete scenario that forces the hybrid design — a strong answer names this problem unprompted.