Wednesday, January 12, 2022

Compare Persistent HTTP and Non-persistent HTTP | Persistent HTTP vs Non-Persistent HTTP


HTTP Connection - Click here for Video

The HTTP CONNECT method starts two-way communications with the requested resource. It can be used to open a tunnel. 

There are two types of HTTP Connection: Non-Persistent HTTP and Persistent HTTP. Let’s discuss HTTP response time and RTT (round trip time). Below figure shows the HTTP response time and RTT.

Figure: HTTP Connection

RTT (round-trip time): A time for a small packet to travel from client to server and server to client.

HTTP response time: 1-RTT to initiate TCP connection, 1-RTT for HTTP request-response and File transmission time.

HTTP Response Time = No. of RTT + file transmit time

Non-persistent HTTP

Non-persistent connections are the default mode for HTTP/1.0. A non-persistent connection is closed after the server sends the requested object to the client. The connection is used exactly for one request and one response. For downloading multiple objects, it required multiple connections.

Non-Persistent HTTP = 2 RTT + 1 file-transmit time 

Figure: Non-Persistent HTTP Connection

Example: Transferring a webpage from server to client, webpage consists of a base HTML file and 10 JPEG images. Total 11 object are resided on server.

11 objects = 22 RTT + 11 file-transmit time


Persistent HTTP

HTTP 1.1 made persistent connections the default mode. The server now keeps the TCP connection open for a certain period of time after sending a response. This enables the client to make multiple requests over the same TCP.

There are two types of Persistent HTTP Connection: Persistent HTTP without pipelining and Persistent HTTP with pipelining.

Persistent HTTP without pipelining

The client issues a new request only when the previous response has been received. The client experiences one RTT in order to request and receive each of the referenced objects. TCP connection is idle. i.e., does nothing while it waits for another request to arrive. This idle situation wastes server resources.

Figure: Persistent HTTP Connection without pipelining

In above figure, new object request sends after receive previous object.

Persistent HTTP with Pipelining

Default mode of HTTP 1.1 uses persistent connections with pipelining. Client issues a request as soon as it encounter a reference. The HTTP client can make back-to-back requests for the referenced objects. It can make a new request before the back-to-back requests; it sends the objects back-to-back. Pipelined TCP connection remains idle for a smaller fraction of time.

Figure: Persistent HTTP Connection with pipelining

In above figure, new object request sends receive previous object, but all the objects are received in a sequence because this method uses pipelining concepts.

Persistent HTTP Vs Non-Persistent HTTP

To learn more about Persistent HTTP vs Non-Persistent HTTP, Click here

Watch more videos click here.