System design interview guide
Discord System Design Interview: Real-Time Chat and Voice at Guild Scale
Short answer
Discord system design is three problems in one app. First, a real-time gateway: every client keeps a WebSocket open, and each guild (server) is one Elixir process that sends new messages, typing and presence to every online member who can see the channel. Second, message storage: messages are partitioned by channel and a time bucket in a wide-column database, first Cassandra and now ScyllaDB, behind a Rust service that merges duplicate reads. Third, voice: clients send audio over UDP and WebRTC to separate voice servers. Discord has published about 26 million WebSocket events a second and a move from 177 Cassandra nodes to 72 ScyllaDB nodes.
Two courses by the author of this page:
770 lessons · 18 free to read
₹1,111 in India · $35 elsewhere, once
Get System DesignYou own this course
219 lessons · 10 free to read
₹1,333 in India · $35 elsewhere, once
Get Generative AI and Agentic AIYou own this course
Save your progress and get the interview checklist PDF
Discord has published that its real-time infrastructure runs on roughly 400 to 500 Elixir machines pushing on the order of 26 million WebSocket events to clients every second, with about 12 million concurrent users at the time of that writing. Its voice platform has served more than 2.6 million concurrent voice users across 850-plus voice servers, pushing over 220 Gbps of egress. The message store holds trillions of rows and was migrated from Apache Cassandra to ScyllaDB, dropping from 177 nodes to 72.
Discord is two hard systems wearing one app. The first is a real-time gateway: every client holds a WebSocket, and events like new messages, typing, and presence must fan out to everyone watching a channel within a guild, sometimes millions of members. Discord models each guild as a single Elixir process on the BEAM that routes events to per-connection session processes, which works beautifully for small servers and becomes a fanout bottleneck for huge ones. The second system is durable message storage. Messages are immutable, append-heavy, and read by channel in reverse-chronological order, so Discord partitions them by channel and a time bucket and stores them in a wide-column store, first Cassandra and now ScyllaDB, fronted by a Rust data service that coalesces duplicate reads. On top of that sit voice servers running a homegrown selective forwarding unit over UDP and WebRTC, plus per-user read state, mentions, and unread counts. A strong answer treats fanout, storage partitioning, and voice as three separate scaling problems with three different solutions.
Where it shows up
Asked at Discord, and used at Meta, Google, Slack, and other companies that run real-time messaging or presence systems. It also shows up in senior interviews under the generic 'design a chat app' or 'design a real-time messaging system' prompt.
Spec sheetDiscord
- 01Concurrent gateway connections
- ~12 million (published)
- 02WebSocket events pushed to clients
- ~26 million per second (published)
- 03Inbound messages vs outbound deliveries
- 1 message can become 1M deliveries (Derived)
- 04Total stored messages
- Trillions of rows (published)
worked through below, with the maths
in this guide
Design Discord, part by part
7 parts open to everyone · 3 with a free account · 3 with the course
You can read 7 of 13 parts. A free account opens the deep dive; the course opens all of it.
- Requirementsopen
- Scale estimatesopen
- High-level architectureopen
- Core componentsopen
- Data modelfree account
- Deep dives (7)free account
- Trade-offs to discussfree account
- What the interviewer asks nextwith the course
- The interview scorecardwith the course
- Mock interview on this questionwith the course
- How Discord actually does itopen
- Frequently asked questionsopen
- Interview readiness checkopen
The hard parts of this design are taught step by step in the System Design course: Actor Model, WebRTC and UDP.
Why this question is asked
It forces a candidate to separate the read path, the write path, and the push path instead of blurring them into one 'chat service'. The interesting tension is fanout: a message write is cheap, but delivering it to every online member of a large guild is expensive, and the naive one-process-per-guild design falls over exactly where the product is most visible. It also rewards candidates who know that immutable, time-ordered data wants a wide-column store with careful partition keys rather than a relational schema, and who can reason about hot partitions, tombstones, and per-user state that cannot be denormalized into the shared message rows.
This page is the free part.
The course goes deeper on the Discord design
₹1,111 in India$35 everywhere elseonce, for the whole course
The System Design course covers the Discord design across a run of lessons, not one page. These 4 alone are about 80 minutes of step-by-step reading, 1 of them with code you run in the browser, all with a quiz.
- Actor Model
Concurrent computation through message-passing actors. Erlang's secret weapon for building fault-tolerant systems.
- WebRTC
Real-time peer-to-peer communication in the browser, the technology behind video calls, screen sharing, and live streaming.
- UDP
The 'fire and forget' transport protocol that prioritizes speed over reliability.
- Tombstoning
Why databases don't actually delete your data right away, and what they leave behind instead.
all part of
System Design Masterclass
770 lessons · about 290 hours · 18 free to read
₹1,111in India, by UPI
$35everywhere else, by card or PayPal
You own this course
Continue with Actor Modelpay once,
yours for life
Live from the course bench
Before you design Discord, try the questions it rests on.
Real interview questions, live diagrams and measured lab results, pulled at random from the lessons. A new set every time you come back.
Requirements
Always clarify these in the first 5 minutes of the interview. Do not start drawing boxes until both lists are agreed.
Functional requirements
- Users send and receive messages in text channels that belong to guilds (servers), with real-time delivery to all online members who can see the channel
- Load recent message history for a channel and scroll back through older messages in reverse-chronological order
- Support guilds ranging from a handful of friends to communities with millions of members
- Show presence (online, idle, offline) and typing indicators to members of a guild
- Track per-user read state: which channels have unread messages, unread counts, and mentions directed at the user
- Join a voice channel and exchange low-latency audio and video with other participants
- Support edits, deletions, reactions, replies, and attachments on messages
- Deliver messages and mentions reliably even when a user is briefly offline, so nothing is silently lost
Non-functional requirements
- Real-time delivery latency in the tens of milliseconds for message and presence fanout
- Very high WebSocket connection count, on the order of millions of concurrent persistent connections
- Message store must scale to trillions of rows with predictable low read latency by channel
- Voice must be low-latency and loss-tolerant, favoring UDP with graceful handling of dropped packets
- High availability: a single node or voice server failure must not take down guilds or ongoing calls
- Elastic fanout so that a message to a giant guild does not stall delivery for small guilds sharing the same infrastructure
- Durability for messages once acknowledged, and correctness of per-user read state under concurrent activity
Back-of-envelope scale estimates
Show your math. Pulling numbers from thin air signals you have not thought about the load.
Concurrent gateway connections
~12 million (published)
Discord's Elixir engineering writeup cited about 12 million concurrent users served by 400 to 500 Elixir machines. Each connection is a long-lived WebSocket with its own session process.
WebSocket events pushed to clients
~26 million per second (published)
Reported in Discord's Elixir at scale material. This is the outbound fanout rate, not the inbound message rate, which is far smaller because one message can fan out to thousands of sessions.
Inbound messages vs outbound deliveries
1 message can become 1M deliveries (Derived)
Discord's own tracing post notes a message to a guild with a million online members spawns roughly a million forwarding operations, one per session. Fanout amplification, not ingest, is the dominant cost.
Total stored messages
Trillions of rows (published)
Discord states the message cluster holds trillions of messages. Cassandra crossed a billion messages in 2017 and grew from there; treat the exact current count as an estimate.
Message store latency after ScyllaDB
p99 read ~15ms, insert ~5ms (published)
Discord reported p99 message reads improving from 40 to 125ms on Cassandra to about 15ms on ScyllaDB, and inserts from 5 to 70ms down to about 5ms.
Concurrent voice users
2.6 million+, 220 Gbps egress (published)
Discord's WebRTC post reported more than 2.6 million concurrent voice users, over 220 Gbps egress and 120 Mpps, served by 850-plus voice servers across 13 regions.
High-level architecture
A client opens a WebSocket to the gateway and authenticates. The gateway spins up a per-connection session process on the BEAM (the Erlang virtual machine that Elixir runs on). That session subscribes to the guilds the user is a member of. Each guild is itself a process living on one of a set of guild nodes; the guild process is the routing hub that knows which sessions are currently watching which channels. When a user sends a message, it goes over that user's WebSocket to the API layer, which persists the message to the storage tier and then hands it to the owning guild process. The guild process fans the event out to the session processes of every online member who can see the channel, and each session writes it down its own socket. For very large guilds this single guild process becomes a hotspot, so Discord introduced Manifold to spread the sending work across nodes and cores, and relays to hold sessions on behalf of enormous guilds. Message persistence lands in a wide-column store (ScyllaDB today, Cassandra before it) partitioned by channel and time bucket, fronted by a Rust data service that coalesces concurrent reads of the same channel so a viral message does not stampede the database. Voice runs on a separate path entirely: the gateway hands the client a voice server in a nearby region, and the client speaks UDP and WebRTC directly to that server's selective forwarding unit, which relays media to the other participants without routing it through the chat backend.
In a real interview, sketch this on the whiteboard before diving into any single box.
Core components
Walk through each service. The interviewer wants to hear what each one owns, not just the names.
Gateway (WebSocket layer)
Terminates millions of long-lived WebSocket connections, built on Elixir and Cowboy. Each connection gets a session process that authenticates the client, tracks which guilds and channels it cares about, and writes events down the socket. Because it is a BEAM process, a crash on one connection is isolated and cheap to restart.
Guild process
One Elixir GenServer per guild acting as the central router for that server. It holds the set of active sessions and dispatches message, presence, and typing events to them. This model is elegant for small and medium guilds and becomes the primary scaling challenge for guilds with hundreds of thousands or millions of members.
Relays for large guilds
For very large guilds, relay processes maintain session connections on the guild's behalf and take over fanout and permission checks, with each relay handling a bounded slice of the membership. This keeps a single guild process from having to talk directly to millions of sessions.
Message data service (Rust)
An intermediary between the API and the database, written in Rust. It routes requests by channel id using consistent hashing and performs request coalescing, so many simultaneous reads of the same channel collapse into a single database query. This is what protects the store when an @everyone announcement makes a whole community open the same channel at once.
Message store (ScyllaDB)
A wide-column store holding trillions of messages, partitioned by channel and a static time bucket, with Snowflake ids as clustering keys so rows sort chronologically. Discord migrated here from Cassandra to escape JVM garbage collection pauses and reduce node count, cutting p99 read latency to around 15ms.
Voice servers and SFU
Standalone servers, separate from the chat backend, each with a signaling component and a media relay called a selective forwarding unit written in C++. Clients send UDP and WebRTC media to the assigned server, and the SFU forwards streams to the other channel participants. Region selection places users on a nearby server to keep latency low.
Read state and presence service
Tracks per-user, per-channel state that cannot be baked into shared message rows: last-read message, unread counts, and mentions. Presence tracks online, idle, and offline status and is published through the guild process to interested sessions.
Data model
messages. Partitioned by channel plus a static time-window bucket so a single busy channel does not create an unbounded partition. Snowflake message ids are time-sortable, so a…
Every table for Discord, its keys, and which store fits it and why.
Deep dives
The guild process and the fanout bottleneck. Discord models each guild as one GenServer on the BEAM. When something happens, a message, a presence change, a typing event, that guild process pushes it to every…
7 deep dives on the parts that break at scale: The guild process and the fanout bottleneck; Manifold and cross-node message distribution; Node lookup, fastglobal, and the registry stampede.
Trade-offs to discuss
One process per guild versus one process per channel or per shard. A single guild process is a clean routing hub and keeps all of a server's state in one place, which is simple to reason about and cheap for the vast majority of guilds…
6 decisions an interviewer expects you to defend, each with the alternative and why it loses here.
What the interviewer asks next
A guild node crashes during a busy event. What do members lose, and how does the system recover?
4 follow-up questions with model answers, the interview scorecard for this question, and a mock interview on Design Discord with the AI tutor.
How Discord actually does it
Discord has documented this architecture in unusual detail. The Elixir gateway, guild processes, and session model are described in their Elixir at scale writeups, and the fanout libraries Manifold and fastglobal are open source on Discord's GitHub. The message storage journey from MongoDB to Cassandra to ScyllaDB, the channel-plus-time-bucket partitioning, the tombstone and hot partition pain, the Rust data services with request coalescing, and the nine-day migration at roughly 3.2 million rows per second are all covered in How Discord Stores Trillions of Messages. Voice, including the C++ selective forwarding unit, UDP and WebRTC transport, region selection, and the 2.6 million concurrent voice user figure, is covered in their WebRTC post. Their 2026 tracing post is where the million-child-spans-per-message framing of fanout comes from.
Sources
- How Discord Stores Trillions of Messages (Discord Engineering)
- How Discord Scaled Elixir to 5,000,000 Concurrent Users (Discord Engineering)
- Real-time communication at scale with Elixir at Discord (elixir-lang.org)
- How Discord Handles 2.5 Million Concurrent Voice Users Using WebRTC (Discord Engineering)
- Tracing Discord's Elixir Systems Without Melting Everything (Discord Engineering)
Lessons to study before this interview
If any of these topics are fuzzy, the interviewer will catch it. Each lesson is 15 to 60 minutes with diagrams, code, and a quiz.
Actor Model
advanced / distributed systems core
WebRTC
intermediate / cloud infrastructure
UDP
intermediate / cloud infrastructure
Tombstoning
foundation / database fundamentals
Compaction
foundation / database fundamentals
WebSockets
intermediate / messaging event systems
Pub/Sub Pattern
intermediate / messaging event systems
Fan-Out/Fan-In
intermediate / messaging event systems
Design a Chat System like WhatsApp
capstone / capstone
System design interviews at companies in the US, UK, Canada and Singapore
41 walkthroughs of real systems at well-known companies, each built from that company's own engineering blog, talks or filings, with the numbers cited.
Banking, payments and trading
Commerce and delivery
Rides and maps
- Grab system design (Singapore)
- Uber system design
Feeds, social and messaging
Streaming and media
AI labs and big tech
Developer and collaboration tools
Frequently asked questions
interview readiness
Are you ready for Design Discord?
Three questions from this guide. Answer them without scrolling up, the way you would have to in the room.
Go deeper
This guide is built on these 6 lessons. Each one teaches one piece of the Discord design above, step by step.
- Actor ModelSystem Design · distributed systems core · 25 min
- WebRTCSystem Design · cloud infrastructure · 24 min
- UDPSystem Design · cloud infrastructure · 17 min
- TombstoningSystem Design · database fundamentals · 14 min
- CompactionSystem Design · database fundamentals · 18 min
- WebSocketsSystem Design · messaging event systems · 22 min
Practice with 770 system design lessons
Lifetime access for ₹1,111 in India or $35 elsewhere. Interactive diagrams, quizzes, and 20 capstone projects to practise on.
This one question is not enough for the interview.
Get all 200 questions in the System Design and Distributed Systems pack
Each question has why it is asked, a full answer, what the interviewer listens for, the follow-ups, the common mistakes and a diagram (268 diagrams in all). A PDF you keep, junior to staff level.
Pay by UPI, cards or netbanking through Razorpay. Pay by card or PayPal, in US dollars. Download at once from My packs.
NEWSystem Design Hands-On
Included in the System Design course: real systems, built live
Postgres Sharding: Complete Hands-On (PgBouncer + Citus). 2 h 36 min and 20 chapters: one PostgreSQL loaded until it breaks, then four shards behind a router you write, PgBouncer and Citus, with the 139-page slide deck. The first 15 minutes are free to watch.


