Problem statement
Design a presence service that tracks whether each user is online, away, or offline and pushes those status changes to the people who care (think the green dot in a large chat or gaming app). Clients hold a long-lived connection and send periodic heartbeats; friends and open conversations must see status flips quickly, and everyone else must see an accurate "last seen" timestamp.
Operating context. The platform has 200M registered users, with 30M connected concurrently at peak across many edge points of presence. Each connected client sends a heartbeat roughly every 30 seconds, so the service absorbs ~1M heartbeat writes/sec at peak. The social graph is skewed: the median user has ~150 subscribers watching their status, but a small tail of celebrity accounts have millions of watchers. Status changes are read-heavy at the edges but write-triggered at the source. Flaps are common — mobile clients on flaky networks drop and reconnect every few seconds, and you must not spam a million watchers with online/offline/online churn. The status-flip fan-out budget is p99 < 2 s from heartbeat-loss to watcher notification; a direct "is X online?" query must answer p99 < 150 ms.
Out of scope. The chat/message delivery pipeline itself, the connection/auth handshake and token refresh, the social-graph (friend/follow) write path, rich statuses ("typing…", custom emoji status), and cross-app federation. Assume a separate service owns the subscription list for each user.
What to produce. A high-level architecture covering: the heartbeat ingestion and session-tracking model, how a session is judged expired (TTL) at this write rate, how a status change fans out to a user's subscribers, how you damp flapping so a brief disconnect does not notify watchers, the last-seen storage and the direct-read path, and the trade-off between pushing every change to every watcher versus letting watchers pull on demand (especially for celebrity accounts). Sketch the major components and the request/event flow between them; we will probe specifics at the checkpoints.
Requirements
This assessment is a Premium feature.
The statement above is free to read. The functional and non-functional requirements, and the graded canvas that scores your design against them, come with Premium.
Topics
- System Design HLD
- Data Cache
- Scaling Fanout
- Consistency Eventual
- Reliability Replication