8.2HTTP timing: persistent and non-persistent
The idea
HTTP page-load time is counted in RTTs: 1 RTT for the TCP handshake and 1 RTT for each request-response. Persistent connections and pipelining save round trips.
Think of it like this: Phoning a shop: non-persistent is hanging up and redialling after every question; persistent is staying on the line; pipelining is asking all your questions in one breath.
Why it exists
The "minimum time to render the page in RTTs" question comes up regularly.
How it works
- Add the DNS lookup RTTs first.
- Base page: 1 RTT (handshake) + 1 RTT (request).
- Objects, non-persistent: 2 RTT each, divided into ⌈n/p⌉ rounds if p connections run in parallel.
- Objects, persistent: 1 RTT each; with pipelining all together cost 1 RTT.
Worked example: 3 DNS RTTs, 10 small objects, non-persistent with 5 parallel connections versus persistent with pipelining.
Non-persistent: 3 + 2 + 2 × 2 = 9 RTT. Persistent with pipelining: 3 + 2 + 1 = 6 RTT (GATE 2023).
Now play with it
- →Change the number of parallel connections in the calculator.
- →Compare persistent with and without pipelining for 10 objects.
GATE 2023: 3 DNS RTTs, 1 RTT for the TCP handshake and 1 for the base page, then 10 objects. Parallel non-persistent: 3 + 2 + 2 × 2 = 9. Persistent with pipelining: 3 + 2 + 1 = 6.
Check yourself
A web page has a base file and 5 images. With non-persistent HTTP and no parallelism, how many TCP connections are needed?
Exam notes (the dense version)
An RTT is the round trip time. A TCP handshake costs 1 RTT, and a request-response costs 1 RTT (ignoring transmission time). Non-persistent HTTP opens a new connection per object: 2 RTT per object (1 handshake + 1 request). Persistent HTTP keeps the connection: after one handshake each object costs 1 RTT, and with pipelining all requests go out together, so n objects cost about 1 RTT. With p parallel connections, objects are fetched in ⌈n/p⌉ rounds. Total time = DNS lookup + 2 RTT for the base page + time for the embedded objects. HTTP is stateless; cookies add state.
Previous year questions: Application Layer: DNS, HTTP, Email (9)
PYQs are grouped by topic, so this is the full set for Application Layer: DNS, HTTP, Email; try the ones that match this subtopic. Open all 9 on the topic page.