How Discord Scales to Millions: A Deep Dive into the Actor Model

2 min read


HERO

Discord processes billions of messages across hundreds of millions of users. Here’s how the Actor Model makes it possible.

The Core Insight

The Core Insight

Discord is essentially a massive distributed system built on the Actor Model—a paradigm from 1973 that’s found renewed relevance in the age of AI agents. Every server, connection, voice call, and screenshare is an actor communicating through messages.

Why This Matters

Why This Matters

If you’ve ever struggled with race conditions, deadlocks, or distributed system complexity, the Actor Model offers a fundamentally different approach. Instead of shared state with locks, actors communicate through messages, process one at a time, and own their own state.

Key Takeaways

  • The Actor Model basics: Each actor owns its state, communicates via messages, processes one at a time, and can spawn children
  • Discord’s architecture: Users connect via WebSocket → Session process → Guild process → fans out to all sessions
  • Why Elixir? Functional language with built-in actor semantics handles millions of processes efficiently
  • The fan-out problem: 10,000 messages in a big server = 100 million notifications. Discord solved this with relay workers
  • Database scaling: Messages partitioned by channel + 10-day buckets prevent hot partitions

Looking Ahead

The Actor Model is experiencing a renaissance thanks to AI agents. An agent is literally an actor—it passes messages (prompts), has internal state (context), and spawns other agents. Hewitt’s 1973 paper was titled “A Universal Modular ACTOR Formalism for Artificial Intelligence.”

As systems get more distributed, this old-new pattern becomes essential. The question isn’t whether to use it—it’s whether your team can handle the paradigm shift.


Based on analysis of Discord performance case study

Share this article

Related Articles