HLDArena
HLD-212·Caching & Consistency
Medium · 1,000 pts

Social Follow Graph & Blocklist Lookup Service

Design a directed social-graph edge store serving high-QPS follow/block checks across feed and messaging services with instant block enforcement.

Max p99
≤ 45 ms
Availability
≥ 99.5%
Budget
≤ $5,100

Functional Requirements

  • FR-1POST /graph/{user_id}/edges — Creates or removes a follow/block edge to target_id.
  • FR-2GET /graph/{user_id}/edges — Queries follower/following lists and block relationships.
  • FR-3PATCH & DELETE /graph/{user_id}/edges — Updates, cancels, or deletes user_id records and immediately invalidates or updates cached state (read-after-write).
  • FR-4Newly created block/unfollow actions must take effect immediately without stale cached edges (read-after-write).

Workload Profile

Baseline Graph Queries42,000 Read RPS / 4,500 Edge Write RPS
Creator Shoutout Surge118,000 Read RPS / 14,000 Write RPS
Active Working Set26 GB hot adjacency & block lists
Traffic DistributionZipfian skew on high-follower user_id nodes

Consistency Model

Read-after-write consistency required so block and unfollow actions immediately invalidate or update adjacency caches.

Design Write-up
0 boxes · 0 edges
0 words
Hidden Cases #4–#7 run automatically on Submit
Case 1: Smoke & API ContractInput Workload
Read RPS
2,000 rps
Write RPS
400 rps
Key Distribution
Uniform (Low Skew)
Chaos Fault
None (Healthy Cluster)
Expected Pass CriteriaASSERTIONS
• Tail Latency: p99 ≤ 90 ms
• Availability: ≥ 99.5%
Valid end-to-end Client → Compute → Storage topology