Real Time Updates medium
Your WebSocket connections are dropping consistently every 60 seconds, even when users are active. What is the most likely infrastructure cause?
- A The browser has a 60s limit.
- B The SSL certificate is renewing.
- C The Load Balancer (e.g., Nginx/AWS ALB) has an 'Idle Timeout' set to 60s, and your application isn't sending traffic frequently enough to reset the timer.
- D The server ran out of ports.
Answer: C. The Load Balancer (e.g., Nginx/AWS ALB) has an 'Idle Timeout' set to 60s, and your application isn't sending traffic frequently enough to reset the timer.
Intermediate proxies track idle connections to save memory. If no data flows for X seconds, they kill the connection. Sending a Heartbeat/Ping every 30s prevents this by resetting the idle timer.
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?