BitTorrent Protocol
Arun Kumar (ENG18CS0047)
Computer Networks Seminar
2
Peer-to-Peer Network
●
Many computers come together and pool their resources to
form a content distribution system.
●
These computers don't need to be machines in data centers,
they can be home computers.
●
They are called peers because each can act as a client and a
server.
●
There is often no central point of control.
●
If a P2P network has an average of N users, each with
broadband connectivity at 1 Mbps, then the aggregate upload
capacity is N Mbps.
●
The aggregate download capacity is also the same because
users has a 1-Mbps link in each direction.
3
Peer-to-Peer Network
●
Skype uses P2P.
●
The two paths that P2P technology has followed are BitTorrent
protocol and Distributed hash table (DHT).
4
BitTorrent Protocol
●
Developed by Bram Cohen in 2001.
●
Quick and easy file-sharing among a set of peers.
●
There are many freely available client softwares. Eg:
BitTorrent, uTorrent, Deluge
●
Applications of BitTorrent
➔Distribution of games, TV shows, podcasts and music albums.
➔Sharing datasets.
➔Facebook uses BitTorrent to distribute updates to Facebook
servers.
➔The British government used BitTorrent to distribute details
about how the tax money of British citizens was spent.
5
How does a peer find other peers that have
the content it wants to download?
●
Not all peers will have all of the content.
●
Every content provider creates a torrent.
●
A torrent is used by a peer to verify the integrity of the data
that it downloads.
●
The content is divided into equal-sized chunks (64 KB to 512
KB).
●
Torrent contains 160-bit SHA1 hashes of all chunks.
●
Tracker is a server that leads peers to the content. It maintains
a list of peers (swarm) that are actively downloading and
uploading the content.
●
Peers contact tracker regularly to report that they are still
active and when they leave the swarm.
6
BitTorrent Protocol
7
How is content replicated by peers to provide
high-speed downloads for everyone?
●
Seeders: Peers that have all of the chunks.
●
A peer simulataneously downloads chunks that it is missing and
uploads chunks that it has.
●
A peer can leave the swarm and return at any time.
●
Each chunk must be available at many peers.
●
If everyone were to get the chunks in the same order, many
peers will depend on the seeders only. This is a bottleneck.
●
Instead, peers exchange lists of chunks that they have with each
other.
●
They select and download rare chunks because downloading
creates a copy and the rarity of the chunk reduces.
●
After a short while, all chunks will be widely available.
8
BitTorrent Protocol
9
How do peers encourage each other to upload
content to others as well as download content for
themselves?
●
Leechers are peers that download content but do not want to upload
and contribute.
●
Solution: Reward peers that show good behaviour.
●
Each peer randomly samples the other peers, retrieving chunks from
them while it uploads chunks to them.
●
The peer prefers to trade chunks with a small group that give high
download performance.
●
The peer will randomly try newcomer peers too. This allows
newcomer peers to obtain initial chunks so that they can trade with
other peers.
●
This algorithm will match peers with comparable upload and
download rates overtime.
●
If a peer is not uploading chunks or is doing so slowly, it will be cut off
/ choked sooner or later.
10
DHT
●
Tracker is centralized for each swarm.
●
Each peer keeping its own index of who has what is not worth the
effort.
●
DHTs impose a regular structure on the communication between
nodes. So they are called structured P2P networks.
●
Properties of DHT
 Each node keeps only a small amount of information about other
nodes.
 Each node can look up entries in the index quickly.
 Each node can use the index at the same time, even as other nodes
come and go.
●
The first proposed DHT was Chord in 2001.
●
Some BitTorrent clients use DHTs to provide a fully distributed tracker.
11
DHT

BitTorrent Protocol

  • 1.
    BitTorrent Protocol Arun Kumar(ENG18CS0047) Computer Networks Seminar
  • 2.
    2 Peer-to-Peer Network ● Many computerscome together and pool their resources to form a content distribution system. ● These computers don't need to be machines in data centers, they can be home computers. ● They are called peers because each can act as a client and a server. ● There is often no central point of control. ● If a P2P network has an average of N users, each with broadband connectivity at 1 Mbps, then the aggregate upload capacity is N Mbps. ● The aggregate download capacity is also the same because users has a 1-Mbps link in each direction.
  • 3.
    3 Peer-to-Peer Network ● Skype usesP2P. ● The two paths that P2P technology has followed are BitTorrent protocol and Distributed hash table (DHT).
  • 4.
    4 BitTorrent Protocol ● Developed byBram Cohen in 2001. ● Quick and easy file-sharing among a set of peers. ● There are many freely available client softwares. Eg: BitTorrent, uTorrent, Deluge ● Applications of BitTorrent ➔Distribution of games, TV shows, podcasts and music albums. ➔Sharing datasets. ➔Facebook uses BitTorrent to distribute updates to Facebook servers. ➔The British government used BitTorrent to distribute details about how the tax money of British citizens was spent.
  • 5.
    5 How does apeer find other peers that have the content it wants to download? ● Not all peers will have all of the content. ● Every content provider creates a torrent. ● A torrent is used by a peer to verify the integrity of the data that it downloads. ● The content is divided into equal-sized chunks (64 KB to 512 KB). ● Torrent contains 160-bit SHA1 hashes of all chunks. ● Tracker is a server that leads peers to the content. It maintains a list of peers (swarm) that are actively downloading and uploading the content. ● Peers contact tracker regularly to report that they are still active and when they leave the swarm.
  • 6.
  • 7.
    7 How is contentreplicated by peers to provide high-speed downloads for everyone? ● Seeders: Peers that have all of the chunks. ● A peer simulataneously downloads chunks that it is missing and uploads chunks that it has. ● A peer can leave the swarm and return at any time. ● Each chunk must be available at many peers. ● If everyone were to get the chunks in the same order, many peers will depend on the seeders only. This is a bottleneck. ● Instead, peers exchange lists of chunks that they have with each other. ● They select and download rare chunks because downloading creates a copy and the rarity of the chunk reduces. ● After a short while, all chunks will be widely available.
  • 8.
  • 9.
    9 How do peersencourage each other to upload content to others as well as download content for themselves? ● Leechers are peers that download content but do not want to upload and contribute. ● Solution: Reward peers that show good behaviour. ● Each peer randomly samples the other peers, retrieving chunks from them while it uploads chunks to them. ● The peer prefers to trade chunks with a small group that give high download performance. ● The peer will randomly try newcomer peers too. This allows newcomer peers to obtain initial chunks so that they can trade with other peers. ● This algorithm will match peers with comparable upload and download rates overtime. ● If a peer is not uploading chunks or is doing so slowly, it will be cut off / choked sooner or later.
  • 10.
    10 DHT ● Tracker is centralizedfor each swarm. ● Each peer keeping its own index of who has what is not worth the effort. ● DHTs impose a regular structure on the communication between nodes. So they are called structured P2P networks. ● Properties of DHT  Each node keeps only a small amount of information about other nodes.  Each node can look up entries in the index quickly.  Each node can use the index at the same time, even as other nodes come and go. ● The first proposed DHT was Chord in 2001. ● Some BitTorrent clients use DHTs to provide a fully distributed tracker.
  • 11.