Design a real-time newsfeed system that handles tweet publishing, follower timelines, and celebrity updates with low read latency.
Displays timeline, handles pull-to-refresh and infinite scroll pagination.
Validates post payload, writes tweet to DB, publishes event to Fanout Worker Queue.
Pushes new tweet IDs into Redis timelines of all followers.
Stores pre-computed list of tweet_ids for every active user: ZSET timeline:{user_id}.
Stores user follow relationships for fast follower list lookups.
User posts a tweet.
Async queue for follower processing.
Returns 100 follower user_ids.
Fanout on Write: Inject tweet_id into 100 Redis timeline sets.
Fetch latest 20 tweets.
Return timeline in under 15ms!