Keep-Alive


Keep-Alive is an HTTP header that enables a internet server to make use of a single connection for a number of requests from a internet browser. Servers operating HTTP/1 typically have keep-alive turned on to enhance web site efficiency. The keep-alive header will not be utilized in HTTP/2 since it’s the default conduct of the HTTP/2 protocol.

When Keep-Alive is enabled on an internet server, it creates persistent connections between the server and purchasers (web site guests). The TCP connection stays open till it’s closed or instances out. Since every TCP connection should full a handshake course of, a number of connections enhance the web page load time. Keep-Alive offers a method for browsers to obtain all webpage property, corresponding to images and CSS information, over a single connection.

The drawback of Keep-Alive is that it requires more system sources from the net server. If web sites on a server obtain a whole lot of visitors, it might have a number of — probably a number of thousand — persistent connections open without delay. Eventually, the server could not be capable of deal with new connections and turn into unresponsive. Apache offers the next directives to stop servers from reaching most capability:

  1. KeepAliveTimeout – the utmost time a persistent connection can keep open whereas ready for brand spanking new requests
  2. MaxKeepAliveRequests – the utmost variety of requests allowed inside a single connection, earlier than it must be reset

To allow keep-alive on an Apache server, add the next code to a server-wide embrace file or the .HTACCESS file of a selected web site:

<IfModule mod_headers.c>
    Header set Connection keep-alive
</IfModule>

Looking to know more Internet Terms