HTTP overview(continued) uses TCP: HTTP is client initiates TCP “stateless” connection (creates server maintains no socket)to server,port information about 80 past client requests server accepts TCP aside- connection from client protocols that maintain HTTP messages “state”are complex! (application-layer past history(state)must be maintained protocol messages) if server/client crashes,their exchanged between views of“state”may be browser(HTTP client) inconsistent,must be and Web server(HTTP reconciled server) TCP connection closed Application Layer 2-21
Application Layer 2-21 HTTP overview (continued) uses TCP: client initiates TCP connection (creates socket) to server, port 80 server accepts TCP connection from client HTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server) TCP connection closed HTTP is “stateless” server maintains no information about past client requests protocols that maintain “state” are complex! past history (state) must be maintained if server/client crashes, their views of “state” may be inconsistent, must be reconciled aside
HTTP connections non-persistent HTTP persistent HTTP 必 at most one object multiple objects can sent over TCP be sent over single connection TCP connection connection then between client, closed server downloading multiple objects required multiple connections Application Layer 2-22
Application Layer 2-22 HTTP connections non-persistent HTTP at most one object sent over TCP connection connection then closed downloading multiple objects required multiple connections persistent HTTP multiple objects can be sent over single TCP connection between client, server
Non-persistent HTTP suppose user enters URL: (contains text, www.someSchool.edu/someDepartment/home.index references to 10 jpeg images) 1a.HTTP client initiates TCP connection to HTTP server (process)at 1b.HTTP server at host www.someSchool.edu on port www.someSchool.edu 80 waiting for TCP connection at port80.“accepts” 2.HTTP client sends HTTP connection,notifying client request message(containing URL)into TCP connection 3.HTTP server receives socket.Message indicates request message,forms that client wants object response message someDepartment/home.inde containing requested object, X and sends message into its time socket ↓ Application Layer 2-23
Application Layer 2-23 Non-persistent HTTP suppose 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.inde x 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 (contains text, references to 10 jpeg images) www.someSchool.edu/someDepartment/home.index
Non-persistent HTTP(cont. 4.HTTP server closes TCP connection. 5.HTTP client receives response message containing html file, displays html.Parsing html file, finds 10 referenced jpeg objects time 6.Steps 1-5 repeated for each of 10 jpeg objects Application Layer 2-24
Application Layer 2-24 Non-persistent HTTP (cont.) 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 HTTP response time: initiate TCP one RTT to initiate TCP connection connection RTT 必 one RTT for HTTP request file request and first few bytes RTT time to of HTTP response to transmit file return file file transmission time received non-persistent HTTP response time time time 2RTT+file transmission time Application Layer 2-25
Application Layer 2-25 Non-persistent HTTP: response time RTT (definition): time for a small packet to travel from client to server and back HTTP response time: one RTT to initiate TCP connection one RTT for HTTP request and first few bytes of HTTP response to return file transmission time non-persistent HTTP response time = 2RTT+ file transmission time time to transmit file initiate TCP connection RTT request file RTT file received time time