System Design · Case Studies
Case Study: Chat System
Design, trade-offs, and alternatives for a real-time chat system at scale.
01
Chapter One
Problem Statement
Problem Statement
Coming Soon
Problem Statement
This chapter covers chat system scale: concurrent users, messages per second, message history retention, latency SLA.
📋 Chapter 1 — Summary
- Summary content pending.
02
Chapter Two
Questions to Ask
Questions to Ask
Coming Soon
Questions to Ask
This chapter covers key questions: 1-1 vs group chat, online presence, message ordering, end-to-end encryption.
📋 Chapter 2 — Summary
- Summary content pending.
03
Chapter Three
Naive Design
Naive Design
Coming Soon
Naive Design
This chapter covers HTTP polling for message delivery and why it doesn't scale to millions of connections.
📋 Chapter 3 — Summary
- Summary content pending.
04
Chapter Four
Refined Design
Refined Design
Coming Soon
Refined Design
This chapter covers WebSocket servers behind a load balancer with presence service and message fan-out via pub/sub.
📋 Chapter 4 — Summary
- Summary content pending.
05
Chapter Five
Alternatives
Alternatives
Coming Soon
Alternatives
This chapter covers two approaches: WebSocket persistent connections vs long polling — trade-offs for mobile clients.
📋 Chapter 5 — Summary
- Summary content pending.
06
Chapter Six
Real Companies
Real Companies
Coming Soon
Real Companies
This chapter covers how WhatsApp, Slack, and Discord handle message delivery and ordering at scale.
📋 Chapter 6 — Summary
- Summary content pending.
07
Chapter Seven
Best Practices
Best Practices
Coming Soon
Best Practices
This chapter covers connection management, message deduplication with client-generated IDs, graceful reconnection.
📋 Chapter 7 — Summary
- Summary content pending.
08
Chapter Eight
What Could Go Wrong
What Could Go Wrong
Coming Soon
What Could Go Wrong
This chapter covers message ordering violations, presence inaccuracy under network partition, thundering herd on reconnect.
📋 Chapter 8 — Summary
- Summary content pending.