UIUC CS438 Communication Networks Summer 2014 Fred Douglas Slides Fred KuroseampRoss sometimes edited A Step Back Today everything is megacorps Google etc You A Step Back ID: 916130
Download Presentation The PPT/PDF document "Application Layer – Peer-to-peer" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Application Layer – Peer-to-peer
UIUC CS438: Communication NetworksSummer 2014Fred DouglasSlides: Fred, Kurose&Ross (sometimes edited)
Slide2A Step Back
Today, everything is megacorps: Google etc.
You
Slide3A Step Back
What, fundamentally, does the internet do?“Internet”
“End host”
“End host”
mobile network
global ISP
regional ISP
home
network
institutional
network
Slide4“Pure”
P2P
architecture
no
always-on server
arbitrary end systems directly communicate
peers are intermittently connected and change IP addresses
examples:
F
ile distribution (
BitTorrent
)
Can
be pure
File distribution (
Freenet
)
VoIP (Skype)
Registration + authentication
Many games
Lobby, matchmaking
Slide5Motivation: 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
u
s
u
N
d
N
server
network (with abundant
bandwidth)
file, size F
u
s
:
server upload capacity
u
i
:
peer i upload capacity
d
i
:
peer i download capacity
u
2
d
2
u
1
d
1
d
i
u
i
Slide6Client-server vs. P2P: example
Slide7P2P file distribution: BitTorrent
tracker:
tracks peers
participating in torrent
torrent:
group of peers exchanging chunks of a file
file divided into
fixed size chunks
[list of peers]
Slide8peer joining torrent:
Starts with no chunks; can only downloadCan pass on any chunk it getsEventually completes the file, andBecomes a “seeder”, orLeaves
During download
P2P file distribution: BitTorrent
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
Slide9BitTorrent: requesting, sending file chunks
requesting chunks:at any given time, different peers have different subsets of file chunksperiodically, Alice asks each peer for list of chunks that they haveAlice 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
Slide10BitTorrent: 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 !
Slide11Distribute (key, value) pairs over millions of peers
pairs are evenly distributed over peersAny peer can query database with a keydatabase returns value for the keyTo 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)
Distributed Hash Table (DHT)
Slide12Assign 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
Slide131
12
13
25
32
40
48
60
Silly
Strawman
Circular DHT
each peer
only
aware of
immediate successor and
predecessor.
(Note: circular DHTs aren’t the
only way; e.g.
Kademlia
)
“
overlay network
”
Slide141
12
13
25
32
40
48
60
What is the value
associated with key 53 ?
value
O(N)
messages
on avgerage to resolve
query, when there
are
N
peers
Resolving a query
Slide15Circular DHT with shortcuts (Chord)
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
1
12
13
25
32
40
48
60
What is the value for
key 53
value
Slide16Chord
Me
Finger
Finger
Finger
Finger
Finger
Slide17Peer churn
example: peer 5 abruptly leaves
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
Slide18Peer churn
example: peer 5 abruptly leavespeer 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.
1
3
4
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
Slide19BitTorrent as true P2P
Traditional BitTorrentGet peers from trackerTrackers identified in .torrent file.torrent file hosted on a centralized torrent search engine site
Fully P2P
BitTorrent
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, …
Slide20P2P Motivation – Revisited
Client-server dominates the mainstream. Why?PerformanceEconomies of scaleRound trip times(Mass file distribution is a rare exception)So, why peer-to-peer?Avoid single points of failureTechnological…and social
Robustness, Survivability
OR
Power to the people
Slide21Optional
Slide22Freenet
Pure P2P document storeAlso forums implemented on topGoalsRobustnessNode failuresCensorshipAnonymity
Slide23Freenet Design
Two components: storage, lookupStorageAll nodes provide ~10+ GB storage to the networkAll content is encrypted: not visible to storerStorer never has any idea what it’s storingLookupKey-based routing, like a DHTLookup path construction: always take the hop closest to the target valueData retrieval and insertion are both “lookups”
Data retrieval
Slide24Freenet Lookup
First, probe for a pathReceive (or send) data once path is builtNodes relaying the data can cache itData lookup caching means popular items are replicated, unpopular items forgotten
Slide25Freenet Topology
Original designStart with connections to some bootstrap nodesRandomly add nodes in lookup paths to neighborsDarknetOnly connect to nodes whose identity the user knows and trustsRelies on social network dynamics to give the necessary fast mixing / “small world” property