What is HTTP keep-alive?
Short answer
Keep-alive (persistent connection) is the reuse of a TCP connection for the same client's subsequent requests instead of closing it after the response is sent; it removes the cost of establishing a new connection (a new TLS handshake on HTTPS) for every request. It is the default behavior in HTTP/1.1. TR7 keeps the connections open on both sides by default. How long the client connection stays open idle between two requests is determined by the HTTP Keepalive Timeout field in the Timeouts profile (default 120 seconds). The behavior between TR7 and the Backend Service is changed with the Connection Mode field of the HTTP TCP Multiplexing action: the default is Keep the Connection Open; Close the Backend Service Connection closes only the Backend Service connection, and Close After Every Request closes the connection on both sides after every request.
Where It Is Used in TR7
| Where | Field / label | What for |
|---|---|---|
| Load Balancer → Profiles (L4-L7 Behavior Sets) → Timeouts | HTTP Keepalive Timeout (seconds; default 120, 0–60,000) | How long the client connection stays open idle between two requests; applied only on an HTTP vService |
| HTTP vService form → Details | Timeout | Assigning the Timeouts profile to the vService; if no profile is assigned, the default Timeouts profile values apply |
| Load Balancer → Actions (Policy Actions) → HTTP TCP Multiplexing action | Connection Mode: Keep the Connection Open (default), Close the Backend Service Connection (Not Recommended), Close After Every Request (Not Recommended) | Whether the connections stay open after the request |
| Same action | Connection Share Strategy: Safe, Aggresive, Always, Never | Sharing the Backend Service connections kept open between requests; visible only while Keep the Connection Open is selected |
All the values in the Timeouts profile: What do the values in the Timeouts profile (HTTP Keepalive Timeout, HTTP Request Timeout, Connect, Server, Client, Queue, Tunnel(Websocket) Timeout, Client FIN, Server FIN) mean?
Common Misconceptions
- "Performance always increases as the keep-alive time gets longer." Every connection waiting idle holds resources on TR7 and on the client; the time is chosen according to how long clients wait between two requests.
- "HTTP keepalive timeout manages the Backend Service connection." This field limits the wait time between two requests on the client side; whether the Backend Service connection stays open is determined by Connection Mode. When Close After Every Request is selected, HTTP Keepalive Timeout has no effect, since the client connection is also closed after every request.
- "Closing the connections is safer." In the closing modes, every request means a new connection, and on HTTPS a new TLS handshake; these modes are selected only for Backend Services that do not work properly with a persistent connection.
How it is done in the documentation
