115-441 Computer NetworkingLecture 25 – The WebLecture 19: 2006-11-02 2Outline• HTTP review and details (more in notes)• Persistent HTTP review• HTTP caching• Content distribution networksLecture 19: 2006-11-02 3HTTP Basics (Review)• HTTP layered over bidirectional byte stream• Almost always TCP• Interaction• Client sends request to server, followed byresponse from server to client• Requests/responses are encoded in text• Stateless• Server maintains no information about pastclient requestsLecture 19: 2006-11-02 4How to Mark End of Message? (Review)• Size of message Content-Length• Must know size of transfer in advance• Delimiter MIME-style Content-Type• Server must “escape” delimiter in content• Close connection• Only server can do thisLecture 19: 2006-11-02 5HTTP Request (review)• Request line• Method• GET – return URI• HEAD – return headers only of GET response• POST – send data to the server (forms, etc.)• URL (relative)• E.g., /index.html• HTTP versionLecture 19: 2006-11-02 6HTTP Request (cont.) (review)• Request headers• Authorization – authentication info• Acceptable document types/encodings• From – user email• If-Modified-Since• Referrer – what caused this page to berequested• User-Agent – client software• Blank-line• Body2Lecture 19: 2006-11-02 7HTTP Request (review)Lecture 19: 2006-11-02 8HTTP Request Example (review)GET / HTTP/1.1Accept: */*Accept-Language: en-usAccept-Encoding: gzip, deflateUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT5.0)Host: www.intel-iris.netConnection: Keep-AliveLecture 19: 2006-11-02 9HTTP Response (review)• Status-line• HTTP version• 3 digit response code• 1XX – informational• 2XX – success• 200 OK• 3XX – redirection• 301 Moved Permanently• 303 Moved Temporarily• 304 Not Modified• 4XX – client error• 404 Not Found• 5XX – server error• 505 HTTP Version Not Supported• Reason phraseLecture 19: 2006-11-02 10HTTP Response (cont.) (review)• Headers• Location – for redirection• Server – server software• WWW-Authenticate – request for authentication• Allow – list of methods supported (get, head, etc)• Content-Encoding – E.g x-gzip• Content-Length• Content-Type• Expires• Last-Modified• Blank-line• BodyLecture 19: 2006-11-02 11HTTP Response Example (review)HTTP/1.1 200 OKDate: Tue, 27 Mar 2001 03:49:38 GMTServer: Apache/1.3.14 (Unix) (Red-Hat/Linux) mod_ssl/2.7.1OpenSSL/0.9.5a DAV/1.0.2 PHP/4.0.1pl2 mod_perl/1.24Last-Modified: Mon, 29 Jan 2001 17:54:18 GMTETag: "7a11f-10ed-3a75ae4a"Accept-Ranges: bytesContent-Length: 4333Keep-Alive: timeout=15, max=100Connection: Keep-AliveContent-Type: text/html…..Lecture 19: 2006-11-02 12Outline• HTTP intro and details• Persistent HTTP• HTTP caching• Content distribution networks3Lecture 19: 2006-11-02 13Typical Workload (Web Pages)• Multiple (typically small) objects per page• File sizes• Heavy-tailed• Pareto distribution for tail• Lognormal for body of distribution-- For reference/interest only --• Embedded references• Number of embedded objects =pareto – p(x) = akax-(a+1)Lecture 19: 2006-11-02 14HTTP 0.9/1.0 (mostly review)• One request/response per TCP connection• Simple to implement• Disadvantages• Multiple connection setups three-wayhandshake each time• Several extra round trips added to transfer• Multiple slow startsLecture 19: 2006-11-02 15Single Transfer ExampleClientServerSYNSYNSYNSYNACKACKACKACKACKDATDATDATDATFINACK0 RTT1 RTT2 RTT3 RTT4 RTTServer reads fromdiskFINServer reads fromdiskClient opens TCPconnectionClient sends HTTP requestfor HTMLClient parses HTMLClient opens TCPconnectionClient sends HTTP requestfor imageImage begins to arriveLecture 19: 2006-11-02 16More Problems• Short transfers are hard on TCP• Stuck in slow start• Loss recovery is poor when windows are small• Lots of extra connections• Increases server state/processing• Server also forced to keep TIME_WAITconnection state-- Things to think about --• Why must server keep these?• Tends to be an order of magnitude greater than # ofactive connections, why?Lecture 19: 2006-11-02 17Persistent Connection Solution (review)• Multiplex multiple transfers onto one TCP connection• How to identify requests/responses• Delimiter Server must examine response for delimiter string• Content-length and delimiter Must know size of transfer inadvance• Block-based transmission send in multiple length delimitedblocks• Store-and-forward wait for entire response and then usecontent-length• Solution use existing methods and close connection otherwiseLecture 19: 2006-11-02 18Persistent Connection Example (review)ClientServerACKACKDATDATACK0 RTT1 RTT2 RTTServer reads fromdiskClient sends HTTP requestfor HTMLClient parses HTMLClient sends HTTP requestfor imageImage begins to arriveDATServer reads fromdiskDAT4Lecture 19: 2006-11-02 19Persistent HTTP (review)Nonpersistent HTTP issues:• Requires 2 RTTs per object• OS must work and allocatehost resources for each TCPconnection• But browsers often openparallel TCP connections tofetch referenced objectsPersistent HTTP• Server leaves connectionopen after sending response• Subsequent HTTP messagesbetween same client/serverare sent over connectionPersistent without pipelining:• Client issues new requestonly when previousresponse has been received• One RTT for eachreferenced objectPersistent with pipelining:• Default in HTTP/1.1• Client sends requests assoon as it encounters areferenced object• As little as one RTT for allthe referenced objectsLecture 19: 2006-11-02 20Outline• HTTP intro and details• Persistent HTTP-- new stuff --• HTTP caching• Content distribution networksLecture 19: 2006-11-02 21HTTP Caching• Clients often cache documents• Challenge: update of documents• If-Modified-Since requests to check• HTTP 0.9/1.0 used just date• HTTP 1.1 has an opaque “entity tag” (could be a file signature,etc.) as well• When/how often should the original be checkedfor changes?• Check every time?• Check each session? Day? Etc?• Use Expires header• If no Expires, often use Last-Modified as estimateLecture 19: 2006-11-02 22Example Cache Check RequestGET / HTTP/1.1Accept: */*Accept-Language: en-usAccept-Encoding: gzip, deflateIf-Modified-Since: Mon, 29 Jan 2001 17:54:18 GMTIf-None-Match:
View Full Document