1. What is a persistent connection? (Keep alive mode)
HTTP1.1 Specifies that long connections are maintained by default (HTTP persistent connection, also translated for persistent connections); Data transfer is done to keep the TCP connection continuously open (no RST packet, no four handshake), waiting for the same domain name to continue to use this channel to transfer data The opposite is a short connection.
HTTP 1.1 version supports persistent Connection version 1.0 is not supported
Differences from non-persistent connections:
Persistent connections make client-to-server connections persistent and avoid re-establishing connections
Greatly reduces the establishment of connections and the delay of closing. The HTTP connection is built on top of the TCP protocol, which requires three handshakes to establish a TCP connection and four waves to close the TCP connection. It all takes time.
2. What is pipeline
The pipelined mechanism must be completed through a permanent connection (persistent connection) and only http/1.1 support this technology (http/1.0 not supported)
In the case of a persistent connection, the delivery of a connection message is similar to
Request 1, Response 1, request 2, Response 2
Pipelining: A message on a connection becomes something like this
Request 1, request 2, request 3, respond 1, Response 2, Response 3
Note
A, the difference between persistent and pipelined is that a disadvantage of persistent connections is that the request and response are executed sequentially, and request 2 is sent only after the response of request 1 is received, and pipelining does not need to wait for the last request to respond before the next request can be made. Implements a parallel send request.
b, only get and head requirements can be pipelined, while post is limited
C, the first time you create a connection should not start the pipeline mechanism, because the other (server) does not necessarily support the http/1.1 version of the Protocol
D HTTP1.1 requires the server side to support pipelining, but does not require the server side of the response is also pipeline processing, only requires that the pipeline of requests do not fail, and now many server-side and agent of the pipeline support is not good, modern browser chrome and Firefox default does not turn on pipeline support.