Client-Server Architecture Pure P2P Architecture
Client-Server Architecture Pure P2P Architecture
Client-Server Architecture Pure P2P Architecture
TDDD36: Lecture 5, P2P networks and streaming TDDD36: Lecture 5, P2P networks and streaming 4
3
TDDD36: Lecture 5, P2P networks and streaming TDDD36: Lecture 5, P2P networks and streaming 6
5
1
Gnutella: protocol
Query flooding: Gnutella ❒ Query message
File transfer:
HTTP
sent over existing TCP
connections
❒ fully distributed overlay network: graph ❒ peers forward
❍ no central server Query message Query
❒ edge between peer X ❒ QueryHit QueryHit
❒ public domain protocol and Y if there’s a TCP sent over
❒ many Gnutella clients connection reverse
implementing protocol path
❒ all active peers and
edges form overlay net
Query
❒ edge: virtual (not
QueryHit
physical) link
❒ given peer typically Scalability:
connected with < 10 limited scope
flooding
overlay neighbors
Peer leaving: see homework problem! content in its children neighoring relationships
in overlay network
TDDD36: Lecture 5, P2P networks and streaming 9 TDDD36: Lecture 5, P2P networks and streaming 10
increases linearly in N
(for large N)
TDDD36: Lecture 5, P2P networks and streaming 11 TDDD36: Lecture 5, P2P networks and streaming 12
2
File distribution time: P2P Server-client vs. P2P: example
Server Client upload rate = u, F/u = 1 hour, us = 10u, dmin ≥ us
❒ server must send one
F u1 d1 u2
copy: F/us time us d2 3.5
P2P
❒ client i takes F/di time
0.5
3
Distributed Hash Table (DHT) DHT Identifiers
❒ DHT = distributed P2P database ❒ Assign integer identifier to each peer in range
❒ Database has (key, value) pairs; [0,2n-1].
❍ key: ss number; value: human name ❍ Each identifier can be represented by n bits.
❍ key: content type; value: IP address ❒ Require each key to be an integer in same range.
❒ Peers query DB with key ❒ To get integer keys, hash original key.
❍ DB returns values that match the key ❍ eg, key = h(“Led Zeppelin IV”)
❒ Peers can also insert (key, value) peers ❍ This is why they call it a distributed “hash” table
TDDD36: Lecture 5, P2P networks and streaming 19 TDDD36: Lecture 5, P2P networks and streaming 20
❒ Central issue:
3
❍ Assigning (key, value) pairs to peers. 15
1110 0100 10
8
1110
1100 ❒ Each peer keeps track of IP addresses of predecessor,
1110 0101 successor, short cuts.
1110
❒ Reduced from 6 to 2 messages.
Define closest 1110
❒ Possible to design shortcuts so O(log N) neighbors,
as closest 1010
1000 O(log N) messages in query
successor
TDDD36: Lecture 5, P2P networks and streaming 23 TDDD36: Lecture 5, P2P networks and streaming 24
4
Peer Churn P2P Case study: Skype
1
Peers as relays
❒ Problem when both
Alice and Bob are
behind “NATs”.
❍ NAT prevents an outside
peer from initiating a call
to insider peer
❒ Solution:
❍ Using Alice’s and Bob’s
SNs, Relay is chosen
❍ Each peer initiates
session with relay.
❍ Peers can now
communicate through
NATs via relay