SysPad › Examples › 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.
- Throughput: 15,000 req/sec
- First to saturate: Social Graph
- Estimated cost: $87k/mo
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
- Client
- DNS
- Load Balancer
- Web/App Servers
- Feed Service
- Feed Cache
- Post Content Cache
- Media CDN
Publish a post
- Client
- DNS
- Load Balancer
- Web/App Servers
- Post Service
- Post Storage
- Fanout Service
- Social Graph
- Feed Cache
- Follower Notifications