WebSockets at Scale: Backpressure, Heartbeats, Redis Fan-out and Reconnection Without Losing Messages
A WebSocket connection is state, and state does not scale on its own. Learn to catch backpressure with bufferedAmount before it eats your heap, kill half-open connections with ping/pong, spread messages across instances with a pub/sub backplane, and reconnect with backoff, jitter and sequence-based resume so you stop losing events on every deploy. With production-ready Node.js, Redis and browser code. Expanded September 2026 edition: memory budget and OS limits (file descriptors, somaxconn, and why the V8 heap does not explain your RSS), the cost of serializing once per client and how to batch and conflate frames in an outbox, message envelope design and versioning, fan-out at scale with Redis sharded Pub/Sub and the arithmetic behind your bill, reliable delivery with Redis Streams, consumer groups and XAUTOCLAIM, per-room authorization with live revocation, three layers of channel rate limiting, the six observability metrics and a canary that measures real delivery, the ALB, nginx, Cloudflare and Envoy timeouts that cut healthy connections, load testing with k6 plus the reconnection-storm test, choosing between ws, uWebSockets.js and Socket.IO, when not to use WebSockets (SSE, polling and WebTransport in 2026), a full case study, FAQ and glossary.
Verificando acceso...