Feed fan-out lab
Build feeds for 1,000 users by pushing posts, pulling at read time, or both. Raise the follower skew and watch the write cost, the write backlog and the read latency move.
tick 60 (1 tick = 1 second)push feedbiggest account 972 followers, 13 at or above 200
Writing posts
- posts
- 1,200
- inserts per post
- 21.4
- largest single post
- 972 inserts
- 99th percentile lag
- 2.9 ticks
Each post is copied into follower inboxes when the mode pushes it. Writers can do 500 inserts a tick, so a very popular account makes a queue.
Reading feeds
- mean read
- 5.5 ms
- 99th percentile read
- 5.5 ms
- busiest timeline
- 0 reads a tick
A read fetches the reader's inbox, plus the latest posts of every account that is pulled. Each fetch adds time.
| Series | Latest | Lowest | Highest |
|---|---|---|---|
| backlog | 574 | 0 | 995 |
After 60 ticks the push feed made 21.4 inserts per post on average and 972 for the largest post. The 99th percentile write lag was 2.9 ticks. Feed reads averaged 5.5 ms, with the 99th percentile at 5.5 ms. The busiest author timeline took 0 reads a tick.
What to try
Each one sets up a starting point. Then make the change it describes.
Push makes reads cheap
Keep push mode and read the mean feed read.
Look for. A read is one lookup of the reader's inbox, so it is fast and the same for everyone. The cost sits on the write side.
Skew breaks push
In push mode, raise the follower skew to 15 tenths.
Look for. The average write cost barely moves, but a handful of accounts now have close to a thousand followers. One post from them floods the writers and the 99th percentile lag jumps.
Pull makes writes cheap
Switch to pull mode.
Look for. A post is one write. Every read now fetches from every followed account, so reads are slower, and popular authors' timelines take many reads.
The hybrid at high skew
Choose hybrid with a skew of 15 tenths.
Look for. Celebrity posts are no longer copied, so the write queue stays short. Reads cost a few extra fetches for the celebrities a reader follows.
Lower the threshold
Choose hybrid and move the threshold down to 50 followers.
Look for. More accounts are pulled, so writes get cheaper and reads get slower. The threshold slides along the push and pull trade-off.
New to the idea? Read the lesson first. Every number here comes from a seeded simulator, so the same seed gives the same run.
Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms