The probe
This is usually a subsystem question (”you mentioned a presence service — how does that work?”). The challenge: 500M users with binary online/offline state, each state changing frequently, each change needing to propagate to potentially thousands of contacts.
Step 1 — Core Design
State storage: Redis key per user: presence:{user_id} → {status: “online”, last_seen: epoch_ms, server_id}, TTL = 60 seconds. Refreshed by heartbeat every 30 seconds while user is active. Expires naturally on disconnect (no explicit offline signal needed — graceful or not).
Heartbeat: Client sends heartbeat to presence service every 30 seconds. Presence service does SET presence:{user_id} ... EX 60. If heartbeat stops (crash, network loss), TTL expires, user is considered offline.
52 FAANG Question Vault — $299 one-time (or $249 for paid subscribers)
All 52 walkthroughs + 52 drill cards + 6 framework cheatsheets + the Senior+ System Design Playbook. Everything, immediately. Lifetime access with all future updates included. → [VAULT CHECKOUT LINK]
The fan-out problem: User A comes online. Who needs to know? Every user who has A in their contact list AND is currently online themselves. For a user with 500 contacts, 50 of whom are currently online — that’s 50 WebSocket pushes.


