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
- Adam Silberstein, Jeff Terrace, Brian F. Cooper, Raghu Ramakrishnan (2010). Feeding Frenzy: selectively materializing users' event feeds.