36
BitTorrent P2P VOD Workshop Spring 2011 Hanoch Levy Based on presentations by Evgeny Vainer 2009, Alexey Zagalsky 2010 Overview

BitTorrent

  • Upload
    orsen

  • View
    41

  • Download
    1

Embed Size (px)

DESCRIPTION

BitTorrent. Overview. P2P VOD Workshop Spring 2011 Hanoch Levy Based on presentations by Evgeny Vainer 2009, Alexey Zagalsky 2010. Based on. The Delicate Tradeoffs in BitTorrent-Like File Sharing Protocol Design [by Bin Fan, Dah-Ming Chiu, John C.S. Lui] Wikipedia - PowerPoint PPT Presentation

Citation preview

Page 1: BitTorrent

BitTorrent

P2P VOD WorkshopSpring 2011Hanoch Levy

Based on presentations by Evgeny Vainer 2009, Alexey Zagalsky 2010

Overview

Page 2: BitTorrent

2

Based on

The Delicate Tradeoffs in BitTorrent-Like File Sharing Protocol Design[by Bin Fan, Dah-Ming Chiu, John C.S. Lui]

Wikipedia slides from “Introduction to BitTorent” by

Arvid Norberg Internet

Page 3: BitTorrent

3

Agenda

P2P what and why

BitTorrent how does it work

Peer Selection speed vs fairness network load issues

Page 4: BitTorrent

4

Client Server File sharing

one server provides the service many clients consuming it

problems: server’s resources single point of failure legality

Page 5: BitTorrent

5

Peer to Peer File sharing

many clients consume the service each client also provides a little

part of the service one server that coordinates the

peers overlay network

Page 6: BitTorrent

6

Peer to Peer File sharing

advantages: more peers in network, the better

the service they receive (?) robustness scalability has no owner

Page 7: BitTorrent

7

Peer to Peer File sharing

disadvantages: clients are small and not efficient

(upload cap) coordinating the clients selfishness and leeching

Page 8: BitTorrent

9

BitTorrent

free P2P protocol created by Bram Cohen at 2001

[www.bittorrent.org] tens of client applications millions of users terabytes of data about 20% of today’s Internet traffic

80% of internat traffic is P2P….

Page 9: BitTorrent

10

BitTorrentthe main entities defined by the protocol are:

peer – instance of a BitTorrent client to which other clients connect and transfer data

tracker – the server which coordinates the communication between the peers

torrent – metadata file describing some downloadable content. It also contains the address of a tracker

swarm - all the peers sharing the same torrent chunk – a piece of data a transferred file is divided to Terms:

Leecher – did not complete download Seeder – completed its download. Serves as a server

(“altruist”)

Page 10: BitTorrent

How It Works

11

The file to be distributed is split up in pieces and a SHA-1 hash is calculated for each piece

Page 11: BitTorrent

How It Works

12

A metadata file (.torrent) is distributed to all peersUsually via Web, Email, etc…

The metadata contains:SHA-1 hashes of all piecesTracker reference (URL)Piece Length: usually 256KB

is it better smaller or bigger pieces ?

Page 12: BitTorrent

How It Works

13

The user makes the file itself available through a BitTorrent node acting as a seed

The Tracker is a central server keeping a list of all peers participating in the swarm

A swarm is the set of peers that are participating in distributing the same file

A peer joins a swarm by asking the tracker for a peer list and connects to those peers

Page 13: BitTorrent

A Peer Joins The Swarm

14

Page 14: BitTorrent

A Peer Joins The Swarm

15

Page 15: BitTorrent

Seeding A File

16

Page 16: BitTorrent

Terminology

17

A downloader is any peer that does not have the entire file and is downloading the file

A leecher is: (ambiguity in definition…)A peer who has a negative effect on the swarm by

having a very poor share ratioA downloader

A seeder is a peer that has an entire copy of the torrent and offers it for upload

Page 17: BitTorrent

Goals

18

EfficiencyAbility to download from many peers yields fast

downloadsMinimize piece overlap among peers

Download random pieces Rarest First algorithm

ReliabilityTolerant to dropping peersAbility to verify data integrity (SHA-1 hashes)

Page 18: BitTorrent

How it works: Trading

19

Exactly like Kid’s card trading Two major factors in trading:

What I want to get (from whom)To whom I want to give?

Page 19: BitTorrent

What I want to take: Rarest First

20

The piece picking algorithm used in BitTorrent is called Rarest First

Serves me: 1) have a rare piece (hard to get), 2) everyone will want me…

Serves the community: maximizes the distributed copies, maximizes the availability of the rarest pieces

Picks a random piece from the set of rarest pieces No peer has global knowledge of piece availability,

it is approximated by the availability among neighbors

Page 20: BitTorrent

To whom to give: Incentive to Share

21

Policies to determine to whom to send data: Tit-for-Tat

Upload to whoever uploads the most to you "Survival of the fittest“ Theoretically increases performance by encouraging fast peers

to upload to you and giving them even more pieces to upload to others

May result in suboptimal situations Optimistic Unchoking

In hope of discovering better partners To ensure that newcomers get a chance to join the swarm

Page 21: BitTorrent

Tit-for-tat as Incentive to Upload

Want to encourage all peers to contribute Peer A is said to choke peer B if it (A) decides not to

upload to B Each peer (say A) unchokes at most 4 interested

peers at any time The three with the largest upload rates to A

Where the tit-for-tat comes in Another randomly chosen (Optimistic Unchoke)

To periodically look for better choices

Page 22: BitTorrent

26

BitTorrent

I want to join the swarm of file

hash1

No problema. The peers p1, .. pn

are in your swarm

Page 23: BitTorrent

27

BitTorrent

Hey, what chunks of hash1 do you

have

I have chunk 1

I have chunk

3

Page 24: BitTorrent

28

BitTorrent

Give me the 1st chunk

Here it is 10…

Here it is 11…

Give me the 3rd chunk

Page 25: BitTorrent

29

BitTorrent

Hey, I now have the 3rd chunk

Page 26: BitTorrent

30

BitTorrent

client exchanges data with tracker sending its download statistics and receiving new peers

the only way for client to discover new peers is to query the tracker

some recent modifications tries to solve this problem by using: PEX – peer exchange extension DHT – distributed hash table

Page 27: BitTorrent

35

BitTorrent

from the point of view of some particular peer (client) other peers can be:

interested – peer who wants to download some chunks from the client

choked – peer to whom the client refuses to send the chunks

Page 28: BitTorrent

36

BitTorrent

each peer stores some data for all the other peer in the swarm

data transfer happens if some peer is interested && unchoked

peer chocked interested rate

1 1mb

2 2mb

3 0mb

: : : :

n 0mb

Page 29: BitTorrent

37

BitTorrent

tit – for – tat strategy each 10 seconds four interested peers with the best rate

are unchoked INCREASE NETWORK THROUGHPUT (performance)

optimistic unchoking strategy each 30 seconds one random interested peer is unchocked

GIVE SOME DATA TO SOME OTHER CLIENTS (FAIRNESS)

Page 30: BitTorrent

38

Video on Demand (Vod)

Suppose all cients want to download a VoD movie In general – want to download a file (“same” like

bittorrent..) However – wants to watch the file ASAP So: Want to get the pieces “in order” , or “get earliest first” STRICT IN ORDER Policy: Client downloads the pieces

according to order This may slowdown the whole torrent …

Page 31: BitTorrent

39

Video on Demand (2)

Mixed Policy: Combine Rarest First with Strict in Order Allows getting ordered pieces (Vod) while giving some

advantage to rare (Bandwidht)

Page 32: BitTorrent

40

Any Questions

Page 33: BitTorrent

41

Breaking the politeness: Selfishness Client is not “polite” or “honest”

Want to get a big share from the system without contributing much (“tit for nothing”)Don’t be altruist and pray others do

Live in environment where you cannot contribute much (e.g poor country with low upload capacity, or

prevent bittorrent upload legaly)Your ISP charges you on upload capacity

Page 34: BitTorrent

42

Breaking the politeness: Selfishness Can one get better download than others? Can one get good download without upload?

Page 35: BitTorrent

43

Breaking the politeness: Selfishness Can one get better download than others? Can one get good download without upload? Bitthief: “A free riding bittorrent client”

ETH Zurich Get good download without uploading http://www.dcg.ethz.ch/projects/bitthief/

Bittyrant: University of Washington and University of Massachusetts Amherst Increase your download capacity (on the account of non bittyrant

clients) As a strategic client, it has demonstrated an average increase in

download speed by 70% over a standard BitTorrent client. Non-BitTyrant leechers in the swarm generally receive a decrease in download speed.

Page 36: BitTorrent

44

Tnx