Connection management in HTTP/1.x - HTTP | MDN (2024)

Connection management is a key topic in HTTP: opening and maintaining connections largely impacts the performance of websites and Web applications. In HTTP/1.x, there are several models: short-lived connections, persistent connections, and HTTP pipelining.

HTTP mostly relies on TCP for its transport protocol, providing a connection between the client and the server. In its infancy, HTTP used a single model to handle such connections. These connections were short-lived: a new one created each time a request needed sending, and closed once the answer had been received.

This simple model held an innate limitation on performance: opening each TCP connection is a resource-consuming operation. Several messages must be exchanged between the client and the server. Network latency and bandwidth affect performance when a request needs sending. Modern Web pages require many requests (a dozen or more) to serve the amount of information needed, proving this earlier model inefficient.

Two newer models were created in HTTP/1.1. The persistent-connection model keeps connections opened between successive requests, reducing the time needed to open new connections. The HTTP pipelining model goes one step further, by sending several successive requests without even waiting for an answer, reducing much of the latency in the network.

Connection management in HTTP/1.x - HTTP | MDN (1)

Note: HTTP/2 adds additional models for connection management.

It's important to note that connection management in HTTP applies to the connection between two consecutive nodes, which is hop-by-hop and not end-to-end. The model used in connections between a client and its first proxy may differ from the model between a proxy and the destination server (or any intermediate proxies). The HTTP headers involved in defining the connection model, like Connection and Keep-Alive, are hop-by-hop headers with their values able to be changed by intermediary nodes.

A related topic is the concept of HTTP connection upgrades, wherein an HTTP/1.1 connection is upgraded to a different protocol, such as TLS/1.0, WebSocket, or even HTTP/2 in cleartext. This protocol upgrade mechanism is documented in more detail elsewhere.

Short-lived connections

The original model of HTTP, and the default one in HTTP/1.0, is short-lived connections. Each HTTP request is completed on its own connection; this means a TCP handshake happens before each HTTP request, and these are serialized.

The TCP handshake itself is time-consuming, but a TCP connection adapts to its load, becoming more efficient with more sustained (or warm) connections. Short-lived connections do not make use of this efficiency feature of TCP, and performance degrades from optimum by persisting to transmit over a new, cold connection.

This model is the default model used in HTTP/1.0 (if there is no Connection header, or if its value is set to close). In HTTP/1.1, this model is only used when the Connection header is sent with a value of close.

Note: Unless dealing with a very old system, which doesn't support a persistent connection, there is no compelling reason to use this model.

Persistent connections

Short-lived connections have two major hitches: the time taken to establish a new connection is significant, and performance of the underlying TCP connection gets better only when this connection has been in use for some time (warm connection). To ease these problems, the concept of a persistent connection has been designed, even prior to HTTP/1.1. Alternatively this may be called a keep-alive connection.

A persistent connection is one which remains open for a period of time, and can be reused for several requests, saving the need for a new TCP handshake, and utilizing TCP's performance enhancing capabilities. This connection will not stay open forever: idle connections are closed after some time (a server may use the Keep-Alive header to specify a minimum time the connection should be kept open).

Persistent connections also have drawbacks; even when idling they consume server resources, and under heavy load, DoS attacks can be conducted. In such cases, using non-persistent connections, which are closed as soon as they are idle, can provide better performance.

HTTP/1.0 connections are not persistent by default. Setting Connection to anything other than close, usually retry-after, will make them persistent.

In HTTP/1.1, persistence is the default, and the header is no longer needed (but it is often added as a defensive measure against cases requiring a fallback to HTTP/1.0).

HTTP pipelining

Note: HTTP pipelining is not activated by default in modern browsers:

  • Buggy proxies are still common and these lead to strange and erratic behaviors that Web developers cannot foresee and diagnose easily.
  • Pipelining is complex to implement correctly: the size of the resource being transferred, the effective RTT that will be used, as well as the effective bandwidth, have a direct incidence on the improvement provided by the pipeline. Without knowing these, important messages may be delayed behind unimportant ones. The notion of important even evolves during page layout! HTTP pipelining therefore brings a marginal improvement in most cases only.
  • Pipelining is subject to the HOL problem.

For these reasons, pipelining has been superseded by a better algorithm, multiplexing, that is used by HTTP/2.

By default, HTTP requests are issued sequentially. The next request is only issued once the response to the current request has been received. As they are affected by network latencies and bandwidth limitations, this can result in significant delay before the next request is seen by the server.

Pipelining is the process to send successive requests, over the same persistent connection, without waiting for the answer. This avoids latency of the connection. Theoretically, performance could also be improved if two HTTP requests were to be packed into the same TCP message. The typical MSS (Maximum Segment Size), is big enough to contain several simple requests, although the demand in size of HTTP requests continues to grow.

Not all types of HTTP requests can be pipelined: only idempotent methods, that is GET, HEAD, PUT and DELETE, can be replayed safely. Should a failure happen, the pipeline content can be repeated.

Today, every HTTP/1.1-compliant proxy and server should support pipelining, though many have limitations in practice: a significant reason no modern browser activates this feature by default.

Domain sharding

Note: Unless you have a very specific immediate need, don't use this deprecated technique; switch to HTTP/2 instead. In HTTP/2, domain sharding is no longer useful: the HTTP/2 connection is able to handle parallel unprioritized requests very well. Domain sharding is even detrimental to performance. Most HTTP/2 implementations use a technique called connection coalescing to revert eventual domain sharding.

As an HTTP/1.x connection is serializing requests, even without any ordering, it can't be optimal without large enough available bandwidth. As a solution, browsers open several connections to each domain, sending parallel requests. Default was once 2 to 3 connections, but this has now increased to a more common use of 6 parallel connections. There is a risk of triggering DoS protection on the server side if attempting more than this number.

If the server wishes a faster website or application response, it is possible for the server to force the opening of more connections. For example, instead of having all resources on the same domain, say www.example.com, it could split over several domains, www1.example.com, www2.example.com, www3.example.com. Each of these domains resolves to the same server, and the Web browser will open 6 connections to each (in our example, boosting the connections to 18). This technique is called domain sharding.

Connection management in HTTP/1.x - HTTP | MDN (2)

Conclusion

Improved connection management allows considerable boosting of performance in HTTP. With HTTP/1.1 or HTTP/1.0, using a persistent connection – at least until it becomes idle – leads to the best performance. However, the failure of pipelining has lead to designing superior connection management models, which have been incorporated into HTTP/2.

Connection management in HTTP/1.x - HTTP | MDN (2024)

FAQs

What is connection management in HTTP? ›

Connection management is a key topic in HTTP: opening and maintaining connections largely impacts the performance of websites and Web applications. In HTTP/1. x, there are several models: short-lived connections, persistent connections, and HTTP pipelining.

What are the two types of HTTP connections? ›

HTTP (Hypertext Transfer Protocol) is an application layer protocol that is used to establish a connection between a client and a server so that the client can transfer data to the server and vice versa. HTTP is divided into two categories i.e. Non-Persistent connection HTTP and Persistent connection HTTP.

What is HTTP 1.1 persistent connection? ›

HTTP 1.1. In HTTP 1.1, all connections are considered persistent unless declared otherwise. The HTTP persistent connections do not use separate keepalive messages, they just allow multiple requests to use a single connection.

What is the difference between HTTP 1.1 and HTTP 2 multiplexing? ›

Multiplexing: HTTP/1.1 loads resources one after the other, so if one resource cannot be loaded, it blocks all the other resources behind it. In contrast, HTTP/2 is able to use a single TCP connection to send multiple streams of data at once so that no one resource blocks any other resource.

What is connection management? ›

Connection management in networking refers to the process of establishing, maintaining, and terminating connections between devices or systems within a network. In the web, connections typically refer to logical associations or pathways that enable communication between devices.

What is HTTP Connection Manager? ›

An HTTP connection enables a package to access a Web server by using HTTP to send or receive files. The Web Service task that SQL Server Integration Services includes uses this connection manager.

Is HTTP 1.1 still used? ›

More specifically, HTTP is the method computers and servers use to request and send information. The first usable version of HTTP was created in 1997. Because it went through several stages of development, this first version of HTTP was called HTTP/1.1. This version is still in use on the web.

What is the difference between HTTP1 and HTTP2 connection? ›

A: HTTP/2 is different from HTTP/1 in several ways, including supporting server push, multiplexing of requests, and header compression. HTTP/2 also uses binary encoding rather than text encoding, making it more efficient.

How does an HTTP connection work? ›

A web browser is an HTTP client that sends requests to servers. When the browser user enters file requests by either "opening" a web file by typing in a URL or clicking on a hypertext link, the browser builds an HTTP request and sends it to the Internet Protocol address (IP address) indicated by the URL.

Does HTTP 1.1 use multiple TCP connections? ›

HTTP/1.1 enables browsers to send several HTTP requests to the server on a single TCP connection.

How to persist an HTTP connection? ›

1. Non-Pipelined Persistent Connection: In a Non-pipeline connection, we first establish a connection that takes two RTTs then we send all the object's images/text files which take 1 RTT each (TCP for each object is not required).

How to keep-alive an HTTP connection? ›

Enabling the Keep-Alive Header
  1. MaxKeepAliveRequests – This directive sets the maximum number of requests for every keep-alive connection. ...
  2. KeepAliveTimeout – This directive sets the time that a server should wait for user requests before a new TCP connection needs to be established.

How do I know if it's HTTP 1 or 2? ›

You can also look for a blue lightning bolt by your search bar in Chrome. If it is there, the website is using HTTP/2. If you do not use Chrome or this test is not working, Key CDN also has a tool for you to check.

Does HTTP 1.1 use pipelining? ›

HTTP pipelining is a feature of HTTP/1.1, which allows multiple HTTP requests to be sent over a single TCP connection without waiting for the corresponding responses.

Is HTTP 1.1 full-duplex? ›

HTTP uses a request-response paradigm, not a full-duplex streaming paradigm. Let me repeat it: HTTP is a request-response protocol! This means that the client sends a request, and when the complete request has been sent then the server sends the response.

What is connection manager used for? ›

Connection Managers can control automatic failover for high-availability clusters, monitor client connections and direct requests to appropriate database servers, act as proxy servers and handle client/server communication, and prioritize connections between application servers and the primary server of a high- ...

What is the TCP connection management protocol? ›

TCP is a unicast connection-oriented protocol. Before either end can send data to the other, a connection must be established between them. TCP detects and repairs essentially all the data transfer problems that may be introduced by packet loss, duplication, or errors at the IP layer (or below).

What is the HTTP connection procedure? ›

HTTP Connection
  1. calculating the IP address from the DNS host name.
  2. establishing a connection with the server.
  3. sending a request.
  4. waiting for the response.
  5. closing the connection.

References

Top Articles
This Italian Grandmother Shares Her Most-Beloved Cookie Recipe for First Time Ever
Keto Pudding (3 ingredients!) - Healthy Recipes Blog
Msbs Bowling
Greater Keene Men's Softball
New Zero Turn Mowers For Sale Near Me
Wyze Thermostat vs Nest: Detailed Comparison
St Vrain Chain Gang
Morbus Castleman - Ursachen, Symptome & Behandlung
Parents & Students · Infinite Campus
Ticket To Paradise Showtimes Near Cmx Daytona 12
Inloggen bij AH Sam - E-Overheid
'Kendall Jenner of Bodybuilding' Vladislava Galagan Shares Her Best Fitness Advice For Women – Fitness Volt
Zack Fairhurst Snapchat
Iowa Image Trend
12 Week Glute Program to Transform Your Booty with Free PDF - The Fitness Phantom
Craigslist Ludington Michigan
Walmart Neighborhood Market Gas Price
Bakkt Theater Purse Policy
Brise Stocktwits
Happy Clown Makeup Tutorial
Central Nj Craiglist
7 Little Johnstons Alex Died Full Episode
Runnings Milwaukee Tool Sale
Elm Nychhc Org
360 Training Food Handlers Final Exam Answers 2022
Sona Twu
9294027542
Coil Cleaning Lititz
Itsfunnydude11 Wisconsin Volleyball Team : Itsfunnydude11 Twitter, Itsfunnydude11 Reddit – Know About It ! - Opensquares
Www.cvs/Otchs/Simply
Language levels - Dutch B1 / 2 –What do these language levels mean? - Learn Dutch Online
Trivago Hotels Austin
Lesley Ann Downey Transcript
Craigslist Hart Mi
Gargoyle Name Generator
Lacy Aaron Schmidt Where Is He Now
Unfall mit Ikarus C42: Gefangen in der Umkehr-Falle
Princeton Mn Snow Totals
Dom Tradingview
Hourly Weather Forecast for Amsterdam, North Holland, Netherlands - The Weather Channel | Weather.com
DIRECT. France-Côte d'Ivoire U23: après Barcola, deux nouveaux forfaits pour les Espoirs
Warranty Killer Performance Reviews
Inter Miami Vs Fc Dallas Total Sportek
Ncaa Wrestling Bracket Challenge
Tu Pulga Online Utah
Is The Rubber Ducks Game Cancelled Today
Gwcc Salvage
Google Halloween Game 2018 Unblocked
Senna Build Guides :: League of Legends Strategy Builds, Runes, Items, and Abilities :: Patch 14.18
Omni Id Portal Waconia
Ladyva Is She Married
Latest Posts
Article information

Author: Pres. Lawanda Wiegand

Last Updated:

Views: 5880

Rating: 4 / 5 (71 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Pres. Lawanda Wiegand

Birthday: 1993-01-10

Address: Suite 391 6963 Ullrich Shore, Bellefort, WI 01350-7893

Phone: +6806610432415

Job: Dynamic Manufacturing Assistant

Hobby: amateur radio, Taekwondo, Wood carving, Parkour, Skateboarding, Running, Rafting

Introduction: My name is Pres. Lawanda Wiegand, I am a inquisitive, helpful, glamorous, cheerful, open, clever, innocent person who loves writing and wants to share my knowledge and understanding with you.