Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Chat Application Cache Architecture

Design an end-to-end private chat system with durable ordered messages and a partitioned recent-history cache that handles misses safely.

Problem statement

For this exercise, assume authenticated users exchange text messages in private conversations with up to 50 fixed participants. A sender receives a durable acknowledgement, connected participants receive newly committed messages, and reconnecting devices page ordered history from a durable cursor.

Each conversation has one stable message sequence and send retries create one visible message. A distributed cache accelerates recent conversation metadata and immutable history pages, but durable message storage remains authoritative and cached results expose a sequence watermark.

Explain the cache type, key layout, partitioning, fill and invalidation behavior, and what happens on cold keys, expired hot keys, cache-node failure, or durable-store slowdown.

Media, presence, typing indicators, edits, deletes, public channels, search, moderation, and end-to-end encryption key management are outside scope.

What to build

  1. For this exercise, a conversation participant can idempotently send a text message and receive a stable message ID, sequence, and durable acknowledgement.
  2. For this exercise, connected participants receive newly committed conversation messages in sequence with low latency and without duplicate visible delivery.
  3. For this exercise, a participant can page authoritative ordered history and reconnect from a durable conversation cursor to recover missed messages.
  4. For this exercise, recent metadata and immutable history pages may come from a partitioned cache whose watermark, miss path, and failure behavior do not lose or invent acknowledged messages.

At scale

  • For this exercise, assume 10 million daily active users, one million concurrent connections, and private conversations with at most 50 fixed participants.
  • For this exercise, support peaks of 100,000 durable message sends and 250,000 history-page reads per second, with skew toward recently active conversations.
  • For this exercise, target 300 milliseconds p95 for a healthy durable send, one second p95 for healthy live delivery, 150 milliseconds p95 for a cache-hit history read, and 600 milliseconds p95 for a healthy cache-miss read.
  • For this exercise, retain message history for one year, keep acknowledged messages available through a single-zone failure, and treat all cache contents and live connection state as disposable and rebuildable.