Introduction P2p

2,868 views

Published on

A short introduction to p2p computing

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,868
On SlideShare
0
From Embeds
0
Number of Embeds
40
Actions
Shares
0
Downloads
129
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • Introduction P2p

    1. 1. Introduction to P2P systems Davide Carboni © 2005-2006
    2. 2. License Attribution-ShareAlike 2.5 You are free: to copy, distribute, display, and perform the work to make derivative works to make commercial use of the work Under the following conditions: Attribution . You must give the original author credit. Share Alike . If you alter, transform, or build upon this work, you may distribute the resulting work only under a licence identical to this one. For any reuse or distribution, you must make clear to others the licence terms of this work. Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above. This is a human-readable summary of the Legal Code (the full licence ) . Disclaimer
    3. 3. P2P is about sharing resources <ul><li>Your CPU time </li></ul><ul><li>Your bandwidth </li></ul><ul><li>Your disk space </li></ul>
    4. 4. What is P2P <ul><li>From Wikipedia </li></ul><ul><li>A peer-to-peer computer network is a network that relies on the computing power and bandwidth of the participants in the network rather than concentrating it in a relatively low number of servers </li></ul>
    5. 5. P2P and GRID <ul><li>From Wikipedia </li></ul><ul><li>Grid computing […] performs higher throughput computing by taking advantage of many networked computers to model a virtual computer architecture. </li></ul>
    6. 6. Topology Comparison Client/server GRID P2P server client client=server
    7. 7. Overlay Crs4.it Australian ISP Mobile phones in cell xyz
    8. 8. Overlay Crs4.it Australian ISP Mobile phones in cell xyz
    9. 9. Three main issues in P2P systems <ul><li>Bootstrapping </li></ul><ul><li>Index/Lookup (query) </li></ul><ul><li>Delivery of large objects (in case of file sharing) </li></ul>
    10. 10. A la Napster Query / Query Hits GET <file>
    11. 11. Copyright issues with Napster <ul><li>Napster claimed that the law allows people to share music with friends. </li></ul><ul><li>The court considered this position illegal and Napster was closed. </li></ul>
    12. 12. Gnutella Overlay Requestor Responder
    13. 13. Gnutella Messages ping, pong, push, query, queryhit 16 23 – 23+payload length Payload length 19-22 hops 18 TTL 17 GUID 0 - 15 Description Byte
    14. 14. Gnutella messages <ul><li>ping: discover hosts on network </li></ul><ul><li>pong: reply to ping </li></ul><ul><li>query: search for a file </li></ul><ul><li>query hit: reply to query </li></ul><ul><li>push: download request for firewalled servents </li></ul><ul><li>Ref. http://rfc-gnutella.sourceforge.net/developer/stable/index.html </li></ul>
    15. 15. Gnutella: PING Requestor PING
    16. 16. Gnutella: PONG Requestor PONG
    17. 17. Gnutella: QUERY Requestor QUERY
    18. 18. Gnutella: QUERY-HITS A C B D Requestor QUERY-HITS Responder 1 Responder 2
    19. 19. Gnutella: GET the file Requestor Responder 1 GET file HTTP/1.1 file
    20. 20. Gnutella, behind firewalls Requestor Responder GET file
    21. 21. Gnutella, behind firewalls (2) C B D Requestor Responder PUSH A
    22. 22. Gnutella, behind firewalls (3) Requestor Responder FILE
    23. 23. Bootstrapping in Gnutella <ul><li>X-Try </li></ul><ul><li>Ping/Pong </li></ul><ul><li>Storing from QueryHit messages </li></ul><ul><li>GWebCache </li></ul>
    24. 24. Open issues in Gnutella <ul><li>Latency </li></ul><ul><li>Scalability </li></ul><ul><li>Vulnerability </li></ul><ul><li>Privacy </li></ul><ul><li>Security </li></ul>
    25. 25. Is Gnutella obsolete? <ul><li>Alive and Kicking </li></ul><ul><li>The version 0.6 of the protocol prevents pure flooding and uses smart routing based on Ultrapeers </li></ul><ul><li>More than 2 millions users with 500,000 nodes always up </li></ul>
    26. 26. Popularity of P2P Networks (measured by Slick.com) <ul><li>Latest Statistics taken 2006-02-26 22:14:12: eDonkey2K Users: 3,474,261 FastTrack Users: 2,609,688 Gnutella Users: 2,219,539 Overnet Users: 578,521 MP2P Users: 252,893 Filetopia Users: 4,806 </li></ul>
    27. 27. Hub (Gnutella2 et al.) Hub Web
    28. 28. Hub Requirements <ul><li>> 100 sockets </li></ul><ul><li>CPU and RAM for servicing the network </li></ul><ul><li>Uptime (>2 hours) </li></ul><ul><li>Broadband (also for upload) </li></ul><ul><li>Able to receive inbound TCP and/or UDP (IP in the global address space, no NAT) </li></ul>
    29. 29. Hub Tasks <ul><li>Keep up-to-date information about other hubs </li></ul><ul><li>Manage routing tables to route messages efficiently </li></ul><ul><li>Manage filters for query messages </li></ul><ul><li>Monitor they own resources. </li></ul>
    30. 30. Query Hash Table <ul><li>QHTs provide information to know that a particular node (and possibly its descendants) will not be able to provide any matching objects for a given query. </li></ul><ul><li>queries can be discarded confidently. </li></ul><ul><li>Neighbours know what their neighbours do not have, but cannot say for sure what they do have. </li></ul>QHT
    31. 31. What is Hashing <ul><li>From Wikipedia, the free encyclopedia </li></ul><ul><li>A hash function or hash algorithm is a function for examining the input data and producing an output hash value. The process of computing such a value is known as hashing . The process of hashing has the property that two different inputs are unlikely to hash to the same hash value. </li></ul>
    32. 32. What is Hashing (2) Collisions occur with 2^(-N)
    33. 33. Query Hash Table 1 1 1 1 1 1 1 1 1 1 0 1 2 2^N 0<= Hash(word) <= 2^N
    34. 34. Query Filtering <ul><li>If any of the lookups based on URNs found a hit, send the query packet </li></ul><ul><li>If at least two thirds of lookups based on words found a hit, send </li></ul><ul><li>Otherwise, drop the packet </li></ul><ul><li>Consider all text content in the query, including generic search text and metadata search text if it is present. </li></ul><ul><li>Tokenize quoted phrases into words, ignoring the phrase at this level </li></ul>
    35. 35. Distributed hashtables
    36. 36. Distributed Hashtables <ul><li>Main features: a key is mapped onto a node of the network. </li></ul><ul><li>Several proposals: Chord, Pastry and Kademlia. </li></ul><ul><li>Lookup(key) reaches the right node with O(log(N) ) hops. </li></ul>
    37. 37. Possible applications of DHT <ul><li>DHT DNS </li></ul><ul><li>Content lookup </li></ul><ul><li>Web search engine </li></ul>
    38. 38. DNS over DHT (1) <ul><li>Problem: how to register a name onto a IP address </li></ul><ul><li>Assign a name to your machine, example ‘mymachine’ </li></ul><ul><li>Check if this name is available or not using the DHT operation get(‘mymachine’). </li></ul><ul><li>If the result is null then register the name and the IP with the DHT operation put(‘mymachine’, 212.22..) </li></ul>
    39. 39. DNS over DHT (2) <ul><li>Problem: how to resolve a name onto a IP address </li></ul><ul><li>Use the DHT operation get(hostname). </li></ul><ul><li>The result if not null is the IP address you’re searching </li></ul>
    40. 40. Content indexing/lookup on DHT <ul><li>A content has a set of metadata (i.e. author, editor, genre, …) </li></ul><ul><li>Build a different index based on DHT for each metadata </li></ul><ul><li>i.e. the index for author </li></ul><ul><ul><li>put(‘john’, http://host/dir/content.avi) </li></ul></ul>
    41. 41. How DHT works <ul><li>In DHT each node has a node ID which belogs to a set S (for instance the set of bitstrings with length 160) </li></ul><ul><li>Also keys must hashed in the same set S (hash(key) belongs to S) </li></ul>
    42. 42. Web crawlers and DHT <ul><li>Assume a network of nodes in a DHT </li></ul><ul><li>Assume each node runs also a crawler. </li></ul><ul><li>For each word in a Web page it performs </li></ul><ul><ul><li>Put(word,URL) </li></ul></ul><ul><li>So a distributed index of the Web is built[1] </li></ul>
    43. 43. Web search and DHT <ul><li>When the user type a keyword ‘foo’ lookup the DHT </li></ul><ul><ul><li>Get(‘foo’) </li></ul></ul><ul><li>The DHT will give the list of URL indexed with ‘foo’ </li></ul>
    44. 44. Kademlia <ul><li>S = [00 ....0 - 11 ...1] the set of 160bit strings </li></ul><ul><li>Each node has a node ID in S </li></ul><ul><li>For each 'key' hash(key) is in S </li></ul>
    45. 45. Kademlia distance <ul><li>Given x,y in S </li></ul><ul><li>Define the distance d(x,y) = xor(x,y) </li></ul><ul><li>d has the following properties: </li></ul><ul><li>d(x,y) = d(y,x) </li></ul><ul><li>d(x,x) = 0 </li></ul><ul><li>d(x,y) + d(y,z) >= d(x,z) </li></ul>
    46. 46. k-Buckets in kademlia <ul><li>Each node stores an array of lists: list[i] </li></ul><ul><li>i = 0,1, ... , 159 </li></ul><ul><li>list[i] stores up to k tuples: (IP,port,ID) </li></ul><ul><li>list[i] stores tuples whose ID is: </li></ul><ul><ul><li>2^i <= D(this,ID)< 2^(i+1) </li></ul></ul><ul><li>list[i] is ordered as LRS (last recent seen) </li></ul>
    47. 47. Tree for nodes in kademlia 1 1 1 1 0 0 0 0 0101
    48. 48. k-Buckets in kademlia <ul><li>For small values of i, list[i] has few elements </li></ul><ul><li>For larger values of i, list[i] is likely to contain more elements. </li></ul>
    49. 49. Operations in kademlia <ul><li>PING (IP, port) </li></ul><ul><li>STORE (key, value) </li></ul><ul><li>FIND_VALUE (key) </li></ul><ul><li>FIND_NODE (ID) </li></ul>
    50. 50. Lookup in Kademlia <ul><li>FIND_NODE(hash(k)) </li></ul><ul><li>Compute D=xor(this,hash(key)) </li></ul><ul><li>Find a tuples in list[i] (i.e. a=3) </li></ul><ul><li>Send FIND_NODE(hash(key)) to the 3 nodes </li></ul><ul><li>I receive other node addresses. Reiterate FIND_NODE(hash(key)) on them. </li></ul><ul><li>Stop when no new addresses are received </li></ul>
    51. 51. Nodes Joining and Leaving <ul><li>Whenever one node asks another for its contacts, the called node stores the contact information of the caller. </li></ul><ul><li>When a node joins the network it takes some of the contacts of an arbitrary node and uses them as its own. </li></ul><ul><li>It then does a search for itself. This results in other nodes being called, which makes them aware of the new node's existence </li></ul>
    52. 52. Node Joining and Leaving (2) <ul><li>A new node may have become the closest node to certain keys </li></ul><ul><li>The previous closest nodes will replicate the appropriate key/value pairs to the new node </li></ul><ul><li>Ignoring replication the cost of a node joining is only O(log n) messages. </li></ul>
    53. 53. Range Query in DHT (1) <ul><li>DHT maps a key onto a node </li></ul><ul><li>It is easy to lookup a value given a key </li></ul><ul><li>It is uneasy lookup values in a range of keys </li></ul><ul><li>Example 1: </li></ul><ul><ul><li>Lookup all tuples in ‘aaaa’ < key < ‘bbbb’ </li></ul></ul><ul><li>Example 2: </li></ul><ul><ul><li>Lookup all tuples in ’39,88’ < lat < ’39,94’ </li></ul></ul>
    54. 54. References (1) <ul><li>Napster Timeline </li></ul><ul><ul><li>http://www.cnn.tv/SPECIALS/2001/napster/timeline.html </li></ul></ul><ul><li>The Gnutella Developer Forum </li></ul><ul><ul><li>http://www.the-gdf.org/wiki/index.php?title=Main_Page </li></ul></ul><ul><li>History of Gnutella in ‘Gnutella’ </li></ul><ul><ul><li>http://ntrg.cs.tcd.ie/undergrad/4ba2.02-03/p5.html </li></ul></ul><ul><li>Slyck.com </li></ul><ul><li>DHT Links </li></ul><ul><ul><li>http://www.etse.urv.es/~cpairot/dhts.html </li></ul></ul>
    55. 55. References (2) <ul><li>YACY (DHT Web search/index) </li></ul><ul><ul><li>http://www.yacy.net/yacy/ </li></ul></ul><ul><li>Kademlia : A Peer-to-peer Information System Based on the XOR Metric . (paper) </li></ul><ul><li>Khashmir – Kademlia in Python </li></ul><ul><ul><li>http://khashmir.sourceforge.net/ </li></ul></ul><ul><li>A Case Study in Building Layered DHT Applications (paper on range query/DHT) </li></ul><ul><ul><ul><li>http://www.placelab.org/publications/pubs/IRS-TR-05-001.pdf </li></ul></ul></ul>
    56. 56. License Attribution-ShareAlike 2.5 You are free: to copy, distribute, display, and perform the work to make derivative works to make commercial use of the work Under the following conditions: Attribution . You must give the original author credit. Share Alike . If you alter, transform, or build upon this work, you may distribute the resulting work only under a licence identical to this one. For any reuse or distribution, you must make clear to others the licence terms of this work. Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above. This is a human-readable summary of the Legal Code (the full licence ) . Disclaimer

    ×