Presence system at scale
Your task
Design a presence system (online / idle / offline + 'typing…') for a workplace chat app with 100M users and large orgs where one user may have 5,000 contacts/teammates whose status they can see. Presence changes constantly (every tab switch, every keypress for 'typing'), and a naive fan-out, broadcast every change to every watcher, would be a write amplification disaster. How do you track and distribute presence at this scale with sub-second freshness but bounded cost?
It covers
- Online status
- Fan out
- Heartbeats
- Scale