Top Banner
A P2P file distribution sys tem ——BitTorrent Pegasus Team CMPE 208
28

A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Dec 29, 2015

Download

Documents

Clyde Davis
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: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

A P2P file distribution system ——BitTorrent

Pegasus Team

CMPE 208

Page 2: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Outline

• 1 What is it

• 2 Why do we need BitTorrent

• 3 Architecture And Operation

• 4 Why does it work so well

• 5 Strengths & Shortcomings

• 6 Conclusion

Page 3: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Overview

• Peer 2 Peer File transfer Protocol

• Works over public Internet.

• Critical components – Web Server (MetaInfo Server)– MetaData file (.torrent)– Central Tracker– End User Peers

Page 4: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Critical Elements

• 1 A web server– To provide the ‘metainfo’ file by HTTP– For example:

• http://my.torrentInfo.net• http://smashhitsongs.com/

Web Server

Snakes on the Plane torrent

US open final torrent

Page 5: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Critical Elements

• 2 The .torrent file– Static ‘metainfo’ file to contain necessary infor

mation :• Name• Size• Checksum• IP address of the Tracker

Matrix.torrent

Page 6: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Critical Elements

• 3 A BitTorrent tracker– Non-content-sharing node– Track peers– For example:

• http://my.moviestracker.com:8080/announce• http://games.records.org:6969/announce

Page 7: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Critical Elements

• 4 An end user (peer)– Guys who want to use BitTorrent must install

corresponding software or plug-in for web browsers.

– Downloader (leecher) : Peer has only a part ( or none ) of the file.

– Seeder: Peer has the complete file, and chooses to stay in the system to allow other peers to download

Page 8: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Outline

• 1 What is it

• 2 Problem And BitTorrent Solution

• 3 Architecture And Operation

• 4 Why does it work so well

• 5 Strengths & Shortcomings

• 6 Conclusion

Page 9: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Problems

• Traditional Client/Server Sharing– Performance deteriorates rapidly as the

number of clients increases

• Free-riding in P2P network – Free riders only download without

contributing to the network.

Page 10: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

BitTorrent

• Scalability of BitTorrent is very good. Even more peers means better performance.

• Strong incentives to prevent free-riding.– Priority downloading– High availability of downloads

Page 11: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Outline

• 1 What is it

• 2 Why do we need BitTorrent

• 3 Architecture And Operation

• 4 Why does it work so well

• 5 Strengths & Shortcomings

• 6 Conclusion

Page 12: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Connectivity

`

Web ServerJohn Doe

Tracker

Matrix.torrent

User

UserUser

User

Downloader:Joe

Seeder:Mike

Downloader:Michelle

Page 13: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Piece

• A file is cut into pieces of fixed size, typically 256Kb

• Each downloader reports to all of its peers what pieces it has.

• To verify data, Hash codes are used for all the pieces, included in .torrent files.

Page 14: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

A trivial example

User

User

Seeder:John

DownloaderMike

{1,2,3,4,5,6,7,8,9,10}

{}{1,2,3}User

DownloaderJoe

{}{1,2,3}

{1,2,3,4}

{1,2,3,5}

{1,2,3,4,5}

Page 15: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Messages

• Peer – Peer messages– TCP Sockets

• Peer – Tracker messages – HTTP Request/Response

• B-encoding– The "B" encoding is identical to the "BASE64"

encoding defined by RFC 1521.

Page 16: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Tracker Function

• Peer cache– IP, port, peer id

• State information– Completed– Downloading

• Returns random list

Page 17: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Peer Functions

• File space allocated• Connect to peers• Bitfield

– have(1) and not have(0)• Have <piece>

– Advertise pieces• Interest /Not_interested

– Expressing interest in the pieces published by the peer

• Requesting for a chunk– Request <index, offset, length>

Page 18: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Outline

• 1 What is it

• 2 Why do we need BitTorrent

• 3 Architecture And Operation

• 4 Why does it work so well

• 5 Strengths & Shortcomings

• 6 Conclusion

Page 19: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Peer Selection

• Built-in incentive mechanism (where all the magic happens):– Choking Algorithm– Optimistic Unchoking– Anti-snubbing

Page 20: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Choking Algorithm

• Choking is a temporal refusal to upload

• Choking evaluation is performed every 10 seconds.

• Each peer unchokes a fixed number of peers (default = 4)

• The decision on which peers to un/choke is based solely on download rate, which is evaluated on a rolling, 20-second average

Page 21: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Reasons for Choking

• TCP congestion control.

• To ensure the peers to get a consistent download rate.

User

User

Joe

mike

ChokedChoked

Page 22: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Optimistic Unchoking

• a BitTorrent peer has a single ‘optimistic unchoke’ which is uploaded regardless of the current download rate from it. This peer rotates avery 30s

• Reason:– To discover currently unused connections are

better than the ones being used

Page 23: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Anti-snubbing

• When a peer received no data in 60s, we assume it is choked by all other peers, and refuse to upload to it except for the optimistic unchoking.

• Reason– It may cause several concurrent optimistic un

chokes.

Page 24: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Example

mikeUser

User

User

Downloader:Albert

Downloader:Rob

User

Downloader:Ron

User

Downloader:Kelly

40kb/s

30kb/s10kb/s

100kb/s

20kb/s

70kb/s

15kb/s

10kb/s

70kb/s

110kb/s

70kb/s

5kb/s

DownloaderJoe

User

Page 25: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Strengths

• Better bandwidth utilization– Never before speeds.

• Up to 7 MB/s from the Internet.

• Limit free riding – tit-for-tat

• Limit leech attack – coupling upload & download

• Spurious files not propagated

• Ability to resume a download

Page 26: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Shortcomings

• Small files – latency, overhead• Random list of peers - naive• Scalability

– Millions of peers – Tracker behavior (uses 1/1000 of bandwidth)

– Single point of failure

• Robustness– System progress dependent on altruistic nature of

seeds (and peers)– Malicious attacks and leeches.

Page 27: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

Conclusion

• BitTorrent is a well thought-out protocol that embraces aspects of cooperation and self-optimizing mechanisms.

• BitTorrent propose solutions for current optimization and scalability problems

Page 28: A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.

References

• [1] Bram Cohen, Incentives build robustness in Bittorrent, May 2003• [2] Stefan Saroiu, P. Krishna Gummadi, Steven D. Gribble, A

Measurement Study of Peer-to-Peer File sharing Systems, Jan 2002

• [3] Bram Cohen, Bitconjurer.org, BitTorrent Protocol Specification • [4] J R. Douceur, The Sybil Attack• [5] A W Tucker, Prisoner’s Dilemma, Serendip.com• [6] V Vishnumurthy, S Chandrakumar, EG Sirer, KARMA : A

Secure Echonomic Framework for Peer-to-Peer Resource Sharing.• [7] E. Adar and B.A. Huberman, Free Riding on Gnutella.• [8] www.kazaa.com