ArchitectAI resilience reviews are here. See what's new
Back to all articles
High Level Design Sep 26, 2026 14 min read

Designing Discord: Million-Member Guilds, Real-Time Presence & Voice Gateway

How Discord handles 150M+ monthly active users and massive 1M-member servers. Exploring Elixir BEAM gateways, presence fanout caching, and WebRTC voice routing.

HLDDiscordWebRTCElixirScyllaDB
HFHLDForge Architecture TeamPrincipal Real-Time Systems Architect

1. Scale & Real-Time Challenges

Discord connects hundreds of millions of users across persistent community servers called 'guilds'. Some mega-guilds contain over 1 million members. When a user changes their status from 'Offline' to 'Online', naively broadcasting that presence update to all 1 million guild members requires 1,000,000 WebSocket messages.

If 100 users toggle status simultaneously, that produces 100 million messages, overwhelming the network. Discord solved this with intelligent presence subscription.

2. Gateway Tier: Erlang & Elixir on BEAM

Discord's real-time gateway is powered by Elixir on the Erlang VM (BEAM). The BEAM process model allows millions of lightweight concurrent actor processes on a single physical machine with microsecond scheduling.

Each client maintains a persistent WebSocket connection to a gateway process that handles heartbeats, sequence numbering, and session resumption.

3. Presence Optimization: Viewport-Based Subscriptions

For large guilds, Discord does not broadcast presence updates to everyone. Instead, clients only subscribe to members currently visible in their sidebar viewport (typically ~30 to 50 members). As the user scrolls, new subscription windows are requested lazily.

4. Trillion-Message Storage with ScyllaDB & WebRTC Voice

Discord migrated from MongoDB to Cassandra and ultimately to ScyllaDB (C++ rewrite of Cassandra) to store trillions of messages with low p99 latency without JVM garbage collection pauses.

Voice channels use WebRTC with custom Selective Forwarding Units (SFUs) written in Rust/Go, routing UDP audio packets between participants without transcode overhead.

Interactive Modeling ArchitectAI

Model this architecture on the HLDForge Canvas

Turn static box diagrams into living, collaborative systems. Drag and drop microservices, Kafka clusters, and cache tiers. Run automated SPOF detection and STRIDE threat modeling in real time.

HF

Written by HLDForge Architecture Team

Principal Real-Time Systems Architect

The HLDForge Architecture Team publishes practical engineering guides, real-world case studies, and high-concurrency blueprints to help engineers build scalable and fault-tolerant software.

Free forever plan

Ready to master distributed system design?

HLDForge gives you the tools, templates, and AI reviews to design systems like a Staff Engineer. Get started free.

SOC 2 Type II · ISO 27001 aligned · SSO on every paid plan