← Discord Interview Insights

Discord·Software Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
Jun 2026Remote

Summary

Discord system design round for a backend/infrastructure role. The whole thing was basically one big question with three mandatory deep-dives baked in, so there was no hiding from the hard parts.

Questions Asked (4)

Q1

Design a Slack-style messaging platform that supports workspaces, channels (public, private, and DMs), threaded messages, mentions, search, presence indicators, and notifications.

System DesignTechnical Trade-offs
Author's notes

Big open-ended prompt and they let you run with it for a bit before steering toward the deep-dives.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying functional and non-functional requirements, then estimate scale (users, messages, channels) to drive design decisions. Propose a high-level architecture with key components (API gateway, message service, presence service, search service, notification service) and dive into data models, storage choices, and trade-offs for real-time delivery, consistency, and scalability.

Pro tip: Emphasize the trade-offs between consistency and availability for presence and notifications, and discuss how to handle fan-out for large channels efficiently. Also, mention how you would leverage existing infrastructure (e.g., WebSockets, pub/sub) and consider cost implications.

1. Requirements Clarification

Ask questions to understand scope: expected number of users, workspaces, channels, messages per day, latency requirements, consistency needs, and features like message history, file sharing, etc. Prioritize features (e.g., real-time messaging vs. search).

2. High-Level Architecture

Sketch the main components: client apps, API gateway, authentication service, message service, channel service, presence service, notification service, search service, and storage layers. Explain how they interact (e.g., via REST, WebSockets, pub/sub).

3. Data Modeling and Storage

Design schemas for workspaces, channels, messages, threads, and user presence. Choose appropriate databases: e.g., relational for user/channel metadata, wide-column or time-series for messages, search index for search, and in-memory store for presence. Discuss partitioning and indexing strategies.

4. Real-Time Messaging and Presence

Detail how messages are delivered in real-time using WebSockets and a pub/sub system (e.g., Redis, Kafka). Explain presence tracking (heartbeats, TTL) and how to handle scalability and fault tolerance. Discuss threading and mentions.

5. Search, Notifications, and Trade-offs

Describe search implementation (e.g., Elasticsearch) with indexing pipelines. Explain notification delivery (push, email, in-app) and fan-out strategies. Discuss trade-offs: consistency vs. availability, latency vs. cost, and how to handle large channels (fan-out on write vs. read).

Key Points to Mention

  • Use WebSockets for real-time bidirectional communication and a pub/sub system (e.g., Redis Pub/Sub, Kafka) for message fan-out.
  • Data storage: messages in a distributed log or wide-column store (e.g., Cassandra) for scalability; metadata in a relational DB; search in Elasticsearch; presence in Redis with TTL.
  • Threading: store parent message ID and reply count; retrieve threads via parent ID. Mentions: parse and notify mentioned users, handle @channel/@here.
  • Presence: use heartbeats and TTL in a fast store; consider eventual consistency and how to handle disconnects.
  • Search: index messages asynchronously; support filters (channel, user, date) and ranking. Consider per-workspace indices for isolation.
  • Notifications: use a notification service that consumes events and delivers via APNs/FCM, email, or in-app; allow user preferences and batching.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

How would you index messages to support fast channel scrolling, full-text search, and unread counts?

System DesignData ModelingTechnical Trade-offs
Author's notes

This is where I fumbled a bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the scale and access patterns (e.g., billions of messages, read-heavy with low-latency scrolling, search, and unread counts). Then propose a polyglot persistence strategy: a time-series store for message history, an inverted index for search, and a counter store for unread counts, while discussing trade-offs like consistency vs. performance.

Pro tip: Emphasize that unread counts should be maintained as approximate counters (e.g., using Redis or Cassandra counters) to avoid expensive COUNT queries, and that search indexing can be asynchronous with a small delay, which is acceptable for most use cases.

1. Clarify Requirements and Scale

Ask about message volume, read/write ratio, latency requirements, and consistency needs. This sets the stage for choosing appropriate data stores and indexing strategies.

2. Design Message Storage for Scrolling

Propose a partitioned, time-ordered store (e.g., Cassandra or DynamoDB) with a composite key (channel_id, message_id) to enable efficient range scans for scrolling. Discuss pagination and caching hot channels.

3. Implement Full-Text Search

Use a dedicated search engine like Elasticsearch or a custom inverted index. Ingest messages asynchronously via a change data capture (CDC) pipeline or message queue to keep the index up-to-date.

4. Maintain Unread Counts

Use a separate counter store (e.g., Redis) per user-channel pair. Update counters on new messages and reset on read. Consider approximate counts and eventual consistency to scale.

5. Address Trade-offs and Consistency

Discuss trade-offs: search index lag, counter accuracy, and storage costs. Explain how to handle failures and ensure eventual consistency across stores.

Key Points to Mention

  • Partitioning strategy: partition by channel_id and sort by message_id/time for efficient range queries.
  • Use of a search engine like Elasticsearch with asynchronous indexing to avoid impacting write latency.
  • Unread counts as separate counters (e.g., Redis) updated on message write and reset on read, avoiding COUNT queries.
  • Caching hot channels and recent messages to reduce database load for scrolling.
  • Trade-offs: consistency vs. availability, search index lag, and counter accuracy.
  • Scalability considerations: sharding, replication, and handling hot partitions.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

Walk through your database choice for this system. Why would you pick relational, NoSQL, or a split approach using a log store plus a key-value store? How would you partition by workspace or channel?

System DesignData ModelingTechnical Trade-offs
Author's notes

Probably my strongest answer of the three deep-dives.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the system's access patterns and scale, then justify a split approach: a log store for message history and a key-value store for metadata, with relational for user/workspace data. Explain partitioning by workspace/channel using consistent hashing or range-based sharding, and discuss trade-offs like hot partitions and cross-shard queries.

Pro tip: Emphasize that Discord's scale (billions of messages) makes a single database infeasible; show you understand that partitioning by channel ID can create hot partitions for large servers, and propose mitigations like sub-partitioning or caching.

1. Clarify requirements and access patterns

Ask about read/write ratio, message volume, latency needs, and query patterns (e.g., fetch recent messages, search, user profiles). This shows you tailor the design to actual needs.

2. Evaluate database options

Compare relational (strong consistency, joins), NoSQL (scalability, flexible schema), and split approach (log store for append-heavy messages, KV for fast lookups). Justify why a split approach fits Discord's scale.

3. Design partitioning strategy

Explain partitioning by workspace or channel using consistent hashing or range-based sharding. Discuss how to avoid hot partitions (e.g., sub-partition large channels) and handle cross-partition queries.

4. Address trade-offs and failure modes

Discuss consistency vs. availability, replication for fault tolerance, and how to handle rebalancing. Mention that partitioning by channel ID can cause hotspots and propose solutions like caching or time-based sharding.

5. Summarize and tie back to Discord

Conclude that a hybrid approach (e.g., Cassandra for messages, Redis for presence, PostgreSQL for users) balances scalability and consistency, and aligns with Discord's real-world architecture.

Key Points to Mention

  • Access patterns: messages are append-heavy and read by channel, while user/workspace data requires relational integrity.
  • Split approach: log store (e.g., Cassandra, ScyllaDB) for message history, key-value store (e.g., Redis) for metadata and presence, relational (e.g., PostgreSQL) for users and guilds.
  • Partitioning by channel ID using consistent hashing to distribute load, but beware of hot partitions in large servers.
  • Mitigation for hot partitions: sub-partition by time or message ID, use caching, or dedicate shards for large channels.
  • Trade-offs: NoSQL offers scalability but eventual consistency; relational provides ACID but harder to scale horizontally.
  • Real-world example: Discord uses Cassandra for messages, Redis for presence, and PostgreSQL for user data, with snowflake IDs for ordering.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

How does a sent message fan out to all channel members? Cover offline users and mobile push, large channels with many members, and how unread counts get updated.

System DesignTechnical Trade-offsAPI & Integrations
Author's notes

Fan-out is the one I'd prep hardest if I were doing this again.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by outlining the high-level message flow from sender to recipients, then dive into the specific challenges of offline users, large channels, and unread counts. Emphasize the use of a pub/sub system (like Elixir/Phoenix or Erlang) for real-time fan-out, and discuss trade-offs between push and pull models. Conclude with how unread counts are maintained per user and synced across devices.

Pro tip: Mention Discord's use of Elixir and Phoenix Channels for real-time communication, and how they handle millions of concurrent connections. Also, highlight the importance of idempotency and ordering when delivering messages to offline users.

1. Message Ingestion and Validation

Describe how the message is received by the API gateway, validated, and persisted to the database (e.g., Cassandra or ScyllaDB). Ensure the message is assigned a unique ID and timestamp.

2. Fan-out to Online Users

Explain the pub/sub mechanism (e.g., Phoenix Channels) that broadcasts the message to all connected clients in the channel. Discuss how the system tracks which users are online and their active sessions.

3. Handling Offline Users and Mobile Push

Detail how messages are queued for offline users and delivered when they reconnect. For mobile push, describe integration with APNs/FCM, including batching and throttling to avoid overwhelming the device.

4. Scaling for Large Channels

Discuss strategies for large channels (e.g., thousands of members): sharding, fan-out on write vs. read, and using a distributed pub/sub system. Mention trade-offs like latency vs. resource usage.

5. Unread Count Updates

Explain how unread counts are tracked per user, likely using a separate service or in-memory store (e.g., Redis). Describe how counts are incremented on new messages and reset when the user reads the channel, ensuring consistency across devices.

Key Points to Mention

  • Use of WebSockets for real-time communication and fallback to long polling.
  • Message persistence and ordering guarantees (e.g., using sequence numbers).
  • Presence system to track online/offline status and multiple sessions per user.
  • Mobile push notification services (APNs, FCM) and handling of notification payloads.
  • Sharding and partitioning strategies for large channels to avoid hotspots.
  • Unread count synchronization across devices using a centralized store and eventual consistency.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.