KatInterview

Design a Social Feed Service with Real-Time Updates

System DesignModel answer
MediumModel answerSystem Designdistributed-systemscachingdata-modeling

Last updated

Build a high-scale microblogging system supporting post creation, social connections, and personalized feeds with near real-time delivery.

Problem Statement

You need to architect a social microblogging service where people can publish short messages, create connections with other accounts, and consume a personalized stream of content from their network.

Core Functionality

  1. Publishing messages with a 280-character limit
  2. Creating and removing connections between accounts
  3. Displaying a personalized content stream showing messages from connected accounts, ordered newest-first

Performance and Scale Targets

  1. Read availability is paramount—feed retrieval must be highly reliable
  2. New content should reach feeds within seconds of publication
  3. System should handle 100 million active users daily with write spikes reaching 50,000 messages per second

What to Cover

Design the system architecture including:

  • Key API endpoints with request and response formats
  • Storage layer design and technology choices (relational vs non-relational trade-offs)
  • Content delivery approach for feed construction (compare different strategies and explain how to handle accounts with massive followings)
  • Performance optimization through caching

Scale Context

  • Typical account connects to 100 other accounts
  • Content distribution operations should finish within 5 seconds for 95% of scenarios

Hints

Hint 1

Calculate read versus write volumes—which operation dominates and by how much?

Hint 2

Consider whether it's cheaper to do work when content is published or when feeds are requested

Hint 3

Think about what happens when someone with millions of connections publishes new content