Persistent HTTP connections make up the majority of modern internet traffic. Non-persistent HTTP connections also offer some advantages and shouldn’t be dismissed without consideration. Knowing the basic differences between the two can help improve application performance and, perhaps, even reduce network loads.
The majority of modern network traffic uses transmission control protocol (TCP) which is a connection-oriented, persistent, transport protocol. This allows two networked systems to establish a connection and communication back and forth until one system initiates a closure. Even though this type of persistent HTTP connection is the most prevalent, there are situations where it is definitely not the best approach.
Non-Persistent HTTP Connections
Non-persistent HTTP connections can be characterized by a network system dropping connections immediately after transferring data. User Datagram Protocol (UDP) offers a non-persistent connection protocol that is well-suited for one-time, fast-as-possible network requests such as DNS lookups.
Non-persistent connections require a separate connection to be created for every object that is transferred. For a webpage, this would mean a separate connection for every image on the page. However, non-persistent connections can also simplify things by reducing connection overhead; limiting sender and receiver-side variables, buffers, and reducing overall RTT.
Persistent HTTP Connections
Persistent connections, such as those offered by TCP, provide a number of advantages for modern web applications such as websites where many different objects are transferred. Imagine, browsing Pinterest, and having to negotiate a separate connection for every image loaded onto the screen!
Persistent HTTP connections require a bit more overhead to setup. Both sender and receiver have to set up buffers to help control the rate at which data is transferred on the network. TCP requires a 3-way handshake to set up a connection, resulting in a 2RTT delay before any data can be transferred. However, once connected, data exchange can occur freely without re-negotiating the connection.
Persistent http connections offer the advantage of allowing multiple data exchanges over a network without re-negotiating connection requirements. However, the initial setup overhead is far greater than non-persistent connections. While non-persistent connections like UDP aren’t well-suited for the exchange of many discrete data they do excel as making fast, on-off requests such as those by DNS resolvers.