Difference between Persistent and Non-Persistent Connection
We all use the internet, and we usually search on the internet for different things. It looks so easy when we search anything on the internet. It is all right before us in seconds. But in the backend, a lot of process will be there like when you request or search for anything your request will be carried out to the server and the result will be carried out to you. This process will be done using a protocol called HTTP. HTTP provides a well secured connection between the client and the server. So, in this article, we are going to discuss about the differences between the Persistent and Non-persistent type of HTTP protocols or the HTTP connections.
Persistent Connection
Persistent Connection is one of the basic HTTP connections. It establishes the connection between the users and the servers. The Persistent connection can also be called as the HTTP/1.1. The HTTP connection will always be terminated after single transaction between the server and the user, but the Persistent Connection is type of HTTP connections in which the interface or the connection that build between the user and the server will be open after sending the response also. Persistent Connection always uses the Transmission control protocol. The Persistent Connection always uses the 1 RTT for all the reference objects. When we use the Persistent Connection there is no need for creating a new connection for different objects. The Persistent connection need only one round trip time because sending the request and receiving the response is considered as a single cycle.
The Persistent Connection is the default mode of the HTTP connection. When the TCP connection is open in the Persistent connection multiple requests can be requested over a single TCP connection. The load on the CPU will be very less because for all objects a single connection is sufficient in the persistent connection. The Persistent connection can also reduce the network traffic.
Non-Persistent Connection
Non-Persistent connection is also a basic type of HTTP connection which is mostly used in the establishing the connection between the client and the server. The Non-Persistent connection can also be called as the HTTP/1.0. The Non-Persistent connection also works like Persistent connection but in non-Persistent connection the connection build between the server and the client will be terminated after using it for a single object. The Non-Persistent connection establishes the new connection to transfer the files. The Non-Persistent connection requires two RTT’s for every object that needed to be transferred. Non-Persistent connection is always over-headed. Non-Persistent connection is not a default mode of the HTTP connection. The TCP will be always closed after every request is processed. For every new request we need new TCP that multiple requests require multiple TCP’s. Non-Persistent connection requires more time to process a request because it needs to establish a new connection for every request and the response.
Differences between Persistent Connection and Non-Persistent Connection in Tabular Form
Persistent Connection | Non-Persistent Connection |
The Persistent Connection is the second version of the HTTP, and it is also called as HTTP/1.1 | The Non-Persistent connection was the first version of HTTP, and it is also called as HTTP/1.0 |
The Persistent connection will always be in the default mode. | The Non-Persistent connection will always be in the non-default mode. |
The Persistent connection uses very less time because all the requests and responses are transferred in a single TCP. | The Non-Persistent connection uses more time when compared to Persistent connection because it uses new TCP for every new request and response. |
The Persistent connection requires only one round trip time for all the objects. | The Non-Persistent connection requires two RTT’s for every object present in the connection. |
The request methods used in the Persistent connection are GET, HEAD, POST, PUT, DELETE, etc. | The request methods used in the non-Persistent connection are HEAD, POST, etc. |
For downloading the multiple objects, the Persistent connection only uses a single connection | For downloading the multiple objects, the non-Persistent connection requires multiple connections |
The usage of the CPU will be less in the persistent connection because it runs on a single TCP | The usage of the CPU will be more when compared to persistent connection because it runs on the multiple TCP’s |