Prerequisite: HTTP Non-Persistent & Persistent Connection – Set 1
For question point of view you need to know that Non-persistent connection is known as HTTP 1.0 and Persistent connection is known as HTTP 1.1.
- Non-Persistent Connection: It requires connection setup again and again for each object to send.
- Persistent connection: It does not require connection setup again and again. Multiple objects can use connection.
Questions : Assume that you have base HTML file with 30 embedded images, images & base file are small enough to fit in one TCP segment. How many RTT are required to retrieve base file & images under-following condition :
(i) Non-Persistent connection without parallel connection
(ii) Non-persistent connection with 10 parallel connection
(iii) Persistent connection without pipe-lining
(iv) Persistent connection with pipe-lining
(Assume RTT dominates all other time)
2RTT is the initial required connection one for TCP connection and one for HTML base file.
Total time = 2RTT + transmit time
(i) Non-Persistent connection with no parallel connection :
Here for each image 2 RTT are required one for TCP connection and one for image to send.
So transmit time for 30 images = 2*(30 RTT) = 60 RTT
Total time = 2 RTT+60 RTT = 62RTT
(ii) Non-persistent connection with 10 parallel connection :
Here 10 images can be send simultaneously.
So for 30 images it required -> 2*(30/10) = 6RTT
Total time = 2 RTT + 6 RTT = 8RTT
(iii) Persistent connection without pipelining :
Here TCP connection is required again and again.
So for 30 images it requires -> 30 RTTs
Total time = 2 RTT + 30 RTT = 32RTT
(iv) Persistent connection with pipe-lining :
Since it is Persistent connection TCP connection is not required again and again.
Pipe-lining means in one packet only images which can fit, can be send.
In Pipe-lining connection we can send all images in 1RTT.
Total time = 2 RTT + 1 RTT = 3RTT
This article is contributed by SHAURYA UPPAL. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.