With this old HTTP 1.0 version, there has to be an unique TCP connection for each HTTP Request/Response pair. This is an inefficient way to transfer content between the client and the server as resource is wasted in setting up and tearing down TCP connections at both client and the server.
HTTP 1.1 Keepalive:
HTTP Keepalive is also known as Persistent Connections. By default, any HTTP 1.1 Requests are expected to be Keepalive. This basically means, multiple HTTP Requests can be be sent within a single TCP connection between the client and the server. However, each HTTP Request must be followed by a HTTP Response before subsequent HTTP Requests are sent within the TCP Connection.
HTTP 1.1 Pipelining:
HTTP Pipelining is similar to HTTP Keepalive and is supported in HTTP 1.1 and future versions.
There can be multiple HTTP Requests within the same TCP connection between the client and the server. This is similar to the Keepalive functionality.
The main difference between Keepalive and Pipelining is that in Keepalive, each HTTP Request must be followed by a HTTP Response. In Pipelining, multiple HTTP Request can be sent without waiting for a HTTP Response.
Although, Pipelining seems like an efficient function for HTTP, it is not widely implemented in the internet world and hence, it can break functionality like that of OneConnect on F5. However, it is widely believed that with the new HTTP2.0 implementation, Pipelining will be implemented in the “real-world”.
Imagine a scenario involving a client and a server. The client needs to send 3 HTTP Requests and the server must respond with 3 HTTP Responses in order to exchange the relevant content.
For HTTP1.0, this will involve setting up 1 TCP Connection for each HTTP Request-Response pair. So, we require 3 TCP Connections with an HTTP Request-Response pair per TCP Connection
For HTTP1.1, this will require 1 TCP connection for the 3 HTTP Request-Response pair resulting in a savings of 2 TCP Connections. For HTTP 1.1 Keepalive, the HTTP Request must be followed by an HTTP Response. For HTTP 1.1 Pipelining, multiple HTTP Requests can be sent without waiting for a corresponding HTTP Response from the server.
Advantages of HTTP 1.1:
- Reduces the total number of TCP Connections.
- Reduces latency as there is no need to set up/tear down multiple TCP connections
- Lowers CPU & Memory utilization as there is fewer number of connections set up and torn down.
When you enter a hostname/domain in the browser, the browser opens more than 1 TCP Connection. There isn’t a well-defined limit on the number of TCP Connections that can be opened. This link provides a rough estimate of the number of TCP Connections that each browser opens: TCP Connection on Broswers
HTTP 1.0 RFC1945
HTTP 1.1 RFC2616
HTTP 2.0 Draft