Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Understanding Peer-to-Peer (P2P) Architectures: Client-Server, Pure P2P, and Hybrid Models, Slides of Computer Networks

An overview of peer-to-peer (p2p) architectures, discussing their differences from client-server models, and exploring specific examples like skype and docsity.com. Topics include the application layer, processes communicating, sockets, addressing processes, http connections, and user-server state using cookies.

Typology: Slides

2012/2013

Uploaded on 04/25/2013

avantika
avantika 🇮🇳

4.3

(22)

165 documents

1 / 54

Toggle sidebar

Related documents


Partial preview of the text

Download Understanding Peer-to-Peer (P2P) Architectures: Client-Server, Pure P2P, and Hybrid Models and more Slides Computer Networks in PDF only on Docsity! 2: Application Layer 1 Chapter 2 Application Layer Docsity.com 2: Application Layer 2 Creating a network app write programs that  run on (different) end systems  communicate over network  e.g., web server software communicates with browser software little software written for devices in network core  network core devices do not run user applications  applications on end systems allows for rapid app development, propagation application transport network data link physical application transport network data link physical application transport network data link physical Docsity.com 2: Application Layer 5 Pure P2P architecture  there is no always-on server  arbitrary end systems directly communicate  peers are intermittently connected and change IP addresses  example: Gnutella Highly scalable but difficult to manage peer-peer Docsity.com 2: Application Layer 6 Hybrid of client-server and P2P Skype  voice-over-IP P2P application  centralized server: finding address of remote party:  client-client connection: direct (not through server) 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 Docsity.com 2: Application Layer 7 Processes communicating 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  Note: applications with P2P architectures have client processes & server processes Docsity.com 2: Application Layer 10 App-layer protocol defines  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 Docsity.com 2: Application Layer 11 Transport service requirements of common apps Application file transfer e-mail Web documents real-time audio/video stored audio/video interactive games instant messaging Data loss no loss no loss no loss loss-tolerant loss-tolerant loss-tolerant no loss Bandwidth elastic elastic elastic audio: 5kbps-1Mbps video:10kbps-5Mbps same as above few kbps up elastic Time Sensitive no no no yes, 100’s msec yes, few secs yes, 100’s msec yes and no Docsity.com 2: Application Layer 12 Internet apps: application, transport protocols Application e-mail 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] proprietary (e.g. RealNetworks) proprietary (e.g., Vonage,Dialpad) Underlying transport protocol TCP TCP TCP TCP TCP or UDP typically UDP Docsity.com 2: Application Layer 15 HTTP overview (continued) 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 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 aside Docsity.com 2: Application Layer 16 HTTP connections 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 Docsity.com 2: Application Layer 17 Nonpersistent HTTP 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 2. HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants object someDepartment/home.index 1b. HTTP server at host www.someSchool.edu waiting for TCP connection at port 80. “accepts” connection, notifying client 3. HTTP server receives request message, forms response message containing requested object, and sends message into its socket time (contains text, references to 10 jpeg images) Docsity.com 2: Application Layer 20 Persistent HTTP Nonpersistent HTTP issues:  requires 2 RTTs per object  OS overhead for each TCP connection  browsers often open parallel TCP connections to fetch referenced objects Persistent HTTP  server leaves connection open after sending response  subsequent HTTP messages between same client/server sent over open connection 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 Docsity.com 2: Application Layer 21 User-server state: cookies 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 Docsity.com 2: Application Layer 22 Cookies: keeping “state” (cont.) client server usual http response msg 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 Docsity.com 2: Application Layer 25 More about Web caching  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. Docsity.com 2: Application Layer 26 FTP: the file transfer protocol  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 This image cannot currently be displayed. file transfer FTP server FTP user interface FTP client local file system remote file system user at host Docsity.com 2: Application Layer 27 FTP: separate control, data connections  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 2nd 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  server opens another TCP data connection to transfer another file.  control connection: “out of band”  FTP server maintains “state”: current directory, earlier authentication Docsity.com 2: Application Layer 30 Electronic Mail: SMTP [RFC 2821]  uses TCP to reliably transfer email message from client to server, port 25  direct transfer: sending server to receiving server  three phases of transfer  handshaking (greeting)  transfer of messages  closure  command/response interaction  commands: ASCII text  response: status code and phrase Docsity.com 2: Application Layer 31 Scenario: Alice sends message to Bob 1) Alice uses UA to compose message and “to” bob@someschool.edu 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 1 2 3 4 5 6 Docsity.com 2: Application Layer 32 DNS: Domain Name System 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)  note: core Internet function, implemented as application-layer protocol  complexity at network’s “edge” Docsity.com 2: Application Layer 35 DNS: Root name servers  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) Docsity.com 2: Application Layer 36 TLD and Authoritative Servers  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 Docsity.com 2: Application Layer 37 Local Name Server  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 Docsity.com 2: Application Layer 40 DNS: caching and updating records  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 2136  http://www.ietf.org/html.charters/dnsind-charter.html Docsity.com 2: Application Layer 41 P2P file sharing Example  Alice runs P2P client application on her notebook computer  intermittently connects to Internet; gets new IP address for each connection  asks for “Hey Jude”  application displays other peers that have copy of Hey Jude.  Alice chooses one of the peers, Bob.  file is copied from Bob’s PC to Alice’s notebook: HTTP  while Alice downloads, other users uploading from Alice.  Alice’s peer is both a Web client and a transient Web server. All peers are servers = highly scalable! Docsity.com 2: Application Layer 42 P2P: centralized directory 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 centralized directory server peers Alice Bob 1 1 1 1 2 3 Docsity.com 2: Application Layer 45 Gnutella: protocol Query QueryHit Query QueryHit File transfer: HTTP  Query message sent over existing TCP connections  peers forward Query message  QueryHit sent over reverse path Scalability: limited scope flooding Docsity.com 2: Application Layer 46 Gnutella: Peer joining 1. joining peer Alice must find another peer in Gnutella network: use list of candidate peers 2. Alice sequentially attempts TCP connections with candidate peers until connection setup with Bob 3. Flooding: Alice sends Ping message to Bob; Bob forwards Ping message to his overlay neighbors (who then forward to their neighbors….)  peers receiving Ping message respond to Alice with Pong message 4. Alice receives many Pong messages, and can then setup additional TCP connections Peer leaving: see homework problem! Docsity.com 2: Application Layer 47 Hierarchical Overlay  between centralized index, query flooding approaches  each peer is either a group leader or assigned to a group leader.  TCP connection between peer and its group leader.  TCP connections between some pairs of group leaders.  group leader tracks content in its children ordinary peer group-leader peer neighoring relationships in overlay network Docsity.com 2: Application Layer 50 P2P Case Study: BitTorrent tracker: tracks peers participating in torrent torrent: group of peers exchanging chunks of a file obtain list of peers trading chunks peer  P2P file distribution Docsity.com 2: Application Layer 51 BitTorrent (1)  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 Docsity.com 2: Application Layer 52 BitTorrent (2) Pulling Chunks  at any given time, different peers have different subsets of file chunks  periodically, a peer (Alice) asks each neighbor for list of chunks that they have.  Alice issues requests for her missing chunks  rarest first Sending Chunks: tit-for-tat  Alice sends chunks to four neighbors currently sending her chunks at the highest rate  re-evaluate top 4 every 10 secs  every 30 secs: randomly select another peer, starts sending chunks  newly chosen peer may join top 4 Docsity.com
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved