Transcript Figure 6-1

Hypertext Transfer
Protocol (HTTP)
Madhusri Nayak
CISC 856: TCP/IP and Upper Layer Protocols
Fall 2004
Thanks to Dr. Amer, UDEL for some of the slides used in this presentation
Thanks to Forouzan for some slides used in this presentation
1
Motivation ?
Tim-Berners Lee
Created by Tim Berners-Lee at CERN (Centre
European pour Rechearche Nucleaire)
– physicists, not computer scientists
– to share data from physics experiments
– because ftp was “too heavy”
Aerial View of CERN
Standardized and much expanded by IETF
2
Basic HTTP Protocol
HTTP
HTTP
TCP
TCP
IP
IP
Link
Link
Physical
 Goal: transfer data
 Stateless, Application-layer protocol
 Request-Response Protocol, uses TCP port 80
3
HTTP Version
HTTP/<major>.<minor>
HTTP/0.9
HTTP/1.0
HTTP/1.1
4
Overview of a browser
User-Agent
(browser/client)
Origin Server
DNS query
URL
DNS Server
DNS response
HTTP request
TCP connection
HTTP response
optional TCP connections
5
6
A-PDU
Request Message
request line
headers
• 3 request methods:
GET, HEAD, POST
blank line
body
GET /pub/index.html HTTP/1.0
Date: Wed, 20 Mar 2002 10:00:02 GMT
From: [email protected]
User-Agent: Mozilla/4.03
7
Response Message
status line
headers
blank line
body
HTTP/1.1 200 OK
Date: Tue, 08 Oct 2002 00:31:35 GMT
Server: Apache/1.3.27 tomcat/1.0
Last-Modified: 7Oct2002 23:40:01 GMT
Accept-Ranges: bytes
Content-Length: 27723
Keep-Alive: timeout=5, max=300
Connection: Keep-Alive
Content-Type: text/html
8
Status Codes
200
201
202
204
301
302
304
400
401
403
404
500
501
502
503
OK
Created
Accepted
No Content
Moved Permanently
Moved Temporarily
Not Modified
Bad Request
Unauthorized
Forbidden
Not Found
Internal Server Error
Not Implemented
Bad Gateway
Service Unavailable
Classes:
1xx: Informational - not used, reserved for future
2xx: Success - action was successfully received,
understood, and accepted
3xx: Redirection - further action needed to complete
request
4xx: Client Error - request contains bad syntax or
cannot be fulfilled
5xx: Server Error - server failed to fulfill an
apparently valid request
9
Headers
Request Line
Status Line
General Headers
General Headers
Request Headers
Response Headers
Entity Headers
Entity Headers
A Blank Line
A Blank Line
Body
Body
10
Example Of Request/Response
11
Performance Issues
12
FTP vs. HTTP
13
FTP vs. HTTP
(cont’d)
14
HTTP/1.0 Nonpersistent Connections
Client
3-way
handshake
SYN
Server
SYN-ACK
ACK
GET URI HTTP/1.0
OK
client
parses
HTML
web page
web page
transferred
DATA
DATA
DATA
ACK
ACK
URL
web page
ACK
DATA ACK
ACK
ACK
FIN
connection
close
ACK
FIN
ACK
15
HTTP/1.0 Nonpersistent (cont’d)
Client
3-Way
Handshake
Web page
transfer
Server
SYN
SYN-ACK
ACK
URL
GET URI HTTP/1.0
OK
ACK
DATA ACK
DATA
DATA
ACK
DATA ACK
ACK
Web Page
with Image1
ACK
Client
parses
HTML web
page
connect
close
FIN
ACK
FIN
ACK
HTML file gets parsed
Image 1 will be issued
GET
SYN
3-Way
Handshake
image 1
transfer
SYN-ACK
ACK
GET IMAGE1 HTTP/1.0
OK
ACK
DATA ACK
DATA
DATA
ACK
DATA ACK
ACK
URL
image1
ACK
connect
close
FIN
ACK
FIN
ACK
16
Nonpersistent with parallel Connections
(a.k.a. Parallel Connections Hack)
Server
Client
SYN
3-Way
Handshake
SYN-ACK
ACK
GET URI HTTP/1.0
DATA
Transfer
OK
ACK
DATA
DATA
DATA
URL
ACK
DATA
ACK
DATA ACK
ACK
Client initiates new TCP connections for each
embedded object after parsing the HTML file
ACK
FIN
CONN.
Close
ACK
FIN
ACK
Server
Client
SYN
Server
Client
3-Way
Handshake
SYN
3-Way
Handshake
DATA
Transfer
SYNACK
ACK
GET URI
OK
ACK HTTP/1.0
DATA ACK
DATA
DATA
ACK
DATAACK
ACK
ACK
ACK
FIN
ACK
DATA
DATA
Transfer
ACK
GET URI
OK HTTP/1.0
ACK
DATA ACK
DATA
DATA
ACK
DATA
ACK
ACK
ACK
URL
DATA
FIN
FIN
CONN
. Close
URL
SYNACK
CONN.
Close
FIN
ACK
ACK
17
HTTP Delay Estimation
assume web page with 2 images
Non Persistent
Client
Server
Non Persistent with Parallel
Connections
Client
Server
Time Delay in RTTs = 4
Delay Due to Connection Request/Handshake
Delay Due to HTML Page Request
Time Delay in RTTs = 6
Delay Due to Object Request
18
Potential HTTP 1.0 Inefficiencies
 v1.0 fetches single URL per TCP connection
 Mean size of responses only a few thousand bytes
 inefficient use of available network bandwidth
 Server resources wasted
 User perceived latency is high
 TCP congestion control not used due to short transfers
19
HTTP/1.1 Default: Persistent
Connections
Client
Server
SYN
SYNACK
3-Way
Handsh
ake
ACK
GET URI
HTTP/1.0
OK-ACK
DATA
Transf
er
DATA
DATA
DATA
GET image 3
URL
DATA
GET URI
OK-ACK
HTTP/1.0
ACK
DATAACK
ACK
DATA
Transfer
ACK
Client parses HTML
GET image 1
GET URI
OK-ACK
HTTP/1.0
DATA
Transfer
DATA
DATA
DATA
ACK
DATA
ACK
ACK
ACK
GET URI
OK-ACK
HTTP/1.0
DATA
Transfer
DATA
DATA
DATA
ACK
DATA
ACK
ACK
ACK
DATA
Conn.
timeout
URL
DATA
CONN.
Close
GET image 2
DATA
DATA
DATA
ACK
DATA
ACK
ACK
ACK
URL
FIN
FIN
ACK
ACK
URL
DATA
• Either client or server can
close the connection
20
Why Persistent Connections?
 CPU time is saved in routers and hosts
 Reduced Network Congestion – fewer packets
 Reduced perceived latency on subsequent requests
21
Persistent with pipelining
Client
Server
SYN
3-Way
Handsh
ake
SYNACK
GET Image 1
ACK
OK-ACK GET Image 2
GET URI
HTTP/1.0
OK-ACK
DATA
Transf
er
URL
DATA
DATA
DATA
DATA
URL Image 1
URL Image 2
OK-ACK
ACK
DATAACK
ACK
ACK
Client parses HTML
DATA
Transfer
Image 1
DATA
Transfer
Image 1
DATA
DATA
DATA
ACK
DATA ACK
ACK
DATA
DATA
DATA
ACK
ACK
DATA ACK
ACK
Image 2
Image 2
ACK
FIN
CONN. Close
FIN
ACK
ACK
22
HTTP Delay Estimation
Persistent w/o pipelining
Client
Server
(cont’d)
Persistent with pipelining
Client
Server
Time Delay in RTTs = 3
Time Delay in RTTs = 4
Delay Due to Connection Request/Handshake
Delay Due to HTML Page Request
Delay Due to Object Request
23
Quantifying TCP connection overhead
Connection Length (bytes)
Figure 3-2: Throughput vs. connection length, RTT = 70 msec
24
Network Latency (seconds)
Experimental Results
(NP HTTP/1.0)
Number of in lined images
Figure 6-1: Latencies for a remote server, image size = 2544 bytes
25
Network Latency (seconds)
Experimental Results (contd..)
(NP HTTP/1.0)
Number of in lined images
Figure 6-2: Latencies for a remote server, image size = 45566 bytes
26
Questions?
30