One Pager Cheat Sheet
- We will learn about the architecture and algorithms behind
Facebook
's newsfeed system in this lesson. - Facebook's Newsfeed provides users with personalized information and updates relevant to them based on connections they have made with other users on the platform.
- The user's post is processed and sent through the web server to the application servers and the back-end to generate a newsfeed, which is then stored and sent to the user through feed notifications.
- At the database level, the most important entity in the system design of a newsfeed system is the
user
, who will be assigned a unique ID along with afeed item
,feed
andfeed_id
, which corresponds to differentmedia sources
and is linked by two main relationships betweenuser - user
andfeed item - media
. - Newsfeed systems are typically represented using relational databases, where
tables
are linked throughforeign keys
to form relationships between entities. - The
ranking algorithm
sorts and ranks the feed items queried from the feed database according torecency
andrelevance
for each user, and the generated feed can be stored in acache memory
for faster retrieval of content and better user experience. - Feed publishing is the process of displaying data to each specific user, and it can be processed by
push
,pull
, or ahybrid
model to reduce resource usage while maintaining performance. - Facebook's edge rank algorithm assigns a rank to each feed item based on
Affinity
,Weight
, andDecay
, and users are then presented their feed items in order of relevance. - Fan-out-on-load is a process used to
cache the feed
of a user to the user's device, thus increasing the efficiency of the newsfeed publishing process without increasing the write operations when publishing. - The core technologies of the Facebook newsfeed system remain unchanged despite its constant
updates and changes
for optimization.