2: Application Layer 1 1DT057 Distributed Information Systems Chapter 2 Application Layer.

Slides:



Advertisements
Similar presentations
Domain Name System (or Service) (DNS) Computer Networks Computer Networks Term B10.
Advertisements

Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Application Layer – Lecture.
Application Layer-11 CSE401N: Computer Networks Lecture-4 Application Layer Overview HTTP.
Application Layer  We will learn about protocols by examining popular application-level protocols  HTTP  FTP  SMTP / POP3 / IMAP  Focus on client-server.
2: Application Layer1 Chapter 2: Application Layer Our goals: r conceptual, implementation aspects of network application protocols m transport-layer service.
Chapter 2: Application Layer
2: Application Layer1 FTP, SMTP and DNS. 2: Application Layer2 FTP: separate control, data connections r FTP client contacts FTP server at port 21, specifying.
9/16/2003-9/18/2003 The Application Layer and Java Programming September 16-18, 2003.
2: Application Layer1 Chapter 2 Application Layer Computer Networking: A Top Down Approach, 4 th edition. Jim Kurose, Keith Ross Addison-Wesley, July 2007.
Application Layer session 1 TELE3118: Network Technologies Week 12: DNS Some slides have been taken from: r Computer Networking: A Top Down Approach.
Introduction to the Application Layer Computer Networks Computer Networks Spring 2012 Spring 2012.
2: Application Layer1 Chapter 2: Application Layer Our goals: r conceptual, implementation aspects of network application protocols m transport-layer service.
1 An Overview of Applications Xin Liu ECS 152A Ref: slides by J. Kurose and K. Ross.
CPSC 441: DNS1 Instructor: Anirban Mahanti Office: ICT Class Location: ICT 121 Lectures: MWF 12:00 – 12:50 Notes derived.
Dr. Philip Cannata 1 Principles of Network Applications.
Introduction 1 Lecture 5 Application Layer slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer Science & Engineering Department.
Chapter 2 Application Layer Computer Networking: A Top Down Approach, 5 th edition. Jim Kurose, Keith Ross Addison-Wesley, April A note on the use.
CS 4396 Computer Networks Lab
Chapter 2, slide: 1 CS 372 – introduction to computer networks* Monday June 28 Announcements: r Lab 1 is due today r Lab 2 is posted today and is due next.
2: Application Layer1 Chapter 2 Application Layer These slides derived from Computer Networking: A Top Down Approach, 6 th edition. Jim Kurose, Keith Ross.
Data Communications and Computer Networks Chapter 2 CS 3830 Lecture 10 Omar Meqdadi Department of Computer Science and Software Engineering University.
2: Application Layer 1 1DT066 Distributed Information Systems Chapter 2 Application Layer.
Data Communications and Computer Networks Chapter 2 CS 3830 Lecture 9
1 Lecture05: Application layer r Principles of network applications r DNS r P2P and DHT.
Throughput: Internet scenario
2: Application Layer 1 1DT066 Distributed Information Systems Chapter 2 Application Layer.
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
2: Application Layer1 Some network apps r r Web r Instant messaging r Remote login r P2P file sharing r Multi-user network games r Streaming stored.
CHAPTER 2. Creating a network app write programs that – run on (different) end systems – communicate over network – e.g., web server software communicates.
1 Application Layer Lecture 4 Imran Ahmed University of Management & Technology.
CS 3830 Day 7 Introduction : Application Layer 2 Processes communicating Process: program running within a host. r within same host, two processes.
2: Application Layer1 CS 4244: Internet Software Development Dr. Eli Tilevich.
Review: –Which protocol is used to move messages around in the Internet? –Describe how a message is moved from the sender’s UA to the receiver’s.
2: Application Layer 1 1DT057 Distributed Information Systems Chapter 2 Application Layer.
Chapter 2 Application Layer Computer Networking: A Top Down Approach, 5 th edition. Jim Kurose, Keith Ross Addison-Wesley, April A note on the use.
DNS: Domain Name System People: many identifiers: – SSN, name, Passport # Internet hosts, routers: – IP address (32 bit) - used for addressing datagrams.
Chapter 2: Application layer
2: Application Layer1 Chapter 2: Application layer r 2.1 Principles of network applications r 2.2 Web and HTTP r 2.3 FTP r 2.4 Electronic Mail  SMTP,
What makes a network good? Ch 2.1: Principles of Network Apps 2: Application Layer1.
2: Application Layer 1 Chapter 2: Application layer r 2.1 Principles of network applications r 2.2 Web and HTTP r 2.3 FTP r 2.4 Electronic Mail  SMTP,
Sockets process sends/receives messages to/from its socket
1 Peer-to-Peer Systems r Application-layer architectures r Case study: BitTorrent r P2P Search and Distributed Hash Table (DHT)
2: Application Layer1 Chapter 2: Application layer r 2.1 Principles of network applications  app architectures  app requirements r 2.2 Web and HTTP r.
2: Application Layer 1 1DT057 Distributed Information Systems Chapter 2 Application Layer.
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
CS 3830 Day 10 Introduction 1-1. Announcements r Quiz #2 this Friday r Program 2 posted yesterday 2: Application Layer 2.
2: Application Layer1 Chapter 2 Application Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross.
CS 3830 Day 9 Introduction 1-1. Announcements r Quiz #2 this Friday r Demo prog1 and prog2 together starting this Wednesday 2: Application Layer 2.
2: Application Layer 1 Chapter 2 Application Layer Computer Networking: A Top Down Approach, 5 th edition. Jim Kurose, Keith Ross Addison-Wesley, April.
2: Application Layer 1 Chapter 2 Application Layer Computer Networking: A Top Down Approach, 5 th edition. Jim Kurose, Keith Ross Addison-Wesley, April.
Important r There will be NO CLASS on Friday 1/30/2015! r Please mark you calendars 1.
Chapter 2 Application Layer Computer Networking: A Top Down Approach, 4 th edition. Jim Kurose, Keith Ross Addison-Wesley, July 2007.
2: Application Layer 1 Chapter 2: Application layer r 2.1 Principles of network applications r 2.2 Web and HTTP r 2.3 FTP r 2.4 Electronic Mail  SMTP,
Week 11: Application Layer 1 Web and HTTP r Web page consists of objects r Object can be HTML file, JPEG image, Java applet, audio file,… r Web page consists.
Important r On Friday, could you ask students to please me their groups (one per group) for Project 2 so we can assign IP addresses. I’ll send.
@Yuan Xue CS 283Computer Networks Spring 2011 Instructor: Yuan Xue.
CSEN 404 Application Layer II Amr El Mougy Lamia Al Badrawy.
@Yuan Xue A special acknowledge goes to J.F Kurose and K.W. Ross Some of the slides used in this lecture are adapted from their.
2: Application Layer 1 Chapter 2 Application Layer.
@Yuan Xue A special acknowledge goes to J.F Kurose and K.W. Ross Some of the slides used in this lecture are adapted from their.
A special acknowledge goes to J.F Kurose and K.W. Ross Some of the slides used in this lecture are adapted from their original slides that accompany the.
2: Application Layer 1 Some network apps r r Web r Instant messaging r Remote login r P2P file sharing r Multi-user network games r Streaming stored.
Introduction to Networks
Data Communications and Computer Networks Chapter 2 CS 3830 Lecture 9
Internet transport protocols services
Chapter 7: Application layer
Chapter 2 Application Layer
FTP, SMTP and DNS 2: Application Layer.
Presentation transcript:

2: Application Layer 1 1DT057 Distributed Information Systems Chapter 2 Application Layer

C HAPTER 2: A PPLICATION LAYER 2: Application Layer Principles of network applications 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail SMTP, POP3, IMAP 2.5 DNS 2.6 P2P applications

C HAPTER 2: A PPLICATION L AYER 2: Application Layer 3 Our goals: conceptual, implementation aspects of network application protocols transport-layer service models client-server paradigm peer-to-peer paradigm learn about protocols by examining popular application-level protocols HTTP FTP SMTP / POP3 / IMAP DNS

S OME NETWORK APPS 2: Application Layer 4 web instant messaging remote login P2P file sharing multi-user network games streaming stored video clips voice over IP real-time video conferencing

C HAPTER 2: A PPLICATION LAYER 2: Application Layer Principles of network applications 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail SMTP, POP3, IMAP 2.5 DNS 2.6 P2P applications

A PPLICATION ARCHITECTURES Client-server Peer-to-peer (P2P) Hybrid of client-server and P2P 6 2: Application Layer

C LIENT - SERVER ARCHITECTURE server: always-on host permanent IP address server farms for scaling clients: communicate with server may be intermittently connected may have dynamic IP addresses do not communicate directly with each other 2: Application Layer 7 client/server

P URE P2P ARCHITECTURE no always-on server arbitrary end systems directly communicate peers are intermittently connected and change IP addresses Highly scalable but difficult to manage 2: Application Layer 8 peer-peer

H YBRID OF CLIENT - SERVER AND P2P Instant messaging chatting between two users is P2P centralized service: client presence detection/location user registers its IP address with central server when it comes online user contacts central server to find IP addresses of buddies 9 2: Application Layer

P ROCESSES COMMUNICATING 2: Application Layer 10 Process: program running within a host. within same host, two processes communicate using inter-process communication (defined by OS). processes in different hosts communicate by exchanging messages Client process: process that initiates communication Server process: process that waits to be contacted

S OCKETS process sends/receives messages to/from its socket API: (1) choice of transport protocol; (2) ability to fix a few parameters (lots more on this later) 2: Application Layer 11 process TCP with buffers, variables socket host or server process TCP with buffers, variables socket host or server Internet controlled by OS controlled by app developer

ADDRESSING PROCESSES 2: Application Layer 12 to receive messages, process must have identifier host device has unique 32- bit IP address Q: does IP address of host suffice for identifying the process?

ADDRESSING PROCESSES 2: Application Layer 13 identifier includes both IP address and port numbers associated with process on host. Example port numbers: HTTP server: 80 Mail server: 25 to send HTTP message to gaia.cs.umass.edu web server: IP address: Port number: 80 more shortly… to receive messages, process must have identifier host device has unique 32-bit IP address Q: does IP address of host on which process runs suffice for identifying the process? A: No, many processes can be running on same host

A PP - LAYER PROTOCOL DEFINES 2: Application Layer 14 Types of messages exchanged, e.g., request, response Message syntax: what fields in messages & how fields are delineated Message semantics meaning of information in fields Rules for when and how processes send & respond to messages Public-domain protocols: defined in RFCs allows for interoperability e.g., HTTP, SMTP Proprietary protocols: e.g., Skype

WHAT TRANSPORT SERVICE DOES AN APP NEED? 2: Application Layer 15 Data loss some apps (e.g., audio) can tolerate some loss other apps (e.g., file transfer, telnet) require 100% reliable data transfer Timing some apps (e.g., Internet telephony, interactive games) require low delay to be “effective” Throughput r some apps (e.g., multimedia) require minimum amount of throughput to be “effective” r other apps (“elastic apps”) make use of whatever throughput they get Security r Encryption, data integrity, …

TRANSPORT SERVICE REQUIREMENTS OF COMMON APPS 16 2: Application Layer Application file transfer Web documents real-time audio/video stored audio/video interactive games instant messaging Data loss (no loss / loss-tolerant) no loss Throughput elastic audio: 5kbps-1Mbps video:10kbps-5Mbps same as above few kbps up elastic Time Sensitive (yes / no) no

TRANSPORT SERVICE REQUIREMENTS OF COMMON APPS 17 2: Application Layer Application file transfer Web documents real-time audio/video stored audio/video interactive games instant messaging Data loss no loss loss-tolerant no loss Throughput elastic audio: 5kbps-1Mbps video:10kbps-5Mbps same as above few kbps up elastic Time Sensitive no yes, 100’s msec yes, few secs yes, 100’s msec yes and no

TRANSPORT LAYER PROTOCOLS TCP VS. UDP ? 18 2: Application Layer

INTERNET TRANSPORT PROTOCOLS SERVICES 2: Application Layer 19 TCP service: connection-oriented: setup required between client and server processes reliable transport between sending and receiving process flow control: sender won’t overwhelm receiver congestion control: throttle sender when network overloaded does not provide: timing, minimum throughput guarantees, security UDP service: unreliable data transfer between sending and receiving process does not provide: connection setup, reliability, flow control, congestion control, timing, throughput guarantee, or security Q: why bother? Why is there a UDP?

INTERNET APPS: APPLICATION, TRANSPORT PROTOCOLS 20 2: Application Layer Application remote terminal access Web file transfer streaming multimedia Internet telephony Application layer protocol Transport protocol (TCP / UDP)

INTERNET APPS: APPLICATION, TRANSPORT PROTOCOLS 21 2: Application Layer Application remote terminal access Web file transfer streaming multimedia Internet telephony Application layer protocol SMTP [RFC 2821] Telnet [RFC 854] HTTP [RFC 2616] FTP [RFC 959] HTTP (eg Youtube), RTP [RFC 1889] SIP, RTP, proprietary (e.g., Skype) Underlying transport protocol TCP TCP or UDP typically UDP

C HAPTER 2: A PPLICATION LAYER 2: Application Layer Principles of network applications app architectures app requirements 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail SMTP, POP3, IMAP 2.5 DNS 2.6 P2P applications

W EB AND HTTP First some jargon 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: 23 2: Application Layer host name path name

HTTP OVERVIEW 2: Application Layer 24 HTTP: hypertext transfer protocol Web’s application layer protocol client/server model client: browser that requests, receives, “displays” Web objects server: Web server sends objects in response to requests PC running Explorer Server running Apache Web server Mac running Navigator HTTP request HTTP response

HTTP OVERVIEW ( CONTINUED ) 2: Application Layer 25 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

U PLOADING FORM INPUT 2: Application Layer 26 Post method: Web page often includes form input Input is uploaded to server in entity body URL method: Uses GET method Input is uploaded in URL field of request line:

HTTP RESPONSE MESSAGE 27 2: Application Layer HTTP/ OK Connection close Date: Thu, 06 Aug :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... status line (protocol status code status phrase) header lines data, e.g., requested HTML file

HTTP RESPONSE STATUS CODES 2: Application Layer 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 In first line in server->client response message. A few sample codes:

U SER - SERVER STATE : COOKIES 2: Application Layer 29 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

COOKIES: KEEPING “STATE” (CONT.) 2: Application Layer 30 client server usual http response msg cookie file one week later: usual http request msg cookie: 1678 cookie- specific action access ebay 8734 usual http request msg Amazon server creates ID 1678 for user create entry usual http response Set-cookie: 1678 ebay 8734 amazon 1678 usual http request msg cookie: 1678 cookie- spectific action access ebay 8734 amazon 1678 backend database

C OOKIES ( CONTINUED ) 2: Application Layer 31 What cookies can bring: authorization shopping carts recommendations user session state (Web ) Cookies and privacy: r cookies permit sites to learn a lot about you r you may supply name and to sites aside How to keep “state”: r protocol endpoints: maintain state at sender/receiver over multiple transactions r cookies: http messages carry state

WEB CACHES (PROXY SERVER) 2: Application Layer 32 user sets browser: Web accesses via cache browser sends all HTTP requests to cache object in cache: cache returns object else 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 origin server origin server HTTP response

M ORE ABOUT W EB CACHING 2: Application Layer 33 cache acts as both client and server typically cache is installed by ISP (university, company, residential ISP) reduce response time for client request reduce traffic on an institution’s access link. Internet dense with caches: enables “poor” content providers to effectively deliver content (but so does P2P file sharing) Why Web caching?

C HAPTER 2: A PPLICATION LAYER 2: Application Layer Principles of network applications 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail SMTP, POP3, IMAP 2.5 DNS 2.6 P2P applications

FTP: THE FILE TRANSFER PROTOCOL 2: Application Layer 35 transfer file to/from remote host client/server model client: side that initiates transfer (either to/from remote) server: remote host ftp: RFC 959 ftp server: port 21 file transfer FTP server FTP user interface FTP client local file system remote file system user at host

FTP: SEPARATE CONTROL, DATA CONNECTIONS 2: Application Layer 36 FTP client contacts FTP server at port 21, TCP is transport protocol client authorized over control connection client browses remote directory by sending commands over control connection. when server receives file transfer command, server opens 2 nd TCP connection (for file) to client after transferring one file, server closes data connection. FTP client FTP server TCP control connection port 21 TCP data connection port 20 r server opens another TCP data connection to transfer another file. r FTP server maintains “state”: current directory, earlier authentication

C HAPTER 2: A PPLICATION LAYER 2: Application Layer Principles of network applications 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail SMTP, POP3, IMAP 2.5 DNS 2.6 P2P applications

ELECTRONIC MAIL 2: Application Layer 38 Three major components: user agents mail servers simple mail transfer protocol: SMTP User Agent a.k.a. “mail reader” composing, editing, reading mail messages e.g., Eudora, Outlook, elm, Mozilla Thunderbird outgoing, incoming messages stored on server user mailbox outgoing message queue mail server user agent user agent user agent mail server user agent user agent mail server user agent SMTP

ELECTRONIC MAIL: MAIL SERVERS 2: Application Layer 39 Mail Servers mailbox contains incoming messages for user message queue of outgoing (to be sent) mail messages SMTP protocol between mail servers to send messages client: sending mail server “server”: receiving mail server mail server user agent user agent user agent mail server user agent user agent mail server user agent SMTP

SCENARIO: ALICE SENDS MESSAGE TO BOB 2: Application Layer 40 1) Alice uses UA to compose message and “to” 2) Alice’s UA sends message to her mail server; message placed in message queue 3) Client side of SMTP opens TCP connection with Bob’s mail server 4) SMTP client sends Alice’s message over the TCP connection 5) Bob’s mail server places the message in Bob’s mailbox 6) Bob invokes his user agent to read message user agent mail server mail server user agent

M AIL ACCESS PROTOCOLS 2: Application Layer 41 SMTP: delivery/storage to receiver’s server Mail access protocol: retrieval from server POP: Post Office Protocol [RFC 1939] authorization (agent server) and download IMAP: Internet Mail Access Protocol [RFC 1730] more features (more complex) manipulation of stored msgs on server HTTP: gmail, Hotmail, Yahoo! Mail, etc. user agent sender’s mail server user agent SMTP access protocol receiver’s mail server

C HAPTER 2: A PPLICATION LAYER 2: Application Layer Principles of network applications 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail SMTP, POP3, IMAP 2.5 DNS 2.6 P2P applications

DNS: DOMAIN NAME SYSTEM 2: Application Layer 43 People: many identifiers: SSN, name, passport # Internet hosts, routers: IP address (32 bit) - used for addressing datagrams “name”, e.g., ww.yahoo.com - used by humans Q: map between IP addresses and name ? Domain Name System: distributed database implemented in hierarchy of many name servers application-layer protocol host, routers, name servers to communicate to resolve names (address/name translation)

DNS 2: Application Layer 44 DNS services hostname to IP address translation host aliasing Canonical, alias names mail server aliasing load distribution replicated Web servers: set of IP addresses for one canonical name single point of failure traffic volume distant centralized database maintenance doesn’t scale! Why not centralize DNS?

D ISTRIBUTED, H IERARCHICAL D ATABASE Client wants IP for 1 st approx: client queries a root server to find com DNS server client queries com DNS server to get amazon.com DNS server client queries amazon.com DNS server to get IP address for 2: Application Layer 45 Root DNS Servers com DNS servers org DNS serversedu DNS servers poly.edu DNS servers umass.edu DNS servers yahoo.com DNS servers amazon.com DNS servers pbs.org DNS servers

DNS: ROOT NAME SERVERS 2: Application Layer 46 contacted by local name server that can not resolve name root name server: contacts authoritative name server if name mapping not known gets mapping returns mapping to local name server 13 root name servers worldwide b USC-ISI Marina del Rey, CA l ICANN Los Angeles, CA e NASA Mt View, CA f Internet Software C. Palo Alto, CA (and 36 other locations) i Autonomica, Stockholm (plus 28 other locations) k RIPE London (also 16 other locations) m WIDE Tokyo (also Seoul, Paris, SF) a Verisign, Dulles, VA c Cogent, Herndon, VA (also LA) d U Maryland College Park, MD g US DoD Vienna, VA h ARL Aberdeen, MD j Verisign, ( 21 locations)

TLD AND A UTHORITATIVE S ERVERS Top-level domain (TLD) servers: responsible for com, org, net, edu, etc, and all top-level country domains uk, fr, ca, jp. Network Solutions maintains servers for com TLD Educause for edu TLD Authoritative DNS servers: organization’s DNS servers, providing authoritative hostname to IP mappings for organization’s servers (e.g., Web, mail). can be maintained by organization or service provider 47 2: Application Layer

L OCAL N AME S ERVER does not strictly belong to hierarchy each ISP (residential ISP, company, university) has one. also called “default name server” when host makes DNS query, query is sent to its local DNS server acts as proxy, forwards query into hierarchy 48 2: Application Layer

DNS NAME RESOLUTION EXAMPLE 2: Application Layer 49 Host at cis.poly.edu wants IP address for gaia.cs.umass.edu requesting host cis.poly.edu gaia.cs.umass.edu root DNS server local DNS server dns.poly.edu authoritative DNS server dns.cs.umass.edu 7 8 TLD DNS server iterated query: r contacted server replies with name of server to contact r “I don’t know this name, but ask this server”

DNS NAME RESOLUTION EXAMPLE 50 2: Application Layer requesting host cis.poly.edu gaia.cs.umass.edu root DNS server local DNS server dns.poly.edu authoritative DNS server dns.cs.umass.edu 7 8 TLD DNS server 3 recursive query: r puts burden of name resolution on contacted name server r heavy load?

DNS: CACHING AND UPDATING RECORDS 2: Application Layer 51 once (any) name server learns mapping, it caches mapping cache entries timeout (disappear) after some time TLD servers typically cached in local name servers Thus root name servers not often visited update/notify mechanisms under design by IETF RFC

C HAPTER 2: A PPLICATION LAYER 2: Application Layer Principles of network applications app architectures app requirements 2.2 Web and HTTP 2.4 Electronic Mail SMTP, POP3, IMAP 2.5 DNS 2.6 P2P applications

P URE P2P ARCHITECTURE no always-on server arbitrary end systems directly communicate peers are intermittently connected and change IP addresses Three topics: File distribution Searching for information Case Study: Skype 2: Application Layer 53 peer-peer

FILE DISTRIBUTION 2: Application Layer 54 Server-Client vs P2P ?

F ILE D ISTRIBUTION : S ERVER -C LIENT VS P2P Question : How much time to distribute file from one server to N peers ? 55 2: Application Layer usus u2u2 d1d1 d2d2 u1u1 uNuN dNdN Server Network (with abundant bandwidth) File, size F u s : server upload bandwidth u i : peer i upload bandwidth d i : peer i download bandwidth

F ILE DISTRIBUTION TIME : SERVER - CLIENT server sequentially sends N copies: NF/u s time client i takes F/d i time to download 56 2: Application Layer usus u2u2 d1d1 d2d2 u1u1 uNuN dNdN Server Network (with abundant bandwidth) F increases linearly in N (for large N) = d cs = max { NF/u s, F/min(d i ) } i Time to distribute F to N clients using client/server approach

F ILE DISTRIBUTION TIME : P2P server must send one copy: F /u s time client i takes F/d i time to download NF bits must be downloaded (aggregate) 57 2: Application Layer usus u2u2 d1d1 d2d2 u1u1 uNuN dNdN Server Network (with abundant bandwidth) F  fastest possible upload rate: u s +  u i d P2P = max { F/u s, F/min(d i ), NF/(u s +  u i ) } i

2: Application Layer 58 Server-client vs. P2P: example Client upload rate = u, F/u = 1 hour, u s = 10u, d min ≥ u s

F ILE DISTRIBUTION : B IT T ORRENT 59 2: Application Layer tracker: tracks peers participating in torrent torrent: group of peers exchanging chunks of a file obtain list of peers trading chunks peer r P2P file distribution

B IT T ORRENT 2: Application Layer 60 file divided into 256KB chunks. peer joining torrent: has no chunks, but will accumulate them over time registers with tracker to get list of peers, connects to subset of peers (“neighbors”) while downloading, peer uploads chunks to other peers. peers may come and go once peer has entire file, it may (selfishly) leave or (altruistically) remain

P2P: SEARCHING FOR INFORMATION 2: Application Layer 61 File sharing (eg e-mule) Index dynamically tracks the locations of files that peers share. Peers need to tell index what they have. Peers search index to determine where files can be found Instant messaging Index maps user names to locations. When user starts IM application, it needs to inform index of its location Peers search index to determine IP address of user. Index in P2P system: maps information to peer location (location = IP address & port number)

P2P INDEXING AND SEARCHING – HOW? Centralized Directory Group 1 : How centralized directory works? Group 2 : What are the disadvantages of centralized directory? Query Flooding Group 3 : How query flooding works? Hierarchical Overlay Group 4 : How hierarchical overlay works? Group 5 : Case study on Skype Tell us three things about Skype. How Skype provides indexing? e.g. hierarchical overlay? 2: Application Layer 62

P2P: CENTRALIZED INDEX original “Napster” design 1) when peer connects, it informs central server: IP address content 2) Alice queries for “Hey Jude” 3) Alice requests file from Bob 2: Application Layer 63 centralized directory server peers Alice Bob

P2P: PROBLEMS WITH CENTRALIZED DIRECTORY 2: Application Layer 64 single point of failure performance bottleneck copyright infringement: “target” of lawsuit is obvious file transfer is decentralized, but locating content is highly centralized

Q UERY FLOODING 2: Application Layer 65 fully distributed no central server used by Gnutella Each peer indexes the files it makes available for sharing (and no other files) overlay network: graph edge between peer X and Y if there’s a TCP connection all active peers and edges form overlay net edge: virtual ( not physical) link given peer typically connected with < 10 overlay neighbors

Q UERY FLOODING 66 2: Application Layer Query QueryHit Query QueryHit Query QueryHit File transfer: HTTP r Query message sent over existing TCP connections r peers forward Query message r QueryHit sent over reverse path Scalability: limited scope flooding

H IERARCHICAL O VERLAY between centralized index, query flooding approaches each peer is either a super node or assigned to a super node TCP connection between peer and its super node. TCP connections between some pairs of super nodes. Super node tracks content in its children 2: Application Layer 67

P2P C ASE STUDY : S KYPE inherently P2P: pairs of users communicate. proprietary application-layer protocol (inferred via reverse engineering) hierarchical overlay with SNs Index maps usernames to IP addresses; distributed over SNs 68 2: Application Layer Skype clients (SC) Supernode (SN) Skype login server

C HAPTER 2: S UMMARY 2: Application Layer 69 application architectures client-server P2P hybrid application service requirements: reliability, bandwidth, delay Internet transport service model connection-oriented, reliable: TCP unreliable, datagrams: UDP our study of network apps now complete! r specific protocols:  HTTP  FTP  SMTP, POP, IMAP  DNS  P2P: BitTorrent, Skype