HTTP can use both nonpersistent connections and persistent connections. Although HTTP uses persistent connections
in its default node, HTTP clients and servers can also be configured to use non-persistent connections instead.
Nonpersistent Connections
As the browser receives the Web page, it displays the page to the user. Two different browsers may interpret a
Web page in somewhat different ways. HTTP has nothbing to do with how a Web page is interpreted by a client. The
HTTP specifications define only the communication protocol between the client HTTP program ans the server HTTP program.
We define the round-trip time (RTT), which is the time it takes for a small packet to travel from one
client to server and then back to the client. The RTT includes packet-propagation delays, packet-queuing delays
in intermediate routers and switches, and packet-processing delays.
Persistent Connections
Nonpersistent connections have some shortcomings. First, a brand-new connection must be established and maintained
for each requested object. For jeach of these connections, TCP buffers must be allocated and TCP variables must be kept
in both the client and server. This can place a serious burden on the Web server, which may be serving request from
hundreds of different clients simultaneously. Second, each object suffers a delivery delay of two RTTs--one RTT to establish
the TCP connection and one RTT to request and receive an object.
![kurose_320719_c02f07.gif](../sitebuildercontent/sitebuilderpictures/kurose_320719_c02f07.gif)
With persistent connections, the server leaves the TCP connection open after sending a response. Subsequent requests
and responses between the same client and server can be snet over the same connection. In particualr, an entire Web
page can be sent over a simgle persistent TCP connection. MOreover, multiple Web pagesresiding on the same server
an be sent from the server to the same client over a single lpersistent TCP connection.
There are two versions fo persistent connections: without pipelinging and with pipelinging. For
the version without pipelinging, the client issuse a new request only when the previous response has been received.
In this case, the client experiences one RTT in order to request and receive each of the refered objects. Although this
is an improvement over nonpersistent's two RTT's per object, the RTT delay can be further reduced with pipelining. Another
disadvantage of no piplining is that after the server sends an oblject over the persistent TCP connection, the connection
idles--does nothing--while it waits for another request to arrive. This idling wastes server resources.
The default mode of HTTP uses persistent connections with pipelining. With pipelining, the HTTP client issues a
request as soon as it encounters a reference. Thus the HTTP client can mak back-to-back requests for the refered objects;
that is, it can make a new request before receiving a response to a previous request.When the server receives the back-to-back
requests, it sends the objects back-to-back, With pipelining, it is possible for only one RTT to be expended for all
the referenced objects. Futhermore, the pipedlined TCP connection remains idle for a smaller fraction of time.
|