1. What is the keep-alive mode?
The HTTP protocol adopts the "request-response" mode. When the common mode is used, that is, the non-keepalive mode, a new connection is required for each request/response client and server, disconnect immediately after completion (the HTTP protocol is connectionless). When the keep-alive mode (also known as persistent connection and connection reuse) is used, the keep-alive function keeps the client-to-server connection valid. When a subsequent request to the server appears, the keep-alive function avoids or reestablishes a connection.
In HTTP 1.0, "connection: keep-alive" must be added to the HTTP header to enable keep-alive. In HTTP 1.1, keep-alive is enabled by default. If "connection: close. Currently, most browsers use the http1.1 Protocol. That is to say, keep-alive connection requests are initiated by default. Therefore, whether a complete keep-alive connection can be completed depends on the server settings.
Ii. Advantages of enabling keep-alive
From the analysis above, enabling the keep-alive mode is certainly more efficient and has higher performance. This avoids the overhead of establishing/releasing connections.
Author: Eric
Original post address: http://blogread.cn/it/article/6296? F = WB