~learn.
0:00 / 1:11
W06 · Presence and chat

100,000 people in one chat: 10 billion notifications.

transcript

One chat room. 10 billion notifications. This is why huge groups melt servers.

1,000 people online. Each says one thing. Everyone sees everything. So that's 1 million notifications. Now 100,000 people. 10 billion.

Picture a cricket final. 40,000 fans online, in one community. Every message costs 40,000 deliveries. The chat tier's CPU hits 100 percent.

More members means more messages. And each message reaches more people. Discord calls it quadratic. Back in 2017? One event from a big server took up to 2.1 seconds.

Discord's first fix? Most people in a huge server aren't even looking at it. Stop sending them everything until they click in. Fan-out got 90 percent cheaper.

Next, split the room's work. Relays take up to 15,000 sessions each. Send one copy per server, not one per person. Full messages only reach people watching. That keeps a server with over 1 million online alive.

Don't send everything to everyone. Send to who's looking, once per server.

Full breakdown in the lecture.