Application Layer Peertopeer UIUC CS 438 Communication Networks

  • Slides: 25
Download presentation
Application Layer – Peer-to-peer UIUC CS 438: Communication Networks Summer 2014 Fred Douglas Slides:

Application Layer – Peer-to-peer UIUC CS 438: Communication Networks Summer 2014 Fred Douglas Slides: Fred, Kurose&Ross (sometimes edited)

A Step Back • Today, everything is megacorps: Google etc. You

A Step Back • Today, everything is megacorps: Google etc. You

A Step Back • What, fundamentally, does the internet do? mobile network global ISP

A Step Back • What, fundamentally, does the internet do? mobile network global ISP home network “End host” “Internet” institutional network regional ISP “End host”

“Pure” P 2 P architecture v v v no always-on server arbitrary end systems

“Pure” P 2 P architecture v v v no always-on server arbitrary end systems directly communicate peers are intermittently connected and change IP addresses examples: § File distribution (Bit. Torrent) • Can be pure § File distribution (Freenet) § Vo. IP (Skype) • Registration + authentication § Many games • Lobby, matchmaking

Motivation: File distribution Question: how much time to distribute file (size F) from one

Motivation: File distribution Question: how much time to distribute file (size F) from one server to N peers? § …the traditional way (e. g. from an HTTP server) § …if peers also upload to each other us: server upload capacity file, size F server u. N d. N us u 1 d 1 u 2 di: peer i download capacity d 2 network (with abundant bandwidth) di ui ui: peer i upload capacity

Client-server vs. P 2 P: example

Client-server vs. P 2 P: example

P 2 P file distribution: Bit. Torrent v file divided into fixed size chunks

P 2 P file distribution: Bit. Torrent v file divided into fixed size chunks tracker: tracks peers participating in torrent [list of peers] torrent: group of peers exchanging chunks of a file

P 2 P file distribution: Bit. Torrent v peer joining torrent: § Starts with

P 2 P file distribution: Bit. Torrent v peer joining torrent: § Starts with no chunks; can only download § Can pass on any chunk it gets § Eventually completes the file, and • Becomes a “seeder”, or • Leaves v During v while v v v download peer uploads chunks to other peers downloading, 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

Bit. Torrent: requesting, sending file chunks requesting chunks: v v v at any given

Bit. Torrent: requesting, sending file chunks requesting chunks: v v v 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 v 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 every 10 secs v every 30 secs: randomly select another peer, starts sending chunks § “optimistically unchoke” this peer § newly chosen peer may join top 4

Bit. Torrent: tit-for-tat (1) Alice “optimistically unchokes” Bob (2) Alice becomes one of Bob’s

Bit. Torrent: 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 !

Distributed Hash Table (DHT) v Distribute (key, value) pairs over millions of peers §

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

Assign key-value pairs to peers v v rule: assign key-value pair to the peer

Assign key-value pairs to peers v v 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

Silly Strawman Circular DHT • • each peer only aware of immediate successor and

Silly Strawman Circular DHT • • each peer only aware of immediate successor and predecessor. (Note: circular DHTs aren’t the 1 only way; e. g. Kademlia) 12 60 13 48 25 40 32 “overlay network”

Resolving a query 1 What is the value associated with key 53 ? value

Resolving a query 1 What is the value associated with key 53 ? value 12 60 13 48 O(N) messages on avgerage to resolve 40 query, when there are N peers 25 32

Circular DHT with shortcuts (Chord) 1 What is the value for value key 53

Circular DHT with shortcuts (Chord) 1 What is the value for value key 53 12 60 13 48 25 40 • • • 32 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

Chord Me Finger Finger

Chord Me Finger Finger

Peer churn 1 handling peer churn: vpeers may come and go (churn) 3 veach

Peer churn 1 handling peer churn: vpeers may come and go (churn) 3 veach peer knows address of 15 its two successors 4 veach peer periodically pings its 12 two successors to check 5 aliveness 10 vif immediate successor 8 leaves, choose next successor example: peer 5 abruptly leaves as new immediate successor

Peer churn 1 handling peer churn: vpeers may come and go (churn) 3 veach

Peer churn 1 handling peer churn: vpeers may come and go (churn) 3 veach peer knows address of 15 its two successors 4 veach peer periodically pings its 12 two successors to check aliveness 10 vif immediate successor 8 leaves, choose next successor example: peer 5 abruptly leaves as new immediate successor vpeer 4 detects peer 5’s departure; makes 8 its immediate successor v 4 asks 8 who its immediate successor is; makes 8’s immediate successor its second successor.

Bit. Torrent as true P 2 P • Traditional Bit. Torrent – Get peers

Bit. Torrent as true P 2 P • Traditional Bit. Torrent – Get peers from tracker – Trackers identified in. torrent file –. torrent file hosted on a centralized torrent search engine site • Fully P 2 P Bit. Torrent – Get peers from DHT, and direct exchange – Magnet link provides file hash • Look the hash up in DHT – Magnet links: just text • Search engines, forums, anonymous message boards, …

P 2 P Motivation – Revisited • Client-server dominates the mainstream. Why? – Performance

P 2 P Motivation – Revisited • Client-server dominates the mainstream. Why? – Performance • Economies of scale • Round trip times • (Mass file distribution is a rare exception) • So, why peer-to-peer? – Avoid single points of failure • Technological • …and social Robustness, Survivability OR Power to the people

Optional

Optional

Freenet • Pure P 2 P document store – Also forums implemented on top

Freenet • Pure P 2 P document store – Also forums implemented on top • Goals – Robustness • Node failures • Censorship – Anonymity

Freenet Design • Two components: storage, lookup • Storage – All nodes provide ~10+

Freenet Design • Two components: storage, lookup • Storage – All nodes provide ~10+ GB storage to the network – All content is encrypted: not visible to storer – Storer never has any idea what it’s storing • Lookup – Key-based routing, like a DHT – Lookup path construction: always take the hop closest to the target value – Data retrieval and insertion are both “lookups” – Data retrieval

Freenet Lookup • First, probe for a path • Receive (or send) data once

Freenet Lookup • First, probe for a path • Receive (or send) data once path is built • Nodes relaying the data can cache it • Data lookup caching means popular items are replicated, unpopular items forgotten

Freenet Topology • Original design – Start with connections to some bootstrap nodes –

Freenet Topology • Original design – Start with connections to some bootstrap nodes – Randomly add nodes in lookup paths to neighbors • Darknet – Only connect to nodes whose identity the user knows and trusts – Relies on social network dynamics to give the necessary fast mixing / “small world” property