今日已更新 246 条资讯 | 累计 21112 条内容
关于我们

Studied how the News Feed works in Instagram and other social media platforms.

/u/No-Resolution-4054 2026年06月04日 15:41 4 次阅读 来源:Reddit r/webdev

One important concept I learned is Fanout, which is basically how posts are distributed to user's feeds. Fanout Push When a user creates a post, the system immediately pushes that post to the feed cache of all followers. This is very fast because the feed is already prepared when users open the app. Fanout Pull Instead of precomputing feeds, the system generates the feed when a user opens the application by fetching posts from accounts they follow. It saves storage and avoids unnecessary work for accounts with huge follower counts. Now real system user Hybrid Approach For normal users with a few hundred followers, Fanout Push works well because the cost is manageable and feed loading is fast. For celebrities like Virat Kohli with 250M+ followers, pushing every post to every follower's feed cache would be extremely expensive. Many followers may not even open the app, so a lot of storage and compute would be wasted. That's why large scale systems often use Fanout Pull (or a hybrid approach) for such accounts. But How Does the Feed Know to Fetch Celebrity Posts? A question I had was: If my normal friends' posts are already present in my feed cache through Fanout Push, how does the system know that it should also fetch posts from celebrity accounts? One possible approach is that the social graph stores metadata about accounts. Celebrity or high follower accounts can be marked differently. When a user opens the app, the Feed Service: Loads the feed generated through Fanout Push. Checks the accounts the user follows in the Social Graph. Identifies celebrity accounts that use Fanout Pull. Fetches their latest posts separately. Merges both results and then applies recommendation algorithms before returning the final feed. Simplified Flow User Creates Post Post Service Store in Database Fanout Service Check Social Graph & User Preferences (blocked users, muted users, close friends, etc.) Create Fanout Tasks Message Queue Fanout Workers (Push or Pull Strategy) I'm still learn

本文内容来源于互联网,版权归原作者所有
查看原文