Preparing your design workspace

Loading the problem and your latest saved attempt…

Large-Scale Messaging Application

Design a multi-device messaging application with private and group conversations, media attachments, offline recovery, and reliable delivery.

Problem statement

For this exercise, assume authenticated users exchange text and media in private and group conversations from several devices. A durable send acknowledgement makes a message part of ordered history, online devices receive it quickly, and offline devices catch up from a cursor.

Retries must not create duplicate visible messages, membership changes must have explicit boundaries, and media upload may complete separately from message commit. Design the client contracts, state model, components, data flows, partitioning, and failure recovery.

Also explain how stored messages are replicated across zones alongside sharding, how events travel between services through a message broker within a latency budget, and which data format internal services exchange.

Exclude voice calls, public channels, presence, end-to-end encryption key management, and content moderation.

What to build

  1. Participants can idempotently send text or committed media references to private and group conversations.
  2. Online devices receive committed messages quickly and every device can recover ordered gaps after reconnecting.
  3. Administrators can change group membership with explicit visibility semantics, and clients can upload media before attaching it to a message.

At scale

  • Assume 50 million daily active users, groups of up to 1,000 members, and 500,000 message sends per second at peak.
  • Target p95 durable acknowledgement below 300 ms and online delivery below one second under normal load. Within that second, the message broker may add at most 250 ms at p95 between an event's publish and its consumption.
  • Retain message history for one year and media for 90 days, with acknowledged text surviving a single-zone failure.
  • A user may have five active devices, and a few celebrity groups may be much hotter than the median conversation.
  • Internal services are deployed independently, so during a rollout older and newer versions of a service may produce and consume the same events.