Presentation is loading. Please wait.

Presentation is loading. Please wait.

Part 4: Peer to Peer - P2P Applications

Similar presentations


Presentation on theme: "Part 4: Peer to Peer - P2P Applications"— Presentation transcript:

1 Part 4: Peer to Peer - P2P Applications
IT 424 Networks2 Chapter 2: Application Layer Part 4: Peer to Peer - P2P Applications Ack.: Slides are adapted from the slides of the book: “Computer Networking” – J. Kurose, K. Ross

2 Database Distribution
File Distribution: Client-Server vs P2P BitTorrent File Distribution Database Distribution Overview Skype Application

3 Learning Outcomes 1 To differentiate between the client-server and the P2P application architectures 2 To analyze the performance of both architectures for file-sharing applications 3 To explain how p2p architecture works 4 To describe the bitTorrent file distribution application 5 To analyze the distributed hash table scheme for database distribution 6 To discuss the structure and operation of skype application

4 Database Distribution
File Distribution: Client-Server vs P2P BitTorrent File Distribution Database Distribution Overview Skype Application

5 Recap: Application Architectures
Application Layer Architectures Recap: Application Architectures Possible structure of applications: Client-server Peer-to-peer (P2P) Hybrid of client-server and P2P

6 File Distribution: Client-Server vs P2P
us: server upload capacity u2 d2 u1 d1 di: peer i download capacity file, size F us server di uN network (with abundant bandwidth) ui dN ui: peer i upload capacity Question: How much time to distribute file (size F) from one server to N peers? Peer upload/download capacity is limited resource

7 File Distribution Time: Client-Server
File Distribution: Client-Server vs P2P File Distribution Time: Client-Server Server transmission: must sequentially send (upload) N file copies: time to send one copy: L/R= F/us time to send N copies: L/R=NF/us F us di network ui increases linearly in N time to distribute F to N clients using client-server approach If N >> then Delayc-s α N

8 File Distribution Time: P2P
File Distribution: Client-Server vs P2P File Distribution Time: P2P Server transmission: must upload at least one copy time to send one copy: F/us Client:s as aggregate must upload NF bits Delay = L/R L α N However R also depends upon N P2P is more scalable F us di network ui … but so does this, as each peer brings service capacity increases linearly in N time to distribute F to N clients using P2P approach DelayP2P α N / (us + ui N)

9 Client-server vs. P2P: example
File Distribution: Client-Server vs P2P Client-server vs. P2P: example

10 Database Distribution
File Distribution: Client-Server vs P2P BitTorrent File Distribution Database Distribution Overview Skype Application

11 P2P File Distribution: BitTorrent
BitTorrent File Distribution P2P File Distribution: BitTorrent tracker: tracks peers participating in torrent torrent: group of peers exchanging chunks of a file Alice arrives … … obtains list of peers from tracker … and begins exchanging file chunks with peers in torrent File divided into 256kb chunks Peers in torrent send/receive file chunks

12 P2P File Distribution: BitTtorrent
Bittorrent File Distribution P2P File Distribution: BitTtorrent Peer joining torrent: Has no chunks, but will accumulate them over time from other peers Registers with tracker to get list of peers, connects to subset of peers (“neighbors”) While downloading, peer uploads chunks to other peers Peer may change peers with whom it exchanges chunks Churn: peers may come and go Once peer has entire file, it may (selfishly) leave or (altruistically) remain in torrent

13 BitTorrent: Requesting, Sending File Chunks
BitTorrent File Distribution – Sending File BitTorrent: Requesting, Sending File Chunks Requesting chunks: At any given time, different peers have different subsets of file chunks Periodically, Alice asks each peer for list of chunks that they have Alice requests missing chunks from peers, “rarest first” Sending chunks: tit-for-tat Alice sends chunks to those four peers currently sending her chunks at highest rate Other peers are choked by Alice (do not receive chunks from her) Re-evaluate top 4 every10 secs Every 30 secs: randomly select another peer, starts sending chunks “Optimistically unchoke” this peer Newly chosen peer may join top 4

14 BitTorrent: Tit-For-Tat
BitTorrent File Distribution – Sending File 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 higher upload rate: find better trading partners, get file faster !

15 Database Distribution
File Distribution: Client-Server vs P2P BitTorrent File Distribution Database Distribution Overview Skype Application

16 Distributed Hash Table (DHT)
Database Distribution Distributed Hash Table (DHT) A critical component of many P2P applications is an information index or a simple database supporting search and update operation. Hash table Distributed Hash Table (DHT) paradigm Circular DHT and overlay networks Peer churn

17 Simple Database Key Value John Washington 132-54-3570
Database Distribution Simple Database Key Value John Washington Diana Louise Jones Xiaoming Liu Rakesh Gopal Linda Cohen ……. ……… Lisa Kobayashi Simple database with (key, value) pairs: key: human name; value: social security # key: movie title; value: IP address

18 Hash Table Original Key Key Value John Washington 8962458 132-54-3570
Database Distribution - Hash Table Hash Table Original Key Key Value John Washington Diana Louise Jones Xiaoming Liu Rakesh Gopal Linda Cohen ……. ……… Lisa Kobayashi More convenient to store and search on numerical representation of key key = hash (original key)

19 Distributed Hash Table (DHT)
Database Distribution - Distributed Hash Table Distributed Hash Table (DHT) Distribute (key, value) pairs over millions of peers Pairs are evenly distributed over peers Any peer can query database with a key Database returns value for the key To resolve query, small number of messages exchanged among peers Each peer only knows about a small number of other peers Robust to peers coming and going (churn)

20 Assign Key-Value Pairs To Peers
Database Distribution - Distributed Hash Table Assign Key-Value Pairs To Peers Rule: assign key-value pair to the peer that has the closest ID. Convention: closest is the immediate successor of the key. E.G., ID space {0,1,2,3,…,63} Suppose 8 peers: 1,12,13,25,32,40,48,60 If key = 51, then assigned to peer 60 If key = 60, then assigned to peer 60 If key = 61, then assigned to peer 1

21 Database Distribution - Circular DHT
Each peer only aware of immediate successor and predecessor. 1 12 13 25 32 40 48 60 “overlay network”

22 Resolving A Query 1 value 12 60 13 48 25 40 32
Database Distribution - Circular DHT Resolving A Query What is the value associated with key 53 ? 1 value 12 O(N) messages On avgerage to resolve Query, when there Are N peers 60 13 48 25 40 32

23 Circular DHT With Shortcuts
Database Distribution - Circular DHT Circular DHT With Shortcuts 1 12 13 25 32 40 48 60 What is the value for key 53 value Each peer keeps track of IP addresses of predecessor, successor, short cuts. Reduced from 6 to 3 messages. Possible to design shortcuts with O(log N) neighbors, O(log N) messages in query

24 Peer Churn 1 3 15 4 12 5 10 8 Handling peer churn:
Database Distribution – Peer Churn Peer Churn 1 3 4 5 8 10 12 15 Handling peer churn: Peers may come and go (churn) Each peer knows address of its two successors Each peer periodically pings its two successors to check aliveness If immediate successor leaves, choose next successor as new immediate successor Example: peer 5 abruptly leaves peer 4 detects peer 5’s departure; makes 8 its immediate successor 4 asks 8 who its immediate successor is; makes 8’s immediate successor its second successor.

25 Database Distribution
File Distribution: Client-Server vs P2P BitTorrent File Distribution Database Distribution Overview Skype Application

26 Voice-over-IP: Skype Skype clients (SC)
Skype Application Voice-over-IP: Skype Skype clients (SC) Proprietary application-layer protocol P2p (PC-to-PC, PC-to-phone, phone-to-PC) Voice-over-IP (VoIP) application Also Instant Messaging Encrypted msgs P2P components: Skype login server supernode (SN) supernode overlay network Clients: skype peers connect directly to each other for voip call Super nodes (SN): skype peers with special functions Overlay network: among SNs to locate SCs Login server

27 Voice-over-IP: Skype Skype client operation:
Skype Application Voice-over-IP: Skype Skype client operation: Skype login server 1. Joins skype network by contacting SN (IP address cached) using TCP 2. Logs-in (usename, password) to centralized skype login server 3. Call: SC contacts SN will callee ID SN contacts other SNs (unknown protocol, maybe flooding) to find addr of callee; returns addr to SC 4. Initiate call directly to callee

28 Voice-over-IP: Skype Problem: both Alice, Bob are behind NATs
Skype Application Voice-over-IP: Skype Problem: both Alice, Bob are behind NATs NAT prevents outside peer from initiating connection to insider peer Inside peer can initiate connection to outside Relay solution: Alice, Bob maintain open connection to their SNs Alice signals her SN to connect to bob Alice’s SN connects to bob’s SN Bob’s SN connects to bob over open connection bob initially initiated to his SN

29 Conclusion There are three application architectures:
Client server (e.g. FTP, Web) Pure HTP (e.g. bitTorrent) Hybrid architecture (e.g skype) File distribution time using P2P architecture is less than using client-server architecture Four paradigm for file distribution: Hash table Distributed Hash Table paradigm Circular DHT and overlay networks Peer churn

30 References References Computer Networking: A Top-Down Approach Featuring the Internet by James Kurose and Keith Ross, Addison Wesley, (chapter 2 ) Peer-to-Peer (P2P) Architecture (RFC5694)


Download ppt "Part 4: Peer to Peer - P2P Applications"

Similar presentations


Ads by Google