Real Time Updates medium
A server pushes stock prices at 60 messages/second. A client is on a slow 3G network and can only read 10 messages/second. What eventually happens without Backpressure?
- A The network automatically upgrades speed.
- B The server's memory buffer for that specific client connection fills up, eventually leading to an Out-of-Memory (OOM) crash or forced disconnection.
- C The client skips the old messages automatically.
- D The TCP protocol slows down the server's CPU.
Answer: B. The server's memory buffer for that specific client connection fills up, eventually leading to an Out-of-Memory (OOM) crash or forced disconnection.
If the Producer is faster than the Consumer, the data must go somewhere. Usually, it queues in RAM. If the queue grows unboundedly, the server crashes. Solutions include dropping messages or telling the producer to slow down.
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?