What is the use of http non persistent connection mode
Asked Answered
F

2

8

It may seem to be a trivial question but still.. I have a confusion over it.

Almost at every site I have read that HTTP persistent or keep-alive connections are better than the non-persistent one. Ques: So, why do non-persistent even exists?

Some says that persistent has disadvantage if server is serving many clients as users are deprived of connection. Ques: All the popular websites server millions of clients, does that mean they don't use persistent mode?

As per my understanding I can think search engines may not be using persistent connections.

Can someone please enlighten me on this topic.

Another doubt I have is regarding the HTTP requests. I have read that if a page contains link to several objects then web browser makes that many request to fetch all those (this is why persistent connections are used). My doubt is why all the objects are not embedded in the page and sent as one object? If argument is that it makes page heavy and not bandwidth friendly then anyways the browser open parallel connections to fetch multiple objects which again putting the same load on the network.

OK, I understand that this cannot be done for like image search but if a page contains few objects then can we embed them into the page and send.

These may seem foolish questions but I can't help. I have a doubt and I need to clear that and you can help. Thanks

Flighty answered 24/9, 2014 at 17:3 Comment(0)
T
6

The original HTTP specification always uses non-persistent connections; HTTP/1.1 added persistence because it is more efficient for web pages that embed a lot of external objects (which were rare when HTTP/1.0 was written.)

However, even though HTTP/1.1 allows persistent connections there are implementations that don't support them, or which still only support HTTP/1.0. For this reason, HTTP/1.1 requires that the Connection: keep-alive header be sent in order to enable this feature, and Connection: close be sent to disable it.

It is possible to include media directly in the HTML by base64 encoding the data and including it in a data: URL. This is not usually done because it slows down your web browser. With a standard HTML page, the browser can start rendering the structure of the page without waiting for the (rather large) inline data: links to download.

Turin answered 24/9, 2014 at 21:40 Comment(3)
I know that by default HTTP 1.1 is persistent and web servers respond with very less keep-alive time. But, this still doesn't answer my question.Flighty
@Flighty I thought I did answer at least a few of your several questions. To which do you refer?Turin
I feel only the last one is answered.Flighty
C
0

As you say most of the webpages hosted over the internet will not only handle fewer data, and nobody can estimate that. The HTTP server should be generic and it should have a mechanism to avoid multiple requests in the name of dependencies. You say that the non-persistent method avoids the blocking of ports by a single client for a long time where as the server may have to serve more clients and it would give a lot of stress, that is not true. Persistent connections actually reduce the load for a server by limiting the number of queries it has to serve.

Hope this HTTP Persistent connection will help you understand.

Cornhusk answered 11/6, 2017 at 16:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.