Skip to content
System Design Explorer

Comparison

Discord vs Slack: Two Ways to Build Real-Time Chat

By Ankur NayakReviewed

Discord and Slack solve the same core problem, delivering a message to everyone in a channel in real time and storing it forever, and both have written in detail about how. Both hold WebSockets open to clients, both use consistent hashing to give each conversation an owner, and both fan messages out from that owner to connected users.

Their public writing emphasises different halves of the problem. Discord's is storage-first: how to keep trillions of messages readable when one channel suddenly gets thousands of readers. Slack's is routing-first: how a message reaches every subscribed gateway, in every region, in about half a second.

Discord architecture diagramComponents: Discord Client, Session Processes (Elixir), Guild Processes (Elixir), API, Data Services (Rust), Message Store (ScyllaDB), Indexing Queue (PubSub), Search Cells (Elasticsearch). Connections: Discord Client to Session Processes (events); Session Processes to Guild Processes (subscribe); Guild Processes to Session Processes (fan out); Discord Client to API (send / history); API to Data Services; Data Services to Message Store (quorum read / write); API to Guild Processes (publish event); API to Indexing Queue (index); Indexing Queue to Search Cells; API to Search Cells (search).Discord ClientClientSession ProcessesElixirGuild ProcessesElixirAPIAPI gatewayData ServicesRustMessage StoreScyllaDBIndexing QueuePubSubSearch CellsElasticsearch
Slack architecture diagramComponents: Slack Client, Envoy Edge (Envoy), Webapp API (Hack), MySQL via Vitess (Vitess), Admin Servers, Channel Tier (CS ring), Gateway Servers, Presence Servers. Connections: Slack Client to Envoy Edge (events); Envoy Edge to Gateway Servers; Slack Client to Webapp API (post / boot); Webapp API to MySQL via Vitess (store); Webapp API to Admin Servers (message); Admin Servers to Channel Tier (by channel hash); Channel Tier to Gateway Servers (broadcast); Gateway Servers to Channel Tier (subscribe); Gateway Servers to Presence Servers (online status).Slack ClientClientEnvoy EdgeEnvoyWebapp APIHackMySQL via VitessVitessAdmin ServersServiceChannel TierCS ringGateway ServersRealtime gatewayPresence ServersCache

Side by side

Discord compared with Slack
DimensionDiscordSlack
Unit of ownershipA process per guild (server), found by consistent hashing (2017)A Channel Server per channel, on a consistent hash ring managed by CHARMs
Client connectionWebSocket to a session process (Elixir GenServer); up to 500,000 per Erlang VMWebSocket via Envoy to Gateway Servers in multiple regions
Fan-outGuild process fans events to every connected member's session; Manifold batches per nodeChannel Server sends to every subscribed Gateway Server, which pushes to its clients
Message storageScyllaDB, partitioned by (channel, time bucket), replication factor 3, quorum reads/writesMySQL sharded by Vitess, messages sharded by channel ID
Hot-spot defenceRust data services coalesce identical requests, routed by channel IDFlannel edge cache serves boot data and absorbs reconnect storms
Failure storyQuorum survives a replica loss; ScyllaDB removed GC pausesReplacement Channel Server in under 20 s; regions drained on failure
Scale (latest public)Trillions of messages; 177 Cassandra → 72 ScyllaDB nodes (2022)2.3M database queries/s (2020); ~500 ms worldwide delivery (2023)

Verdict

Both architectures share the same skeleton: persistent connections, an owner per conversation chosen by consistent hashing, and fan-out from that owner. Discord's posts show what to do when reads of history become the bottleneck: coalesce requests and pick a database with predictable tail latency. Slack's show what to do when delivery across regions is the challenge: stateful channel servers, gateways near users and an edge cache. In an interview, design the skeleton first, then ask which of those two bottlenecks your requirements make worse.

Frequently asked questions

Do Discord and Slack use the same architecture?

Broadly similar: both keep WebSocket connections open, assign each conversation an owner with consistent hashing and fan messages out to connected clients. They differ in detail: Discord models each server as a process and stores messages in ScyllaDB, while Slack uses Channel Servers and Gateway Servers and stores data in MySQL with Vitess.

Which databases do Discord and Slack use for messages?

Discord moved its messages from Cassandra to ScyllaDB in 2022, partitioned by channel and time bucket. Slack uses MySQL sharded with Vitess, with message data sharded by channel ID; by 2020 Vitess served 99% of its query load.

More comparisons