CS 3700 Networks and Distributed Systems P2P and BitTorrent (Why - - PowerPoint PPT Presentation

cs 3700
SMART_READER_LITE
LIVE PREVIEW

CS 3700 Networks and Distributed Systems P2P and BitTorrent (Why - - PowerPoint PPT Presentation

CS 3700 Networks and Distributed Systems P2P and BitTorrent (Why is Lars Ulrich So Angry?) Revised 10/21/16 Traditional Internet Services Model 2 Client-server Many clients, 1 (or more) server(s) Web servers, DNS, file


slide-1
SLIDE 1

CS 3700


Networks and Distributed Systems

P2P and BitTorrent (Why is Lars Ulrich So Angry?)

Revised 10/21/16

slide-2
SLIDE 2

Traditional Internet Services Model

Client-server

Many clients, 1 (or more) server(s) Web servers, DNS, file downloads, video streaming

2

slide-3
SLIDE 3

Traditional Internet Services Model

Client-server

Many clients, 1 (or more) server(s) Web servers, DNS, file downloads, video streaming

Problems

Scalability: how many users can a server support?

■ What happens when user traffic overload servers? ■ Limited resources (bandwidth, CPU, storage)

2

slide-4
SLIDE 4

Traditional Internet Services Model

Client-server

Many clients, 1 (or more) server(s) Web servers, DNS, file downloads, video streaming

Problems

Scalability: how many users can a server support?

■ What happens when user traffic overload servers? ■ Limited resources (bandwidth, CPU, storage)

Reliability: if # of servers is small, what happens when they break, fail, get

disconnected, are mismanaged by humans?

2

slide-5
SLIDE 5

Traditional Internet Services Model

Client-server

Many clients, 1 (or more) server(s) Web servers, DNS, file downloads, video streaming

Problems

Scalability: how many users can a server support?

■ What happens when user traffic overload servers? ■ Limited resources (bandwidth, CPU, storage)

Reliability: if # of servers is small, what happens when they break, fail, get

disconnected, are mismanaged by humans?

Efficiency: if your users are spread across the entire globe, how do you make sure

you answer their requests quickly?

2

slide-6
SLIDE 6

The Alternative: Peer-to-Peer

A simple idea

Users bring their own resources to the table A cooperative model: clients = peers = servers

3

slide-7
SLIDE 7

The Alternative: Peer-to-Peer

A simple idea

Users bring their own resources to the table A cooperative model: clients = peers = servers

The benefits

Scalability: # of “servers” grows with users

■ BYOR: bring your own resources (storage, CPU, B/W)

3

slide-8
SLIDE 8

The Alternative: Peer-to-Peer

A simple idea

Users bring their own resources to the table A cooperative model: clients = peers = servers

The benefits

Scalability: # of “servers” grows with users

■ BYOR: bring your own resources (storage, CPU, B/W)

Reliability: load spread across many peers

■ Probability of them all failing is very low…

3

slide-9
SLIDE 9

The Alternative: Peer-to-Peer

A simple idea

Users bring their own resources to the table A cooperative model: clients = peers = servers

The benefits

Scalability: # of “servers” grows with users

■ BYOR: bring your own resources (storage, CPU, B/W)

Reliability: load spread across many peers

■ Probability of them all failing is very low…

Efficiency: peers are distributed

■ Peers can try and get service from nearby peers

3

slide-10
SLIDE 10

Peer-to-Peer Challenges

What are the key components for leveraging P2P?

Protocol: how do peers talk to each other? Service/data location: how do peers know who to talk to? Routing: how do you get a message from peer A to peer B?

4

slide-11
SLIDE 11

Peer-to-Peer Challenges

What are the key components for leveraging P2P?

Protocol: how do peers talk to each other? Service/data location: how do peers know who to talk to? Routing: how do you get a message from peer A to peer B?

New reliability challenges

Network reachability, i.e. dealing with NATs Dealing with churn, i.e. short peer uptimes

4

slide-12
SLIDE 12

Peer-to-Peer Challenges

What are the key components for leveraging P2P?

Protocol: how do peers talk to each other? Service/data location: how do peers know who to talk to? Routing: how do you get a message from peer A to peer B?

New reliability challenges

Network reachability, i.e. dealing with NATs Dealing with churn, i.e. short peer uptimes

What about security?

Malicious peers and cheating The Sybil attack

4

slide-13
SLIDE 13

❑ Unstructured P2P ❑ BitTorrent Basics ❑ Cheating on BitTorrent

Outline

5

slide-14
SLIDE 14

Centralized Approach

The original: Napster

1999-2001 Shawn Fanning, Sean Parker Invented at Northeastern Specialized in MP3s (but not for long)

Centralized index server(s)

Supported all queries

What caused its downfall?

6

slide-15
SLIDE 15

Centralized Approach

The original: Napster

1999-2001 Shawn Fanning, Sean Parker Invented at Northeastern Specialized in MP3s (but not for long)

Centralized index server(s)

Supported all queries

What caused its downfall?

Not scalable Centralization of liability

6

slide-16
SLIDE 16

Napster Architecture

7

Napster Central Server A B C D E F G

slide-17
SLIDE 17

Napster Architecture

7

Napster Central Server

Log-in, upload list

  • f files

A B C D E F G

slide-18
SLIDE 18

Napster Architecture

7

Napster Central Server A B C D E F G

slide-19
SLIDE 19

Napster Architecture

7

Napster Central Server

Search for “Bad Blood”

A B C D E F G

slide-20
SLIDE 20

Napster Architecture

7

Napster Central Server A B C D E F G

B and C have the file

slide-21
SLIDE 21

Napster Architecture

7

Napster Central Server A B C D E F G

slide-22
SLIDE 22

Napster Architecture

7

Napster Central Server A B C D E F G

slide-23
SLIDE 23

Napster Architecture

7

Napster Central Server A B C D E F G

slide-24
SLIDE 24

Unstructured P2P Applications

Centralized systems have single points of failure Response: fully unstructured P2P

No central server, peers only connect to each other Queries sent as controlled flood Later systems are hierarchical for performance reasons

8

slide-25
SLIDE 25

Unstructured P2P Applications

Centralized systems have single points of failure Response: fully unstructured P2P

No central server, peers only connect to each other Queries sent as controlled flood Later systems are hierarchical for performance reasons

Limitations

Bootstrapping: how to join without central knowledge? Floods of traffic = high network overhead Probabilistic: can only search a small portion of the system Uncommon files are easily lost

8

slide-26
SLIDE 26

Gnutella

First massively popular unstructured P2P application

Justin Frankel, Nullsoft, 2000 AOL was not happy at all

Original design: flat network

Join via bootstrap node Connect to random set of existing hosts Resolve queries by localized flooding

■ Time to live field limits hops Recent incarnations use hierarchical structure Problems

High bandwidth costs in control messages Flood of queries took up all avail b/w for dialup users

9

slide-27
SLIDE 27

File Search via Flooding in Gnutella

10

slide-28
SLIDE 28

File Search via Flooding in Gnutella

10

slide-29
SLIDE 29

File Search via Flooding in Gnutella

10

slide-30
SLIDE 30

File Search via Flooding in Gnutella

10

slide-31
SLIDE 31

File Search via Flooding in Gnutella

10

slide-32
SLIDE 32

File Search via Flooding in Gnutella

10

slide-33
SLIDE 33

File Search via Flooding in Gnutella

10

slide-34
SLIDE 34

File Search via Flooding in Gnutella

10

slide-35
SLIDE 35

File Search via Flooding in Gnutella

10

slide-36
SLIDE 36

File Search via Flooding in Gnutella

10

slide-37
SLIDE 37

File Search via Flooding in Gnutella

10

Redundancy

slide-38
SLIDE 38

File Search via Flooding in Gnutella

10

Redundancy Traffic Overhead

slide-39
SLIDE 39

File Search via Flooding in Gnutella

10

What if the file is rare or far away? Redundancy Traffic Overhead

slide-40
SLIDE 40

Problem: Churn

Study of host uptime and application uptime (MMCN 2002)

17,000+ Gnutella peers for 60 hours 7,000 Napster peers for 25 hours

11

Host Uptime (Minutes) Percentage of Hosts

slide-41
SLIDE 41

Hierarchical P2P Networks

FastTrack network (Kazaa, Grokster, Morpheus, Gnutella++)

12

slide-42
SLIDE 42

Hierarchical P2P Networks

FastTrack network (Kazaa, Grokster, Morpheus, Gnutella++)

12

slide-43
SLIDE 43

Hierarchical P2P Networks

FastTrack network (Kazaa, Grokster, Morpheus, Gnutella++)

supernode

12

slide-44
SLIDE 44

Hierarchical P2P Networks

FastTrack network (Kazaa, Grokster, Morpheus, Gnutella++)

supernode

12

slide-45
SLIDE 45

Hierarchical P2P Networks

FastTrack network (Kazaa, Grokster, Morpheus, Gnutella++)

supernode

12

slide-46
SLIDE 46

Hierarchical P2P Networks

FastTrack network (Kazaa, Grokster, Morpheus, Gnutella++)

supernode

12

slide-47
SLIDE 47

Hierarchical P2P Networks

FastTrack network (Kazaa, Grokster, Morpheus, Gnutella++)

supernode

12

slide-48
SLIDE 48

Hierarchical P2P Networks

FastTrack network (Kazaa, Grokster, Morpheus, Gnutella++)

supernode

12

slide-49
SLIDE 49

Hierarchical P2P Networks

FastTrack network (Kazaa, Grokster, Morpheus, Gnutella++)

supernode

12

slide-50
SLIDE 50

Hierarchical P2P Networks

FastTrack network (Kazaa, Grokster, Morpheus, Gnutella++)

supernode

12

slide-51
SLIDE 51

Hierarchical P2P Networks

FastTrack network (Kazaa, Grokster, Morpheus, Gnutella++)

supernode

12

  • Improves scalability
  • Limits flooding
  • Still no guarantees of

performance

  • What if a supernode

leaves the network?

slide-52
SLIDE 52

Skype: P2P VoIP

P2P client supporting VoIP

, video, and text based conversation, buddy lists, etc.

Based on Kazaa network (FastTrack) Overlay P2P network consisting of ordinary and Super Nodes (SN) Ordinary node connects to network through a Super Node Each user registers with a central server User information propagated in a decentralized fashion Uses a variant of STUN to identify the type of NAT and firewall Sadly, Microsoft purchased Skype and centralized their architecture

13

slide-53
SLIDE 53

❑ Unstructured P2P ❑ BitTorrent Basics ❑ Cheating on BitTorrent

Outline

14

slide-54
SLIDE 54

What is BitTorrent

15

Designed for fast, efficient content distribution

Ideal for large files, e.g. movies, DVDs, ISOs, etc. Uses P2P file swarming

slide-55
SLIDE 55

What is BitTorrent

15

Designed for fast, efficient content distribution

Ideal for large files, e.g. movies, DVDs, ISOs, etc. Uses P2P file swarming

Not a full fledged P2P system

Does not support searching for files File swarms must be located out-of-band Trackers acts a centralized swarm coordinators

■ Fully P2P

, trackerless torrents are now possible

slide-56
SLIDE 56

What is BitTorrent

15

Designed for fast, efficient content distribution

Ideal for large files, e.g. movies, DVDs, ISOs, etc. Uses P2P file swarming

Not a full fledged P2P system

Does not support searching for files File swarms must be located out-of-band Trackers acts a centralized swarm coordinators

■ Fully P2P

, trackerless torrents are now possible

Was insanely popular at one point in time

35-70% of all Internet traffic

slide-57
SLIDE 57

BitTorrent Overview

16

Tracker Seeder

slide-58
SLIDE 58

BitTorrent Overview

16

Tracker Seeder

slide-59
SLIDE 59

BitTorrent Overview

16

Tracker Seeder

slide-60
SLIDE 60

BitTorrent Overview

16

Tracker Seeder

slide-61
SLIDE 61

BitTorrent Overview

16

Tracker Seeder

slide-62
SLIDE 62

BitTorrent Overview

16

Tracker Seeder

slide-63
SLIDE 63

BitTorrent Overview

16

Tracker Seeder

slide-64
SLIDE 64

BitTorrent Overview

16

Tracker Seeder

slide-65
SLIDE 65

BitTorrent Overview

16

Tracker Seeder

slide-66
SLIDE 66

BitTorrent Overview

16

Tracker Seeder

slide-67
SLIDE 67

BitTorrent Overview

16

Tracker Seeder

slide-68
SLIDE 68

BitTorrent Overview

16

Tracker Seeder

slide-69
SLIDE 69

BitTorrent Overview

16

Tracker

Swarm Leechers

Seeder

slide-70
SLIDE 70

.torrent File

17

Contains all meta-data related to a torrent

File name(s), sizes Torrent hash: hash of the whole file URL of tracker(s)

slide-71
SLIDE 71

.torrent File

17

Contains all meta-data related to a torrent

File name(s), sizes Torrent hash: hash of the whole file URL of tracker(s)

BitTorrent breaks files into pieces

64 KB – 1 MB per piece .torrent contains the size and SHA-1 hash of each piece

slide-72
SLIDE 72

.torrent File

17

Contains all meta-data related to a torrent

File name(s), sizes Torrent hash: hash of the whole file URL of tracker(s)

BitTorrent breaks files into pieces

64 KB – 1 MB per piece .torrent contains the size and SHA-1 hash of each piece

Basically, a .torrent tells you

Everything about a given file Where to go to start downloading

slide-73
SLIDE 73

Torrent Sites

18

Just standard web servers

Allow users to upload .torrent files Search, ratings, comments, etc.

Some also host trackers Many famous ones

Mostly because they host illegal content

Legitimate .torrents

Linux distros World of Warcraft patches

slide-74
SLIDE 74

Torrent Trackers

19

Really, just a highly specialized webserver

BitTorrent protocol is built on top of HTTP

Keeps a database of swarms

Swarms identified by torrent hash State of each peer in each swarm

■ IP address, port, peer ID, TTL ■ Status: leeching or seeding ■ Optional: upload/download stats (to track fairness)

Returns a random list of peers to new leechers

Tracker

slide-75
SLIDE 75

The Beauty of BitTorrent

20

More leechers = more replicas of pieces More replicas = faster downloads

Multiple, redundant sources for each piece

Even while downloading, leechers take load off the seed(s)

Great for content distribution Cost is shared among the swarm

slide-76
SLIDE 76

Typical Swarm Behavior

21

slide-77
SLIDE 77

Peer Selection

22

Tracker provides each client with a list of peers

Which peers are best?

■ Truthful (not cheating) ■ Fastest bandwidth

slide-78
SLIDE 78

Peer Selection

22

Tracker provides each client with a list of peers

Which peers are best?

■ Truthful (not cheating) ■ Fastest bandwidth Option 1: learn dynamically

Try downloading from many peers Keep only the best peers Strategy used by BitTorrent

slide-79
SLIDE 79

Peer Selection

22

Tracker provides each client with a list of peers

Which peers are best?

■ Truthful (not cheating) ■ Fastest bandwidth Option 1: learn dynamically

Try downloading from many peers Keep only the best peers Strategy used by BitTorrent

Option 2: use external information

E.g. Some torrent clients prefer peers in the same ISP

slide-80
SLIDE 80

Sharing Pieces

23

Initial Seeder 1 2 3 4 5 6 7 8

slide-81
SLIDE 81

Sharing Pieces

23

Initial Seeder 1 2 3 4 5 6 7 8 Leecher

slide-82
SLIDE 82

Sharing Pieces

23

Initial Seeder 1 2 3 4 5 6 7 8 Leecher 1 2 3

slide-83
SLIDE 83

Sharing Pieces

23

Initial Seeder 1 2 3 4 5 6 7 8 Leecher 1 2 3 Leecher 5 4

slide-84
SLIDE 84

Sharing Pieces

23

Initial Seeder 1 2 3 4 5 6 7 8 Leecher 1 2 3 Leecher 5 4

slide-85
SLIDE 85

Sharing Pieces

23

Initial Seeder 1 2 3 4 5 6 7 8 Leecher 1 2 3 Leecher 5 4 1 4

slide-86
SLIDE 86

Sharing Pieces

23

Initial Seeder 1 2 3 4 5 6 7 8 Leecher 1 2 3 Leecher 5 4 7 1 4 6

slide-87
SLIDE 87

Sharing Pieces

23

Initial Seeder 1 2 3 4 5 6 7 8 Leecher 1 2 3 Leecher 5 4 7 6 1 2 4 6

slide-88
SLIDE 88

Sharing Pieces

23

Initial Seeder 1 2 3 4 5 6 7 8 Leecher 1 2 3 Leecher 5 4 7 6 1 2 4 6 8

slide-89
SLIDE 89

Sharing Pieces

23

Initial Seeder 1 2 3 4 5 6 7 8 Leecher 1 2 3 Leecher 5 4 7 6 8 1 2 3 4 6 8

slide-90
SLIDE 90

Sharing Pieces

23

Initial Seeder 1 2 3 4 5 6 7 8 1 2 3 Leecher 5 4 7 6 8 1 2 3 4 6 8 Seeder

slide-91
SLIDE 91

Sharing Pieces

23

Initial Seeder 1 2 3 4 5 6 7 8 1 2 3 Leecher 5 4 7 6 8 1 2 3 5 4 7 6 8 Seeder

slide-92
SLIDE 92

Sharing Pieces

23

Initial Seeder 1 2 3 4 5 6 7 8 1 2 3 5 4 7 6 8 1 2 3 5 4 7 6 8 Seeder Seeder

slide-93
SLIDE 93

Piece Selection (start here on Thursday)

24

Piece download order is critical

Worst-case scenario: all leeches have identical pieces

■ Nobody can share anything :(

Worst-case scenario: the initial seed disappears

■ If a piece is missing from the swarm, the torrent is broken

slide-94
SLIDE 94

Piece Selection (start here on Thursday)

24

Piece download order is critical

Worst-case scenario: all leeches have identical pieces

■ Nobody can share anything :(

Worst-case scenario: the initial seed disappears

■ If a piece is missing from the swarm, the torrent is broken What is the best strategy for selecting pieces?

slide-95
SLIDE 95

Piece Selection (start here on Thursday)

24

Piece download order is critical

Worst-case scenario: all leeches have identical pieces

■ Nobody can share anything :(

Worst-case scenario: the initial seed disappears

■ If a piece is missing from the swarm, the torrent is broken What is the best strategy for selecting pieces?

Trick question It depends on how many pieces you already have

slide-96
SLIDE 96

Download Phases

25

Bootstrap: random selection

Initially, you have no pieces to trade Essentially, beg for free pieces at random

0% 100% % Downloaded

slide-97
SLIDE 97

Download Phases

25

Bootstrap: random selection

Initially, you have no pieces to trade Essentially, beg for free pieces at random

Steady-state: rarest piece first

Ensures that common pieces are saved for last

0% 100% % Downloaded

slide-98
SLIDE 98

Download Phases

25

Bootstrap: random selection

Initially, you have no pieces to trade Essentially, beg for free pieces at random

Steady-state: rarest piece first

Ensures that common pieces are saved for last

Endgame

Simultaneously request final pieces from multiple

peers

Cancel connections to slow peers Ensures that final pieces arrive quickly

0% 100% % Downloaded

slide-99
SLIDE 99

BitTorrent Protocol Fundamentals

26

BitTorrent divides time into rounds Each round, decide who to upload to/download from Rounds are typically 30 seconds

Leecher

1 2 3

Leecher

4

slide-100
SLIDE 100

BitTorrent Protocol Fundamentals

26

BitTorrent divides time into rounds Each round, decide who to upload to/download from Rounds are typically 30 seconds Each connection to a peer is controlled by four states Interested / uninterested – do I want a piece from you? Choked / unchoked – am I currently downloading from you?

Leecher

1 2 3

Leecher

4

slide-101
SLIDE 101

BitTorrent Protocol Fundamentals

26

BitTorrent divides time into rounds Each round, decide who to upload to/download from Rounds are typically 30 seconds Each connection to a peer is controlled by four states Interested / uninterested – do I want a piece from you? Choked / unchoked – am I currently downloading from you?

Connections are bidirectional

You decide interest/choking on each peer Each peer decides interest/chocking on you

Leecher

1 2 3

Leecher

4

slide-102
SLIDE 102

Connection States

27

slide-103
SLIDE 103

Connection States

27

slide-104
SLIDE 104

Connection States

27

Download control d – interested and choked D – interested and unchoked K – uninterested and unchoked S – snubbed (no data received in

60 seconds)

F – piece(s) failed to hash

slide-105
SLIDE 105

Connection States

27

Download control d – interested and choked D – interested and unchoked K – uninterested and unchoked S – snubbed (no data received in

60 seconds)

F – piece(s) failed to hash

Most peers are d or D. No need to connect with uninteresting peers.

slide-106
SLIDE 106

Connection States

27

Download control d – interested and choked D – interested and unchoked K – uninterested and unchoked S – snubbed (no data received in

60 seconds)

F – piece(s) failed to hash

slide-107
SLIDE 107

Connection States

27

Download control d – interested and choked D – interested and unchoked K – uninterested and unchoked S – snubbed (no data received in

60 seconds)

F – piece(s) failed to hash

Error states. Connection should be closed.

slide-108
SLIDE 108

Connection States

27

Download control d – interested and choked D – interested and unchoked K – uninterested and unchoked S – snubbed (no data received in

60 seconds)

F – piece(s) failed to hash Upload control u – interested and choked U – interested and unchoked O – optimistic unchoke ? – uninterested and unchoked

slide-109
SLIDE 109

Connection States

27

Download control d – interested and choked D – interested and unchoked K – uninterested and unchoked S – snubbed (no data received in

60 seconds)

F – piece(s) failed to hash Upload control u – interested and choked U – interested and unchoked O – optimistic unchoke ? – uninterested and unchoked Connection information I – incoming connection E/e – Using protocol encryption h – used UDP hole punching P – connection uses µTP

slide-110
SLIDE 110

Connection States

27

Download control d – interested and choked D – interested and unchoked K – uninterested and unchoked S – snubbed (no data received in

60 seconds)

F – piece(s) failed to hash Upload control u – interested and choked U – interested and unchoked O – optimistic unchoke ? – uninterested and unchoked Connection information I – incoming connection E/e – Using protocol encryption h – used UDP hole punching P – connection uses µTP

More on this later…

slide-111
SLIDE 111

Connection States

27

Download control d – interested and choked D – interested and unchoked K – uninterested and unchoked S – snubbed (no data received in

60 seconds)

F – piece(s) failed to hash Upload control u – interested and choked U – interested and unchoked O – optimistic unchoke ? – uninterested and unchoked Connection information I – incoming connection E/e – Using protocol encryption h – used UDP hole punching P – connection uses µTP How was this peer located? H – DHT (distributed hash table) L – local peer discovery (multicast) X – peer exchange

slide-112
SLIDE 112

Connection States

27

Download control d – interested and choked D – interested and unchoked K – uninterested and unchoked S – snubbed (no data received in

60 seconds)

F – piece(s) failed to hash Upload control u – interested and choked U – interested and unchoked O – optimistic unchoke ? – uninterested and unchoked Connection information I – incoming connection E/e – Using protocol encryption h – used UDP hole punching P – connection uses µTP How was this peer located? H – DHT (distributed hash table) L – local peer discovery (multicast) X – peer exchange

More on this next week

slide-113
SLIDE 113

Upload and Download Control

28

How does each peer decide who to trade with? Incentive mechanism

Based on tit-for-tat, game theory “If you give a piece to me, I’ll give a piece to you” “If you screw me over, you get nothing” Two mechanisms: choking and optimistic unchoke

slide-114
SLIDE 114

A Bit of Game Theory

29

Iterated prisoner’s dilemma Very simple game, two players, multiple rounds

Both players agree: +2 points each One player defects: +5 for defector, +0 to other Both players defect: +0 for each

slide-115
SLIDE 115

A Bit of Game Theory

29

Iterated prisoner’s dilemma Very simple game, two players, multiple rounds

Both players agree: +2 points each One player defects: +5 for defector, +0 to other Both players defect: +0 for each

Maps well to trading pieces in BitTorrent

Both peers trade, they both get useful data If both peers do nothing, they both get nothing If one peer defects, he gets a free piece, other peer gets nothing

slide-116
SLIDE 116

A Bit of Game Theory

29

Iterated prisoner’s dilemma Very simple game, two players, multiple rounds

Both players agree: +2 points each One player defects: +5 for defector, +0 to other Both players defect: +0 for each

Maps well to trading pieces in BitTorrent

Both peers trade, they both get useful data If both peers do nothing, they both get nothing If one peer defects, he gets a free piece, other peer gets nothing

What is the best strategy for this game?

slide-117
SLIDE 117

Tit-for-Tat (Fix round order in example)

30

Best general strategy for iterated prisoner’s dilemma Meaning: “Equivalent Retaliation”

slide-118
SLIDE 118

Tit-for-Tat (Fix round order in example)

30

Best general strategy for iterated prisoner’s dilemma Meaning: “Equivalent Retaliation”

Rules

  • 1. Initially: cooperate
  • 2. If opponent cooperates,

cooperate next round

  • 3. If opponent defects,

defect next round

slide-119
SLIDE 119

Tit-for-Tat (Fix round order in example)

30

Best general strategy for iterated prisoner’s dilemma Meaning: “Equivalent Retaliation”

Round Points 1 Cooperate Cooperate +2 / +2 2 Cooperate Defect +0 / +5 3 Defect Cooperate +5 / +0 4 Cooperate Cooperate +2 / +2 5 Cooperate Defect +0 / +5 6 Defect Defect +0 / +0 7 Defect Cooperate +5 / +0 Totals: +14 / +14

Rules

  • 1. Initially: cooperate
  • 2. If opponent cooperates,

cooperate next round

  • 3. If opponent defects,

defect next round

slide-120
SLIDE 120

Tit-for-Tat (Fix round order in example)

30

Best general strategy for iterated prisoner’s dilemma Meaning: “Equivalent Retaliation”

Round Points 1 Cooperate Cooperate +2 / +2 2 Cooperate Defect +0 / +5 3 Defect Cooperate +5 / +0 4 Cooperate Cooperate +2 / +2 5 Cooperate Defect +0 / +5 6 Defect Defect +0 / +0 7 Defect Cooperate +5 / +0 Totals: +14 / +14

Rules

  • 1. Initially: cooperate
  • 2. If opponent cooperates,

cooperate next round

  • 3. If opponent defects,

defect next round

slide-121
SLIDE 121

Tit-for-Tat (Fix round order in example)

30

Best general strategy for iterated prisoner’s dilemma Meaning: “Equivalent Retaliation”

Round Points 1 Cooperate Cooperate +2 / +2 2 Cooperate Defect +0 / +5 3 Defect Cooperate +5 / +0 4 Cooperate Cooperate +2 / +2 5 Cooperate Defect +0 / +5 6 Defect Defect +0 / +0 7 Defect Cooperate +5 / +0 Totals: +14 / +14

Rules

  • 1. Initially: cooperate
  • 2. If opponent cooperates,

cooperate next round

  • 3. If opponent defects,

defect next round

slide-122
SLIDE 122

Tit-for-Tat (Fix round order in example)

30

Best general strategy for iterated prisoner’s dilemma Meaning: “Equivalent Retaliation”

Round Points 1 Cooperate Cooperate +2 / +2 2 Cooperate Defect +0 / +5 3 Defect Cooperate +5 / +0 4 Cooperate Cooperate +2 / +2 5 Cooperate Defect +0 / +5 6 Defect Defect +0 / +0 7 Defect Cooperate +5 / +0 Totals: +14 / +14

Rules

  • 1. Initially: cooperate
  • 2. If opponent cooperates,

cooperate next round

  • 3. If opponent defects,

defect next round

slide-123
SLIDE 123

Tit-for-Tat (Fix round order in example)

30

Best general strategy for iterated prisoner’s dilemma Meaning: “Equivalent Retaliation”

Round Points 1 Cooperate Cooperate +2 / +2 2 Cooperate Defect +0 / +5 3 Defect Cooperate +5 / +0 4 Cooperate Cooperate +2 / +2 5 Cooperate Defect +0 / +5 6 Defect Defect +0 / +0 7 Defect Cooperate +5 / +0 Totals: +14 / +14

Rules

  • 1. Initially: cooperate
  • 2. If opponent cooperates,

cooperate next round

  • 3. If opponent defects,

defect next round

slide-124
SLIDE 124

Tit-for-Tat (Fix round order in example)

30

Best general strategy for iterated prisoner’s dilemma Meaning: “Equivalent Retaliation”

Round Points 1 Cooperate Cooperate +2 / +2 2 Cooperate Defect +0 / +5 3 Defect Cooperate +5 / +0 4 Cooperate Cooperate +2 / +2 5 Cooperate Defect +0 / +5 6 Defect Defect +0 / +0 7 Defect Cooperate +5 / +0 Totals: +14 / +14

Rules

  • 1. Initially: cooperate
  • 2. If opponent cooperates,

cooperate next round

  • 3. If opponent defects,

defect next round

slide-125
SLIDE 125

Tit-for-Tat (Fix round order in example)

30

Best general strategy for iterated prisoner’s dilemma Meaning: “Equivalent Retaliation”

Round Points 1 Cooperate Cooperate +2 / +2 2 Cooperate Defect +0 / +5 3 Defect Cooperate +5 / +0 4 Cooperate Cooperate +2 / +2 5 Cooperate Defect +0 / +5 6 Defect Defect +0 / +0 7 Defect Cooperate +5 / +0 Totals: +14 / +14

Rules

  • 1. Initially: cooperate
  • 2. If opponent cooperates,

cooperate next round

  • 3. If opponent defects,

defect next round

slide-126
SLIDE 126

Choking

31

Choke is a temporary refusal to upload

Tit-for-tat: choke free riders Cap the number of simultaneous uploads

■ Too many connections congests your network

Periodically unchoke to test the network connection

■ Choked peer might have better bandwidth

slide-127
SLIDE 127

Optimistic Unchoke

32

Each peer has one optimistic unchoke slot

Uploads to one random peer Peer rotates every 30 seconds

Reasons for optimistic unchoke

Help to bootstrap peers without pieces Discover new peers with fast connections

slide-128
SLIDE 128

Upload-Only Mode

33

Once a peer completes a torrent, it becomes a seed

No downloads, no tit-for-tat Who to upload to first?

slide-129
SLIDE 129

Upload-Only Mode

33

Once a peer completes a torrent, it becomes a seed

No downloads, no tit-for-tat Who to upload to first?

BitTorrent policy

Upload to the fastest known peer Why?

slide-130
SLIDE 130

Upload-Only Mode

33

Once a peer completes a torrent, it becomes a seed

No downloads, no tit-for-tat Who to upload to first?

BitTorrent policy

Upload to the fastest known peer Why? Faster uploads = more available pieces More available pieces helps the swarm

slide-131
SLIDE 131

Trackerless Torrents

34

New versions of BitTorrent have the ability to locate swarms without a tracker

Based on a P2P overlay Distributed hash table (DHT)

Recall: peers located via DHT are given “H” state More on this next week

slide-132
SLIDE 132

❑ Unstructured P2P ❑ BitTorrent Basics ❑ Cheating on BitTorrent

Outline

35

slide-133
SLIDE 133

Incentives to Upload

36

Every round, a BitTorrent client calculates the number of pieces received from

each peer

The peers who gave the most will receive pieces in the next round These decisions are made by the unchoker

slide-134
SLIDE 134

Incentives to Upload

36

Every round, a BitTorrent client calculates the number of pieces received from

each peer

The peers who gave the most will receive pieces in the next round These decisions are made by the unchoker

Assumption

Peers will give as many pieces as possible each round Based on bandwidth constraints, etc.

slide-135
SLIDE 135

Incentives to Upload

36

Every round, a BitTorrent client calculates the number of pieces received from

each peer

The peers who gave the most will receive pieces in the next round These decisions are made by the unchoker

Assumption

Peers will give as many pieces as possible each round Based on bandwidth constraints, etc.

Can an attacker abuse this assumption?

slide-136
SLIDE 136

Unchoker Example

37

Round t Round t + 1

13 10 4 12 7 9 15

slide-137
SLIDE 137

Unchoker Example

37

Round t Round t + 1

13 10 4 12 7 9 15

slide-138
SLIDE 138

Unchoker Example

37

Round t Round t + 1

13 10 4 12 7 9 15 10 10 10 10

slide-139
SLIDE 139

Abusing the Unchocker

38

What if you really want to download from someone?

Round t Round t + 1

13 10 4 12 7 9 15

slide-140
SLIDE 140

Abusing the Unchocker

38

What if you really want to download from someone?

Round t Round t + 1

13 10 4 12 7 9 15 20

Send a lot of data, get 1st place

slide-141
SLIDE 141

Abusing the Unchocker

38

What if you really want to download from someone?

Round t Round t + 1

13 10 4 12 7 9 15 10 10 10 10 20

Send a lot of data, get 1st place

slide-142
SLIDE 142

Abusing the Unchocker

38

What if you really want to download from someone?

Round t Round t + 1

13 10 4 12 7 9 15

slide-143
SLIDE 143

Abusing the Unchocker

38

What if you really want to download from someone?

Round t Round t + 1

13 10 4 12 7 9 15 11

Send just enough data, get 4th place

10

slide-144
SLIDE 144

Sybil Attack

39

Round t Round t + 1 Total Capacity = 42

13 10 12 15

slide-145
SLIDE 145

Sybil Attack

39

Round t Round t + 1 Total Capacity = 42

13 10 12 15 42

slide-146
SLIDE 146

Sybil Attack

39

Round t Round t + 1 Total Capacity = 42

13 10 12 15 10 10 10 10 42

Only receive 10 pieces

slide-147
SLIDE 147

Sybil Attack

39

Round t Round t + 1 Total Capacity = 42

13 10 12 15

slide-148
SLIDE 148

Sybil Attack

39

Round t Round t + 1 Total Capacity = 42

13 10 12 15 14 14 14

Divide resources across 3 fake peers

slide-149
SLIDE 149

Sybil Attack

39

Round t Round t + 1 Total Capacity = 42

13 10 12 15 14 10 14 14 10 10

Divide resources across 3 fake peers Receive 30 pieces

slide-150
SLIDE 150

BitTyrant

40

Piatek et al. 2007

Implements the “come in last strategy” Essentially, an unfair unchoker Faster than stock BitTorrent

■ For the Tyrant user

slide-151
SLIDE 151

BitTyrant

40

Piatek et al. 2007

Implements the “come in last strategy” Essentially, an unfair unchoker Faster than stock BitTorrent

■ For the Tyrant user Problem with BitTyrant

slide-152
SLIDE 152

BitTyrant

40

Piatek et al. 2007

Implements the “come in last strategy” Essentially, an unfair unchoker Faster than stock BitTorrent

■ For the Tyrant user Problem with BitTyrant

Tragedy of the commons BitTyrant performs well if most peers are honest As more peers use BitTyrant, performace suffers If all users used BitTyrant, torrents wouldn’t work at all

slide-153
SLIDE 153

PropShare Unchoker

41

slide-154
SLIDE 154

PropShare Unchoker

41

Goal: modify BitTorrents incentive mechanisms to mitigate “come in last” and

Sybil attacks

Levin et al. 2008

Propose PropShare unchoker PropShare clients allocate upload bandwidth proportionally across all peers There is no longer a “top four”

Can you cheat vs. PropShare?

slide-155
SLIDE 155

PropShare Unchoker

42

Round t Round t + 1

13 10 4 12 7 9 15

slide-156
SLIDE 156

PropShare Unchoker

42

Round t Round t + 1

13 10 4 12 7 9 15

Total = 70

slide-157
SLIDE 157

PropShare Unchoker

42

Round t Round t + 1

13 10 4 12 7 9 15 13/70 * upload_cap 10/70 * upload_cap 12/70 * upload_cap 15/70 * upload_cap

Total = 70

4/70 * upload_cap 7/70 * upload_cap 9/70 * upload_cap

slide-158
SLIDE 158

PropShare Resiliency to BitTyrant

43

Round t Round t + 1

13 10 4 12 7 9 15

slide-159
SLIDE 159

PropShare Resiliency to BitTyrant

43

Round t Round t + 1

13 10 4 12 7 9 15 20

slide-160
SLIDE 160

PropShare Resiliency to BitTyrant

43

Round t Round t + 1

13 10 4 12 7 9 15

Total = 90

20

slide-161
SLIDE 161

PropShare Resiliency to BitTyrant

43

Round t Round t + 1

13 10 4 12 7 9 15 13/90 10/90 12/90 15/90

Total = 90

4/90 7/90 9/90 20 20/90

slide-162
SLIDE 162

PropShare Resiliency to BitTyrant

44

Round t Round t + 1

13 10 4 12 7 9 15

slide-163
SLIDE 163

PropShare Resiliency to BitTyrant

44

Round t Round t + 1

13 10 4 12 7 9 15 11

slide-164
SLIDE 164

PropShare Resiliency to BitTyrant

44

Round t Round t + 1

13 10 4 12 7 9 15

Total = 81

11

slide-165
SLIDE 165

PropShare Resiliency to BitTyrant

44

Round t Round t + 1

13 10 4 12 7 9 15 13/81 10/81 12/81 15/81

Total = 81

4/81 7/81 9/81 11 11/81

slide-166
SLIDE 166

PropShare Resiliency to BitTyrant

44

Round t Round t + 1

13 10 4 12 7 9 15 13/81 10/81 12/81 15/81

Total = 81

4/81 7/81 9/81 11 11/81

  • Download always proportional to upload
  • No way to game the system
slide-167
SLIDE 167

PropShare Resiliency to Sybils

45

Round t Round t + 1

42

Total Capacity = 42

slide-168
SLIDE 168

PropShare Resiliency to Sybils

45

Round t Round t + 1 Total = 42

42 42/42

Total Capacity = 42

slide-169
SLIDE 169

PropShare Resiliency to Sybils

45

Round t Round t + 1 Total = 42

42 42/42 14 14 14

Total Capacity = 42

slide-170
SLIDE 170

PropShare Resiliency to Sybils

45

Round t Round t + 1 Total = 42

42 42/42

Total = 42

14 14/42 14 14 14/42 14/42

Total Capacity = 42

slide-171
SLIDE 171

PropShare Resiliency to Sybils

45

Round t Round t + 1 Total = 42

42 42/42

Total = 42

14 14/42 14 14 14/42 14/42

Total Capacity = 42

PropShare is Sybil resistant

slide-172
SLIDE 172

Unchoker Summary

46

BitTyrant and PropShare are both faster than stock BitTorrent

But for different reasons

PropShare performs comparably to BitTyrant PropShare does not suffer from a tragedy of the commons

i.e. it’s safe for all peers to use PropShare Not true for BitTyrant

slide-173
SLIDE 173

Abusing Optimistic Unchoking

47

So far, assumed peers all have pieces to trade

Thus, all peers are interesting

slide-174
SLIDE 174

Abusing Optimistic Unchoking

47

So far, assumed peers all have pieces to trade

Thus, all peers are interesting

What about peers that have nothing?

The bootstrap mechanism is supposed to help them Optimistic unchoke: reserve some bandwidth to give free pieces away (presumably

to new peers)

slide-175
SLIDE 175

Abusing Optimistic Unchoking

47

So far, assumed peers all have pieces to trade

Thus, all peers are interesting

What about peers that have nothing?

The bootstrap mechanism is supposed to help them Optimistic unchoke: reserve some bandwidth to give free pieces away (presumably

to new peers)

BitThief (Locher et al. 2006)

Abuses optimistic unchoke, uploads nothing Swarm collapses if all peers use BitThief

slide-176
SLIDE 176

BitThief Details

48

Large-view exploit

The swarm is (potentially) huge BitThief client tries to get optimistic unchoke from many, many peers Will only receive one free piece from each

■ Since there is no reciprocal upload

But in aggregate, this is enough to finish download

slide-177
SLIDE 177

BitThief Details

48

Large-view exploit

The swarm is (potentially) huge BitThief client tries to get optimistic unchoke from many, many peers Will only receive one free piece from each

■ Since there is no reciprocal upload

But in aggregate, this is enough to finish download

How to deal with this?

Enlist the help of peers Have them verify that a given client uploads

slide-178
SLIDE 178

Abusing the Endgame

49

Rare pieces are valuable

Make you popular, many people want to trade with you More trading partners = faster downloads

slide-179
SLIDE 179

Abusing the Endgame

49

Rare pieces are valuable

Make you popular, many people want to trade with you More trading partners = faster downloads

Selective piece revelation

You can’t advertise pieces you don’t have

■ Peers could detect this

But you can hide information about the pieces you have

slide-180
SLIDE 180

Abusing the Endgame

49

Rare pieces are valuable

Make you popular, many people want to trade with you More trading partners = faster downloads

Selective piece revelation

You can’t advertise pieces you don’t have

■ Peers could detect this

But you can hide information about the pieces you have

Why is this useful?

Pieces sent at time t impact your popularity at time t+1 Sending common pieces first, monopolize rare pieces

slide-181
SLIDE 181

Strategic Piece Revelation

50

1 2 Leecher Leecher 3 4

slide-182
SLIDE 182

Strategic Piece Revelation

50

1 2 Leecher Leecher 3 4

slide-183
SLIDE 183

Strategic Piece Revelation

50

1 2 Leecher Leecher 3 4 1 1

slide-184
SLIDE 184

Strategic Piece Revelation

50

1 2 Leecher Leecher 3 4 1 1

slide-185
SLIDE 185

Strategic Piece Revelation

50

1 2 Leecher Leecher 3 4 1 1

slide-186
SLIDE 186

Strategic Piece Revelation

50

1 2 Leecher Leecher 3 4 1 1

slide-187
SLIDE 187

Strategic Piece Revelation

50

1 2 Leecher Leecher 3 4 1 2 1 2

slide-188
SLIDE 188

Strategic Piece Revelation

50

1 2 Leecher Leecher 3 4 1 2 3 1 2 3

slide-189
SLIDE 189

Strategic Piece Revelation

50

1 2 Leecher Leecher 3 4 1 2 3 4 1 2 3 4

slide-190
SLIDE 190

Conclusions

51

BitTorrent is an extremely efficient tool for content distribution

Strong incentive system (nominally) based on game theory Most popular file sharing client since 2001

However, BitTorrent is a large system with many different mechanisms

Ample room to modify the client, alter behavior Cheating can happen, not all strategies are fair