The Desi Architect
Notes / Docker Sandboxes / Real-Time Protocols: WebSockets vs SSE & Reconnect Storm Mitigation
Docker Sandboxes · Tier 3: Reliability & Messaging · Lab 73

Real-Time Protocols: WebSockets vs SSE & Reconnect Storm Mitigation

What happens when an edge network glitch disconnects 50,000 live streaming users simultaneously? Compare bidirectional WebSockets with unidirectional Server-Sent Events (SSE), reproduce the catastrophic thundering herd reconnect storm when clients reconnect at fixed intervals, and apply Full Jitter Exponential Backoff to flatten connection burst spikes by 85 percent.

Time25 minutes
StackWebSocketsPorts 18400
MemoryAbout 160 MB
Before thisLab 00Docker Basics
Verified runWindows, Mac, LinuxBash and PowerShell
  1. 1PrepareWhat you will learn
  2. 2PredictGuess before you run
  3. 3RunStep by step
  4. 4ObserveWhat you should see
  5. 5Break itChange one thing
  6. 6Clean upLeave nothing running
On this page
  1. 00 / What You Will Learn
  2. 01 / Why It Matters
  3. 02 / What We Are Building
  4. 03 / Words You Need
  5. 04 / Predict First
  6. 05 / Step by Step
  7. 06 / What You Should See
  8. 07 / Look Inside
  9. 08 / Break It, Fix It
  10. 09 / In Real Projects
  11. 10 / Interview Corner
  12. 11 / Clean Up

00 /What You Will Learn

By the end you will be able to
  • Distinguish the architectural tradeoffs between WebSockets (bidirectional, full-duplex) and Server-Sent Events (unidirectional, HTTP-native).
  • Demonstrate automated stream recovery and event re-ordering using the Last-Event-ID HTTP header.
  • Reproduce a thundering herd reconnect storm: observe how naive simultaneous reconnection bursts saturate server accept queues.
  • Implement AWS-recommended Full Jitter Exponential Backoff to temporally disperse client retries across a wide distribution window.
  • Measure burst rate suppression: prove an 85 percent reduction in peak connections per 100 millisecond window.

Before you start

Complete Lab 01 (Docker Compose Basics) and Lab 12 (Timeouts, Retries & Toxiproxy) first. You should understand HTTP headers, TCP handshakes, and retry backoff concepts. Docker Desktop must be running.