KatInterview

Design a Real-Time Social Activity Feed

System DesignModel answer
MediumModel answerSystem Designsystem designreal-timefeeds

Last updated

Design a scalable system that delivers a personalized, real-time activity feed to millions of users with low latency and high throughput.

Scenario

You are a senior engineer at a mid-sized social platform (think: a professional networking app). Users follow other users and organizations. When someone posts an update, their followers should see it in their feed within a few seconds.

The product team has the following requirements:

  • A user's feed shows the 200 most recent activities from the accounts they follow.
  • New posts should appear in a follower's feed within 3 seconds of being published.
  • Users can follow up to 5,000 accounts; some celebrities have 10 million+ followers.
  • The platform has 50 million daily active users (DAU), with peak traffic around 3x the average.
  • Feed reads are 10x more frequent than feed writes.
  • Feeds do not need to be perfectly ordered to the millisecond; eventual consistency within a few seconds is acceptable.

What is expected

Walk the interviewer through:

  1. Requirements & scale estimation — clarify ambiguities and back-of-envelope numbers.
  2. API design — the key endpoints a client calls.
  3. Data model — what you store and where.
  4. Core architecture — how a post flows from creation to a follower's screen.
  5. Deep dives — handle celebrity/high-fan-out accounts, feed ranking, and storage costs.
  6. Trade-offs — fan-out-on-write vs. fan-out-on-read vs. a hybrid.

Hints

Hint 1

Start with the read/write ratio to justify your caching strategy before jumping into components.

Hint 2

Think about what happens when a celebrity with 10M followers posts — a naive fan-out-on-write will create a write storm. How do you handle it?

Hint 3

Consider what the feed cache actually stores: full post objects vs. just post IDs. Each choice has real memory and consistency implications.