HTTP Non-Persistent & Persistent Connection | Set 1

The Hypertext Transfer Protocol (HTTP) is an application-level protocol that uses TCP as an underlying transport and typically runs on port 80. HTTP is a stateless protocol i.e. server maintains no information about past client requests.

HTTP Connections

  1. Non-Persistent
  2. Persistent

Before starting with persistent and non-persistent HTTP connection lets know what is a RTT.

RTT-> Time for a small packet to travel from client to server and back.

RTT= 2*propagation time

1. For an connection Persistent or Non-persistent it is sure that to initiate TCP connection one RTT is used.
2. One RTT is used for HTTP request and first few bytes to HTTP response to return.

So in order to know total file transmission time->

 total = 2RTT+transmit time

Difference between Persistent & Non-Persistent connection.

Non-Persistent Connection

  1. Without parallel connection
  2. With parallel connection

Without parallel connection Non-Persistent
Each objection takes two RTT (assuming no window limit) one for TCP connection and other for HTTP image/text file.

With parallel connection Non-Persistent

Persistent connection

  1. Non-Pipelined
  2. Pipelined

In Non-pipeline connection we first establish connection which takes two RTT then we send all the objects images/text files which takes 1 RTT each (TCP for each object is not required).

In Pipelined connection 2RTT for connection establishment and then 1RTT(assuming no window limit) for all the objects i.e. images/text.

Advantages of persistent connections :
1) Lower CPU and memory usage because there are less number of connections.
2) Allows HTTP pipelining of requests and responses.
3) Reduced network congestion (fewer TCP connections).
4) Reduced latency in subsequent requests (no handshaking).
5) Errors can be reported without the penalty of closing the TCP connection.

Disadvantages of persistent connections :
Resources may be be kept occupied even when not needed and may not be available to others.

Most of the modern browsers like Chrome, Firefox and Internet Explorer use persistent connections.

Reference :

This article is contributed by SHAURYA UPPAL. If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

GATE CS Corner    Company Wise Coding Practice

Recommended Posts:

Writing code in comment? Please use, generate link and share the link here.