Social Graph
Follow/follower lookups so hot that every feature depends on the cache in front of them.
Keep follow-graph lookups fast and always-on while a celebrity joins and the graph store falters.
Every feature — feed, mentions, suggestions — fans into this one service, so reads dwarf writes by orders of magnitude. The adjacency cache IS the product: if lookups fall through to the graph store, one store blip takes every feature down with it.
Components in play
- Internal LB — Spreads the fan-in from every feature across the API fleet.
- Graph API — Answers follows(a,b), followers(x), following(x).
- Adjacency cache — Hot adjacency lists in memory — the read path's real backbone.
- Graph store — Source of truth for every edge in the graph.
Graded on these SLOs
- ≥ 98.00%Lookups succeed
- ≤ 80 msLookup p99
- ≥ 9.0k rpsFeed the features
- ≤ 90%Fleet headroom
- ≤ 7Lean footprint
The brief
Design the follow-graph service behind a social product: follows(a,b), followers(x), following(x). Every feature — feed, notifications, mentions, suggestions — fans into this one lookup, so reads dwarf writes by orders of magnitude. When a celebrity joins and millions tap Follow in the same minute, the graph store cannot be on the hot path.
Functional
- Follow / unfollow a user
- List followers(x) and following(x)
- Check follows(a,b) for a given pair
Non-functional
- Extreme read skew — a handful of accounts draw most of the lookups
- High availability — feed, notifications, and mentions all depend on this service
- Lookups must stay fast even when one account's edge count spikes suddenly
Warm-up: design decisions
Optional theory to prime the calls a senior engineer would make before you build.
Solving is a Pro feature
Unlock the on-canvas AI design coach, per-run design reviews, the chaos simulator and all 12 problems for $15/month.
- AI design coach on your canvas — pins failure points & over-engineering
- Honest AI design review on every run
- All 12 problems + unlimited chaos simulator
- Points, levels & leaderboard