50,000 Messages/sec Peak
Sustained peak request volume during high-traffic events.
Manage massive shared channels with live fanout to 100,000+ online members, message edit history, and reaction counters.
Target production parameters expected in a senior or staff interview round.
Sustained peak request volume during high-traffic events.
Daily active users generating read and write operations.
Projected data ingestion and replication storage capacity.
Strict end-to-end percentile latency SLA constraint.
Establish clear problem boundaries before proposing architectural components.
Step-by-step arithmetic conversions for QPS, storage, and bandwidth.
| Dimension | Calculation Formula | Estimated Result |
|---|---|---|
| Peak Message Ingestion QPS | 1 Billion messages/day / 86,400s * 3x peak factor | 34,722 peak messages/sec |
| Real-Time WebSocket Fanout Volume | Average active channel has 200 members -> 35k msgs * 200 members | 7,000,000 WebSocket frames delivered/sec |
| Daily Message Storage Growth | 1B messages * 600 bytes (content + metadata + formatting) | 600 GB/day compressed message storage |
How requests navigate ingress gateways, application logic, caching, and persistence.
Maintain millions of persistent TLS WebSocket connections, heartbeat health checks, and packet compression (Zlib).
Route outbound messages to the specific gateway servers hosting connected channel members.
Assign time-ordered 64-bit IDs and write immutable message records partitioned by channel_id.
Debounce rapid emoji reaction clicks and maintain aggregate counts without overloading primary storage.
Entity models, indexing, and primary key partitioning.
Partitioned by channel_id and 10-day time bucket to avoid massive unbounded partitions in ScyllaDB.
Indexed on user_id to resolve all subscribed channels on initial login sync.
Clustered for fast reaction tally counts and user emoji toggling.
How to defend engineering compromises when challenged by interviewers.
Rationale: Discord famously migrated from MongoDB to Cassandra and ultimately ScyllaDB because trillions of chat messages require linear write scalability and predictable sub-millisecond p99 latencies without GC pauses.
Rationale: Broadcasting presence in a 500k-member guild creates quadratic O(N^2) traffic storms. Lazy sync sends presence only for members currently visible in the active channel window.
Key interview questions and conceptual defenses.
Clients query messages with `BEFORE {message_id}` using time-sorted Snowflake IDs, executing high-speed range queries across clustered partition keys without offset pagination.
Clients attach a client-generated UUID nonce to each message. The gateway checks a 5-minute Redis idempotency cache before inserting.