Pick the fix
An account with 30 million followers posts. With pure fan-out on write, what goes wrong and what's the fix?
Hint 1 of 1
How many writes does one post cause?
Choose an answer, then open Show answer below to check it.
Text version
Boxes on the board, in order:
- Post API
- Fan-out queue
- Feed workers
- Feed store
- Post cache
- Feed API
Show answer
Answer: A 30 million feed writes per post; merge that account's posts at read time instead
Correct. The hybrid approach.
Fan-out on write copies each post into every follower's feed. That is cheap for normal accounts and impossible for 30 million followers, so huge accounts are merged in when a follower reads.
Why not the others?
- B Nothing; Redis is fast. 30 million writes per post backs up the queue.
- C Fan out synchronously in the request. The request would take minutes.
- D Drop followers above 1 million. Not a product option.