HTTP connections:two types Non-persistent HTTP Persistent HTTP 1.TCP connection opened -TCP connection opened to 2.at most one object sent a server over TCP connection -multiple objects can be 3.TCP connection closed sent over single TCP connection between client, downloading multiple and that server objects required multiple -TCP connection closed connections Application Layer:2-21
HTTP connections: two types Application Layer: 2-21 Non-persistent HTTP 1. TCP connection opened 2. at most one object sent over TCP connection 3. TCP connection closed downloading multiple objects required multiple connections Persistent HTTP ▪TCP connection opened to a server ▪multiple objects can be sent over single TCP connection between client, and that server ▪TCP connection closed
Non-persistent HTTP:example User enters URL:www.someschool.edu/someDepartment/home.index (containing text,references to 10 jpeg images) 1a.HTTP client initiates TCP connection to HTTP server 1b.HTTP server at host (process)at www.someSchool.edu on www.someSchool.edu waiting for TCP port 80 connection at port&0“accepts” connection,notifying client 2.HTTP client sends HTTP request message (containing URL)into TCP connection 3.HTTP server receives request message, socket.Message indicates forms response message containing time that client wants object requested object,and sends message someDepartment/home.index into its socket Application Layer:2-22
Non-persistent HTTP: example Application Layer: 2-22 User enters URL: 1a. HTTP client initiates TCP connection to HTTP server (process) at www.someSchool.edu on port 80 2. HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants object someDepartment/home.index 1b. HTTP server at host www.someSchool.edu waiting for TCP connection at port 80 “accepts” connection, notifying client 3. HTTP server receives request message, forms response message containing requested object, and sends message into its socket time (containing text, references to 10 jpeg images) www.someSchool.edu/someDepartment/home.index
Non-persistent HTTP:example(cont.) User enters URL:www.someschool.edu/someDepartment/home.index (containing text,references to 10 jpeg images) 4.HTTP server closes TCP 5.HTTP client receives response connection. message containing html file, displays html.Parsing html file, finds 10 referenced jpeg objects 6.Steps 1-5 repeated for each of 10 jpeg objects time Application Layer:2-23
Non-persistent HTTP: example (cont.) Application Layer: 2-23 User enters URL: (containing text, references to 10 jpeg images) www.someSchool.edu/someDepartment/home.index 5. HTTP client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects 6. Steps 1-5 repeated for each of 10 jpeg objects 4. HTTP server closes TCP connection. time
Non-persistent HTTP:response time RTT(definition):time for a small packet to travel from client to server and back initiate TCP connection HTTP response time (per object): RTT. one RTT to initiate TCP connection request file one RTT for HTTP request and first few bytes of HTTP response to return RTT time to transmit obect/file transmission time file received file time time Non-persistent HTTP response time 2RTT+file transmission time Application Layer:2-24
Non-persistent HTTP: response time Application Layer: 2-24 RTT (definition): time for a small packet to travel from client to server and back HTTP response time (per object): ▪ one RTT to initiate TCP connection ▪ one RTT for HTTP request and first few bytes of HTTP response to return ▪ obect/file transmission time time to transmit file initiate TCP connection RTT request file RTT file received time time Non-persistent HTTP response time = 2RTT+ file transmission time
Persistent HTTP(HTTP1.1) Non-persistent HTTP issues: Persistent HTTP (HTTP1.1): requires 2 RTTs per object server leaves connection open after OS overhead for each TCP sending response connection subsequent HTTP messages browsers often open multiple between same client/server sent parallel TCP connections to over open connection fetch referenced objects in client sends requests as soon as it parallel encounters a referenced object as little as one RTT for all the referenced objects(cutting response time in half) Application Layer:2-25
Persistent HTTP (HTTP 1.1) Application Layer: 2-25 Non-persistent HTTP issues: ▪ requires 2 RTTs per object ▪OS overhead for each TCP connection ▪ browsers often open multiple parallel TCP connections to fetch referenced objects in parallel Persistent HTTP (HTTP1.1): ▪ server leaves connection open after sending response ▪ subsequent HTTP messages between same client/server sent over open connection ▪ client sends requests as soon as it encounters a referenced object ▪ as little as one RTT for all the referenced objects (cutting response time in half)