Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Resource Discovery for the Web Platform using a P2P Overlay Network with WebRTC as the layer of Transport

495 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Resource Discovery for the Web Platform using a P2P Overlay Network with WebRTC as the layer of Transport

  1. 1. HI, I’M DAVID ://daviddias.me ://blog.daviddias.me ://github.com/diasdavid ://twitter.com/daviddias
  2. 2. RESOURCE DISCOVERY
  3. 3. RESOURCE DISCOVERY FOR THE WEB PLATFORM ON TOP OF A P2P OVERLAY NETWORK USING WEBRTC AS THE LAYER OF TRANSPORT
  4. 4. THE INTERNET
  5. 5. MEMEX
  6. 6. URL
  7. 7. { “KEY” : ”VALUE” }
  8. 8. GET http://recipes.com/francesinha
  9. 9. GET http://recipes.com/latest
  10. 10. GET http://recipes.com/latest
  11. 11. GET http://recipes.com/latest
  12. 12. GET http://recipes.com/latest LB
  13. 13. GET http://recipes.com/latest LB Centralized
  14. 14. GET http://recipes.com/latest L L L L
  15. 15. DECENTRALISED ARCHITECTURES
  16. 16. P2P networks are only as useful as their Resource Discovery capabilities remain efficient when they scale up
  17. 17. GNUTELA 0.4
  18. 18. • march 2000, Justin Frankel and Tom Pepper • topology is completely random • routing and search using flooding with TTL and hop counter • really slow • lot’s of signalling traffic
  19. 19. GNUTELA 0.6
  20. 20. UNSTRUCTURED P2P NETWORKS Without an implicit way to organize content
  21. 21. STRUCTURED P2P NETWORKS
  22. 22. CHORD
  23. 23. • DHT • Highly scalable • Each node only knows of m number of other nodes • Each node has a unique identifier • Each node is responsible for a segment of the data • Ids are 160 bits (SHA-1 for Uniform Distribution) • CHORD is awesome
  24. 24. 02160 • 160 bit namespace
  25. 25. 0 1 2 3 4 5 6 7 • 3 bit namespace • Id = hash(IP)
  26. 26. 0 1 2 3 4 5 6 7 • each node is responsible for a segment
  27. 27. 0 1 2 3 4 5 6 7 • minimum requirement - each node has to know their successor
  28. 28. 0 1 2 3 4 5 6 7 • each node is going to have it’s finger table
  29. 29. start interval sucessor start(k) = (n+2k-1) mod 2m, 1 ≤ k ≤ m interval(k) = start(k) = start(k+1) sucessor - first node after start(k)
  30. 30. 0 1 2 3 4 5 6 7 start interval sucessor start(k) = (n+2k-1) mod 2m, 1 ≤ k ≤ m interval(k) = [start(k), start(k+1) ) sucessor - first node after start(k)
  31. 31. 0 1 2 3 4 5 6 7 start interval sucessor 1 start(k) = (n+2k-1) mod 2m, 1 ≤ k ≤ m interval(k) = [start(k), start(k+1) ) sucessor - first node after start(k) interval(k) = [(0+2*1-1) mod 23 , (0+2*2-1) mod 23) = [1,2)
  32. 32. 0 1 2 3 4 5 6 7 start interval sucessor 1 [1,2) 1 start(k) = (n+2k-1) mod 2m, 1 ≤ k ≤ m interval(k) = [start(k), start(k+1) ) sucessor - first node after start(k) interval(k) = [(0+2*1-1) mod 23 , (0+2*2-1) mod 23) =
  33. 33. 0 1 2 3 4 5 6 7 start interval sucessor 1 [1,2) 1 2 start(k) = (n+2k-1) mod 2m, 1 ≤ k ≤ m interval(k) = [start(k), start(k+1) ) sucessor - first node after start(k) interval(k) = [(0+2*2-1) mod 23 , (0+2*3-1) mod 23)
  34. 34. 0 1 2 3 4 5 6 7 start interval sucessor 1 [1,2) 1 2 [2,4) 3 start(k) = (n+2k-1) mod 2m, 1 ≤ k ≤ m interval(k) = [start(k), start(k+1) ) sucessor - first node after start(k) interval(k) = [(0+2*2-1) mod 23 , (0+2*3-1) mod 23)
  35. 35. 0 1 2 3 4 5 6 7 start interval sucessor 1 [1,2) 1 2 [2,4) 3 4 start(k) = (n+2k-1) mod 2m, 1 ≤ k ≤ m interval(k) = [start(k), start(k+1) ) sucessor - first node after start(k) interval(k) = [(0+2*3-1) mod 23 , (0+2*4-1) mod 23)
  36. 36. 0 1 2 3 4 5 6 7 start interval sucessor 1 [1,2) 1 2 [2,4) 3 4 [4,0) 6 start(k) = (n+2k-1) mod 2m, 1 ≤ k ≤ m interval(k) = [start(k), start(k+1) ) sucessor - first node after start(k) interval(k) = [(0+2*3-1) mod 23 , (0+2*4-1) mod 23)
  37. 37. • API drafted by W3C • enables voice, video and data transfer between browsers in a P2P fashion
  38. 38. DEMO
  39. 39. WEBRTC-EXPLORER
  40. 40. • Chord inspired P2P overlay network designed for the Web Platform • Uses CHORD routing scheme • Uses WebRTC for transport • WebSockets for Signalling • Peers (browsers) route messages amongst them • 48 bits Ids • Brings a full DHT to the browser WEBRTC-EXPLORER
  41. 41. WEBRTC-RING http://blog.daviddias.me/ 2014/12/20/webrtc-ring
  42. 42. HOW DOES IT WORK
  43. 43. var Explorer = require(‘webrtc-explorer’); var config = { signalingURL: '<url>' }; var peer = new Explorer(config); peer.events.on(‘registered', function(data) { console.log('Id:', data.peerId); }); peer.events.on('ready', function() { console.log('ready to send messages'); }); peer.events.on('message', function(envelope) { console.log(envelope); }); peer.register(); //peer.send(‘<dst_id>’, <data_to_send>); s-register c-registered { id: “<this_node_id>” } 1 2
  44. 44. c-finger-update c-finger-update c-finger-update
  45. 45. s-send-offer c-offer-accepted 1 4 s-accept-offer s-offer-accepted 2 3 5
  46. 46. DEMO
  47. 47. PAPERS • A study on peer-to-peer based discovery of grid resource information by Rajiv Ranjan, Aaron Harwood, Rajkumar Buyya • Peer-to-peer architecture case study: Gnutella network by M. Ripeanu • Dynamo : Amazon ’ s Highly Available Key-value Store by Giuseppe DeCandia, Deniz Hastorun, Madan Jampani, Gunavardhan Kakulapati, Avinash Lakshman, Alex Pilchin, Swaminathan Sivasubramanian, Peter Vosshall, Werner Vogels • The Gnutella Protocol Specification v0.6 by Tor Klingberg, Raphael Manfredi • Chord : A Scalable Peer-to-peer Lookup Service for Internet by Ion Stoica, Robert Morris, David Karger, M Frans Kaashoek, Hari Balakrishnan Ý
  48. 48. THANK YOU! :D

×