Bit Torrent


Published on

BitTorrent is a peer-to-peer file sharing protocol used to distribute large amounts of data. A user can obtain multiple files simultaneously without any considerable loss of the transfer rate .

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Bit Torrent

  1. 1. BitTorrent<br />Presented By : Seminar Guide:<br />Ashish Kumar Ms. Preetha M Kurup<br />Roll no.: 17<br />Cs – ‘ A ’<br />
  2. 2. Contents:<br />Introduction<br />Working of BitTorrent<br />Terminology<br />Architecture of bitTorrent<br />Simple example<br />Conclusion <br />References<br />
  3. 3. Introduction<br />BitTorrent is a peer to peer communication protocol for file sharing.<br />The data to be shared is divided into many equal sized portions called pieces.<br />Each piece is further sub-divided into equal-sized sub-pieces called blocks.<br />All clients interested in sharing the same data are grouped into a swarm.<br />It does not require a user to download a file completely from a single server. <br />
  4. 4. Introduction<br />Instead a file can be downloaded from many such users who are indeed downloading the same file.<br />A user who has the complete file, called the seed will initiate the download by transferring pieces of file to the users.<br />Once a user has some considerable number of such pieces of a file then even he can start sharing them with other users who are yet to receive those pieces.<br />Pieces are not downloaded in sequential order.<br />
  5. 5. Introduction<br />This concept enables a client not to depend on a server completely .<br />It also reduces the overall load on the server.<br />
  6. 6. Terminology<br />Torrent : refers to the small metadata file you receive from the web server.<br />Peer : A peer is another computer on the internet that you connect to and transfer data.<br />Leech: peer that’s downloading the file<br />Seed: A computer that has a complete copy of a certain torrent. <br />Swarm: The group of machines that are collectively connected for a particular file.<br />
  7. 7. Terminology<br />Tracker : A server on the Internet that acts to coordinate the action of BitTorrent clients. The clients are in constant touch with this server to know about the peers in the swarm.<br />Share ratio : This is ratio of amount of a file downloaded to that of uploaded. <br />Choked: It is a state of an uploader where he does not want to send anything on his link. In such cases, the connection is said to be choked.<br />
  8. 8. Swarm -snapshot<br />
  9. 9. Working of BitTorrent<br />BitTorrent protocol shares data through what are known as torrents.<br />For a torrent to be alive or active it must have several key components to function. <br />These components include a tracker server, a .torrent file, a web server where the .torrent file is stored and a complete copy of the file being exchanged. <br />The first step in the BitTorrent exchange occurs when a peer downloads a .torrent file from a server. <br />
  10. 10. Working of BitTorrent<br />The role of .torrent files is to provide the metadata that allows the protocol to function.<br />The .torrent files contains :<br /><ul><li>The URL of the tracker
  11. 11. Pieces <hash1, hash 2,…, hash n>
  12. 12. Piece length
  13. 13. Name of the file
  14. 14. Length of the file</li></li></ul><li>Working of BitTorrent<br />When a .torrent file is opened by the peer’s client software, the peer then connects to the tracker server responsible for coordinating activity for that specific torrent.<br />
  15. 15. Tracker<br />Web Server<br />3<br />2<br />1<br />4<br />Peer2<br />Peer1<br />5<br />5<br />6<br />Client<br />6<br />Fig: A Typical BitTorrent System<br />
  16. 16. BitTorrent: publishing a file<br />Harry Potter.torrent<br />Bob<br />Web Server<br />Tracker<br />Downloader:<br />A<br />Seeder:<br />B<br />Downloader:<br />C<br />
  17. 17. Architecture of BitTorrent<br />The BitTorrent protocol can be split into the following five main components:<br />MetainfoFile - a file which contains all details necessary for the protocol to operate.<br />Tracker - A server which helps manage the BitTorrent protocol.<br />Peers - Users exchanging data via the BitTorrent protocol.<br />Data - The files being transferred across the protocol<br />
  18. 18. Architecture of BitTorrent<br />Client - The program which sits on a peers computer and implements the protocol<br />Peers use TCP to communicate and send data<br />A tracker is a HTTP/HTTPS service and typically works on port 6969. <br />BitTorrent clients communicate with the tracker using HTTP GET requests, which is a standard CGI method.<br />BitTorrent uses ports 6881-6889 to send messages and data between peers.<br />
  19. 19. Tracker<br />Peer1<br />Peer3<br />Peer4<br />Peer2<br />4<br />3<br />2<br />1<br />0<br />I have pieces<br />I have pieces<br />Tracker<br />Does anyone <br />have piece 1<br />yes, peers 1 and 4<br />
  20. 20. Piece Selection<br />There are three stages of piece selection, which change depending on which stage of completion a peer is at.<br /><ul><li>Random First Piece</li></ul>When downloading first begins, as the peer has nothing to upload, a piece is selected at random to get the download started.<br /><ul><li>Rarest First</li></ul>When a peer selects which piece to download next, the rarest piece will be chosen from the current swarm.<br />
  21. 21. Piece Selection<br /><ul><li>End-game mode:</li></ul>When requests sent for all sub-pieces, (re)send requests to all peers.<br />To speed up completion of download<br />Cancel request for downloaded sub-pieces<br />
  22. 22. Tit-for-tat as incentive to upload<br />Want to encourage all peers to contribute<br />Peer A said to choke peer B if it (A) decides not to upload to B<br />Each peer (say A) unchokes at most 4 interested peers at any time<br />The three with the largest upload rates to A<br />Where the tit-for-tat comes in<br />Another randomly chosen (Optimistic Unchoke)<br />To periodically look for better choices<br />
  23. 23. Simple example<br />{1,2,3,4,5,6,7,8,9,10}<br />Seeder: A<br />{}<br />{1,2,3}<br />{1,2,3,5}<br />{}<br />{1,2,3}<br />{1,2,3,4}<br />{1,2,3,4,5}<br />Downloader C<br />Downloader B<br />
  24. 24. Conclusion<br />BitTorrent pioneered mesh-based file distribution that effectively utilizes all the uplinks of participating nodes.<br />BitTorrent is a well thought-out protocol that embraces aspects of cooperation and self-optimizing mechanisms.<br />BitTorrent propose solutions for current optimization and scalability problems<br />
  25. 25. References<br />BitTorrent Inc. (2006)<br />BitTorrent.Org(2006)<br />Cohen, Bram (2003) Incentives Build Robustness in BitTorrent, May 22 2003<br /><br />Information on BitTorrent Protocol<br />
  26. 26. THANK YOU<br />