All problems

Social Graph

Follow/follower lookups so hot that every feature depends on the cache in front of them.

medium~15 min Pro Simulator · +110 ptsTheory +46 pts
The build

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 LBSpreads the fan-in from every feature across the API fleet.
  • Graph APIAnswers follows(a,b), followers(x), following(x).
  • Adjacency cacheHot adjacency lists in memory — the read path's real backbone.
  • Graph storeSource 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
Base 9,000 rps44s run 3 scripted failures

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.

Pro

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
Get started