Download presentation
Presentation is loading. Please wait.
Published byEunice Mosley Modified over 9 years ago
1
2: Application Layer1 Chapter 2 Application Layer Computer Networking: A Top Down Approach Featuring the Internet, 2 nd edition. Jim Kurose, Keith Ross Addison-Wesley, July 2002. A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students, readers). They’re in powerpoint form so you can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following: If you use these slides (e.g., in a class) in substantially unaltered form, that you mention their source (after all, we’d like people to use our book!) If you post any slides in substantially unaltered form on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material. Modifications made by Brigitte, Melissa, and Amy. Thanks and enjoy! JFK/KWR All material copyright 1996-2002 J.F Kurose and K.W. Ross, All Rights Reserved
2
2: Application Layer2 Chapter 2 outline r 2.1 Principles of app layer protocols m clients and servers m app requirements r 2.2 Web and HTTP r 2.3 FTP r 2.4 Electronic Mail m SMTP, POP3, IMAP r 2.5 DNS r 2.6 Socket programming with TCP r 2.7 Socket programming with UDP r 2.8 Building a Web server r 2.9 Content distribution m Network Web caching m Content distribution networks m P2P file sharing
3
2: Application Layer3 Building a simple Web server r handles one HTTP request r accepts the request r parses header r obtains requested file from server’s file system r creates HTTP response message: m header lines + file r sends response to client r after creating server, you can request file using a browser (eg IE explorer) r see text for details
4
2: Application Layer4 Web server code in Java import java.io.*; import java.net.*; import java.util.*; class WebServer { public static void main(String argv[]) throws Exception { String requestMessageLine; String fileName; ServerSocket listenSocket = new ServerSocket(6789); Socket connectionSocket = listenSocket.accept(); BufferedReader inFromClient = new BufferedReader(new InputStreamReader(connectionSocket.getInputStream())); DataOutputStream outToClient = newDataOutputStream(connectionSocket.getOutputStream());
5
2: Application Layer5 Webserver Code in Java (2) requestMessageLine = inFromClient.readLine(); // client sends GET file_name HTTP/1.0 StringTokenizer tokenizedLine = new StringTokenizer(requestMessageLine); if (tokenizedLine.nextToken().equals)(“GET”)) { fileName = tokenizedLine.nextToken(); if (fileName.startsWith(“/”) == true) fileName = fileName.substring(1); FileInputStream inFile = new FileInputStream(fileName); byte[] fileInBytes = new byte[numOfBytes]; inFile.read(fileInBytes);
6
2: Application Layer6 Webserver Code in Java (3) outToClient.writeBytes(“HTTP/1.0 200 Document Follows\r\n”); if (fileName.endsWith(“.jpg”)) outToClient.writeBytes(“Content-Type: image/jpeg\r\n”); if (fileName.endsWith(“.gif”)) outToClient.writeBytes(“Content-Type: image/gif\r\n”); outToClient.writeBytes(“Content-Length: “ + numOfBytes + “\r\n”); outToClient.writeBytes(“\r\n”); outToClient.write(fileInBytes, 0, numOfBytes); connectionSocket.close();
7
2: Application Layer7 Chapter 2 outline r 2.1 Principles of app layer protocols m clients and servers m app requirements r 2.2 Web and HTTP r 2.3 FTP r 2.4 Electronic Mail m SMTP, POP3, IMAP r 2.5 DNS r 2.6 Socket programming with TCP r 2.7 Socket programming with UDP r 2.8 Building a Web server r 2.9 Content distribution m Network Web caching m Content distribution networks m P2P file sharing
8
2: Application Layer8 Why Might Access time be Slow?
9
2: Application Layer9 Why Might Access Time be Slow? r The path the object must follow is a low- speed link r The path the object file must follow contains at least 1 congested link. (queuing delays & dropped packets) r Web server that contains the desired object called the origin server is overloaded with requests causing long delays.
10
2: Application Layer10 Web caches (aka Proxy Servers) r user sets browser: Web accesses via cache r browser sends all HTTP requests to proxy server m object in cache: cache returns object m Object not in cache: requests object from origin server, then returns object to client Goal: satisfy client request without involving origin server client Proxy server client HTTP request HTTP response HTTP request HTTP response origin server origin server
11
2: Application Layer11 Diagram origin servers public Internet institutional network 10 Mbps LAN 1.5 Mbps access link institutional cache
12
2: Application Layer12 More about Web caching r Cache acts as both client and server Cache can do up-to- date check using If- modified-since HTTP header r Typically cache is installed by ISP (university, company, residential ISP) Why Web caching? r Reduce response. r Reduce traffic on institution’s access link. r Internet dense with caches enables “poor” content providers to effectively deliver content r Less costly to upgrade
13
2: Application Layer13 Caching Comparison Assumptions r average object size = 100,000 bits r avg. request rate from institution’s browser to origin serves = 15/sec r delay from institutional router to any origin server and back to router = 2 sec Consequences r utilization on LAN = 15% r utilization on access link = 100% r total delay = Internet delay + access delay + LAN delay = 2 sec + minutes + milliseconds origin servers public Internet institutional network 10 Mbps LAN 1.5 Mbps access link institutional cache
14
2: Application Layer14 Caching Comparison Possible solution r increase bandwidth of access link to, say, 10 Mbps Consequences r utilization on LAN = 15% r utilization on access link = 15% r Total delay = Internet delay + access delay + LAN delay = 2 sec + msecs + msecs r often a costly upgrade origin servers public Internet institutional network 10 Mbps LAN 10 Mbps access link institutional cache
15
2: Application Layer15 Solution-Caching Install cache r suppose hit rate is.4 Consequence r 40% requests will be satisfied almost immediately r 60% requests satisfied by origin server r utilization of access link reduced to 60%, resulting in negligible delays (say 10 msec) r total delay = Internet delay + access delay + LAN delay =.6*2 sec +.6*.01 secs + milliseconds < 1.3 secs origin servers public Internet institutional network 10 Mbps LAN 1.5 Mbps access link institutional cache
16
2: Application Layer16 How Good is Caching?
17
2: Application Layer17 CDN’s vs. Web Cache Assist Content providers ex.Yahoo Assist to ISP’s ex. AOL Origin server sends content to CDN If last modified CDN WEB CACHE
18
2: Application Layer18 Content distribution networks (CDNs) r The content providers are the CDN customers. Content replication r CDN company installs hundreds of CDN servers throughout Internet m in lower-tier ISPs, close to users r CDN replicates its customers’ content in CDN servers. When provider updates content, CDN updates servers origin server in North America CDN distribution node CDN server in S. America CDN server in Europe CDN server in Asia
19
2: Application Layer19 CDN example origin server r www.foo.com r distributes HTML r Replaces: http://www.foo.com/sports.ruth.gif with h ttp://www.cdn.com/www.foo.com/sports/ruth.gif HTTP request for www.foo.com/sports/sports.html DNS query for www.cdn.com HTTP request for www.cdn.com/www.foo.com/sports/ruth.gif 1 2 3 Origin server CDNs authoritative DNS server Nearby CDN server CDN company r cdn.com r distributes gif files r uses its authoritative DNS server to route redirect requests
20
2: Application Layer20 More about CDNs routing requests r CDN creates a “map”, indicating distances from leaf ISPs and CDN nodes r when query arrives at authoritative DNS server: m server determines ISP from which query originates m uses “map” to determine best CDN server not just Web pages r streaming stored audio/video r streaming real-time audio/video m CDN nodes create application-layer overlay network
21
2: Application Layer21 Network Content Distribution Review 1) Origin web servers managed by content providers 2) Proxy caches managed by the ISPs 3) CDN servers managed by CDN companies
22
2: Application Layer22 Peer-to-Peer Networks for Content Distribution via the Internet r PCs at the edge of the network are called “Peers” r Peers can retrieve objects directly from each other
23
2: Application Layer23 Advantages of a P2P Network r A large collection of peers may be available for content distribution--sometimes millions! r User takes advantage of the network’s currently available resources m Various bandwidths of other peers m Storage for various objects
24
2: Application Layer24 P2P: File-Sharing Paradigms for the Internet r Centralized Directory m Napster r Decentralized Directory m KaZaA r Query Flooding m Gnutella
25
2: Application Layer25 P2P: Centralized Directory 1) when peer connects, it informs central server: m IP address m content 2) Alice queries for “Baby Got Back” 3) Alice requests file from Bob 4) Tracking of peers? centralized directory server peers Alice Bob 1 1 1 1 2 3
26
2: Application Layer26 Problems with Centralized Directories r Single point of failure m Application crash r Performance bottleneck r Huge database to maintain r Copyright infringement m Legal proceedings may result in the company having to shut down directory server centralized directory server peers Alice Bob 1 1 1 1 2 3 While file transfer is decentralized, locating content is highly centralized
27
2: Application Layer27 P2P: Decentralized Directory r Each peer is either a group leader or assigned to a group leader. r Group leader tracks the content in all its children. r Peer queries group leader; group leader may query other group leaders.
28
2: Application Layer28 Pros/Cons of a Decentralized Directory Pros r no centralized directory server mlocation service distributed over peers mmore difficult to shut down Cons r bootstrap node needed r group leaders can get overloaded
29
2: Application Layer29 P2P: Query Flooding r Gnutella r no hierarchy r use bootstrap node to learn about others r join message r Send query to neighbors r Neighbors forward query r If queried peer has object, it sends message back to querying peer join
30
2: Application Layer30 P2P: Pros of Query Flooding Pros r peers have similar responsibilities: no group leaders r highly decentralized r no peer maintains directory info
31
2: Application Layer31 P2P: Cons of Query Flooding Cons r query radius: may not have content when present r bootstrap node r maintenance of overlay network r excessive query traffic
32
2: Application Layer32 Topology of Gnutella via Gnutella Web Crawler www.ececs.uc.edu/~mjovanov/Research/paper.html
33
2: Application Layer33 Topology of Gnutella
34
2: Application Layer34 Topology of Gnutella
35
2: Application Layer35 Topology of Gnutella
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.