Polling vs server-sent events
With polling each browser asks for news every second, even when there is none. With server-sent events the server sends each update on one open stream. For 20,000 browsers that get an update every 10 s, polling floods the server and the stream keeps p99 under 150 ms.
HTTP/1.1 · connections: 6 · 30 files in 7 round trips, 630 ms
Case 1
20,000 browsers watch a status feed. Each gets an update about every 10 s, and it must arrive within 1 s. Browsers never send on this channel.
| Measure | Goal | Polling every second | Server-sent events |
|---|---|---|---|
| p99 latency | under 150 ms | 8.2 s Fail | 69 ms Pass |
| Monthly cost | 8 USD/mo | 8 USD/mo | |
| Error rate | 81.8% | 0% |