TCP KeepAliveとHTTP KeepAliveについて勘違いされている方が多いですね。
「HTTP KeepAlive」の前提として、「TCP KeepAlive」は必要ではありません。
1つのTCPセッションの中で複数のHTTPリクエストを送ることができるものが「HTTP KeepAlive」です。
以下の説明がわかりやすいです。
- HTTP Keep-Alive is a feature that allows HTTP client (usually browser) and server (webserver) to send multiple request/response pairs over the same TCP connection. This decreases latency for 2nd, 3rd,… HTTP request, decreases network traffic and similar.
- TCP keepalive is a totally different beast. It keeps TCP connection opened by sending small packets. Additionally, when the packet is sent this serves as a check so the sender is notified as soon as connection drops (note that this is NOT the case otherwise – until we try to communicate through TCP connection we have no idea if it is ok or not).
引用元:stackoverflow
覚えておきましょう!