Fan Out Home Timelines
Medium About 45 min Free with an account
Reading every followed author on demand is collapsing the database. Publish post events and materialize timelines asynchronously.
The brief
The home feed queries recent posts for every followed account, merges them, and sorts on every refresh. As follow counts grow, one page view becomes hundreds of database reads.
Keep the post store authoritative, but publish new posts to a topic and let redundant fan-out workers materialize follower timelines in a cache. Fan-out has a second data dependency the naive design hides: who follows the author. Those relationships live in their own Social Graph store, which every worker reads to expand an author into follower timeline keys. A Feed API should read the cached projection rather than recomputing every request.
Drag components from the palette, wire them together, then Check your design. Prefer to be guided step by step? The first hint holds the guided plan.
The topology is deliberately bounded. Choose the responsibility and interaction pattern, not a cloud vendor or product SKU.
How it is graded
You build the design on a canvas, and Katabench checks the topology against the challenge's design rules.
Related guides
What it practices
- Pub/sub fan-out
- Publish once to a topic and let independent consumers, timelines and channels fan out.
- Caching
- Put a cache in front of hot reads and decide what stays fresh.
Do these first
Related katas
- Cache the Hot Path Medium Free with account The product page hammers the database directly and melts under load. Design a read path with a load balancer, a cache and a replica, while keeping the client off the database.
- Handle Celebrity Fan-out Hard Free with account One celebrity post creates millions of writes. Combine pushed timelines for ordinary authors with a pulled celebrity index at read time.
- Cache DNS and Robots Rules Medium Pro Share DNS answers and robots policy across fetchers so repeated control lookups do not dominate the crawl or violate site rules.
- Cache the Redirect Medium Pro Reads outnumber writes a thousand to one and every redirect still hits the database. Cache the read path only (writes go around it) and give the links a replica.