DesignTheSystem/dev
MEDIUM Read-Heavy & Caching

Design Real-time Activity Feed

Serve home timeline feeds for 30,000 peak requests/sec (90% reads). Ensure p99 latency stays under 200ms with 99.9% availability.

Category & DifficultyRead-Heavy & Caching · MEDIUM
Traffic Profile30,000 RPS sustained, 42,000 RPS spike (90% reads / 10% writes)
Latency & Availability SLAp99 < 200 ms · 99.9% availability
Monthly Infra Budget$650/month

Scale, traffic & SLA targets

To pass in the DesignTheSystem simulator, your architecture must hold all four targets simultaneously across a 60-second load run (spiking up to 42,000 RPS):

Peak traffic30,000 RPS90% reads / 10% writes
Latency (p99)< 200 ms99th percentile target
Availability99.9%Max error rate 0.10%
Monthly budget$650/moPriced per component
  • Users (50M daily): Most follow a few hundred accounts; a few accounts have millions of followers.

Functional & non-functional requirements

Functional scope

  • Publish a post.
  • See a home feed of recent posts from people you follow, newest first.

Non-functional goals

  • p99 latency under 200 ms at the spike.
  • At least 99.9% of requests answered.
  • Costs no more than $650 a month.
  • Feed loads must be fast on mobile.
  • Celebrity accounts must not slow everyone else down.

Core challenge: Build feeds before they are read

Reading a feed should not mean joining many tables on every page view. Prepare each user's feed ahead of time and keep it in a cache, so a page load is one quick read.

What breaks first?

Building it on open means joining posts with follows for every page view, which is far too slow at this volume. Instead, when someone posts, a worker adds the post id to each follower's feed list in Redis. Opening the app is then one read of a ready list.

Key architectural trade-offs

  • A new post can take a moment to appear in followers' feeds.
  • Storing a feed per user uses a lot of memory; capping the length keeps it bounded.

Starting architecture & how to practise

The simulator starts you with a baseline setup: Mobile App Users → Timeline Service → Posts & Follows DB. Run the baseline under 30,000 RPS to watch exactly which component saturates first, then add caching, queues, replicas, sharding or CDN until latency, availability and cost all turn green.

Common interview questions for Real-time Activity Feed

What are the target SLA and scale numbers for Real-time Activity Feed?

Design for 30,000 RPS sustained (spiking to 42,000 RPS) with a 90% read / 10% write mix, keeping p99 latency under 200 ms, availability at or above 99.9%, and infrastructure spend within $650/month.

What is the main architectural bottleneck in Real-time Activity Feed?

Reading a feed should not mean joining many tables on every page view. Prepare each user's feed ahead of time and keep it in a cache, so a page load is one quick read.

How can I verify my Real-time Activity Feed architecture works under load?

Open the live simulator to wire up load balancers, caches, queues, replicas, or shards and run a 60-second traffic simulation that grades latency, error rate, and monthly cost automatically.

Recommended lessons before you build

Related Read-Heavy & Caching problems