ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • HTTP keepalive(HTTP persistent connection)
    Web/Protocol 2019. 9. 28. 17:41

    1. Overview

    HTTP keep-alive, a.k.a., HTTP persistent connection, is an instruction that allows a single TCP connection to remain open for multiple HTTP requests/responses.

    By default, HTTP connections close after each request. When someone visits your site, their browser needs to create new connections to request each of the files that make up your web pages (e.g. images, Javascript, and CSS stylesheets), a process that can lead to high page load time.

    Enabling the keep-alive header allows you to serve all web page resources over a single connection. Keep-alive also reduces both CPU and memory usage on your server.

     

    2. Description

    2.1 Parameters

    Parameter Description
    timeout Indicating the minimum amount of time, an idle connection has to be kept opened (in seconds). Note that timeouts longer than the TCP timeout may be ignored if no keep-alive TCP message is set at the transport level.
    max Indicating the maximum number of requests that can be sent on this connection before closing it. Unless 0, this value is ignored for non-pipelined connections as another request will be sent in the next response. An HTTP pipeline can use it to limit the pipelining.

    2.2 Advantages

    • Reduced latency in subsequent requests with no handshaking 
    • Reduced CPU usage and round-trips because of fewer new connections and TLS handshakes
    • Enables HTTP pipelining of requests and responses.
    • Reduced network congestion (fewer TCP connections).
    • Errors can be reported without the penalty of closing the TCP connection.

    2.3 Disadvantages

    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 depending on the server's architecture and configuration.

    3. References

    https://en.wikipedia.org/wiki/HTTP_persistent_connection

    https://www.imperva.com/learn/performance/http-keep-alive/

    'Web > Protocol' 카테고리의 다른 글

    Dynamic Adaptive Streaming over HTTP  (0) 2020.02.24
    WebSockets vs Long Polling  (0) 2020.02.23
    QUIC  (0) 2020.02.23
    Hypertext Transfer Protocol (HTTP)  (0) 2019.08.31
    Stateful and stateless in Protocol  (0) 2019.08.25

    댓글

Designed by Tistory.