Friday, October 29, 2021

HTTP persistent connection | My 20 minutes reading time - Oct. 29, 2021 | Understand GFS paper

HTTP persistent connection

From Wikipedia, the free encyclopedia

 HTTP persistent connection, also called HTTP keep-alive, or HTTP connection reuse, is the idea of using a single TCP connection to send and receive multiple HTTP requests/responses, as opposed to opening a new connection for every single request/response pair. The newer HTTP/2 protocol uses the same idea and takes it further to allow multiple concurrent requests/responses to be multiplexed over a single connection.

Advantages[edit]

According to RFC 7230, section 6.4, "a client ought to limit the number of simultaneous open connections that it maintains to a given server". The previous version of the HTTP/1.1 specification stated specific maximum values but in the words of RFC 7230 "this was found to be impractical for many applications... instead... be conservative when opening multiple connections". These guidelines are intended to improve HTTP response times and avoid congestion. If HTTP pipelining is correctly implemented, there is no performance benefit to be gained from additional connections, while additional connections may cause issues with congestion.[13]

Disadvantages[edit]

If the client does not close the connection when all of the data it needs has been received, the resources needed to keep the connection open on the server will be unavailable for other clients. How much this affects the server's availability and how long the resources are unavailable depend on the server's architecture and configuration.

Also a race condition can occur where the client sends a request to the server at the same time that the server closes the TCP connection.[14] A server should send a 408 Request Timeout status code to the client immediately before closing the connection. When a client receives the 408 status code, after having sent the request, it may open a new connection to the server and re-send the request.[15] Not all clients will re-send the request, and many that do will only do so if the request has an idempotent HTTP method.

Use in web browsers

All modern web browsers including Google ChromeFirefoxInternet Explorer (since 4.01), Opera (since 4.0)[16] and Safari use persistent connections.

By default, Internet Explorer versions 6 and 7 use two persistent connections while version 8 uses six.[17] Persistent connections time out after 60 seconds of inactivity which is changeable via the Windows Registry.[18]

In Firefox, the number of simultaneous connections can be customized (per-server, per-proxy, total). Persistent connections time out after 115 seconds (1.92 minutes) of inactivity which is changeable via the configuration.[

No comments:

Post a Comment