Page 1Peter A. Steenkiste, SCS, CMU1Lecture 3Applications andApplication RequirementsPeter SteenkisteSchool of Computer ScienceCarnegie Mellon University15-441 Networking, Spring 2004http://www.cs.cmu.edu/~prs/15-441Peter A. Steenkiste, SCS, CMU2Lecture Overviewz Application examples.» ftp» httpzApplication requirements.» “ilities”» SharingzInternet architecture discussion.Page 2Peter A. Steenkiste, SCS, CMU3Ftp: The File Transfer Protocolz Transfer file to/from remote hostz Client/server model» Client: side that initiates transfer (either to/from remote)» Server: remote hostz ftp: RFC 959z ftp server: port 21file transferFTPserverFTPuserinterfaceFTPclientlocal filesystemremote filesystemuser at hostPeter A. Steenkiste, SCS, CMU4Ftp: Separate Control, Data Connectionsz Ftp client contacts ftp server at port 21, specifying TCP as transport protocolz Two parallel TCP connections opened:» Control: exchange commands, responses between client, server.“out of band control”» Data: file data to/from serverz Ftp server maintains “state”: current directory, earlier authenticationFTPclientFTPserverTCP control connectionport 21TCP data connectionport 20Page 3Peter A. Steenkiste, SCS, CMU5Ftp Commands, ResponsesSample Commands:z sent as ASCII text over control channelz USER usernamez PASS passwordz LIST return list of files in current directoryz RETR filename retrieves (gets) filez STOR filename stores (puts) file onto remote hostSample Return Codesz status code and phrasez 331 Username OK, password requiredz 125 data connection already open; transfer startingz 425 Can’t open data connectionz 452 Error writing filePeter A. Steenkiste, SCS, CMU6HTTP Basicsz HTTP layered over bidirectional byte stream» Almost always TCPz Interaction» Client sends request to server, followed by response from server to client» Requests/responses are encoded in textz Stateless» Server maintains no information about past client requestsPage 4Peter A. Steenkiste, SCS, CMU7How to Mark End of Message?z Size of message Æ Content-Length» Must know size of transfer in advancez Delimiter Æ MIME style Content-Type» Server must “escape” delimiter in contentz Close connection» Only server can do thisPeter A. Steenkiste, SCS, CMU8HTTP RequestPage 5Peter A. Steenkiste, SCS, CMU9HTTP Requestz Request line» Method– GET – return URI– HEAD – return headers only of GET response– POST – send data to the server (forms, etc.)» URI– E.g. http://www.intel-iris.net/index.htmlwith a proxy– E.g. /index.html if no proxy» HTTP versionPeter A. Steenkiste, SCS, CMU10HTTP Requestz Request headers» Authorization – authentication info» Acceptable document types/encodings» From – user email» If-Modified-Since» Referrer – what caused this page to be requested» User-Agent – client softwarez Blank-linez BodyPage 6Peter A. Steenkiste, SCS, CMU11HTTP Request ExampleGET / HTTP/1.1Accept: */*Accept-Language: en-usAccept-Encoding: gzip, deflateUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)Host: www.intel-iris.netConnection: Keep-AlivePeter A. Steenkiste, SCS, CMU12HTTP Responsez Status-line» HTTP version» 3 digit response code– 1XX – informational– 2XX – successz 200 OK– 3XX – redirectionz 301 Moved Permanentlyz 303 Moved Temporarilyz 304 Not Modified– 4XX – client errorz 404 Not Found– 5XX – server errorz 505 HTTP Version Not Supported» Reason phrasePage 7Peter A. Steenkiste, SCS, CMU13HTTP Responsez 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-Modifiedz Blank-linez BodyPeter A. Steenkiste, SCS, CMU14HTTP Response ExampleHTTP/1.1 200 OKDate: Tue, 27 Mar 2001 03:49:38 GMTServer: Apache/1.3.14 (Unix) (Red-Hat/Linux) mod_ssl/2.7.1 OpenSSL/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…..Page 8Peter A. Steenkiste, SCS, CMU15Cookies: Keeping “state”Many major Web sites use cookiesFour components:1) Cookie header line in the HTTP response message2) Cookie header line in HTTP request message3) Cookie file kept on user’s host and managed by user’s browser4) Back-end database at Web siteExample:» Susan accesses Internet always from same PC» She visits a specific e-commerce site for the first time» When initial HTTP requests arrives at site, site creates a unique ID and creates an entry in backend database for IDPeter A. Steenkiste, SCS, CMU16Cookies: Keeping “State” (Cont.)clientAmazon serverusual http request msgusual http response +Set-cookie: 1678 usual http request msgcookie: 1678usual http response msgusual http request msgcookie: 1678usual http response msgcookie-specificactioncookie-specificactionservercreates ID1678 for userentry in backend databaseaccessaccessCookie fileamazon: 1678ebay: 8734Cookie fileebay: 8734Cookie fileamazon: 1678ebay: 8734one week later:Page 9Peter A. Steenkiste, SCS, CMU17Typical Workload (Web Pages)z Multiple (typically small) objects per page z File sizes» Why different than request sizes?» Also heavy-tailed– Pareto distribution for tail– Lognormal for body of distributionz Embedded references» Number of embedded objects = pareto – p(x) = akax-(a+1)Peter A. Steenkiste, SCS, CMU18HTTP 0.9/1.0z One request/response per TCP connection» Simple to implementz Disadvantages» Multiple connection setups Æ three-way handshake each time– Several extra round trips added to transfer» Multiple slow startsPage 10Peter A. Steenkiste, SCS, CMU19Single Transfer ExampleClientServerSYNSYNSYNSYNACKACKACKACKACKDATDATDATDATFINACK0 RTT1 RTT2 RTT3 RTT4 RTTServer reads from diskFINServer reads from diskClient opens TCP connectionClient sends HTTP request for HTMLClient parses HTMLClient opens TCP connectionClient sends HTTP request for imageImage begins to arrivePeter A. Steenkiste, SCS, CMU20Performance Issuesz Short transfers are hard on TCP» Stuck in slow start» Loss recovery is poor when windows are smallzLots of extra connections» Increases server state/processingzServer also forced to keep TIME_WAIT connection state» Why must server keep these?» Tends to be an order of magnitude greater than # of active connections,
View Full Document