chapter 2 application layer
play

Chapter 2: Application layer 2.1 Principles of network 2.6 P2P - PowerPoint PPT Presentation

Chapter 2: Application layer 2.1 Principles of network 2.6 P2P applications applications 2.7 Socket app architectures programming with app requirements TCP 2.2 Web and HTTP 2.8 Socket 2.4 Electronic Mail


  1. Chapter 2: Application layer • 2.1 Principles of network • 2.6 P2P applications applications • 2.7 Socket – app architectures programming with – app requirements TCP • 2.2 Web and HTTP • 2.8 Socket • 2.4 Electronic Mail programming with – SMTP, POP3, IMAP UDP • 2.5 DNS 2: Application Layer 1

  2. Pure P2P architecture • no constantly-on server • arbitrary end systems directly communicate peer-peer • peers are intermittently connected and change IP addresses • Three topics: – File distribution – Searching for information – Case Study: Skype 2: Application Layer 2

  3. File Distribution: Server-Client vs P2P Question : How much time to distribute file from one server to N peers ? u s : server upload bandwidth Server u i : peer i upload bandwidth u 2 u 1 d 1 d 2 u s d i : peer i download File, size F bandwidth d N Network (with abundant bandwidth) u N 2: Application Layer 3

  4. File distribution time: server-client Server • server sequentially F u 2 u 1 d 1 d 2 u s sends N copies: Network (with – NF/u s time d N abundant bandwidth) • client i takes F/d i u N time to download increases linearly in N (for large N) 2: Application Layer 4

  5. File distribution time: P2P Server • server must send one F u 2 u 1 d 1 copy: F /u s time d 2 u s • client i takes F/d i time to Network (with d N download abundant bandwidth) u N • NF bits must be downloaded (aggregate) � fastest possible upload rate: u s + Σ u i 2: Application Layer 5

  6. Server-client vs. P2P: example Client upload rate = u, F/u = 1 hour, u s = 10u, d min ≥ u s 3.5 P2P Minimum Distribution Time 3 Client-Server 2.5 2 1.5 1 0.5 0 0 5 10 15 20 25 30 35 N 2: Application Layer 6

  7. File distribution: BitTorrent � P2P file distribution torrent: group of tracker: tracks peers peers exchanging participating in torrent chunks of a file obtain list of peers trading chunks peer 2: Application Layer 7

  8. 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 2: Application Layer 8

  9. BitTorrent (2) Sending Chunks: tit-for-tat Pulling Chunks � Alice sends chunks to four • at any given time, neighbors currently different peers have sending her chunks at the different subsets of file highest rate chunks � re-evaluate top 4 every • periodically, a peer 10 secs (Alice) asks each � every 30 secs: randomly neighbor for list of select another peer, chunks that they have. starts sending chunks • Alice sends requests for � newly chosen peer may her missing chunks join top 4 – rarest first � “optimistically unchoke” 2: Application Layer 9

  10. BitTorrent: Tit-for-tat (1) Alice “optimistically unchokes” Bob (2) Alice becomes one of Bob’s top-four providers; Bob reciprocates (3) Bob becomes one of Alice’s top-four providers With higher upload rate, can find better trading partners & get file faster! 2: Application Layer 10

  11. Distributed Hash Table (DHT) • DHT = distributed P2P database • Database has (key, value) pairs; – key: ss number; value: human name – key: content type; value: IP address • Peers query DB with key – DB returns values that match the key • Peers can also insert (key, value) peers

  12. DHT Identifiers • Assign integer identifier to each peer in range [0,2 n -1]. – Each identifier can be represented by n bits. • Require each key to be an integer in same range. • To get integer keys, hash original key. – eg, key = h(“Led Zeppelin IV”) – This is why they call it a distributed “hash” table

  13. How to assign keys to peers? • Central issue: – Assigning (key, value) pairs to peers. • Rule: assign key to the peer that has the closest ID. • Convention in lecture: closest is the immediate successor of the key. • Ex: n=4; peers: 1,3,4,5,8,10,12,14; – key = 13, then successor peer = 14 – key = 15, then successor peer = 1

  14. Circular DHT (1) 1 3 14 4 12 5 10 8 • Each peer only aware of immediate successor and predecessor. • “Overlay network”

  15. Circle DHT (2) 0001 O(N) messages Who’s resp on avg to resolve for key 1101 ? I am query, when there 0011 are N peers 1110 1101 0100 1101 1101 1100 0101 1101 1101 Define closest 1101 1010 as closest 1000 successor

  16. Circular DHT with Shortcuts 1 Who’s resp for key 1101? 3 15 4 12 5 10 8 • Each peer keeps track of IP addresses of predecessor, successor, short cuts. • Reduced from 6 to 2 messages. • Possible to design shortcuts so O(log N) neighbors, O(log N) messages in query

  17. Peer Churn 1 • To handle peer churn, require 3 each peer to know the IP address 15 of its two successors. • Each peer periodically pings its 4 two successors to see if they are still alive . 12 5 10 8 • Peer 5 abruptly leaves • Peer 4 detects; makes 8 its immediate successor; asks 8 who its immediate successor is; makes 8’s immediate successor its second successor. • What if peer 13 wants to join?

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

  19. Peers as relays • Problem when both Alice and Bob are behind “NATs”. – NAT prevents an outside peer from initiating a call to insider peer • Solution: – Using Alice’s and Bob’s SNs, Relay is chosen – Each peer initiates session with relay. – Peers can now communicate through NATs via relay 2: Application Layer 19

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend