System design
Design a news feed
Design the home feed for a social app. Each user sees recent posts from the accounts they follow, newest first, and can scroll back through older ones.
There are 300 million daily active users, each following about 200 accounts, and a few celebrity accounts have more than 50 million followers. Users publish 500 million posts a day, feeds are read about 100,000 times a second at peak, and a feed should load in under 200 ms.
Things to cover
- Building feeds when a post is written, or when a feed is read
- Accounts with tens of millions of followers
- Where posts and feeds are stored and cached
- Pagination, and where ranking would fit in later