Top Banner
OVERVIEW Lecture 8 Distributed Hash Tables
53

OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and [email protected] m E.g.,

Jan 04, 2016

Download

Documents

Melanie Hunt
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

OVERVIEW

Lecture 8

Distributed Hash Tables

Page 2: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Hash Table

Name-value pairs (or key-value pairs) E.g,. “Mehmet Hadi Gunes” and

[email protected] E.g., “http://cse.unr.edu/” and the Web page E.g., “HitSong.mp3” and “12.78.183.2”

Hash table Data structure that associates keys with values

2

lookup(key) valuekey value

Page 3: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Distributed Hash Table

Hash table spread over many nodes Distributed over a wide area

Main design goals Decentralization: no central coordinator Scalability: efficient with large # of nodes Fault tolerance: tolerate nodes joining/leaving

Two key design decisions How do we map names on to nodes? How do we route a request to that node?

3

Page 4: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Hash Functions

Hashing Transform the key into a number And use the number to index an array

Example hash function Hash(x) = x mod 101, mapping to 0, 1, …,

100 Challenges

What if there are more than 101 nodes? Fewer?

Which nodes correspond to each hash value? What if nodes come and go over time?

4

Page 5: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Consistent Hashing Large, sparse identifier space (e.g., 128

bits) Hash a set of keys x uniformly to large id space Hash nodes to the id space as well

5

0 1

Hash(name) object_idHash(IP_address) node_id

Id space represented

as a ring

2128-1

Page 6: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Where to Store (Key, Value) Pair?

Mapping keys in a load-balanced way Store the key at one or more nodes Nodes with identifiers “close” to the key

• where distance is measured in the id space

Advantages Even distribution Few changes as

nodes come and go…

6

Hash(name) object_idHash(IP_address) node_id

Page 7: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Joins and Leaves of Nodes Maintain a circularly linked list around the

ring Every node has a predecessor and successor

7

node

pred

succ

Page 8: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Joins and Leaves of Nodes

When an existing node leaves Node copies its <key, value> pairs to its

predecessor Predecessor points to node’s successor in the

ring When a node joins

Node does a lookup on its own id And learns the node responsible for that id This node becomes the new node’s successor And the node can learn that node’s predecessor

• which will become the new node’s predecessor

8

Page 9: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Nodes Coming and Going

Small changes when nodes come and go Only affects mapping of keys mapped to the

node that comes or goes

9

Hash(name) object_idHash(IP_address) node_id

Page 10: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

How to Find the Nearest Node? Need to find the closest node

To determine who should store (key, value) pair To direct a future lookup(key) query to the node

Strawman solution: walk through linked list Circular linked list of nodes in the ring O(n) lookup time when n nodes in the ring

Alternative solution: Jump further around ring “Finger” table of additional overlay links

10

Page 11: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Links in the Overlay Topology Trade-off between # of hops vs. # of neighbors

E.g., log(n) for both, where n is the number of nodes E.g., such as overlay links 1/2, 1/4 1/8, … around the ring Each hop traverses at least half of the remaining distance

11

1/2

1/4

1/8

Page 12: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Lecture 9Peer-to-Peer (p2p)

CPE 401/601 Computer Network Systems

slides are modified from Jennifer Rexford

Page 13: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Goals of Today’s Lecture

Scalability in distributing a large file Single server and N clients Peer-to-peer system with N peers

Searching for the right peer Central directory (Napster) Query flooding (Gnutella) Hierarchical overlay (Kazaa)

BitTorrent Transferring large files Preventing free-riding

Page 14: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Clients and Servers Client program

Running on end host Requests service E.g., Web browser

Server program Running on end host Provides service E.g., Web server

GET /index.html

“Site under construction”

Page 15: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Client-Server Communication

Client “sometimes on” Initiates a request to

the server when interested

E.g., Web browser on your laptop or cell phone

Doesn’t communicate directly with other clients

Needs to know the server’s address

Server is “always on” Services requests from

many client hosts E.g., Web server for the

www.unr.edu Web site Doesn’t initiate contact

with the clients Needs a fixed, well-

known address

Page 16: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Server Distributing a Large File

d1

F bits

d2

d3

d4

upload rate us

Download rates di

Internet

Page 17: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Server Distributing a Large File Server sending a large file to N receivers

Large file with F bits Single server with upload rate us

Download rate di for receiver i

Server transmission to N receivers Server needs to transmit NF bits Takes at least NF/us time

Receiving the data Slowest receiver receives at rate dmin= mini{di}

Takes at least F/dmin time

Download time: max{NF/us, F/dmin}

Page 18: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Speeding Up the File Distribution Increase the upload rate from the server

Higher link bandwidth at the one server Multiple servers, each with their own link Requires deploying more infrastructure

Alternative: have the receivers help Receivers get a copy of the data And then redistribute the data to other

receivers To reduce the burden on the server

Page 19: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Peers Help Distributing a Large File

d1

F bits

d2

d3

d4

upload rate us

Download rates di

Internet

u1u2

u3

u4

Upload rates ui

Page 20: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Peers Help Distributing a Large File Start with a single copy of a large file

Large file with F bits and server upload rate us

Peer i with download rate di and upload rate ui

Two components of distribution latency Server must send each bit: min time F/us

Slowest peer receives each bit: min time F/dmin

Total upload time using all upload resources Total number of bits: NF Total upload bandwidth us + sumi(ui)

Total: max{F/us, F/dmin, NF/(us+sumi(ui))}

Page 21: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Comparing the Two Models

Download time Client-server: max{NF/us, F/dmin}

Peer-to-peer: max{F/us, F/dmin, NF/(us+sumi(ui))}

Peer-to-peer is self-scaling Much lower demands on server bandwidth Distribution time grows only slowly with N

But… Peers may come and go Peers need to find each other Peers need to be willing to help each other

Page 22: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Challenges of Peer-to-Peer

Peers come and go Peers are intermittently connected May come and go at any time Or come back with a different IP address

How to locate the relevant peers? Peers that are online right now Peers that have the content you want

How to motivate peers to stay in system? Why not leave as soon as download ends? Why bother uploading content to anyone

else?

Page 23: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Locating the Relevant Peers

Three main approaches Central directory (Napster) Query flooding (Gnutella) Hierarchical overlay (Kazaa, modern

Gnutella)

Design goals Scalability Simplicity Robustness Plausible deniability

Page 24: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Peer-to-Peer Networks: Napster Napster history: the rise

January 1999: Napster version 1.0 May 1999: company founded December 1999: first lawsuits 2000: 80 million users

Napster history: the fall Mid 2001: out of business due to lawsuits Mid 2001: dozens of P2P alternatives that were harder

to touch, though these have gradually been constrained 2003: growth of pay services like iTunes

Napster history: the resurrection 2003: Napster name/logo reconstituted as a pay service

Shawn Fanning,Northeastern freshman

Page 25: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Napster Technology: Directory Service

User installing the software Download the client program Register name, password, local directory, etc.

Client contacts Napster (via TCP) Provides a list of music files it will share … and Napster’s central server updates the directory

Client searches on a title or performer Napster identifies online clients with the file … and provides IP addresses

Client requests the file from the chosen supplier Supplier transmits the file to the client Both client and supplier report status to Napster

Page 26: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Napster Technology: Properties Server’s directory continually updated

Always know what music is currently available Point of vulnerability for legal action

Peer-to-peer file transfer No load on the server Plausible deniability for legal action (but not enough)

Proprietary protocol Login, search, upload, download, and status operations No security: cleartext passwords and other vulnerability

Bandwidth issues Suppliers ranked by apparent bandwidth & response time

Page 27: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Napster: Limitations of Central Directory

Single point of failure Performance bottleneck Copyright infringement

So, later P2P systems were more distributed Gnutella went to the other extreme…

File transfer is decentralized, but locating content is highly centralized

Page 28: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Peer-to-Peer Networks: Gnutella Gnutella history

2000: J. Frankel & T. Pepper released Gnutella Soon after: many other clients

• e.g., Morpheus, Limewire, Bearshare 2001: protocol enhancements, e.g.,

“ultrapeers” Query flooding

Join: contact a few nodes to become neighbors Publish: no need! Search: ask neighbors, who ask their neighbors Fetch: get file directly from another node

Page 29: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Gnutella: Query Flooding Fully distributed

No central server

Public domain protocol Many Gnutella clients implementing protocol

Overlay network: graph Edge between peer X and Y if there’s a TCP

connection All active peers and edges is overlay net Given peer will typically be connected with < 10

overlay neighbors

Page 30: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Gnutella: Protocol

Query message sent over existing TCPconnections

Peers forwardQuery message

QueryHit sent over reversepath

Query

QueryHit

Query

Query

QueryHit

Query

Query

QueryHit

File transfer:HTTP

Scalability:limited scopeflooding

Page 31: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Gnutella: Peer Joining

Joining peer X must find some other peers Start with a list of candidate peers X sequentially attempts TCP connections with

peers on list until connection setup with Y X sends Ping message to Y

Y forwards Ping message. All peers receiving Ping message respond

with Pong message X receives many Pong messages

X can then set up additional TCP connections

Page 32: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Gnutella: Pros and Cons

Advantages Fully decentralized Search cost distributed Processing per node permits powerful

search semantics Disadvantages

Search scope may be quite large Search time may be quite long High overhead, and nodes come and go

often

Page 33: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Peer-to-Peer Networks: KaAzA KaZaA history

2001: created by Dutch company (Kazaa BV) Single network called FastTrack used by other clients as

well Eventually the protocol changed so other clients could

no longer talk to it

Smart query flooding Join: on start, the client contacts a super-node

• and may later become one

Publish: client sends list of files to its super-node Search: send query to super-node, and the super-nodes

flood queries among themselves Fetch: get file directly from peer(s); can fetch from

multiple peers at once

Page 34: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

KaZaA: Exploiting Heterogeneity Each peer is either a

group leader or assigned to a group leader TCP connection between

peer and its group leader TCP connections between

some pairs of group leaders

Group leader tracks the content in all its children

ordinary peer

group-leader peer

neighoring re la tionshipsin overlay network

Page 35: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

KaZaA: Motivation for Super-Nodes Query consolidation

Many connected nodes may have only a few files

Propagating query to a sub-node may take more time than for the super-node to answer itself

Stability Super-node selection favors nodes with high

up-time How long you’ve been on is a good predictor

of how long you’ll be around in the future

Page 36: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Peer-to-Peer Networks: BitTorrent

BitTorrent history and motivation 2002: B. Cohen debuted BitTorrent Key motivation: popular content

• Popularity exhibits temporal locality (Flash Crowds)• E.g., Slashdot/Digg effect, CNN Web site on 9/11,

release of a new movie or game Focused on efficient fetching, not searching

• Distribute same file to many peers• Single publisher, many downloaders

Preventing free-loading

Page 37: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

BitTorrent: Simultaneous Downloading

Divide large file into many pieces Replicate different pieces on different peers A peer with a complete piece can trade with

other peers Peer can (hopefully) assemble the entire file

Allows simultaneous downloading Retrieving different parts of the file from

different peers at the same time And uploading parts of the file to peers Important for very large files

Page 38: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

BitTorrent: Tracker

Infrastructure node Keeps track of peers participating in the torrent

Peers register with the tracker Peer registers when it arrives Peer periodically informs tracker it is still there

Tracker selects peers for downloading Returns a random set of peers Including their IP addresses So the new peer knows who to contact for data

Can have “trackerless” system using DHT

Page 39: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

BitTorrent: Chunks

Large file divided into smaller pieces Fixed-sized chunks Typical chunk size of 256 Kbytes

Allows simultaneous transfers Downloading chunks from different neighbors Uploading chunks to other neighbors

Learning what chunks your neighbors have Periodically asking them for a list

File done when all chunks are downloaded

Page 40: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Web page with link to .torrent

A

B

C

Peer

[Leech]

Downloader

“US”

Peer

[Seed]

Peer

[Leech]

TrackerWeb Server

.torr

ent

BitTorrent: Overall Architecture

Page 41: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

BitTorrent: Overall Architecture

A

Web page with link to .torrent

B

C

Peer

[Leech]

Downloader

“US”

Peer

[Seed]

Peer

[Leech]

Tracker

Get-announce

Web Server

Page 42: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

BitTorrent: Overall Architecture

Peer

[Leech]

Downloader

“US”

Web page with link to .torrent

A

B

C

Peer

[Seed]

Peer

[Leech]

Tracker

Response-peer list

Web Server

Page 43: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Web page with link to .torrent

A

B

C

Peer

[Leech]

Downloader

“US”

Peer

[Seed]

Peer

[Leech]

Tracker

Shake-hand

Web Server

Shake-hand

BitTorrent: Overall Architecture

Page 44: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

BitTorrent: Overall Architecture

Web page with link to .torrent

A

B

C

Peer

[Leech]

Downloader

“US”

Peer

[Seed]

Peer

[Leech]

Tracker

pieces

pieces

Web Server

Page 45: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

BitTorrent: Overall Architecture

Web page with link to .torrent

A

B

C

Peer

[Leech]

Downloader

“US”

Peer

[Seed]

Peer

[Leech]

Tracker

piecespieces

pieces

Web Server

Page 46: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

BitTorrent: Overall Architecture

Web page with link to .torrent

A

B

C

Peer

[Leech]

Downloader

“US”

Peer

[Seed]

Peer

[Leech]

Tracker

Get-announce

Response-peer list

piecespieces

pieces

Web Server

Page 47: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

BitTorrent: Chunk Request Order Which chunks to request?

Could download in order Like an HTTP client does

Problem: many peers have the early chunks Peers have little to share with each other Limiting the scalability of the system

Problem: eventually nobody has rare chunks E.g., the chunks need the end of the file Limiting the ability to complete a download

Solutions: random selection and rarest first

Page 48: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

BitTorrent: Rarest Chunk First

Which chunks to request first? The chunk with the fewest available copies i.e., the rarest chunk first

Benefits to the peer Avoid starvation when some peers depart

Benefits to the system Avoid starvation across all peers wanting a file Balance load by equalizing # of copies of

chunks

Page 49: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Free-Riding Problem in P2P Networks

Vast majority of users are free-riders Most share no files and answer no queries Others limit # of connections or upload speed

A few “peers” essentially act as servers A few individuals contributing to the public good Making them hubs that basically act as a server

BitTorrent prevent free riding Allow the fastest peers to download from you Occasionally let some free loaders download

Page 50: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Bit-Torrent: Preventing Free-Riding Peer has limited upload bandwidth

And must share it among multiple peers Prioritizing the upload bandwidth: tit for tat

Favor neighbors that are uploading at highest rate

Rewarding the top four neighbors Measure download bit rates from each neighbor Reciprocates by sending to the top four peers Recompute and reallocate every 10 seconds

Optimistic unchoking Randomly try a new neighbor every 30 seconds So new neighbor has a chance to be a better partner

Page 51: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

51

BitTyrant: Gaming BitTorrent

BitTorrent can be gamed, too Peer uploads to top N peers at rate 1/N E.g., if N=4 and peers upload at 15, 12, 10, 9, 8, 3 … then peer uploading at rate 9 gets treated quite well

Best to be the Nth peer in the list, rather than 1st

Offer just a bit more bandwidth than the low-rate peers But not as much as the higher-rate peers And you’ll still be treated well by others

BitTyrant software Uploads at higher rates to higher-bandwidth peers http://bittyrant.cs.washington.edu/

Page 52: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

BitTorrent Today

Significant fraction of Internet traffic Estimated at 30% Though this is hard to measure

Problem of incomplete downloads Peers leave the system when done Many file downloads never complete Especially a problem for less popular content

Still lots of legal questions remains Further need for incentives

Page 53: OVERVIEW Lecture 8 Distributed Hash Tables. Hash Table r Name-value pairs (or key-value pairs) m E.g,. “Mehmet Hadi Gunes” and mgunes@cse.unr.edu m E.g.,

Conclusions

Peer-to-peer networks Nodes are end hosts Primarily for file sharing, and recently telephony

Finding the appropriate peers Centralized directory (Napster) Query flooding (Gnutella) Super-nodes (KaZaA)

BitTorrent Distributed download of large files Anti-free-riding techniques

Great example of how change can happen so quickly in application-level protocols