1 / 41

CS 372 – introduction to computer networks* Wednesday June 30

Announcements: Assignment 2 is posted. CS 372 – introduction to computer networks* Wednesday June 30. * Based in part on slides by Bechir Hamdaoui and Paul D. Paulson. Acknowledgement: slides drawn heavily from Kurose & Ross. Principles of network applications app architectures

Download Presentation

CS 372 – introduction to computer networks* Wednesday June 30

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Announcements: Assignment 2 is posted. CS 372 – introduction to computer networks*Wednesday June 30 * Based in part on slides by Bechir Hamdaoui and Paul D. Paulson. Chapter 2, slide: Acknowledgement: slides drawn heavily from Kurose & Ross

  2. Principles of network applications app architectures app requirements Web and HTTP File transfer: FTP P2P file sharing Socket programming with TCP Chapter 2: Application layer Chapter 2, slide:

  3. www.someschool.edu/someDept/pic.gif path name host name Web and HTTP First some terminologies: • Web page consists of objects • Object can be HTML file, JPEG image, Java applet, audio file,… • Web page consists of base HTML-file which includes several referenced objects • Each object is addressable by a URL • Example URL (Uniform Resource Locator): Chapter 2, slide:

  4. HTTP: hypertext transfer protocol Web’s appl-layer protocol client/server model client: browser that requests, receives, “displays” Web objects server: Web server sends objects in response to requests HTTP 1.0: RFC 1945 HTTP 1.1: RFC 2068 HTTP overview: app architecture HTTP request PC running Explorer HTTP response HTTP request Server running Apache Web server HTTP response Mac running Navigator Chapter 2, slide:

  5. Uses TCP: client initiates TCP connection (creates socket) to server, port 80 server accepts TCP connection from client HTTP 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 HTTP overview (continued) aside • 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 Chapter 2, slide:

  6. Nonpersistent HTTP At most one object is sent over a TCP connection. HTTP/1.0 uses nonpersistent HTTP Persistent HTTP Multiple objects can be sent over single TCP connection between client and server. HTTP/1.1 uses persistent connections in default mode HTTP connections Chapter 2, slide:

  7. Suppose user enters URL www.someSchool.edu/someDepartment/home.index 1a. HTTP client initiates TCP connection to HTTP server (process) at www.someSchool.edu on port 80 Nonpersistent HTTP (contains text, references to 10 jpeg images) 1b. HTTP server at host www.someSchool.edu waiting for TCP connection at port 80. “accepts” connection, notifying client 2. HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants object someDepartment/home.index 3. HTTP server receives request message, forms response message containing requested object, and sends message into its socket time Chapter 2, slide:

  8. 5. HTTP client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects Nonpersistent HTTP (cont.) 4. HTTP server closes TCP connection. time 6.Steps 1-5 repeated for each of 10 jpeg objects Chapter 2, slide:

  9. initiate TCP connection RTT request file time to transmit file RTT file received time time Non-Persistent HTTP: Response time Definition of RTT (round trip time): time to send a small packet to travel from client to server and back. 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 = 2RTT + transmit time Chapter 2, slide:

  10. initiate TCP connection RTT request file time to transmit file RTT file received time time Non-Persistent HTTP: issues Nonpersistent HTTP: • Name some issues?? • requires 2 RTTs per object • E.g., a 10 object-page needs ~ 20 RTTs • Open/close TCP connection for each object => OS overhead • Any ideas for improvement? Chapter 2, slide:

  11. Persistent HTTP server leaves connection open after sending response subsequent HTTP messages between same client/server sent over open connection reduces response time Persistent without pipelining: client issues new request only when previous response has been received one RTT for each referenced object Persistent with pipelining: default in HTTP/1.1 client sends requests as soon as it encounters a referenced object as little as one RTT for all the referenced objects Persistent HTTP Chapter 2, slide:

  12. HTTP request message • two types of HTTP messages: request, response • HTTP request message: • ASCII (human-readable format) request line (GET, POST, HEAD commands) GET /somedir/page.html HTTP/1.1 Host: www.someschool.edu User-agent: Mozilla/4.0 Connection: close Accept-language:fr (extra carriage return, line feed) header lines Carriage return, line feed indicates end of message Chapter 2, slide:

  13. HTTP response message status line (protocol status code status phrase) HTTP/1.1 200 OK Connection close Date: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) Last-Modified: Mon, 22 Jun 1998 …... Content-Length: 6821 Content-Type: text/html data data data data data ... header lines Entity body: data, e.g., requested HTML file Chapter 2, slide:

  14. 200 OK request succeeded, requested object later in this message 301 Moved Permanently requested object moved, new location specified later in this message (Location:) 400 Bad Request request message not understood by server 404 Not Found requested document not found on this server 505 HTTP Version Not Supported HTTP response status codes In first line in server -> client response message. A few sample codes: Chapter 2, slide:

  15. 1. Telnet to your favorite Web server: Trying out HTTP (client side) for yourself Opens TCP connection: • to port 80 (default HTTP port) • at cis.poly.edu (~ IP address) • anything typed is sent there telnet cis.poly.edu 80 • 2. Type in a GET HTTP request: By typing this in (hit carriage return twice), you send this minimal (but complete) GET request to HTTP server GET /~ross/ HTTP/1.1 Host: cis.poly.edu 3. Look at response message sent by HTTP server! Try it at home or lab! Chapter 2, slide:

  16. initiate TCP connection RTT request file time to transmit file RTT file received time time Web and HTTP: Review Question • A HTTP request consists of: • 1 basic html object • 2 referenced JPEG objects • All objects of size = 106bits • RTT = 1 second • Transmission rate = 1Mbps • Consider transmission delay of objects only • Question: how long it takes to receive the entire page: • Non-persistent connection • Persistent without pipelining • Persistent with pipelining Chapter 2, slide:

  17. initiate TCP connection RTT request file time to transmit file RTT file received time time Web and HTTP: Review Question • A HTTP request consists of: • 1 basic html object • 2 referenced JPEG objects • All objects of size = 106bits • RTT = 1 second • Transmission rate = 1Mbps • Consider transmission delay of objects only • Answer: (transmit time = 1 sec) a) 3+3+3=9 sec initiate + request + transmit for each of all 3 b) 1+2+2+2=7 sec initiate + (request + transmit for each of all 3) c) 1+2+3=6 sec initiate + (request + transmit for basic) + (one request for 2 + two transmits, one for each of the 2 objects) Chapter 2, slide:

  18. Many major Web sites use cookies Four components: 1) cookie header line of HTTP response message 2) cookie header line in HTTP request message 3) cookie file kept on user’s host, managed by user’s browser 4) back-end database at Web site Example: Susan always access Internet always from PC visits specific e-commerce site for first time when initial HTTP requests arrives at site, site creates: unique ID entry in backend database for ID User-server state: cookies

  19. ebay 8734 usual http request msg Amazon server creates ID 1678 for user usual http response Set-cookie: 1678 create entry ebay 8734 amazon 1678 ebay 8734 amazon 1678 usual http request msg cookie: 1678 access cookie- specific action usual http response msg usual http response msg access usual http request msg cookie: 1678 cookie- spectific action Cookies: keeping “state” (cont.) client server cookie file backend database one week later:

  20. What cookies can bring: authorization shopping carts recommendations user session state (Web e-mail) Cookies (continued) aside • Cookies and privacy: • cookies permit sites to learn a lot about you • you may supply name and e-mail to sites • How to keep “state”: • protocol endpoints: maintain state at sender/receiver over multiple transactions • cookies: http messages carry state

  21. If page is needed, browser requests it from the Web cache Q: what if object not in cache?? cache requests object from origin server, then returns object to client HTTP request HTTP request HTTP response HTTP response HTTP request HTTP response Web caches (or proxy server) Goal: satisfy client request without involving origin server origin server Proxy server client client origin server Chapter 2, slide:

  22. cache acts as both client and server typically cache is installed by ISP (university, company, residential ISP) Why Web caching? reduce response time for client request reduce traffic on an institution’s access link. More about Web caching Chapter 2, slide:

  23. Assumptions avg. object size = 0.1x106bits avg. request rate from institution to origin servers = 10/sec Internet delay = 2 sec Consequences utilization on LAN = 10% (LAN: local area network) utilization on access link = 100% total delay = Internet delay + access delay + LAN delay = 2 sec + minutes + milliseconds Caching example origin servers public Internet 1 Mbps access link institutional network 10 Mbps LAN institutional cache Chapter 2, slide:

  24. possible solution increase bandwidth of access link to, say, 10 Mbps consequence utilization on LAN = 10% utilization on access link = 10% Total delay = Internet delay + access delay + LAN delay = 2 sec + msecs + msecs often a costly upgrade Caching example (cont) origin servers public Internet 10 Mbps access link institutional network 10 Mbps LAN institutional cache Chapter 2, slide:

  25. possible solution: web cache suppose hit rate is 0.4 consequence 40% requests will be satisfied almost immediately 60% requests satisfied by origin server utilization of access link reduced to 60% total avg delay will also be reduced Caching example (cont) origin servers public Internet 1 Mbps access link institutional network 10 Mbps LAN institutional cache Chapter 2, slide:

  26. Advantages are obvious: Reduce response time Reduce internet traffic Web cache (cont) • Solution • Upon receiving a web request, a cache must consult origin server to check whether the requested page is up-to-date • Conditional GET method • What: Sent by cache to origin server: check page status • When: For each new request: client checks with cache • Any problems with caches?? • Local cache copies of web pages may not be up-to-date?? • What do we do then? Chapter 2, slide:

  27. Goal: don’t send object if cache has up-to-date version How: cache specifies date of cached copy in HTTP request If-modified-since: <date> Server: response contains no object if cached copy is up-to-date: HTTP/1.0 304 Not Modified cache server HTTP request msg If-modified-since: <date> object not modified HTTP response HTTP/1.0 304 Not Modified HTTP request msg If-modified-since: <date> object modified HTTP response HTTP/1.0 200 OK <data> Conditional GET Chapter 2, slide:

  28. Principles of network applications Web and HTTP FTP P2P file sharing Socket programming with TCP Chapter 2: Application layer Chapter 2, slide:

  29. transfer file to/from remote host client/server model client: that initiates transfer (to or from remote) server: remote host ftp: RFC 959 FTP user interface FTP client FTP server FTP: the file transfer protocol file transfer user at host remote file system local file system Chapter 2, slide:

  30. FTP client contacts FTP server to open TCP control connection client browses remote directory by sending commands over the TCP control connection. TCP data connection port 20 FTP: separate control, data connections TCP control connection port 21 FTP client FTP server • when server receives file transfer command, server opens 2ndTCP data connection (for file) to client • after transferring one file, server closes TCP data connection. Chapter 2, slide:

  31. TCP control connection port 21 TCP data connection port 20 FTP client FTP server FTP: separate control, data connections • More on FTP • server opens a separate TCP data connection for each file to transfer • TCP control stays on • control connection: called: “out of band” • FTP server maintains “state”: current directory, earlier authent. => limit on concurrent connections Chapter 2, slide:

  32. Principles of network applications Web and HTTP FTP P2P file sharing Socket programming with TCP Chapter 2: Application layer Chapter 2, slide:

  33. There are 2 approaches Centralized: Client-server architecture Distributed: P2P architecture (e.g., BitTorrent) Bob server peers obtain list of peers trading chunks peer Alice File sharing approaches server Chapter 2, slide:

  34. File sharing: P2P vs. client-server architectures Client-Server Single point of failure Not scalable More secure Bottleneck P2P Fault-tolerant Scalable Less secure Better Robustness to failure Scalability Security Performance Chapter 2, slide:

  35. us: server upload bandwidth Server ui: client/peer i upload bandwidth u2 u1 d1 d2 us di: client/peer i download bandwidth File, size F dN Network (with abundant bandwidth) uN Comparing Client-Server, P2P architectures Question : What is the file distribution time: from one server to N hosts? Chapter 2, slide:

  36. Time to distribute F to N clients using client/server approach = dcs> max {NF/us, F/min(di)} i Client-server: file distribution time Server • server sequentially sends N copies: • NF/ustime • client i takes F/di time to download u2 F u1 d1 d2 us Network (with abundant bandwidth) dN uN increases linearly in N (for large N) lower bound is also achievable Chapter 2, slide:

  37. dP2P > max {F/us, F/min(di) , NF/(us + Sui) } i=1,N P2P: file distribution time Server • server must send one copy: F/ustime • client i takes F/di time to download u2 F u1 d1 d2 us Network (with abundant bandwidth) dN • NF bits must be downloaded • - NF bits must be uploaded • - Fastest possible upload rate • (assuming all nodes sending file chunks to same peer) is: • us + Sui uN i=1,N Chapter 2, slide:

  38. Comparing Client-server, P2P architectures Chapter 2, slide:

  39. Principles of network applications app architectures app requirements Web and HTTP FTP P2P file sharing Socket programming with TCP (assignment 2) Chapter 2: Application layer Chapter 2, slide:

  40. Building a Multi-Threaded Web Server Read Chapter 2, Section 7 first Good examples on how to write socket-programs in Java using TCP Then do your assignment Socket/Java programming: relatively simple and easy to do Assignment 2- programming part Chapter 2, slide:

  41. application architectures client-server P2P application service requirements: reliability, bandwidth, delay Internet transport service model connection-oriented, reliable: TCP unreliable, datagrams: UDP our study of network apps now complete! Chapter 2: Summary • specific protocols: • HTTP • FTP • P2P • socket programming (assignment 2) Chapter 2, slide:

More Related