Skip to main content
Articles/system-design/system-design-hld-chat-messaging-example
Scenario Article

System Design HLD Example: Chat and Messaging Platform

Scenario context

Abstract Algorithmsβ€’Mar 13, 2026
XLinkedInReddit
πŸ’‘ Executive Summary

A distributed chat system must balance low-latency delivery with strong per-conversation ordering.

🎯 System Scenario & Requirements

System Goal

A distributed chat system must balance low-latency delivery with strong per-conversation ordering.

Actors & Components

  • Application or API tier
  • Core service under design
  • Operator or SRE observer

Functional Requirements

  • A distributed chat system must balance low-latency delivery with strong per-conversation ordering.
  • The architectural crux is the WebSocket Gateway for persistent stateful connections and Cassandra for append-heavy message storage partitioned by conversation.
  • By using a Kafka-driven Fan-out model and Redis-based Presence heartbeats, the system can handle millions of concurrent users while ensuring no… This walkthrough focuses on Lessons Learned from Building Production Chat…

Constraints & Assumptions

  • The source does not isolate a separate failure mode.
  • Limits that matter for the scenario are called out in the stage decisions above.

⚑ Execution Stages & Decision Trace

1

Stage 1 β€” End-to-end outcome

Action / Decision:

After working through the stages, you should be able to explain: - Hot Conversation Partitions Are Real and Painful.

Component Behavior:

- A Cassandra partition for a single high-traffic public server or channel β€” 10 million messages per day β€” concentrates all writes on one Cassandra node, creating a hot partition that degrades p99 write latency for that…

Observable Output: - The Gateway tier is stateful; everything behind it β€” Message Service, Fan-out Workers, Presence Service β€” must be stateless and independently scalable.
Read Full Stage in Deep Dive ↓
πŸ“–

Deep Dive

Detailed Architectural Analysis

Scenario context

A distributed chat system must balance low-latency delivery with strong per-conversation ordering. The architectural crux is the WebSocket Gateway for persistent stateful connections and Cassandra for append-heavy message storage partitioned by conversation. By using a Kafka-driven Fan-out model and Redis-based Presence heartbeats, the system can handle millions of concurrent users while ensuring no……

This walkthrough focuses on Scenario context.

Before making a design choice, clarify:

  • A distributed chat system must balance low-latency delivery with strong per-conversation ordering.
  • The architectural crux is the WebSocket Gateway for persistent stateful connections and Cassandra for append-heavy message storage partitioned by conversation.
  • By using a Kafka-driven Fan-out model and Redis-based Presence heartbeats, the system can handle millions of concurrent users while ensuring no… This walkthrough focuses on Lessons Learned from Building Production Chat…

Concepts in play: system-design-hld-architectures, btree-vs-lsmtree, caching, consistency-replication

Stage 1 β€” End-to-end outcome

  • After working through the stages, you should be able to explain: - Hot Conversation Partitions Are Real and Painful.
    • A Cassandra partition for a single high-traffic public server or channel β€” 10 million messages per day β€” concentrates all writes on one Cassandra node, creating a hot partition that degrades p99 write latency for that…
    • The Gateway tier is stateful; everything behind it β€” Message Service, Fan-out Workers, Presence Service β€” must be stateless and independently scalable.

Observable outcome: - The Gateway tier is stateful; everything behind it β€” Message Service, Fan-out Workers, Presence Service β€” must be stateless and independently scalable.

End-to-end outcome

After working through the stages, you should be able to explain:

      • Chat is a stateful problem (persistent WebSocket connections) that must be solved with a stateless mindset (horizontal scaling behind the gateway).
    • The Gateway tier is stateful; everything behind it β€” Message Service, Fan-out Workers, Presence Service β€” must be stateless and independently scalable.

Alternatives considered

Alternatives considered

The source focuses on one primary design.

Failure and degraded modes

Failure and degraded modes

  • Detection: The source does not isolate a separate failure mode.
  • User or operator impact: The source does not isolate a separate failure mode.
βœ…

Key learnings

      • Chat is a stateful problem (persistent WebSocket connections) that must be solved with a stateless mindset (horizontal scaling behind the gateway).
    • The Gateway tier is stateful; everything behind it β€” Message Service, Fan-out Workers, Presence Service β€” must be stateless and independently scalable.
  • After working through the stages, you should be able to explain: - Hot Conversation Partitions Are Real and Painful.

Share this case study

Discuss architecture trade-offs and lessons with your team.

Share:XLinkedInReddit