content is dynamic, real time updates
user can customize, filter and sort
newsfeed(prioritize, hides, contents)
personal recommendations, ranking by algo
engagement metrics
user interaction notification
privacy control
reliability,TP?
performance, 1 sec for loading
scalability?
back up and recovery
final consistency
DAU, 1.9billion
1post per user per day = 1.9 B post
4 interactions per post = 5.7 B interactions
each post = 100K, 1.9T per day for User generated contents
POST /posts
json
Copy code
{
"userId": "12345",
"content": "Hello World!",
"media": ["image1.jpg"],
"visibility": "public"
}
GET /newsfeed/{userId}
json
Copy code
{
"userId": "12345",
"limit": 20,
"cursor": "timestamp_1700000000"
}
POST /posts/{postId}/like
POST /posts/{postId}/comment
user_id (Primary Key)namefriends_list (Array of user_ids)following_pages (Array of page_ids)post_id (Primary Key)user_id (Foreign Key)contentmedia_urls (Array)timestampuser_id (Primary Key)feed_items (List of post_ids)last_updated (Timestamp)Content Ingestion
Feed Generation
Ranking & Personalization
Storage & Caching
Real-Time Updates
feed generation models:
push model(fanout on write)
Precompute and store a user’s newsfeed in a Newsfeed Table.
Posts from friends/pages are pushed to followers during creation.
Low latency but requires high storage.
pull model:
The feed is generated dynamically when a user opens the app.
Uses an index of latest posts from followed users.
More scalable, but higher query load.
The ranking model evaluates:
💡 Tech Stack:
Storage & Caching Strategy
Explain any trade offs you have made and why you made certain tech choices...
High Read Load
Node Failure
Ranking Delays
High Storage Cost
Cache Penetration
Better Personalization – AI-driven interest prediction.
Efficient Storage – Auto-delete inactive feeds.
A/B Testing – Experiment with ranking models.