1. Overview
Some websites will go down after the server has been running for a period of time. There are many reasons that may cause this phenomenon: such as insufficient tomcat heap and non-heap memory settings,
the program fails to release memory space and causes memory overflow, or a certain Some processes have been running and cannot be released, causing a large consumption of cup resources.
But in addition to the program itself, it may also be caused by client access (of course, this client also includes search engines such as spider software).
If the server and client establish a long link (you can use "netstat -a" command to view network access information), which requires certain settings for the connection of the http response header
.
In http1.1, a connection header field may appear in both the request and response headers. The meaning of this header is how to handle long links when the client
communicates with the server.
In http1.1, the client and server support long links by default. If the client uses the http1.1 protocol but does not want to use
long links, you need to specify the value of connection in the header as close; if the server If the party does not want to support long links, it is also necessary to clearly state that the value of the connection is close in the response. Whether the header of the request or the response contains a connection with a value of close, it indicates that the TCP link currently being used is being processed by the request. It will be disconnected after completion. In the future, the client must create a new tcp link when making a new request.
The close setting of HTTP Connection allows either the client or the server to close the underlying connection. Both parties will require
to close their TCP connections after processing the request.
2. Example
Connection:Keep-Alive
Connection:Close
The above has introduced PHP knowledge point 3-HTTP header-Connection, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.