Home >Backend Development >PHP Tutorial >A brief discussion on HTTP connection management
The editor of this article will talk to you about HTTP connection management, which has certain learning value. Interested friends can learn about it.
HTTP connection management:
1. Misunderstood Connection header
When the http message passes through various proxy devices between the intermediate client and the server, the label in the Delete the listed header information. close means closing the connection after the transaction.
2. Eliminate the serialization delay
Parallel connection: multiple TCP connections initiated Concurrent HTTP requests
Persistent connections: reuse TCP connections, eliminating connection and closing delays
Pipeline connections: initiating concurrent HTTP requests through concurrent TCP connections
3 .Open a small number of parallel connections, each connection is a persistent connection
keep-alive in HTTP/1.0 and persistent in HTTP/1.1
The client sends Connection:keep-alive service The end response Connection: keep-alive means support, otherwise it does not support
4. HTTP/1.1 persistent connection persistent
The difference between persistent
and keep-alive is that this is open by default unless sent Connection:close explicitly closes
5. The connection will be closed at any time. Each http response should contain Content-Length to verify the integrity of the data
6. Closing the connection And retrying will bring some side effects. If the post request is retried multiple times, there will be risks.
7. Close the connection normally, there are two types: complete closure and semi-closure
Complete closure That is, the input and output of the server are all turned off. Half-closure means that only the output or input is turned off.
When data is sent to a closed connection, an error will occur that the connection was reset by the opposite end.
When closing, the output channel should be closed first, and then the input channel Related tutorials:
HTTP video tutorial######The above is the detailed content of A brief discussion on HTTP connection management. For more information, please follow other related articles on the PHP Chinese website!