In-class Paper Review #2“Improving World Wide Web Latency”
By Venkata N. Padmanabhan
Department of Computer ScienceSouthern Illinois University Edwardsville
Spring, 2006
Dr. Hiroshi FujinokiE-mail: [email protected]
CS 587 High-Speed Networks
Padmanabhan/000
CS 587 High-Speed Networks
Padmanabhan/001
Problems in HTTP (HTTP 1.0)
= The required time after a web user makes a request for a web page until the page is (completely) displayed at the user’s local monitor
Possible contributing factors in latency
• Transmission bandwidth
• Network congestion (due to high queuing delay at intermediate routers)
• Client/server host resources
(we can never transmit more than link capacity)
The problem addressed by the author Latency
Example Transmitting a 1 Mbyte file across a 1Mbps link
Never be less than 1 second
• Propagation delay The author claims that this is the most serious limiting factor in web latency
CS 587 High-Speed Networks
Padmanabhan/002
Why is “propagation delay” is the most significant factor?
• Propagation delay is a function of the constant propagation speed of light
• It is the factor money can not improve anything
It is proportional to the physical end-to-end distance
If the distance becomes doubled, the latency will be doubled
You can not improve it by upgrading to a faster hardware
Reducing traffic load will not reduce the latency
Even transmitting 1 bit over a coast-to-coast will take at least 70 ms using the fastest Internet backbone (> 10Tbps)
CS 587 High-Speed Networks
Padmanabhan/003
The two approaches used by the author to improve web latency
Hide the propagation delay, if it is impossible to eliminate
There are some delay components that are impossible to eliminate,then, try to hide it.
Approach #2
Approach #1
Eliminate the propagation delay as much as possible.
If there is unnecessary delay components and if it isPossible to eliminate, eliminate it!
CS 587 High-Speed Networks
Padmanabhan/004
The three techniques the author proposed to hide the web latency
HTTP 1.1 Persistent Connection
HTTP 1.1 Pipelining
Pre-fetching web pages in conjunction client-side caching
Already officially adopted in HTTP 1.1
• Pre-fetch prediction algorithm
• Implementation in HTTP
Backward compatibility is important
Implemented by most of the web browsers
CS 587 High-Speed Networks
Padmanabhan/005
How to eliminate latency?
Eliminate unnecessary message round-trips in HTTP.
Analysis Phase #1 Understand the essences in HTTP (HTTP 1.0)
(The author called this “a brief sketch of the HTTP protocol” (page 3))
• HTTP protocol is layered over a reliable bidirectional byte stream (i.e., socket) normally TCP.
• Each HTTP interaction consists of a request sent from a client to the server, followed by a response sent from the server (i.e., client-server model).
• Client requests are implemented by:
- Methods (GET, POST, etc)- URL (Universal Resource Locator)- HTTP header (Specific data structure to transmit client information)
CS 587 High-Speed Networks
Padmanabhan/006
Analysis Phase #1 (continued)
• Client requests are parsed by the server
• The server takes the action(s) according to the specified method.
• The server sends a response to the client (meta-information)
• The server sends a status code
HTTP 200 OK
HTTP 404 Page Not Found
HTTP 500 Access Refused
content-length
• The server transmits the content of a web page (just a file)
CS 587 High-Speed Networks
Padmanabhan/007
Analysis Phase #1 (continued)
Web Browser Web Server
Connection requestfor a stream socket (=TCP)
acceptconnect Socket type: AF_INET SOCK_STREAM
CS 587 High-Speed Networks
Padmanabhan/008
Analysis Phase #1 (continued)
Web Browser Web Server
A socket (= TCP) connectionas a bi-directional data channel
Web Browser
CS 587 High-Speed Networks
Padmanabhan/009
Analysis Phase #1 (continued)
Web Server
• URL: www.siue.edu
• Method: GET index.html HTTP/1.0
• HTTP header
• Parse the client request
• Take the requested action
• Transmit a result status code (HTTP 200 OK)
HTTP 200 OK
• Transmit server-side meta-information
Context-length
Contents of a file
• Transmit the contents of the requested web file
CS 587 High-Speed Networks
Identify unnecessary round tripsAnalysis Phase #2
Eliminate unnecessary message round-trips in HTTP, but we need toidentify which round-trips are unnecessary.
client server
SYN
SYN-ACK
ACKDAT
ACKDAT
ACKDAT
FINACK
FIN
ACKSYN
SYN-ACK
ACKDAT
DAT
0 RTT
1 RTT
2 RTT
3 RTT
4 RTT
• Establish stream socket• TCP 3-way handshake
• Transmit GET request for index.html top page
• ACK can be piggy-backed to the GET payload packet
• Receive the top page• Parse other required files
• Establish stream socket• TCP 3-way handshake
• Transmit GET request for another file
• Receive the requested page
• TCP prepares data structure for a connection
• Server establishes a connection• Server accesses its local HDD
• Server drops the connection
• TCP prepares data structure for a connection
Padmanabhan/010
CS 587 High-Speed Networks
Padmanabhan/012
• Which round-trips are unnecessary?
• How can we eliminate those unnecessary round trips??
Padmanabhan said, “almost all of the unnecessary round trips may be eliminated by surprisingly simple changes in HTTP protocol.
Analysis Phase #2 (continued)
CS 587 High-Speed Networks
Padmanabhan/013
Analysis Phase #2 (continued)
Significant expected benefits in eliminating unnecessary round-trips (page 5)
• Reducing number of round-trips Shorter web latency
• Reducing processing overhead at both client and server
• Reducing connections - Allocating new ports
- Creating/deleting TCP data structures
- Creating/deleting processes/threads
• Reducing application-level workload- Overhead for authentication
- Overhead for message encryption
• Less probability of request refusal due to the max. # of TCP connections
Significant for busy/popular web servers
The author described these to convince The significance of his proposed solutions
CS 587 High-Speed Networks
Padmanabhan/014
Analysis Phase #2 (continued)
TCP TIME_WAIT and CLOSE_WAIT
TCP TIME_WAIT: A host waits for up to a few minutes (4 min. in default) after FIN message has been released.
For a busy/popular web server, the number of TCP connections opened (and those still not dropped) will quickly hit the max. number ofconnections allowed at a server host.
CS 587 High-Speed Networks
Padmanabhan/015
Analysis Phase #2 (continued)
At a busy/popular web server host, the TCP connections (entries in the TCP connection management table) tend to increase in a short time.
CS 587 High-Speed Networks
Padmanabhan/016
Another thought to convince the importance in reducing the number of round-trips
• The average file size in web application is very small
Use of a subjective word
- Mean document size is 13 Kbytes (12,925 bytes)
- The median is 1.77 Kbytes (1,770 bytes)
- 12,727 messages are zero-contents message (TCP+IP header only)
The statistics from 200,000 HTTP retrievals say:
Most of the files are less than 1.7KB. Occasional large files
Only 40 bytes in a message
CS 587 High-Speed Networks
Padmanabhan/017
Another thought to convince the importance in reducing the number of round-trips
• The average file size in web application is very small
Use of a subjective word
client server
Small messages
S1 R1
U1 = R1/S1
Large messages
client server
S2 R2
U2 = R2/S2
U1 < U2
CS 587 High-Speed Networks
Solution #1: Persistent Connection
client server
SYN
SYN-ACK
ACKDAT
ACKDAT
ACKDAT
FINACK
FIN
ACKSYN
SYN-ACK
ACKDAT
DAT
Padmanabhan/018
Keep a stream socket connection (= TCPconnection) until you download all the files
CS 587 High-Speed Networks
Solution #1: Persistent Connection
client server
SYN
SYN-ACK
ACKDAT
ACKDAT
ACKDAT
ACK
DAT
DAT
Padmanabhan/019
Keep a stream socket connection (= TCPconnection) until you download all the files
DAT
DAT
• Round trips reduced
• Reduced TIME_WAIT
• Reduced CLOSE_WAIT
CS 587 High-Speed Networks
Padmanabhan/020
Implementation details in Persistent Connection
1. Detection of the end of transmissions (page 8)
2. Backward-compatible extension of HTTP 1.0 (page 9)
How can the client know the end of transmissions?
• Boundary delimiter
• Blocked data transmission protocol
• Store-and-forward
• HTTP PC-enabled server should be able to handle PC-non-enabled HTTP clients
• HTTP PC-enabled client should be able to handle PC-non-enabled HTTP servers
• OS-kernel and TCP should not be changed
CS 587 High-Speed Networks
client server
SYN
SYN-ACK
ACKDAT
ACKDAT
ACKDAT
ACK
DAT
DAT
Padmanabhan/021
DAT
DAT
Solution #2: HTTP Pipelining An improvement over Persistent Connection
client server
SYN
SYN-ACK
ACKDAT
ACKDAT
ACKDAT
ACK
DAT
DAT
DAT
DATDAT
DATDAT
DAT
This parallel HTTP requests areimpossible in PC (since this requires multiple connections)
CS 587 High-Speed Networks
Padmanabhan/022
Solution #2: HTTP Pipelining
client server
SYN
SYN-ACK
ACKDAT
ACKDAT
ACKDAT
ACK
DAT
GET-ALL
DAT
DAT
DAT
DAT
• Parse the index.html
• Identify all the files needed for this page
• Request all files
Web Browser
CS 587 High-Speed Networks
Padmanabhan/023
Web Server
• URL: www.siue.edu
• Method: GETALL ***** HTTP/1.0
• HTTP header
• Parse the client request
• Take the requested action
HTTP 200 OK
Solution #2: HTTP Pipelining
A requested file A requested file A requested file
HTTP Header
FTTP Header contains “context-length” field
US Home
CNN Top
CS 587 High-Speed Networks
Padmanabhan/024
Solution #2: HTTP Pipelining
• HTTP Pipelining working with the client-side cache
Web Browser
CS 587 High-Speed Networks
Padmanabhan/025
Web Server
• URL: www.siue.edu
• Method: GETLIST ***** HTTP/1.0
• HTTP header
HTTP 200 OK
Solution #2: HTTP Pipelining
A requested file A requested fileA requested file
Only the files missing in the client’s cache will be requestedUsing HTTP Pipelining
CNN_icon.gif
US_Home.gifNetScape.gif
ToolBar.gif
Client-Side cache
• Parse the client request
• Take the requested action
CS 587 High-Speed Networks
Padmanabhan/026
Solution #3: HTTP Pre-Fetching
CNN TOP
US Home
Weather page
Travel page
CS 587 High-Speed Networks
Solution #3: HTTP Pre-Fetching
client server
SYN
SYN-ACK
ACKGETALL
ALLFILES
GETALL
ALLFILES
ALLFILES
GETALL
Initial TCP hand- shaking delay
• Requesting TOP page
• Browsing time
• Requesting US home page
• Browsing time
• Requesting weather page
Padmanabhan/027
CS 587 High-Speed Networks
Solution #3: HTTP Pre-Fetching
client server
SYN
SYN-ACK
ACKGETALL
ALLFILES
GETALL
ALLFILES
ALLFILES
GETALL
Initial TCP hand- shaking delay
• Requesting TOP page
• Browsing time
• Requesting US home page
• Browsing time
• Requesting weather page
Padmanabhan/028
Latency as observed by a web user
Latency as observed by a web user
Latency as observed by a web user
Utilize the time foruser’s browsing totransmit next data
CS 587 High-Speed Networks
Solution #3: HTTP Pre-Fetching
client server
SYN
SYN-ACK
ACKGETALL
ALLFILES
GETALL
ALLFILES
ALLFILES
GETALL
Initial TCP hand- shaking delay
• Requesting TOP page
• Browsing time
Padmanabhan/029
Latency as observed by a web user
• Requesting US home page
• Browsing time
• Requesting weather page
Latency as observed by a web user
Latency as observed by a web user
CS 587 High-Speed Networks
Solution #3: HTTP Pre-Fetching
client server
SYN
SYN-ACK
ACKGETALL
ALLFILES
GETALL
ALLFILES
ALLFILES
GETALL
Initial TCP hand- shaking delay
• Requesting TOP page
• Browsing time
Padmanabhan/030
Latency as observed by a web user
• Browsing time
CS 587 High-Speed Networks
Solution #3: HTTP Pre-Fetching
client server
SYN
SYN-ACK
ACKGETALL
ALLFILES
GETALL
ALLFILES
ALLFILES
GETALL
Initial TCP hand- shaking delay
• Requesting TOP page
• Browsing time
Padmanabhan/031
• Browsing time
Need to predict which files will be requested
Need to predict which files will be requested
CS 587 High-Speed Networks
Solution #3: HTTP Pre-Fetching
Padmanabhan/032
How can we predict next files to be requested by a web user?
New web customer
Files in USHome
Files in Weather Page
Files in Europe Home
0.5
0.2
0.2
0.3
0.2Files in
Another Page
Files in Another Page
0.25
0.25
index.html(Top page)
This figurealmost stolen from
Padmanabhan’s paper
This figurealmost stolen from
Padmanabhan’s paper
CS 587 High-Speed Networks
Solution #3: HTTP Pre-Fetching
Padmanabhan/033
How to calculate the probability of a group of files to be requested next?
Web Server
Requests from clients
Httpd
Prefecthd
OS/file-system
Log web requests
Prediction Window
CS 587 High-Speed Networks
Solution #3: HTTP Pre-Fetching
Padmanabhan/034
How to calculate the probability of a group of files to be requested next?
• Concept of “Prediction Window”
index.html(Top page)
- “Prediction Window” = An array of “slots”
- Each slot remembers a file requested
- Remember as many files as in the prediction window
CS 587 High-Speed Networks
Solution #3: HTTP Pre-Fetching
Padmanabhan/035
How to calculate the probability of a group of files to be requested next?
• The dependency (prediction) graph has an arch from a file A (or a group of files) to another file B, if and only if:
- B was accessed within w accesses after A
(w is the window size)
• The probability (weight) of an arc is the ratio of (the number of accesses to B) to (the number of accesses to A).
INOUT
Prediction Window as FIFO Queue
When a page entry is kicked put or re-inserted, all the files after the one is recorded