Api Gateway hard
High-performance proxies like Envoy support 'Hot Restart'. What is the low-level mechanism that allows this process to update its binary/config without dropping active TCP connections?
- A The Gateway uses an FPGA chip that can reconfigure its internal circuits on the fly while traffic is flowing.
- B Shared Socket Inheritance: The new process starts and communicates with the old process over a Unix Domain Socket to 'Pass' the file descriptors for the listening ports, then carefully drains active connections.
- C The Gateway relies on the user's browser to automatically detect the restart and hold the request in a local buffer.
- D It uses a special 'Quantum Entanglement' feature of modern Linux kernels to sync memory across two processes.
Answer: B. Shared Socket Inheritance: The new process starts and communicates with the old process over a Unix Domain Socket to 'Pass' the file descriptors for the listening ports, then carefully drains active connections.
Usually, two processes can't listen to port 80 simultaneously. Hot restart allows a new version of the proxy to 'Inherit' the socket from the old version. While the old process gracefully finishes existing long-running connections (like WebSockets), the new process takes over all incoming traffic, resulting in zero downtime deployments.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- Your Gateway communicates with backends via HTTP/1.1 connections. A slow backend service causes 'Head-of-Line Blocking'. How does switching to HTTP/2 as the Gateway-to-Backend transport mitigate this?
- What is the primary architectural role of an API Gateway in a microservices environment?
- Why is 'Stateless Token Validation' (e.g., using JWTs) significantly more scalable at the Gateway level than 'Stateful Validation' (e.g., using Opaque/Reference Tokens)?
- Your Gateway is configured to cache any URL ending in `.css` or `.jpg`. An attacker tricks a victim into visiting `https://api.com/v1/profile/info/style.css`. How can this lead to an 'Account Takeover'?
- An API is receiving a sudden surge of 10,000 requests per second from a single IP address. How does an API Gateway preserve the stability of the backend services?
- How can an API Gateway help prevent 'Double Charging' in a payment system when a mobile client retries a failed request due to a poor connection?