Client-Server Architecture Pure P2P
Client-Server Architecture Pure P2P
server:
always-on host
permanent IP address
server farms for
scaling
clients:
client/server
no always-on server
directly communicate
peers are intermittently
File sharing
File distribution
Searching for information
Case Studies: Bittorrent
and Skype
TDDD36: Peer-to-peer
TDDD36: Peer-to-peer
Skype
voice-over-IP P2P application
centralized server: finding address of remote
party:
client-client connection: direct (not through
server)
Instant messaging
chatting between two users is P2P
centralized service: client presence
detection/location
user registers its IP address with central
server when it comes online
user contacts central server to find IP
addresses of buddies
Example
Alice runs P2P client
application on her
notebook computer
intermittently
connects to Internet;
gets new IP address
for each connection
asks for Hey Jude
application displays
other peers that have
copy of Hey Jude.
TDDD36: Peer-to-peer
Bob
peers
1
Bobs PC to Alices
notebook: HTTP
while Alice downloads,
other users uploading
from Alice.
Alices peer is both a
Web client and a
transient Web server.
All peers are servers =
highly scalable!
TDDD36: Peer-to-peer
centralized
directory server
IP address
content
peer-peer
copyright infringement:
target of lawsuit is
obvious
file transfer is
decentralized, but
locating content is
highly centralized
Alice
TDDD36: Peer-to-peer
TDDD36: Peer-to-peer
Gnutella: protocol
implementing protocol
File transfer:
HTTP
Query message
sent over existing TCP
connections
peers forward
Query message
QueryHit
sent over
reverse
path
Query
QueryHit
Query
QueryHit
Scalability:
limited scope
flooding
TDDD36: Peer-to-peer
TDDD36: Peer-to-peer
Hierarchical Overlay
between centralized
1.
ordinary peer
group-leader peer
neighoring relationships
in overlay network
TDDD36: Peer-to-peer
TDDD36: Peer-to-peer
DHT Identifiers
[0,2n-1].
TDDD36: Peer-to-peer
TDDD36: Peer-to-peer
Central issue:
15
closest ID.
Convention in lecture: closest is the
immediate successor of the key.
Ex: n=4; peers: 1,3,4,5,8,10,12,14;
4
12
5
10
TDDD36: Peer-to-peer
TDDD36: Peer-to-peer
O(N) messages
on avg to resolve
query, when there
are N peers
0001
Whos
responsible
for key 1110 ?
I am
15
0011
1111
12
1110
10
0100
1110
1110
1100
Define closest
as closest
successor
Whos
responsible
for key 1110?
0101
1110
1010
1000
TDDD36: Peer-to-peer
Peer Churn
15
4
12
5
10
TDDD36: Peer-to-peer
TDDD36: Peer-to-peer
of users communicate.
proprietary
Skype
login server
application-layer
protocol (inferred via
reverse engineering)
hierarchical overlay
with Supernodes
(SNs)
Index maps usernames
to IP addresses;
distributed over SNs
Supernode
(SN)
TDDD36: Peer-to-peer
Peers as relays
Motivation
Solution:
Using Alices and Bobs
SNs, Relay is chosen
Each peer initiates
session with relay.
Peers can now
communicate through
NATs via relay
BitTorrent (peer-to-peer)
Peer-assisted streaming
Server-based solutions (aggregation and replication)
TDDD36: Peer-to-peer
Server
u1
d1
u2
us
File, size F
dN
uN
Network (with
abundant bandwidth)
TDDD36: Peer-to-peer
server sequentially
sends N copies:
u1 d1 u2
d2
F
us
NF/us time
dN
Network (with
abundant bandwidth)
uN
time to download
Time to distribute F
to N clients using
client/server approach = dcs = max { NF/us, F/min(di) }
increases linearly in N
(for large N)
TDDD36: Peer-to-peer
Server
u1 d1 u2
F
us
d2
Network (with
abundant bandwidth)
dN
uN
3.5
TDDD36: Peer-to-peer
P2P
Client-Server
3
2.5
2
1.5
1
0.5
0
u ) }
10
15
20
25
30
35
N
TDDD36: Peer-to-peer
TDDD36: Peer-to-peer
BitTorrent (1)
torrent: group of
peers exchanging
chunks of a file
participating in torrent
chunks.
obtain list
of peers
trading
chunks
peer
TDDD36: Peer-to-peer
BitTorrent-like systems
TDDD36: Peer-to-peer
Downloader
Seed
Downloader
Seed
Downloader
Torrent
Arrivals
(x downloaders; y seeds)
Departures
Downloader
Seed residence
time
Download time
TDDD36: Peer-to-peer
BitTorrent (2)
Peer 2:
Peer N :
(2) (1)
(2)
from
Optimistic unchoke
to
Pulling Chunks
at any given time,
different peers have
different subsets of
file chunks
periodically, a peer
(Alice) asks each
neighbor for list of
chunks that they have.
Alice sends requests
for her missing chunks
rarest first
highest rate
v re-evaluate top 4 every 10 secs
every 30 secs: randomly select
another peer, starts sending chunks
v newly chosen peer may join top 4
v optimistically unchoke
TDDD36: Peer-to-peer
Live Streaming
BitTorrent: Tit-for-tat
(1) Alice optimistically unchokes Bob
(2) Alice becomes one of Bobs top-four providers; Bob reciprocates
(3) Bob becomes one of Alices top-four providers
Internet
piece
upload/downloads
Media player
queue/buffer
Buffer window
TDDD36: Peer-to-peer
TDDD36: Peer-to-peer
Streaming Analysis
demand streaming?
configuration parameters?
Piece selection policy
Peer selection policy
Upload/download bandwidth
MSP = DP
Start-up delay
Probability of disrupted playback
(pieces obtained
per unit time)
SP
(useful media pieces
per pieces obtained)
TDDD36: Peer-to-peer
Baseline Protocol
Example Results
Piece diversity
Tit-for-tat is most effective with rarest-first
In-order requirements
Streaming is most natural using in-order
0.1
Inorder, Rarest
Portion, x%
n
0.01
inorder
portion, 90%
portion, 50%
rarest
zipf(1.25)
0.001
Zipf()
n
0.0001
Zipf()
TDDD36: Peer-to-peer
4
8
12
Client Bandwidth
16
x% inorder
(100-x)% rarest
TDDD36: Peer-to-peer
Start-up Rule
Start-up Rule
Intuition
Intuition
The amount of in-order
data received (i.e., the size
of the in-order buffer)
data
data
x
The amount of data played out if
playback starts at time T
time
In-order buffer
Contains all pieces up to the first missing piece
The rate the size of the in-order buffer increases
time
TDDD36: Peer-to-peer
TDDD36: Peer-to-peer
S
S
C
Energy costs
Green data centers (close to renewable
energy source, for example)
Energy proportional data centers
S
S
S
C
S C
C
C C
C
TDDD36: Peer-to-peer
Without Losses
With Losses
scheduled on a channel
- Clients listen until fully served
1 2 3 4 5 6 7 8
File A
File A
1 2 X X X 6 7 8
1 2 3 4 5 6 7 8
8
3
2 1 8 7 6
Server
TDDD36: Peer-to-peer
2 1 8 7 6
1
2
Client
1 2 X X X 6 7 8
File A
scheduled on a channel
- Clients listen until fully served
Server
losses
Client
TDDD36: Peer-to-peer
Fountain service
File A
1 2 3 4 5 6 7 8
Enc.
Byers et al.)
Dec.
request arrivals
S
Server
losses
Client
TDDD36: Peer-to-peer
A final note
S
S
S
S
C
S
S
C
S C
C
C C
C
TDDD36: Peer-to-peer