Real Time Updates hard
You are building a stock dashboard using Server-Sent Events (SSE). Each widget opens a separate SSE connection. Users report the app stops loading after 6 widgets. Why does this happen, and how does HTTP/2 fix it?
- A SSE requires a unique port for every connection.
- B Browsers enforce a limit of ~6 simultaneous connections per domain for HTTP/1.1. HTTP/2 allows multiplexing multiple streams over a single TCP connection, bypassing this limit.
- C The server runs out of file descriptors.
- D SSE is not supported in multiple tabs.
Answer: B. Browsers enforce a limit of ~6 simultaneous connections per domain for HTTP/1.1. HTTP/2 allows multiplexing multiple streams over a single TCP connection, bypassing this limit.
This is a classic 'Stalled Request' issue. Under HTTP/1.1, the browser queues the 7th request indefinitely. HTTP/2 creates one physical connection and runs all 7 SSE streams inside it virtually.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- When a mobile app is closed/backgrounded, it cannot keep a WebSocket open. How does it receive real-time alerts (like 'New Message')?
- For a human user, what is generally considered the maximum acceptable latency for an interaction to feel 'Real-Time' (e.g., typing in a Google Doc)?
- If you want to update a news feed on a website every time a new article is published, what is the simplest (but least efficient) 'Real-Time' technique?
- In a persistent real-time connection, what is the purpose of a 'Heartbeat' or 'Ping/Pong' message?
- Why is Short Polling considered 'Chatty'?
- Server-Sent Events (SSE) are ideal for which type of real-time application?