HTTP Persistent Connections: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 38: Line 38:


=Disadvantages=
=Disadvantages=
* If the persistent connections are maintained for too long for idle clients, this may cause performance problems in heavily loaded servers. The higher the timeout, the more server processes will be kept occupied waiting on connections with idle clients.


=Configuration=
=Configuration=

Revision as of 17:28, 23 November 2016

External

Internal

Overview

A HTTP persistent connection is a TCP/IP connection between the client and server that allows more that one request per connection.

It is the client that initially requests the connection to be kept alive. In HTTP 1.1, a persistent connection is initiated by specifying a "Keep-Alive" value for the "Connection" request header:

GET ... HTTP/1.1
Host: ...
Connection: Keep-Alive

The server may or may not support persistent connections. If the server does support them, it will confirm that by including with the response a "Connection" response header:

200 OK
Content-Length: ...
Connection: Keep-Alive

Once both the client and the server have agreed on using persistent connections, they will keep the underlying TCP/IP connection open, and subsequent requests from that client will be sent over the persistent connection.

Advantages

  • Both the client and the server avoid multiple TCP and SSL handshakes.
  • The network throughput is increasing by avoiding TCP slowstart algorithms.

Disadvantages

  • If the persistent connections are maintained for too long for idle clients, this may cause performance problems in heavily loaded servers. The higher the timeout, the more server processes will be kept occupied waiting on connections with idle clients.

Configuration

For details on how to configure HTTP persistent connections with httpd, see:

httpd Persistent Connection Configuration