Whole systems / 4 / 4
Design a chat
Alice writes to Bob, and the message should appear on his screen in a fraction of a second, in the right order, even if his phone was asleep. We build the chat step by step: WebSocket gateways, routing, storage by conversation, sequence numbers, receipts, push, groups and presence.
- 15 min
- Advanced
- 12 steps
- Delivery p99
- 2 100 ms
- Out-of-order messages
- 0 /day
- Unnoticed for 1 h+
- 0 /day
- request
- reply
- redelivery
- duplicate
- lost
Numbers are a model scenario, not measurements
The real request
Bob's app → Chat serviceRequest
GET /v1/messages?since=1795400100 HTTP/1.112
Host: chat.example.com
Authorization: hidden
Response
HTTP/1.1 200 OK
{
"messages": []
}
since— Last moment the app checked. The server returns anything newer.messages— Empty, as on most polls: the cost of asking when nothing happened.
Course: 42 lessons
01 Foundations
02 Scaling
03 Data & storage
04 Communication
05 Reliability
06 Architecture
07 Security
08 Shipping
09 Whole systems
10 Business processes