by timewizard · 1y ago · 0 comments
Seriously? Isn't this the nut of your problem right here?
There are obviously other ways of doing it (doing the timeline propagation in a batch job, fanning out the reads rather than the writes), but they've got their own problems. Probably worse ones.
Periodically classify users as hot/cold based on their activity, build hot-follower timelines on write, and build cold-follower timelines on read.
(And the same for the inverse hybrid strategy of quarantining the writes of highly followed users and handling their fan-out at read time. A neat optimization, and maybe even absolutely once you have accounts with 100M followers. But the vast majority of posts would still be handled via the original strategy.)