HLDArena
HLD-305·Messaging & Fan-out
Hard · 1,500 pts

Real-Time Group Chat & Channel Persistence

Design a persistent multi-device chat backend supporting direct messages and active group channels with ordered message history, read-after-write delivery, and automatic node failover.

Max p99
≤ 70 ms
Availability
≥ 99.5%
Budget
≤ $6,200

Functional Requirements

  • FR-1POST /channels/{channel_id}/messages — Appends an ordered message and triggers channel fan-out.
  • FR-2GET /channels/{channel_id}/history — Fetches recent paginated messages for reconnecting clients.
  • FR-3PATCH & DELETE /channels/{channel_id}/messages/{message_id} — Edits or deletes messages and propagates updates across channel caches.
  • FR-4Authors and channel participants must observe newly sent/edited messages immediately without stale cache gaps.

Workload Profile

Baseline Messaging55,000 Read RPS / 12,000 Message Write RPS
Live Event Peak140,000 Read RPS / 32,000 Write RPS
Active Working Set36 GB hot channel buffers & presence state
Traffic DistributionHeavy skew on active mega-channels (channel_id)

Consistency Model

Per-channel read-after-write consistency required; cache layers must be updated or invalidated on message commit.

Design Write-up
0 boxes · 0 edges
0 words
Hidden Cases #4–#7 run automatically on Submit
Case 1: Smoke & API ContractInput Workload
Read RPS
2,000 rps
Write RPS
400 rps
Key Distribution
Uniform (Low Skew)
Chaos Fault
None (Healthy Cluster)
Expected Pass CriteriaASSERTIONS
• Tail Latency: p99 ≤ 140 ms
• Availability: ≥ 99.5%
Valid end-to-end Client → Compute → Storage topology