Design leaderboard and messenger systems
Company: Meta
Role: Software Engineer
Category: System Design
Difficulty: hard
Interview Round: Onsite
##### Question
This Meta onsite system-design round asks you to design two large-scale systems back to back. Cover end-to-end architecture, APIs, data models, storage choices, sharding/partitioning, consistency, scale estimates, and operational considerations for each.
**A) Leaderboard service (large-scale game)**
1. Compute a user's **global rank** and their **rank within their friendship circle**.
2. Retrieve the **k users immediately before and after** a given user, both globally and within the friend circle.
3. Support **top-N paginated** queries with stable pagination windows.
4. Handle **high write rates** (frequent score updates), caching, and consistency trade-offs.
5. Integrate the **friend graph** and handle large friend lists efficiently.
6. Support **anti-cheat / integrity** (server-authoritative scoring, anomaly detection).
7. Support **seasonal resets** and **multi-game / multi-mode** leaderboards.
8. Provide **backfill / batch** workflows for recovery and recomputation.
Detail APIs, data models (e.g., sorted sets and secondary indexes), sharding/partitioning, caching, consistency, ranking computation, and how ties are broken.
**B) Real-time messenger application**
1. Support **1:1 and group chat** (including very large groups).
2. Guarantee correct **per-conversation message ordering**.
3. Choose and **justify a delivery guarantee** (at-least-once / at-most-once / exactly-once).
4. Support **online presence**, **typing indicators**, and **read/delivery receipts**.
5. Support **media sharing** and **push notifications**.
6. Support **end-to-end encryption (E2EE)**.
7. Support **offline sync** and **multi-device** consistency.
8. Handle **fanout for large groups**.
9. Provide **spam/abuse controls** and **disaster recovery**.
Provide an end-to-end architecture, storage choices, protocols, scale estimates, and operational considerations.
Quick Answer: A Meta software-engineer onsite system-design round combining two designs: a scalable game leaderboard (global and friend-circle ranks, k-neighbor windows, anti-cheat, seasonal resets) and a real-time messenger (1:1 and group chat, ordering, delivery guarantees, presence, E2EE, offline sync, and large-group fanout). Covers APIs, data models, sharding, consistency, and operations end to end.