The persistent network connection allows the client and server to send/receive multiple HTTP requests/responses without opening a new connection for every single request/response pair.
Persistent connections can improve overall system performance by eliminating the need to send additional TCP/IP packets for establishing and closing the network connection before/after each request.
The connection is persistent by default for HTTP/1.1 clients. For HTTP/1.0 connections, you need to explicitly indicate that you want a persistent connection by adding the "Connection: keep-alive" header.
Connection Examples
The "Connection keep-alive" header means the client wants to keep it open. The Keep-Alive header: timeout = 5, max = 100 means that the client specifies a timeout to keep the connection open for 5 seconds and a maximum of 100 requests.
A client can inform the server that it doesn't need a persistent connection by sending the "Connection: close" header, thereby freeing up server resources. For example, if the client does not plan to send more than one request to this server.
If the server does not support persistent connections or cannot provide a persistent connection at this time, it can indicate this by sending the "Connection: close" header in the response.