System Design: Slack-like Messaging (DMs + Channels)
Design a Slack-like real-time messaging system that supports:
Core features
-
Direct Messages (DMs)
between two users.
-
Channels
with many members (from small teams to
very large channels
).
-
Real-time delivery
to online users (web/mobile).
-
Multi-device
: the same user may be logged in on multiple devices simultaneously.
Key design topics to cover
-
How messages are
persisted
and
delivered
in real time.
-
Push vs pull delivery models, including how you would handle
large channels
.
-
Multi-device delivery semantics (e.g., once per device vs once per user) and how you track delivery/reads.
-
Scalability: caching, partitioning/sharding, and how the system behaves under high fanout and spikes.
Assumptions / constraints (you may refine)
-
Message ordering should be correct
within a DM or channel
.
-
The system should tolerate server failures and client reconnects.
-
Latency target: near real-time for online users (e.g., p99 < 1–2s).
Provide APIs, data model, high-level architecture, and the key trade-offs/edge cases.