A million people online, and one message costs about 67 sends
transcript
One Discord server. Over a million people online. One message costs about 67 sends. Not a million.
Discord's own example. A thousand people each say I love jello. A million notifications. Ten thousand people online? A hundred million. A hundred thousand? Ten billion. The work is quadratic.
And each server runs as one process. One message at a time. But here's the catch. Send to everyone, and its mailbox grows. Until the machine runs out of memory.
Trick one. About 90 percent of connections in big servers are passive. They get summaries. Trick two. Relays. Each owns up to 15,000 sessions and does the sends. A million sessions, 15,000 each. About 67 relays.
So the guild sends once per relay. Relays check permissions and send to active sessions. And the order? The guild still decides it. Relays just forward.
Every trick here is a way of not sending something. One ordered process per server. Push the fan-out outwards. That keeps a server with a million online survivable.
Full breakdown in the lecture.