Home : Internet Terms : Keep-Alive Definition

Keep-Alive

Keep-Alive is an HTTP header that allows a web server to use a single connection for multiple requests from a web browser. Servers running HTTP/1 often have keep-alive turned on to improve website performance. The keep-alive header is not used in HTTP/2 since it is the default behavior of the HTTP/2 protocol.

When Keep-Alive is enabled on a web server, it creates persistent connections between the server and clients (website visitors). The TCP connection stays open until it is closed or times out. Since each TCP connection must complete a handshake process, multiple connections increase the page load time. Keep-Alive provides a way for browsers to download all webpage assets, such as images and CSS files, over a single connection.

The disadvantage of Keep-Alive is that it requires more system resources from the web server. If websites on a server receive a lot of traffic, it may have several — possibly several thousand — persistent connections open at once. Eventually, the server may not be able to handle new connections and become unresponsive. Apache provides the following directives to prevent servers from reaching maximum capacity:

  1. KeepAliveTimeout - the maximum time a persistent connection can stay open while waiting for new requests
  2. MaxKeepAliveRequests - the maximum number of requests allowed within a single connection, before it needs to be reset

To enable keep-alive on an Apache server, add the following code to a server-wide include file or the .HTACCESS file of a specific website:

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

Updated: May 27, 2021

Cite this definition:

https://techterms.com/definition/keep-alive

TechTerms - The Tech Terms Computer Dictionary

This page contains a technical definition of Keep-Alive. It explains in computing terminology what Keep-Alive means and is one of many Internet terms in the TechTerms dictionary.

All definitions on the TechTerms website are written to be technically accurate but also easy to understand. If you find this Keep-Alive definition to be helpful, you can reference it using the citation links above. If you think a term should be updated or added to the TechTerms dictionary, please email TechTerms!

Subscribe to the TechTerms Newsletter to get featured terms and quizzes right in your inbox. You can choose to receive either a daily or weekly email.

Sign up for the free TechTerms Newsletter

How often would you like to receive an email?

You can unsubscribe at any time.
Questions? Please contact us.