⚡️TLDR;
Discord has a server with 10,000,000 concurrent users and keeps things under control by
Sending events only to people who actively check that server
Splitting work from a single process to multiple sub-processes
Being efficient with in memory databases
🔥 Too many users is a good problem. Fanning out is not.
The biggest issue Discord has for a server with 10,000,000 users is fanning out notifications to them.
When someone uses a call like “@everyone”, everyone in that humongous server is notified. That’s 10 million notifications in a single message!
🔧 Here’s the requirements
Coming straight from the official article:
Ensuring that we can keep almost all operations quick is important to the server feeling like it's responsive:
When a message is sent, others should see it right away;
When someone joins a voice channel, they should be able to start participating right away.
Dropping the “@everyone” command isn’t an option so we need to figure other ways to make it work.
👏 Optimization #1: Do less fam
The simplest way to handle to much throughput is to put less through
Before doing crazy technical solutions, Discord figured out if how much fanning out it actually needed to do.
Turns out not everyone is active in every server at all times of the day.
So their first optimization was to just send notifications when someone peeked into that server. Lazy loading the notification was a huge first step.
How good was this optimization?
Keep reading with a 7-day free trial
Subscribe to Byte-Sized Design to keep reading this post and get 7 days of free access to the full post archives.