Real Time Updates easy
What is the 'Ephemeral Port Limit' problem when testing a real-time server?
- A You run out of IP addresses.
- B A single machine only has ~65,000 ports. If you try to open 100,000 connections from one test machine, it will fail.
- C The server runs out of RAM.
- D The cables melt.
Answer: B. A single machine only has ~65,000 ports. If you try to open 100,000 connections from one test machine, it will fail.
Every TCP connection needs a unique 4-tuple (SrcIP, SrcPort, DestIP, DestPort). Since the client has 1 IP and the server has 1 IP, the only variable is SrcPort, which is a 16-bit number (max 65535).
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?