Slack / Discord — Notes
Functional
- Workspaces with channels (public/private), DMs, group DMs, threads.
- Messages with reactions, edits, deletes, attachments.
- Real-time presence, typing, notifications.
- Search across history.
- Bots, slash commands, webhooks.
- Voice / huddles / stages (Discord stages).
Non-functional
- Real-time delivery < 1 s.
- 99.99% uptime.
- 12M+ DAU (Slack 2023), Discord 500M registered.
- Workspaces from 5 to 500k members.
Capacity (Slack-scale)
- 2B+ messages/week → ~3300 msgs/s avg.
- Concurrent WS connections: ~5M.
- Per gateway box: ~50–100k connections.
Schema
workspaces(id, plan, region)
channels(id, workspace_id, type, name, archived)
messages(id, channel_id, user_id, ts, text, thread_ts, edits[]) sharded by workspace
memberships(workspace_id, user_id, role)
reactions(message_id, user_id, emoji)
Trade-offs
- Workspace-level shard simplifies authorization but skews on huge teams.
- Vitess + MySQL vs NoSQL: SQL chosen for ACID on team data.
- Long-poll vs WS: WS for foreground, push for background, hybrid for resilience.
- Search per-workspace keeps ACL simple; harder for cross-workspace enterprise grid.
Refs
- Slack engineering blog ("Scaling Slack", "Real-Time Messaging"),
Discord engineering blog (Cassandra → ScyllaDB migration),
ByteByteGo "Design Slack", Alex Xu Vol 2.