NOTE
2.5 HTTP KeepAlive
HTTP KeepAlive reuses a TCP connection for multiple requests, reducing repeated connection setup. These notes explain the mechanism through HTTP version changes.
This is a historical learning note and may contain outdated or incomplete understanding.
1. What Is HTTP KeepAlive?
An HTTP persistent connection is a mechanism for reusing a TCP connection.
In HTTP/1.0, each TCP connection could be used for only one HTTP transaction (request + response).
HTTP/1.1 introduced HTTP Keep-Alive, which reuses one TCP connection for multiple HTTP transactions.

2. How HTTP KeepAlive Works
-
The client request header contains:
Connection: KeepAlive -
The server response header contains:
Connection: KeepAlive
3. TCP KeepAlive vs. HTTP KeepAlive
- They are unrelated.
- TCP KeepAlive is a liveness mechanism that sends heartbeat packets to detect whether the other endpoint is still alive.
- HTTP Keep-Alive is used to negotiate reuse of a TCP connection.
4. HTTP Client Selection
- Server side: Apache HttpComponents (an upgraded version of Apache HTTP Client).
- Android: OkHttp (supports HTTP/2).
5. References
Drag to pan, scroll to zoom, and click a node to expand or collapse it. Large maps start with deeper levels collapsed; click nodes to expand them.
Discussion
Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub