Real-time messaging at scale: channels, gateways, message delivery, and sharding with Vitess.
What Slack Actually Is — Not one chat system but millions of small ones: the workspace as the tenant boundary, and why a channel is a topic that hundreds of event types are routed through. (24 min read)
One WebSocket Per Client: Gateway, Channel, Admin — The server holding your socket and the server doing fan-out are different machines: connections shard by user and region, fan-out shards by channel on a consistent-hash ring. (43 min read)
Flannel: An Application-Level Cache at the Edge — A cache that subscribes to the event stream it serves never has to ask whether it is stale, which is what lets it sit an ocean away from the database. (11 min read)
Channel Fan-Out: Why Big Channels Are Expensive — Socket writes are cheap; the per-recipient bookkeeping each delivery triggers (unread counts, mentions, badges, push decisions) is what scales with channel size. (7 min read)
Presence: The Green Dot Is the Worst Data in the Product — Naive presence broadcast is quadratic for the lowest-value data in the product; Slack deleted the broadcast and subscribed clients only to what is on screen. (7 min read)
Async Work: The N+1 Unfurl and the Fan-Out Nobody Watches — Deferring work to a job queue removes the latency SLO and the backpressure; the "forget user" outage traced link by link, and why Kafka went in front of Redis. (7 min read)
Synthesis: How the Pieces Pay for Each Other — Every part is one of two moves: replace a broadcast with a subscription, or replace a tenant-shaped boundary with an entity-shaped one. (3 min read)
Self-Test — Six integrative questions with full answers, and the central question revisited. (8 min read)
Side Reads: The Recent-History Buffer — How a Channel Server's per-channel ring buffer lets a reconnecting Gateway Server catch up by comparison, and what that buffer is really protecting. (4 min read)