Page 1. How Did it Start?" Model" Main Challenge" CS162 Operating Systems and Systems Programming Lecture 24. Peer-to-Peer Networks"

Similar documents
EE 122: Peer-to-Peer Networks

EECS 122: Introduction to Computer Networks Overlay Networks and P2P Networks. Overlay Networks: Motivations

Overlay Networks: Motivations. EECS 122: Introduction to Computer Networks Overlay Networks and P2P Networks. Motivations (cont d) Goals.

Main Challenge. Other Challenges. How Did it Start? Napster. Model. EE 122: Peer-to-Peer Networks. Find where a particular file is stored

EE 122: Peer-to-Peer (P2P) Networks. Ion Stoica November 27, 2002

Goals. EECS 122: Introduction to Computer Networks Overlay Networks and P2P Networks. Solution. Overlay Networks: Motivations.

CSCI-1680 P2P Rodrigo Fonseca

CIS 700/005 Networking Meets Databases

Page 1. Key Value Storage"

Flooded Queries (Gnutella) Centralized Lookup (Napster) Routed Queries (Freenet, Chord, etc.) Overview N 2 N 1 N 3 N 4 N 8 N 9 N N 7 N 6 N 9

Page 1. P2P Traffic" P2P Traffic" Today, around 18-20% (North America)! Big chunk now is video entertainment (e.g., Netflix, itunes)!

CS 268: DHTs. Page 1. How Did it Start? Model. Main Challenge. Napster. Other Challenges

CS 3516: Advanced Computer Networks

Lecture 6: Overlay Networks. CS 598: Advanced Internetworking Matthew Caesar February 15, 2011

CSCI-1680 Web Performance, Content Distribution P2P Rodrigo Fonseca

CSCI-1680 Web Performance, Content Distribution P2P John Jannotti

CompSci 356: Computer Network Architectures Lecture 21: Overlay Networks Chap 9.4. Xiaowei Yang

15-744: Computer Networking P2P/DHT

Peer-to-Peer (P2P) Systems

DISTRIBUTED SYSTEMS CSCI 4963/ /4/2015

Lecture 8: Application Layer P2P Applications and DHTs

Peer-to-Peer Internet Applications: A Review

Distributed Systems. peer-to-peer Johan Montelius ID2201. Distributed Systems ID2201

416 Distributed Systems. Mar 3, Peer-to-Peer Part 2

Distributed Hash Tables Chord and Dynamo

CS 640 Introduction to Computer Networks. Today s lecture. What is P2P? Lecture30. Peer to peer applications

CPSC 426/526. P2P Lookup Service. Ennan Zhai. Computer Science Department Yale University

Telematics Chapter 9: Peer-to-Peer Networks

Content Overlays (continued) Nick Feamster CS 7260 March 26, 2007

P2P: Distributed Hash Tables

Distributed Systems. 17. Distributed Lookup. Paul Krzyzanowski. Rutgers University. Fall 2016

Introduction to P2P Computing

Badri Nath Rutgers University

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University

12/5/16. Peer to Peer Systems. Peer-to-peer - definitions. Client-Server vs. Peer-to-peer. P2P use case file sharing. Topics

Peer-to-Peer Applications Reading: 9.4

Distributed Systems. 16. Distributed Lookup. Paul Krzyzanowski. Rutgers University. Fall 2017

Architectures for Distributed Systems

Distributed Hash Tables

Peer-to-Peer Protocols and Systems. TA: David Murray Spring /19/2006

CPSC 426/526. P2P Lookup Service. Ennan Zhai. Computer Science Department Yale University

Peer to Peer I II 1 CS 138. Copyright 2015 Thomas W. Doeppner, Rodrigo Fonseca. All rights reserved.

Department of Computer Science Institute for System Architecture, Chair for Computer Networks. File Sharing

Peer-to-Peer Systems and Distributed Hash Tables

Content Overlays. Nick Feamster CS 7260 March 12, 2007

Peer to Peer Networks

March 10, Distributed Hash-based Lookup. for Peer-to-Peer Systems. Sandeep Shelke Shrirang Shirodkar MTech I CSE

Overlay networks. To do. Overlay networks. P2P evolution DHTs in general, Chord and Kademlia. Turtles all the way down. q q q

Advanced Computer Networks

Chord : A Scalable Peer-to-Peer Lookup Protocol for Internet Applications

CS 3516: Computer Networks

Last Time. CSE 486/586 Distributed Systems Distributed Hash Tables. What We Want. Today s Question. What We Want. What We Don t Want C 1

Today. Why might P2P be a win? What is a Peer-to-Peer (P2P) system? Peer-to-Peer Systems and Distributed Hash Tables

Distributed Hash Tables: Chord

Peer to Peer Networks

Distributed lookup services

INF5071 Performance in distributed systems: Distribution Part III

DISTRIBUTED COMPUTER SYSTEMS ARCHITECTURES

*Adapted from slides provided by Stefan Götz and Klaus Wehrle (University of Tübingen)

Chord: A Scalable Peer-to-peer Lookup Service For Internet Applications

0!1. Overlaying mechanism is called tunneling. Overlay Network Nodes. ATM links can be the physical layer for IP

Handling Churn in a DHT

Last Lecture SMTP. SUNY at Buffalo; CSE 489/589 Modern Networking Concepts; Fall 2010; Instructor: Hung Q. Ngo 1

C 1. Last Time. CSE 486/586 Distributed Systems Distributed Hash Tables. Today s Question. What We Want. What We Want. What We Don t Want

PEER-TO-PEER NETWORKS, DHTS, AND CHORD

CSE 486/586 Distributed Systems Peer-to-Peer Architectures

Scalability In Peer-to-Peer Systems. Presented by Stavros Nikolaou

: Scalable Lookup

Overview Computer Networking Lecture 16: Delivering Content: Peer to Peer and CDNs Peter Steenkiste

Telecommunication Services Engineering Lab. Roch H. Glitho

internet technologies and standards

Finding Data in the Cloud using Distributed Hash Tables (Chord) IBM Haifa Research Storage Systems

Finding Data in the Cloud using Distributed Hash Tables (Chord) IBM Haifa Research Storage Systems

Unit 8 Peer-to-Peer Networking

CS 347 Parallel and Distributed Data Processing

Making Gnutella-like P2P Systems Scalable

Peer-to-peer systems and overlay networks

CDNs and Peer-to-Peer

Scaling Problem Computer Networking. Lecture 23: Peer-Peer Systems. Fall P2P System. Why p2p?

Localhost: A browsable peer-to-peer file sharing system

Distributed Hash Tables

Scalable overlay Networks

Introduction to P P Networks

Overlay and P2P Networks. Structured Networks and DHTs. Prof. Sasu Tarkoma

Introduction to Peer-to-Peer Systems

Overlay networks. Today. l Overlays networks l P2P evolution l Pastry as a routing overlay example

LECT-05, S-1 FP2P, Javed I.

An Expresway over Chord in Peer-to-Peer Systems

Peer to Peer Systems and Probabilistic Protocols

L3S Research Center, University of Hannover

Peer-to-Peer Systems. Chapter General Characteristics

Searching for Shared Resources: DHT in General

P2P Applications. Reti di Elaboratori Corso di Laurea in Informatica Università degli Studi di Roma La Sapienza Canale A-L Prof.ssa Chiara Petrioli

Scaling Problem Millions of clients! server and network meltdown. Peer-to-Peer. P2P System Why p2p?

P2P Network Structured Networks: Distributed Hash Tables. Pedro García López Universitat Rovira I Virgili

Peer-to-Peer (P2P) Architectures

Overlay networks. T o do. Overlay networks. P2P evolution DHTs in general, Chord and Kademlia. q q q. Turtles all the way down

Overlay and P2P Networks. Unstructured networks. Prof. Sasu Tarkoma

Peer-to-Peer Systems. Network Science: Introduction. P2P History: P2P History: 1999 today

CS514: Intermediate Course in Computer Systems

Transcription:

How Did it Start?" CS162 Operating Systems and Systems Programming Lecture 24 Peer-to-Peer Networks" A killer application: Napster (1999) Free music over the Internet Key idea: share the storage and bandwidth of individual (home) users November 21, 2011 Anthony D. Joseph and Ion Stoica http://inst.eecs.berkeley.edu/~cs162 Internet 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.2 Model" Each user stores a subset of files Each user has access (can download) files from all users in the system Main Challenge" Find nodes storing a specified file F E D F E D E? A B C A B C 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.3 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.4 Page 1

Other Challenges" Scale: up to hundred of thousands or millions of machines Dynamicity: machines can come and go at any time Napster" Assume a centralized lookup/directory service that maps files (songs) to machines that are alive How to find a file (song)? Query the lookup service return a machine that stores the required file» Ideally this is the closest/least-loaded machine Download (ftp) the file 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.5 Advantages: Simplicity, easy to implement sophisticated search engines on top of a centralized lookup service Disadvantages: Robustness, scalability (?) 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.6 Napster: Example" The Aftermath" m6 F E? E E? m5 m5 E A m1 B m2 C m3 D m4 E m5 F m6 m4 D Recording Industry Association of America (RIAA) Sues Music Startup Napster for $20 Billion December 1999 Napster ordered to remove copyrighted material March 2001 Main legal argument: " Napster owns the lookup service, so it is directly responsible for disseminating copyrighted material" m1 A m2 B m3 C 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.7 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.8 Page 2

Gnutella (2000)" Gnutella: Example" Distribute file location Idea: broadcast the request How to find a file? Send request to all neighbors Neighbors recursively multicast the request Eventually a machine that has the file receives the request, and it sends back the answer Advantages: Totally decentralized, highly robust Disadvantages: Not scalable; the entire network can be swamped with requests (to alleviate this problem, each request has a TTL) Assume: m1s neighbors are m2 and m3; m3s neighbors are m4 and m5; m6 F m1 E A E? m5 E? E m2 E? B E? m3 m4 C D 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.9 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.10 Two-Level Hierarchy" KaZaa, subsequent versions of Gnutella Leaf nodes are connected to a small number of ultrapeers (suppernodes) Two-Level Hierarchy" Query A leaf sends query to its ultrapeers If ultrapeers dont know the answer, they flood the query to other ultrapeers Ultrapeer nodes Ultrapeer nodes Leaf nodes Leaf nodes 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.11 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.12 Page 3

Example: Oct 2003 Crawl on Gnutella" Skype (2003)" Ultrapeer nodes Leaf nodes 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.13 Peer-to-peer Internet Telephony Two-level hierarchy like KaZaa Ultrapeers used to route traffic between NATed endhosts plus a login server to» authenticate users» ensure that names are unique across network 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 B A login server Messages exchanged to login server Data traffic (Note*: probable protocol; Skype protocol is not published) Lec 23.14 BitTorrent (2001)" BitTorrent: Join Procedure" Allow fast downloads even when sources have low uplink capacity How does it work? Seed (origin) site storing the file to be downloaded Tracker server maintaining the list of peers in system Split each file into pieces (~ 256 KB each), and each piece into sub-pieces (~ 16 KB each) The loader loads one piece at a time Within one piece, the loader can load up to five subpieces in parallel" 1) Peer contacts tracker responsible for file it wants to download 2) Tracker returns a list of peer (20-50) downloading same file 3) Peer connects to peers in the list join" Tracker m2 peer " List " (m1,m2,m5)" m1 m3 m5 Seed (origin server) m6 m4 m7 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.15 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.16 Page 4

BitTorrent: Download Algorithm" Download consists of three phases: Start: get a piece as soon as possible Select a random piece Middle: spread all pieces as soon as possible Select rarest piece next End: avoid getting stuck with a slow source, when downloading the last sub-pieces Request in parallel the same sub-piece Cancel slowest downloads once a sub-piece has been received (For details see: http://bittorrent.org/bittorrentecon.pdf) 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.17 Bittorrent: Handling Freeriders" Freeriders: peers that use the network without contributing (with the upstream bandwidth) Solution: chocking, a variant of Tit-for-Tat Each peer has a limited number of upload slots When a peer's upload bandwidth is saturated, it exchanges upload bandwidth for download bandwidth If peer U downloads from peer C and doesnʼt upload in return, C chokes download to U 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 C U chock C U Lec 23.18 Distributed Hash Tables (DHTs)" Goal: make sure an item (file) identified is always found DHTs" Partition hash table across nodes Abstraction: a distributed hash-table data structure insert(id, item); item = query(id); Note: item can be anything: a data object, document, file, pointer to a file Proposals CAN, Chord, Kademlia, Pastry, Viceroy, Tapestry, etc id1 id2 id5 id8 id9 id11 id13 id16 id18 item1 item2 item5 item8 item9 item11 item13 item16 item18 m1 m2 m3 m4 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.19 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.20 Page 5

DHT: Insertion" Call insert(id4, item14) at m1 Find node responsible for id4, i.e., node m3 Insert (id14, item14) at m3 DHT: Query" Call query(id4) at m4 Find node responsible for id4, i.e., m3 Return (id14, item14) to m4 insert(id14, item14) id1 item1 id2 item2 m1 id11 item11 id13 item13 m2 id14 item14 id16 item16 id5 item5 m3 id18 item18 id8 item8 id9 item9 m4 id1 item1 id2 item2 m1 item14 query(id14) id11 item11 id13 item13 m2 id14 item14 id16 item16 id5 item5 m3 id18 item18 id8 item8 id9 item9 m4 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.21 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.22 DHT: Lookup Service" Key primitive: lookup service Given an ID, map it to a host Challenges Scalability: hundreds of thousands or millions of machines Instability» Changes in routes, congestion, availability of machines Heterogeneity» Latency: 1ms to 1000ms» Bandwidth: 32Kb/s to 100Mb/s» Nodes stay in system from 10s to a year Trust» Selfish users» Malicious users Content Addressable Network (CAN)" Associate to each node and item a unique id in an d- dimensional space, e.g., torus Properties Routing table size O(d), i.e., each node needs to know about O(d) Guarantees that a file is found in at most d*n 1/d steps, where n is the total number of nodes 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.23 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.24 Page 6

CAN Example: Two Dimensional Space" CAN Example: Two Dimensional Space" Space divided between nodes All nodes cover the entire space Each node covers either a square or a rectangular area of ratios 1:2 or 2:1 Example: Assume space size (8 x 8) Node n1:(1, 2) first node that joins cover the entire space n Node n2:(4, 2) joins space is divided between n1 and n2 n n 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.25 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.26 CAN Example: Two Dimensional Space" CAN Example: Two Dimensional Space" Node n2:(4, 2) joins space is divided between n1 and n2 Nodes n4:(5, 5) and n5:(6,6) join n n n n n n n n 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.27 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.28 Page 7

CAN Example: Two Dimensional Space" CAN Example: Two Dimensional Space" Nodes: n1:(1, 2); n2:(4,2); n3:(3, 5); n4:(5,5);n5:(6,6) Items: f1:(2,3); f2:(5,0); f3:(2,1); f4: (7,5); n n n f Each item is stored by the node who owns its mapping in the space n n n f f n n f f f n n f f 0 1 2 3 4 5 6 7 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.29 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.30 CAN: Query Example" Each node knows its neighbors in the d-space Forward query to the neighbor that is closest to the query id Example: assume n1 queries f4 n n n f f n n f f 5min Break" 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.31 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.32 Page 8

Chord" Identifier to Node Mapping Example" Associate to each node and item a unique id in an unidimensional space 0..2 m -1 Key design decision Decouple correctness from efficiency Properties Routing table size O(log(N)), where N is the total number of nodes Guarantees that a file is found in O(log(N)) steps Node 8 maps [5,8] Node 15 maps [9,15] Node 20 maps [16, 20] Node 4 maps [59, 4] Each node maintains a pointer to its successor 44 58 35 32 4 8 20 15 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.33 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.34 Each node maintains its successor Route packet (ID, data) to the node responsible for ID using successor pointers 4 Lookup" 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 node=4 3 3 lookup(37)" 2 1 Lec 23.35 Stabilization Procedure" Periodic operation performed by each node N to handle joins N: periodically: send GET_PRED to N.successor; M: upon receiving GET_PRED from N: reply PRED(M.predecessor) to N; N: upon receiving PRED(Mʼ) if (Mʼ between (N, N.successor)) N.successor = Mʼ; send NOTIFY to N.successor; M: upon receiving NOTIFY from N: if ((N between (Mpredecessor, M)) M.predecessor = NULL) predecessor = N; 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.36 Page 9

Joining Operation" Joining Operation" Node with id=50 joins the ring Node 50 needs to know at least one node already in the system - Assume known node is 15 succ=nil" pred=nil" 5 succ= pred=4 1 Node 50: send join (50) to node 15 Node 44: returns its successor, i.e., node 58 Node 50 updates its successor to 58 succ= succ=nil" pred=nil" 5 succ= pred=4 join(50)" 1 succ= pred=3 4 2 succ= pred=3 4 2 3 3 3 3 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.37 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.38 Joining Operation" Joining Operation" Node 50: ask its successor (node 58) for its predecessor Node 58: reply with its predecessor, i.e., node 44 Node 50: doesnʼt do anything as 44 not in (50,58) succ= pred=nil" pred(44)" 5 succ= pred=3 succ= pred=4 get_pred()" 4 2 1 Node 50: send NOTIFY to 58 Node 58: update its predecessor to 50 as 50 is in (44, 58) succ= pred=nil" 5 succ= pred=3 succ= pred=4 pred=5 notify()" 4 2 1 3 3 3 3 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.39 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.40 Page 10

Joining Operation (contʼd)" Joining Operation (contʼd)" Node 44: ask its successor (node 58) for its predecessor Node 58: reply with its predecessor, i.e., node 50 Node 44: update its successor to 50, as 50 in (44, 58) succ= pred=nil" 5 succ=5 succ= pred=3 succ= pred=5 pred(50)" 4 get_pred()" 2 1 Node 44: send NOTIFY to its successor, i.e., node 50 Node 50: update its predecessor to 44 succ= pred=4 pred=nil" 5 succ=5 pred=3 succ= pred=5 notify(44)" 4 2 1 3 3 3 3 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.41 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.42 Joining Operation (contʼd)" Achieving Efficiency: finger tables This completes the joining operation succ= pred=4 succ=5 pred=5 5 4 2 1 Finger Table at 80 i ft[i] 0 96 1 96 2 96 3 96 4 96 5 112 6 20 80 + 2 4 " 80 + 2 5 " 96 80 + 2 3 " 80 + 2 2 80 + 2 1 " " 80 + 2 0 " 112 80 0 Say m=7 (80 + 2 6 ) mod 2 7 = 1 20 32 45 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 3 3 Lec 23.43 i m ith entry at peer with id n is first peer with id >= n + 2 (mod2 ) 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.44 Page 11

Achieving Robustness" To improve robustness each node maintains the k (> 1) immediate successors instead of only one successor In the pred() reply message, node A can send its k-1 successors to its predecessor B Upon receiving pred() message, B can update its successor list by concatenating the successor list received from A with its own list 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.45 Iteratively: Example: node 4 issue query(31) Recursively Example: node 4 issue query(31) Iterative vs. Recursive Queries" 50 44 32 35 25 11/21 Anthony D. Joseph and Ion Stoica 32 CS162 UCB Spring 2011 58 50 58 25 44 32 4 35 32 8 15 4 25 8 15 Lec 23.46 Performance" Conclusions" Routing in the overlay network can be more expensive than in the underlying network Because usually there is no correlation between node ids and their locality;» A query can repeatedly jump from Europe to North America, though both the initiator and the node that store the item are in Europe Solutions: CAN and Chord maintain multiple copies for each entry in their routing tables and choose the closest in terms of network distance The key challenge of building wide area P2P systems is a scalable and robust directory service Solutions covered in this lecture Naptser: centralized location service Gnutella: broadcast-based decentralized location service CAN, Chord, Tapestry, Pastry: intelligent-routing decentralized solution» Guarantee correctness» Tapestry, Pastry provide efficient routing, but more complex 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.47 11/21 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2011 Lec 23.48 Page 12