~learn.
0:00 / 1:12
Side quest 31 · Discord

Green dots could cost 3.3 billion messages a second

transcript

Those little green dots next to names. In one huge server, they could cost 3.3 billion messages a second.

A million people online. Say each changes status every five minutes. That's about 3,300 changes a second. Send each to everyone online? 3.3 billion a second. Impossible.

But here's the catch. Who is actually looking? Your screen shows about a hundred names. So each client subscribes to just those rows.

Your phone goes idle, but your laptop's online. The most present device wins. Nothing changes. When it does change, it goes to clients watching that row. Plus your friends. Everyone else gets nothing. Their list is only wrong where they aren't looking. And when your laptop closes without a goodbye? Its session dies. Presence recomputes.

And the online count? Recomputed every few seconds. Nobody can check it. Messages and permissions can't lag. Green dots can.

Presence is the most frequent event. And the least important. Send each person only what they can see.

Full breakdown in the lecture.