28
H yper T ext T ransfer P rotocol (HTTP) RICHI GUPTA CISC 856: TCP/IP and Upper Layer Protocols Fall 2007 Thanks to Dr. Amer, UDEL for some of the slides used in this presentation Thanks to Madhusri Nayak for some of the slides used in this presentation

H yper T ext T ransfer P rotocol ( HTTP )

Embed Size (px)

DESCRIPTION

H yper T ext T ransfer P rotocol ( HTTP ). RICHI GUPTA CISC 856: TCP/IP and Upper Layer Protocols Fall 2007. Thanks to Dr. Amer, UDEL for some of the slides used in this presentation Thanks to Madhusri Nayak for some of the slides used in this presentation. Motivation ?. - PowerPoint PPT Presentation

Citation preview

Page 1: H yper T ext  T ransfer  P rotocol  ( HTTP )

HyperText Transfer Protocol

(HTTP)

RICHI GUPTA

CISC 856: TCP/IP and Upper Layer Protocols

Fall 2007

Thanks to Dr. Amer, UDEL for some of the slides used in this presentation

Thanks to Madhusri Nayak for some of the slides used in this presentation

Page 2: H yper T ext  T ransfer  P rotocol  ( HTTP )

Motivation ?

Single informational network

Light protocol

SpeedTim-Berners Lee

Director of the W3CHTTP Versions

Format : HTTP/<major>.<minor> HTTP/0.9 – No RFC

HTTP/1.0 – RFC 1945

HTTP/1.1 – RFC 2616

2

Page 3: H yper T ext  T ransfer  P rotocol  ( HTTP )

Position of HTTP in the TCP/IP Protocol suite

HTTP

TCP

Application-layer

Transport layer

Network layer

Data link layer

Physical layer

IGMP ICMP

ARP RARP

IP

Underlying LAN or WAN

3

Page 4: H yper T ext  T ransfer  P rotocol  ( HTTP )

Request –Response Protocol

Origin Server

URL

User-Agent (browser/client)

HTTP response

DNS response

HTTP request

DNS ServerDNS query

TCP connection

optional TCP connections

4

Page 5: H yper T ext  T ransfer  P rotocol  ( HTTP )

GET , HEAD, POST, PUT , TRACE , CONNECT , OPTION

URLHTTP

version

space space

Request Line Request Type

Request Type

Header Name Header format :

Header Value

General Header Date , Pragma, Cache control ,Connection, MIME-version, Upgrade, Transfer encoding

space

Request Header From, Referer, User-agent, Authorization, If-Modified-Since, Accept *

Entity Header Content-length, Content-type, Content- encoding, Last-modified, Expires, Upgrade

Response Header Location, Age, Retry-after, Server

A-PDU format (cont’d)

6

Page 6: H yper T ext  T ransfer  P rotocol  ( HTTP )

1xx: Informational Continue (100) , Switching Protocols(101)

2xx: Success - action was successfully received, understood, and accepted Created (201), Accepted (202), No Content (204), OK (200)

3xx: Redirection - further action needed to complete request Moved Permanently (301) , Moved Temporarily (302), Not Modified (304)

4xx: Client Error - request contains bad syntax or cannot be fulfilled Bad Request (400), Unauthorized (401), Forbidden (403), Not Found (404)

5xx: Server Error - server failed to fulfill an apparently valid request Internal Server Error (500), Not Implemented (501), Bad Gateway (502),

Service Unavailable (503)

Status Code

Status Phrase

HTTP Version

Status Line

space spaceA-PDU format Cont’d…

7

Page 7: H yper T ext  T ransfer  P rotocol  ( HTTP )

Example Of Request/Response

Note: Headers are in ascii format.8

Page 8: H yper T ext  T ransfer  P rotocol  ( HTTP )

4 variations of HTTP

Nonpersistent with one connection Nonpersistent with parallel connections Persistent without pipelining Persistent with pipelining

Page 9: H yper T ext  T ransfer  P rotocol  ( HTTP )

Nonpersistent (HTTP /1.0 default)

Page 10: H yper T ext  T ransfer  P rotocol  ( HTTP )

SYN

SYN-ACK

ACK

Client Server

GET web page HTTP/1.0

OK

Web page transferred

3-way handshake

Connection close

Get web page

Web page

Client parses HTML web page

FIN

1.Found referenced object “Image 1”2. Found referenced object “Image 2”

Ack

Data

11

ACK

ACK

FIN

Page 11: H yper T ext  T ransfer  P rotocol  ( HTTP )

Nonpersistent (cont’d)

Ack

Data

12

SYN

SYN-ACKACK

Client Server

GET image1 HTTP/1.0

OK

FIN

Image 1 Transferred

Connection close

3-Way Handshake Get image1

FINACK

ACK

Image1

SYN

SYN-ACKACK

Client Server

GET image2 HTTP/1.0

OK

FIN

Image 2

Transferred

Connection close

3-Way Handshake Get image2

FINACK

ACK

Image2

Page 12: H yper T ext  T ransfer  P rotocol  ( HTTP )

Key points

13

Connection does not persist for other objects

Connections are sequential

Page 13: H yper T ext  T ransfer  P rotocol  ( HTTP )

Rough calculation for number of RTTSClient Server

Delay due to connection request/handshake

Delay Due to HTML Page Request

Delay Due to Object Request

Time delay in RTTs = 6

Can we reduce the number of RTTS?

Web Page

Image 1

Image 2

14

Page 14: H yper T ext  T ransfer  P rotocol  ( HTTP )

Nonpersistent with parallel connections( browser dependent)

15

Page 15: H yper T ext  T ransfer  P rotocol  ( HTTP )

Ack

Data16

Parallel connections

SYN

SYN-ACK

ACK

Client Server

GET web page HTTP/1.0

OK

FIN

Web page Transferred

Connection close

3-Way Handshake

Get web page

FIN

ACK

ACK

Web page

SYN

SYN-ACK

Client Server

GET image1 HTTP/1.0

OK

FIN

Image 1 Transferred

Connection close

3-Way Handshake

Get image1

FIN

ACK

ACK

Image1

SYN

SYN-ACK

ACK

Client Server

GET image2 HTTP/1.0

OK

FIN

Image 2

Transferred

Connection close

3-Way Handshake

Get image2

FIN

ACK

ACK

Image2

Client parses HTML web page

1. Referenced object “Image 1”2. Referenced object “Image 2”

Page 16: H yper T ext  T ransfer  P rotocol  ( HTTP )

Rough calculation

Client Server

Time delay in RTTs = 4 Delay due to connection request/handshake

Delay due to HTML page request

Delay due to object request

17

Web page

Image1 & Image2

Page 17: H yper T ext  T ransfer  P rotocol  ( HTTP )

Disadvantages:

overhead of multiple TCP connections A busy server could end up with lots of connections in the ‘TIME-

WAIT’ state Seldom does each connection get past the ‘slow-start’ region

failure to use the full end-to-end available bandwidth extra time opening connections increases user-perceived latency

Can HTTP be further improved?

18

Page 18: H yper T ext  T ransfer  P rotocol  ( HTTP )

Persistent without pipelining

Page 19: H yper T ext  T ransfer  P rotocol  ( HTTP )

FIN

Connection close

ACKFIN

ACK

Time Out

Ack

Data

20

SYN

SYN-ACK

Client Server

GET web page HTTP/1.1

OKWeb page Transferred

3-Way Handshake Get web page

Web page

GET image2 HTTP/1.1

OK Image 2 Transferred

Get image2

Image2

GET image1 HTTP/1.1

OK Image 1 Transferred

Get image1

Image1

Note: 1) Requests are sequential 2) Timer is at application layer

Timer started

Timer started

Timer startedTimer started

Page 20: H yper T ext  T ransfer  P rotocol  ( HTTP )

Rough calculation

21

Client Server

Time delay in RTTs = 4Delay due to connection request/handshake

Delay due to HTML page request

Delay due to object request

Web page

Image1

Image2

Page 21: H yper T ext  T ransfer  P rotocol  ( HTTP )

Persistent with pipelining

22

Page 22: H yper T ext  T ransfer  P rotocol  ( HTTP )

Client parses

web page;

Gets Image 1

Gets Image 2

FIN

Connection close FIN

ACK

ACK

Back to back requests

Ack

Data23

SYN

SYN-ACK

Client Server

GET webpage HTTP/1.1

OKWeb page Transferred

3-Way Handshake Get web

page

Web page

Image 2

OK Image 2

Get image1Get image2

GET image1 HTTP/1.1

GET image2 HTTP/1.1ACKACK

Image 1

Image 1OK

Time Out

Timer started

Timer started

Page 23: H yper T ext  T ransfer  P rotocol  ( HTTP )

Rough calculation

Client Server

24

Time delay in RTTs = 3

24

Delay due to connection request/handshake

Delay due to HTML page request

Delay due to object request

Web page

Image1 & Image2

Page 24: H yper T ext  T ransfer  P rotocol  ( HTTP )

Advantages:

fewer connections • Reduced network traffic • CPU time is saved in routers and hosts

Reduced perceived latency on subsequent requests

Either client or server can close the connection

Disadvantages:

Connections stay open longer at the server

25

Page 25: H yper T ext  T ransfer  P rotocol  ( HTTP )

Figure 6-1: Latencies for a remote server, image size = 2544 bytes

Experimental Results

(NP HTTP/1.0) without parallel connections

Number of in lined images

Net

wor

k La

tenc

y (s

econ

ds)

27

(Persistent without pipelining)

(Persistent with pipelining)

Page 26: H yper T ext  T ransfer  P rotocol  ( HTTP )

Figure 6-2: Latencies for a remote server, image size = 45566 bytes

Experimental Results (cont’d)

Number of in lined images

Net

wor

k La

tenc

y (s

econ

ds)

28

(Persistent without pipelining)

(Persistent with pipelining)

(NP HTTP/1.0) without parallel connections

Page 27: H yper T ext  T ransfer  P rotocol  ( HTTP )

Summary: 4 variations of HTTP

Nonpersistent with 1 connectionOne TCP connection at a timeServer initiates connection close

Nonpersistent with parallel connectionsMore than one TCP connection at a timeServer initiates connection close

Persistent without pipelining One TCP connection at a time Sequential requests of embedded web page objects Server or client initiates connection close

Persistent with pipelining One TCP connection at a time Back to back requests for embedded web page objects Server or client initiates connection close

Page 28: H yper T ext  T ransfer  P rotocol  ( HTTP )

Questions?

35

Do you know?

IE will only open 2 parallel HTTP connections to a named server by default

Do you know?

Firefox will open 4 parallel HTTP connections to a named server by default

Do you know?

Pipelining is implemented entirely at the browser end.

Thanks