Try
↑ ↓ move↵ openesc close

Interview prep / News feed

Senior · News feed · System design interview question

What do you store for a feed, and what happens when an inbox is lost?

Sketch your own answer first, then compare it with the one below.

A strong answer

Store post ids, not posts, in a capped list per reader, ordered by time. Posts live once in a partitioned post store, so an edit or delete changes one place. A read fetches ids, then batches the post lookups.

The inbox is a cache of work you can redo. If it is lost, rebuild it by pulling from the follow graph. That lets the inbox store be fast and cheap and not strongly durable.

Skip inbox writes for users who have been away, and rebuild on return.

Sources

Learn it by running it

The design a news feed lesson explains the mechanism behind this question, and its lab lets you change the parameters and watch the effect.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms