The Bit Torrent Protocol

download The Bit Torrent Protocol

of 27

Transcript of The Bit Torrent Protocol

  • 7/31/2019 The Bit Torrent Protocol

    1/27

    The BitTorrent protocol

    A peer-to-peer file sharing protocol.

  • 7/31/2019 The Bit Torrent Protocol

    2/27

    History & Other facts BitTorrent is a peer-to-peer file sharingprotocol used for

    distributing large amounts of data over the Internet.

    Programmer Bram Cohen designed the protocol in April 2001and released a first implementation on July 2, 2001.It is nowmaintained by Cohen's company BitTorrent, Inc. There are

    numerous BitTorrent clients available for a variety of computingplatforms.

    http://en.wikipedia.org/wiki/Peer-to-peer_file_sharinghttp://en.wikipedia.org/wiki/Protocol_(computing)http://en.wikipedia.org/wiki/Datahttp://en.wikipedia.org/wiki/Bram_Cohenhttp://en.wikipedia.org/wiki/BitTorrent,_Inc.http://en.wikipedia.org/wiki/BitTorrent_clienthttp://en.wikipedia.org/wiki/Computing_platformhttp://en.wikipedia.org/wiki/Computing_platformhttp://en.wikipedia.org/wiki/Computing_platformhttp://en.wikipedia.org/wiki/Computing_platformhttp://en.wikipedia.org/wiki/BitTorrent_clienthttp://en.wikipedia.org/wiki/BitTorrent_clienthttp://en.wikipedia.org/wiki/BitTorrent_clienthttp://en.wikipedia.org/wiki/BitTorrent,_Inc.http://en.wikipedia.org/wiki/BitTorrent,_Inc.http://en.wikipedia.org/wiki/Bram_Cohenhttp://en.wikipedia.org/wiki/Datahttp://en.wikipedia.org/wiki/Protocol_(computing)http://en.wikipedia.org/wiki/Peer-to-peer_file_sharinghttp://en.wikipedia.org/wiki/Peer-to-peer_file_sharinghttp://en.wikipedia.org/wiki/Peer-to-peer_file_sharinghttp://en.wikipedia.org/wiki/Peer-to-peer_file_sharinghttp://en.wikipedia.org/wiki/Peer-to-peer_file_sharing
  • 7/31/2019 The Bit Torrent Protocol

    3/27

    Common Scenario Millions want to download the same popular huge

    files (for free)

    ISOs

    Media (the real example!)

    Client-server model fails

    Single server fails

    Cant afford to deploy enough servers

  • 7/31/2019 The Bit Torrent Protocol

    4/27

    Why Torrent ?

  • 7/31/2019 The Bit Torrent Protocol

    5/27

    Client-Server

  • 7/31/2019 The Bit Torrent Protocol

    6/27

    Client-ServerOverloaded!

  • 7/31/2019 The Bit Torrent Protocol

    7/27

    Basic terms : Tracker

    Web Server

    .torrent file

    Seeder Piece

  • 7/31/2019 The Bit Torrent Protocol

    8/27

    The Tracker

    IP address, port, peer id

    State information (Completed or Downloading)

    Returns a random list of peers

  • 7/31/2019 The Bit Torrent Protocol

    9/27

    The .torrent file The URL of the tracker

    Pieces

    Piece length

    Name of the file Length of the file

  • 7/31/2019 The Bit Torrent Protocol

    10/27

    Overall Architecture

    A

    B

    C

    Peer

    [Leech]

    Downloader

    US

    Peer

    [Seed]

    Peer

    [Leech]

    TrackerWeb Server

  • 7/31/2019 The Bit Torrent Protocol

    11/27

    Overall Architecture

    A

    B

    C

    Peer

    [Leech]

    Downloader

    US

    Peer

    [Seed]

    Peer

    [Leech]

    TrackerWeb Server

  • 7/31/2019 The Bit Torrent Protocol

    12/27

    Overall Architecture

    A

    B

    C

    Peer

    [Leech]

    Downloader

    US

    Peer

    [Seed]

    Peer

    [Leech]

    TrackerWeb Server

  • 7/31/2019 The Bit Torrent Protocol

    13/27

    Overall Architecture

    A

    B

    C

    Peer

    [Leech]

    Downloader

    US

    Peer

    [Seed]

    Peer

    [Leech]

    TrackerWeb Server

  • 7/31/2019 The Bit Torrent Protocol

    14/27

    Overall Architecture

    A

    B

    C

    Peer

    [Leech]

    Downloader

    US

    Peer

    [Seed]

    Peer

    [Leech]

    TrackerWeb Server

  • 7/31/2019 The Bit Torrent Protocol

    15/27

    Overall Architecture

    A

    B

    C

    Peer

    [Leech]

    Downloader

    US

    Peer

    [Seed]

    Peer

    [Leech]

    TrackerWeb Server

  • 7/31/2019 The Bit Torrent Protocol

    16/27

    Piece Selection

    The order in which pieces are selected bydifferent peers is critical for good performance

    If an inefficient policy is used, then peers may

    end up in a situation where each has allidentical set of easily available pieces, andnone of the missing ones.

    If the original seed is prematurely taken down,

    then the file cannot be completelydownloaded! What are good policies?

  • 7/31/2019 The Bit Torrent Protocol

    17/27

    Peer-peer transactions:Choosing pieces to request

    Rarest-first: Look at all pieces at all peers, andrequest piece thats owned by fewest peers Increases diversity in the pieces downloaded

    avoids case where a node and each of its peers haveexactly the same pieces; increases throughput

    Increases likelihood all pieces still available even iforiginal seed leaves before any one node hasdownloaded entire file

  • 7/31/2019 The Bit Torrent Protocol

    18/27

    Choosing pieces to request

    Random Piece: When peer starts to download, request random

    piece.

    So as to assemble first complete piece quickly

    Then participate in uploads When first complete piece assembled, switch to

    rarest-first

  • 7/31/2019 The Bit Torrent Protocol

    19/27

    Choosing pieces to request

    End-game mode: When requests sent for all sub-pieces, (re)send

    requests to all peers.

    To speed up completion of download

    Cancel request for downloaded sub-pieces

  • 7/31/2019 The Bit Torrent Protocol

    20/27

    One more example

    peer A

    peer B

    peer C

    peer D

    peer E

  • 7/31/2019 The Bit Torrent Protocol

    21/27

    One more example

    peer A

    peer B

    peer C

    peer D

    peer E

    C3,C4

  • 7/31/2019 The Bit Torrent Protocol

    22/27

    One more example

    peer A

    peer B

    peer C

    peer D

    peer E

    C5

  • 7/31/2019 The Bit Torrent Protocol

    23/27

    One more example

    peer A

    peer B

    peer C

    peer D

    peer E

  • 7/31/2019 The Bit Torrent Protocol

    24/27

    Pros and cons of BitTorrent Pros

    Proficient in utilizing partially downloaded files

    Discourages freeloading By rewarding fastest uploaders

    Encourages diversity through rarest-first Extends lifetime of swarm

    Works well for hot content

  • 7/31/2019 The Bit Torrent Protocol

    25/27

    Pros and cons of BitTorrent Cons

    Assumes all interested peers active at same time;performance deteriorates if swarm cools off

    Even worse: no trackers for obscure content

  • 7/31/2019 The Bit Torrent Protocol

    26/27

    Pros and cons of BitTorrent Dependence on centralized tracker: pro/con?

    Single point of failure: New nodes cant enterswarm if tracker goes down

    Lack of a search feature

    Prevents pollution attacks Users need to resort to out-of-band search: well known

    torrent-hosting sites / plain old web-search

  • 7/31/2019 The Bit Torrent Protocol

    27/27

    Thank you !!!!!