← All problems
Dashboard
Courses
Problems
Badges
Theme
Sign inStart free
Problem 003 · Caching

Design a News Feed

Medium 50 min

Design the home feed for a social network. Users follow other users and see their recent posts, newest or highest-ranked first. Some accounts have millions of followers.

Functional requirements

  • Publish a post
  • Fetch a paginated home feed
  • Follow and unfollow users

Non-functional requirements

  • Feed loads in under 300 ms at p99
  • New posts appear in followers' feeds within 10 seconds
  • Celebrity posts must not overload the system

Constraints and scale

  • 300 million daily active users
  • Average user follows 200 accounts
  • Top accounts have 50 million followers

You will practise

  • Choose between fan-out on write and fan-out on read
  • Handle hot keys
  • Cache precomputed feeds
Show 2 hints
  1. Fan-out on write is cheap for small accounts and expensive for celebrities
  2. Feeds are read far more often than posts are written

Ready to build?

Open the canvas, place your components and explain your decisions. Your draft saves automatically.

Sign in to start

Failure scenarios

  • A celebrity with 50M followers postsA top account posts during peak hours.

Run them from the workspace once your design is in place.