HTTP is a
Request <-> ResponseA typical example of a pattern is a client sending a request message to the server to respond to this information. In the old HTTP version, each request will be created with a new
Client-ServerConnection, send a request on this connection, and then receive the request. One of the great advantages of such a model is that it is simple, easy to understand and programmed to implement; it also has a big drawback that it is inefficient, so keep-alive is proposed to solve the problem of low efficiency.The keep-Alive feature makes the client-to-server connection continuous and effective, and thekeep-alive feature avoids establishing or re-establishing a connection when a subsequent request to the server occurs. Most Web servers on the market, including Iplanet, IIS, and Apache, support HTTP keep-Alive. This feature is often useful for websites that provide static content. However, there is another problem with heavier sites: while retaining open connections for customers has some benefits, it also affects performance because the resources that could have been freed during the processing pause are still occupied. When the Web server and application server are running on the same machine, thekeep- alive feature has a particularly significant impact on resource utilization. This feature is a feature of HTTP 1.1 presets, and HTTP 1.0 plus keep-Aliveheader can also provide the persistent function of HTTP.
keep-alive:timeout=5, max=100
Timeout: Expires 5 seconds (the parameter in the corresponding httpd.conf is: keepalivetimeout), Max is a maximum of 100 requests, forcing the connection to be disconnected
is a new connection in timeout time, and Max will automatically minus 1 until 0, forcing it to break. we know that the HTTP protocol uses "request-answer" mode, when using normal mode, that is, non-keepalive mode, each request/reply client and server to create a new connection, immediately after the completion of the connection (HTTP protocol is a non-connected protocol) When using Keep-alive mode (also known as persistent connection, connection reuse), the Keep-alive feature keeps the client-to-server connection active, and the keep-alive feature avoids establishing or re-establishing a connection when a subsequent request to the server occurs. HTTP 1.0 is turned off by default, you need to add "connection:keep-alive" in the HTTP header to enable Keep-alive;http 1.1 by default enabling Keep-alive, if you join "Connection: Close "before it is closed. Most browsers now use the http1.1 protocol, which means that the Keep-alive connection request is initiated by default, so whether a full keep-alive connection can be completed depends on the server setup.
HTTP keep-alive