50M/s
deliveries a second from one server
One server with a million people online carries 50 messages a second during a launch. Push each to every session, and that’s 40× the whole platform’s average.
Mailbox or room?
Bad: A copy per member
WhatsApp-style, an audience of 25 costs 30 TB a day.
Good: Store once, push live
1.2 TB a day. Offline members get no push; they read history later.
A million online. The server’s owner sends 67 copies, not a million.
Relays of 15,000 sessions do the sends and permission checks. Nine in ten sessions are passive, with no message bodies until you click in.
@everyone to 10 million members: a counter each means 10 million writes.
The trick
Compare two IDs, last read vs last message. Count only people named; @everyone is counted at read time. One write.
Thousands ask for the same page. The database sees one query.
Every request for a channel is hashed to one data service. The first reads the database; the rest wait for its answer.
A train enters a tunnel. Resume after event 4182; don’t reload.
Every event carries a sequence number. The session outlives its socket for a few minutes, buffers what you miss, and replays it on Resume.
When a whole region reconnects at once
- Jitter heartbeats and reconnect delays
- Drain gateways over minutes, not seconds
- Rate-limit full identifies, the expensive kind
- Send a slim start-up snapshot; load the rest lazily
Remember
A room, not a mailbox. Store each message once by channel and time bucket. Push only to active sessions that may see it, through relays for giants. Unread compares two IDs.