SysPadExamples › News feed system

News feed system

A Fanout Service pushes new posts into followers’ feed caches on write (reading the social graph); a Feed Service assembles reads from the pre-computed cache + hydrated post content + CDN media.

Fan-out-on-write publishing alongside cache-assembled feed reads sharing one app tier - reads stay cheap because the expensive work happens once, at write time.

Client Users DNS Route 53 Load Balancer ALB Web/App Servers Fargate Post Service Lambda Post Storage DynamoDB Fanout Service Lambda Social Graph Neptune AT LIMIT Feed Cache ElastiCache Follower Notificati… SNS Feed Service Lambda Post Content Cache Memcached Media CDN CloudFront

How it works

Fanout Service
Fan-out-on-write: on a new post it reads the author’s followers from the social graph and pushes the post id into each follower’s feed cache, so reads never have to compute the feed.
Social Graph
Follower/following edges. Read heavily at write time to know who to fan out to; celebrity accounts with millions of followers are why fan-out-on-write has to be rate-aware.
Feed Cache
The pre-computed per-user feed (list of post ids). Written by fan-out, read on every feed load - this is what makes the read path a cache hit instead of a query.

Request flows

Load feed

  1. Client
  2. DNS
  3. Load Balancer
  4. Web/App Servers
  5. Feed Service
  6. Feed Cache
  7. Post Content Cache
  8. Media CDN

Publish a post

  1. Client
  2. DNS
  3. Load Balancer
  4. Web/App Servers
  5. Post Service
  6. Post Storage
  7. Fanout Service
  8. Social Graph
  9. Feed Cache
  10. Follower Notifications

Other interview practice

Open this architecture in SysPad · All examples