DesignTheSystem/dev
HARD Real-Time & Messaging

Design Chat App Message Broker

Deliver 80,000 messages/sec (70% message writes). Scale consumers and partitions to keep p99 latency under 120ms without unbounded lag.

Category & DifficultyReal-Time & Messaging · HARD
Traffic Profile80,000 RPS sustained, 136,000 RPS spike (30% reads / 70% writes)
Latency & Availability SLAp99 < 120 ms · 99.95% availability
Monthly Infra Budget$1,800/month

Scale, traffic & SLA targets

To pass in the DesignTheSystem simulator, your architecture must hold all four targets simultaneously across a 60-second load run (spiking up to 136,000 RPS):

Peak traffic80,000 RPS30% reads / 70% writes
Latency (p99)< 120 ms99th percentile target
Availability99.95%Max error rate 0.05%
Monthly budget$1,800/moPriced per component

Functional & non-functional requirements

Functional scope

  • Serve Chat App Message Broker at the traffic below.

Non-functional goals

  • p99 latency under 120 ms at the spike.
  • At least 99.95% of requests answered.
  • Costs no more than $1,800 a month.

Core challenge: Deliver now, store after

A message must reach the other person in a blink. Hand it to a broker that pushes it to their connection, and save the history in a store built for many writes.

What breaks first?

Run the starting design first and look at what breaks. Chat History DB reaches 1126% of its capacity at the spike, and Chat Gateway 636%. About 87% of requests fail. Open Full metrics to see which requests pile up there, and ask why that part gets so much traffic.

Key architectural trade-offs

  • Messages pass through Kafka before workers store them, so history can trail live delivery by a moment; a user who reconnects fetches what they missed from the message store (Cassandra here).

Starting architecture & how to practise

The simulator starts you with a baseline setup: Active Chatters → Chat Gateway → Chat History DB. Run the baseline under 80,000 RPS to watch exactly which component saturates first, then add caching, queues, replicas, sharding or CDN until latency, availability and cost all turn green.

Common interview questions for Chat App Message Broker

What are the target SLA and scale numbers for Chat App Message Broker?

Design for 80,000 RPS sustained (spiking to 136,000 RPS) with a 30% read / 70% write mix, keeping p99 latency under 120 ms, availability at or above 99.95%, and infrastructure spend within $1,800/month.

What is the main architectural bottleneck in Chat App Message Broker?

A message must reach the other person in a blink. Hand it to a broker that pushes it to their connection, and save the history in a store built for many writes.

How can I verify my Chat App Message Broker architecture works under load?

Open the live simulator to wire up load balancers, caches, queues, replicas, or shards and run a 60-second traffic simulation that grades latency, error rate, and monthly cost automatically.

Recommended lessons before you build

Related Real-Time & Messaging problems