Which load balancer type is recommended for WebSocket connections to preserve persistent TCP connections end-to-end?

Test your Systems Design Concepts knowledge with our comprehensive quiz. Utilize flashcards and multiple choice questions to enhance your study session. Prepare thoroughly with detailed explanations for each answer and ace your examination!

Multiple Choice

Which load balancer type is recommended for WebSocket connections to preserve persistent TCP connections end-to-end?

Explanation:
WebSocket connections are long-lived TCP tunnels that remain open from the client to the server. To keep that tunnel intact end-to-end, you want a load balancer that does not terminate the TCP stream at the edge. A layer-4 load balancer operates at the transport layer and forwards the raw TCP connection to a backend, often using TCP pass-through, so the client’s single TCP connection is handed off without being broken or re-encapsulated. This preserves the persistent connection all the way to the backend. In contrast, a layer-7 load balancer works at the application layer and typically terminates HTTP (or HTTPS) at the proxy, then proxies the traffic to backends. While WebSocket can be supported, this approach introduces an intermediary that can alter or terminate parts of the TCP connection, which can complicate or disrupt end-to-end persistence. DNS round-robin simply directs initial connection attempts to different backends and does not maintain a live connection to a single backend, so it can't guarantee a persistent tunnel. A global traffic manager focuses on distributing traffic across regions or data centers, not on preserving a single long-lived TCP connection from client to backend. Therefore, the transport-layer (layer-4) load balancer best preserves the persistent TCP connection end-to-end for WebSocket.

WebSocket connections are long-lived TCP tunnels that remain open from the client to the server. To keep that tunnel intact end-to-end, you want a load balancer that does not terminate the TCP stream at the edge. A layer-4 load balancer operates at the transport layer and forwards the raw TCP connection to a backend, often using TCP pass-through, so the client’s single TCP connection is handed off without being broken or re-encapsulated. This preserves the persistent connection all the way to the backend.

In contrast, a layer-7 load balancer works at the application layer and typically terminates HTTP (or HTTPS) at the proxy, then proxies the traffic to backends. While WebSocket can be supported, this approach introduces an intermediary that can alter or terminate parts of the TCP connection, which can complicate or disrupt end-to-end persistence. DNS round-robin simply directs initial connection attempts to different backends and does not maintain a live connection to a single backend, so it can't guarantee a persistent tunnel. A global traffic manager focuses on distributing traffic across regions or data centers, not on preserving a single long-lived TCP connection from client to backend.

Therefore, the transport-layer (layer-4) load balancer best preserves the persistent TCP connection end-to-end for WebSocket.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy