What is Http Persistent connection

HTTP protocol has a concept of persistent connection, which means the connection is not closed after Http request and response transaction, instead the Http connection is kept open across multiple transaction. I.e. browser opens a Http connection to get a web page and then reuses that connection to get images, JavaScript, CSS on the page. By reusing an idle, persistent connection that is already open to a target server, you can avoid the slow connection establishment as well as slow start-up throttle.

Persistent connections provide quite few advantages like reduce the delays and overheads of connection establishment, keep the connections in a tuned state, and reduce the potential number of open connections. But if you don't handle persistent connections with care, you may end up accumulating a large number of idle connections, consuming local resources and resources on remote clients and servers.

There are two types of persistent connections

  1. Http/1.0: had concept of keep-alive connections:

  2. Http/1.1 has concept of persistent connections.

No comments: