Università degli Studi di Pisa Dipartimento di Informatica P2P Systems and Blockchains Spring 2021, instructor: Laura Ricci [email protected] Lesson 6: BITTORRENT PROTOCOL THE MAINLINE DHT 4/3/2021 Dipartimento di Informatica Laura Ricci Università degli Studi di Pisa The Bittorrent Protocol, the Mainline DHT, 1 BITTORRENT: OVERVIEW key idea: in 2002, Bran Cohen content popularity exhibits temporal locality (Flash Crowds) e.g. CNN on 9/11, new movie/game release,... goal: efficient content distribution system initially focused on distributing content efficiently, not on searching distribute the same file to all peers throughput increases with the number of downloaders an efficient use of network bandwidth single publisher, multiple downloaders later introduce also searching functionality: Kademlia has many “legal” publishers Blizzard Entertainment using it to distribute the beta of their new game Dipartimento di Informatica Laura Ricci Università degli Studi di Pisa The Bittorrent Protocol, the Mainline DHT, 2 THE CLIENT SERVER MODEL Dipartimento di Informatica Laura Ricci Università degli Studi di Pisa The Bittorrent Protocol, the Mainline DHT, 3 BITTORRENT IN A NUTSHELL more nodes can serve the content, not only one server needs a mechanism to detect which node is currently providing the content introducing the tracker taking trace of who is currently providing the content Joe connects to the tracker announcing the content the tracker now knows Joe is providing the file only for a better visualization nodes are arranged in a circle Dipartimento di Informatica Laura Ricci Università degli Studi di Pisa The Bittorrent Protocol, the Mainline DHT, 4 BITTORRENT IN A NUTSHELL a) b) c) Bob wants to download the red content a) it first connect to the tracker and learns that Joe is providing the content b) it establishes a direct connection with Joe c) Joe sends the content, from now on the distribution of the file goes on directly between the peers Bob then announces the tracker that it can also provide the red content Dipartimento di Informatica Laura Ricci Università degli Studi di Pisa The Bittorrent Protocol, the Mainline DHT, 5 A BITTORRENT GLOSSARY the peer which is going to share a file generates a descriptor of the file, the file .torrent, and publishes it on a server. the descriptor includes a reference to a tracker, an active entity which coordinates the peers sharing the file swarm: set of peers collaborating to the distribution of the same file coordinated by the same tracker a picture of a swarm Dipartimento di Informatica Laura Ricci Università degli Studi di Pisa The Bittorrent Protocol, the Mainline DHT, 6 A BITTORRENT GLOSSARY seeder: peer which owns all the file parts at starting time: a single seeder S exists, the peer publishing the content, creates the file .torrent e publishes it if S leaves the network after having “seeded” a set of peers, in the following, new peers become seeders. these are the peers which have downloaded the whole file and are still in the network leecher: the peer which has some part or no part of the file and downloads the file from the seeders and/or from other lechers. at the beginning, it looks for the .torrent file to start the download Dipartimento di Informatica Laura Ricci Università degli Studi di Pisa The Bittorrent Protocol, the Mainline DHT, 7 PROTOCOL OVERVIEW the peer Seeder (grey) is going to share a file 1. upload the .torrent on a Torrent Server 2. opens a connection to the tracker and informs it of its own existence: for the moment, it is the only peer which owns the file Dipartimento di Informatica Laura Ricci Università degli Studi di Pisa The Bittorrent Protocol, the Mainline DHT, 8 PROTOCOL OVERVIEW the peer Peer (grey) is going to download file, 3. downloads the file descriptor (.torrent) and opens it through the BitTorrent client 4. opens a connection to the tracker and informs it of its own existence and receives from the tracker a list of peers of the swarm 5. + 6. opens a set of connections with the peers of the swarm. Dipartimento di Informatica Laura Ricci Università degli Studi di Pisa The Bittorrent Protocol, the Mainline DHT, 9 PROTOCOL OVERVIEW the peer Peer (grey) is going to download file, 5. + 6. ask other peer abot the parts they own declares its interest in some part of the file goes on exchaning information with the peers in the swarm if Peer remains online when it has finished the file download, it goes on distributing the file, becoming a seeder Dipartimento di Informatica Laura Ricci Università degli Studi di Pisa The Bittorrent Protocol, the Mainline DHT, 10 PROTOCOL OVERVIEW: THE P2P PROTOCOL Dipartimento di Informatica Laura Ricci Università degli Studi di Pisa The Bittorrent Protocol, the Mainline DHT, 11 A SNAPSHOT OF A SWARM Dipartimento di Informatica Laura Ricci Università degli Studi di Pisa The Bittorrent Protocol, the Mainline DHT, 12 PIECES AND BLOCKS content is split into pieces (256KB - 2MB) typically 256/512/1024/2048 kByte one SHA-1 hash per piece in the .torrent file size adapted to have a reasonably small .torrent file piece is the smaller unit of retransmission: each time a piece is fully downloaded, check it (using the SHA1 algorithm) against what the torrent file tells. if check fails, piece is retrasmitted pieces are split into blocks (16KB) Dipartimento di Informatica Laura Ricci Università degli Studi di Pisa The Bittorrent Protocol, the Mainline DHT, 13 THE TORRENT FILE info contained in the .torrent length on the content in bytes File Name Pieces length (256kB, 512kB, 1024kB, etc.) Concatenation of all pieces SHA-1 hash Announce URL of the tracker (HTTP) Possibility of announce list for backup trackers Some optional fields creation date, comment, created by,.... md5 hash of the content (optional) not used by the protocol pieces SHA-1 hash are enough Dipartimento di Informatica Laura Ricci Università degli Studi di Pisa The Bittorrent Protocol, the Mainline DHT, 14 THE TORRENT FILE automatically generated by proper tools (maketorrent) or directly by the Bittorrent client when the .torrent is generated, the tool requires to the client all the set up information in particular the address of a tracker. may insert the address of a known tracker, for instance: http://www.smarttorrent.com:2710/a nnounce Dipartimento di Informatica Laura Ricci Università degli Studi di Pisa The Bittorrent Protocol, the Mainline DHT, 15 PEER BOOTSTRAP a peer downloads the .torrent file of the file it wants to download from the tracker the peer client retrieves the tracker’s URL and connects to it (HTTP GET) the peer sends to the tracker the information about its identity (identifier, port, etc,..), the number of the peer of the swarm it needs, and other information the tracker returns a random list of peers already in the torrent peer ID, peer IP, peer port typically 50 peers Dipartimento di Informatica Laura Ricci Università degli Studi di Pisa The Bittorrent Protocol, the Mainline DHT, 16 PEER BOOTSTRAP tracker for bootstrap and as certification authority, but not involved in file distribution If a .torrent file is certified by the web server, there is no way to corrupt the torrent each piece SHA-1 hash is in the .torrent file peers exploit the .torrent received from the tracker to check the integrity of the pieces received from the P2P network a peer connects to the some peers returned by the tracker at most 40 outgoing connections remaining peers kept as a pool of peers to connect if needed trackerless Bittorrent in the last versions, use Kademlia DHT to avoid the centralization point of the tracker Dipartimento di Informatica Laura Ricci Università degli Studi di Pisa The Bittorrent Protocol, the Mainline DHT, 17 THE PROBLEM OF FREE RIDERS individuals hiding his/her preference for a common good, so avoiding to pay its price and giving to others the burden to pay the good if there are other individuals interested in the common good, the free rider is aware that he/she can benefit of the common good without paying for it a group of students have to decide if they can buy an electrical appliance for the common apartment someone may hide his/her will of buying the good to avoiding the payment of the price when the good is acquired, it is not easy to prevent the free rider from utilising the common good the presence of free riders is due to the fact that it is difficult to exclude the he/she from utilising the common good the name derives from the person that gets into a bus without paying the ticket Dipartimento di Informatica Laura Ricci Università degli Studi di Pisa The Bittorrent Protocol, the Mainline DHT, 18 FREE RIDERS IN BITTORRENT free riding in BitTorrent: peers that do not put their bandwidth at disposal of the community a complex resolution of the free riders problem, because: no centralized entity that may control the nodes exists it is not possible to impose a given behaviour to the Bittorrent clients, because it is possible to modify the code of the client by a reverse engineering process several non official BitTorrent clients enables the user to limit the upload bandwidth as they like Dipartimento di Informatica Laura Ricci Università degli Studi di Pisa The Bittorrent Protocol, the Mainline DHT, 19 FREE RIDERS IN BITTORRENT a good behaviour of the whole BitTorrent network depends from the “cooperative behaviour” of the peers with respect to the community requires to eliminate the free riders a possible approach to solve this problem is based on reciprocity: a client obtains a good service if and only if it gives a good service to the community “force” the egoist peers to have a good behaviour..
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages64 Page
-
File Size-