Lecture 17: Peer-to-Peer System and BitTorrent

Similar documents
Content Distribution and BitTorrent [Based on slides by Cosmin Arad]

Extreme Computing. BitTorrent and incentive-based overlay networks.

Content Overlays (continued) Nick Feamster CS 7260 March 26, 2007

BitTorrent. Masood Khosroshahy. July Tech. Report. Copyright 2009 Masood Khosroshahy, All rights reserved.

CompSci 356: Computer Network Architectures Lecture 21: Overlay Networks Chap 9.4. Xiaowei Yang

Do incentives build robustness in BitTorrent?

BitTorrent Optimization Techniques. (from various online sources)

Distributed Data Management. Christoph Lofi Institut für Informationssysteme Technische Universität Braunschweig

Introduction to P P Networks

P2P Applications. Reti di Elaboratori Corso di Laurea in Informatica Università degli Studi di Roma La Sapienza Canale A-L Prof.ssa Chiara Petrioli

Game Theory. Presented by Hakim Weatherspoon

CS 3516: Advanced Computer Networks

CS5412: TORRENTS AND TIT-FOR-TAT

DISTRIBUTED SYSTEMS CSCI 4963/ /4/2015

BitTorrent. Internet Technologies and Applications

Peer to Peer Systems and Probabilistic Protocols

P2P Applications. Reti di Elaboratori Corso di Laurea in Informatica Università degli Studi di Roma La Sapienza

P2P content distribution Jukka K. Nurminen

Last Lecture SMTP. SUNY at Buffalo; CSE 489/589 Modern Networking Concepts; Fall 2010; Instructor: Hung Q. Ngo 1

Reti P2P per file distribution: BitTorrent

416 Distributed Systems. Mar 3, Peer-to-Peer Part 2

Lecture 8: Application Layer P2P Applications and DHTs

Scalability of the BitTorrent P2P Application

Peer-to-Peer Applications Reading: 9.4

Application Layer: P2P File Distribution

Distributed Data Management

Lecture 21 P2P. Napster. Centralized Index. Napster. Gnutella. Peer-to-Peer Model March 16, Overview:

Distributed Data Management

Application-Layer Protocols Peer-to-Peer Systems, Media Streaming & Content Delivery Networks

P2P. 1 Introduction. 2 Napster. Alex S. 2.1 Client/Server. 2.2 Problems

CS 3516: Computer Networks

Cooperation in Open Distributed Systems. Stefan Schmid

CSE 486/586 Distributed Systems Peer-to-Peer Architectures

P2P Content Distribution

Middleware and Distributed Systems. Peer-to-Peer Systems. Peter Tröger

P2P content distribution

Attacks and exploits targeting BitTorrent and other P2P file sharing networks

UKNova s Getting Connectable Guide

BitTorrent and CoolStreaming

Peer-to-Peer Systems. Internet Computing Workshop Tom Chothia

Cooperative End-to-end content distribution. Márk Jelasity

CS 43: Computer Networks BitTorrent & Content Distribution. Kevin Webb Swarthmore College September 28, 2017

internet technologies and standards

Peer-to-Peer Networks 12 Fast Download

Department of Computer Science Institute for System Architecture, Chair for Computer Networks. File Sharing

5. Bi&orrent and coopera0on

Peer-to-peer systems and overlay networks

BitTorrent for Really Selfish Peers T4T Trading over Cycles

Chapter 2: Application layer

IMPLEMENTATION AND EVALUATION OF THE MULTICAST FILE TRANSFER PROTOCOL (MCFTP)

Improving Performance of BitTorrent Network through Incentive Mechanism

Page 1. How Did it Start?" Model" Main Challenge" CS162 Operating Systems and Systems Programming Lecture 24. Peer-to-Peer Networks"

Spotify Behind the Scenes

CSCI 466 Midterm Networks Fall 2013

CMSC 332 Computer Networks P2P and Sockets

Congestion? What Congestion? Mark Handley

CSCI-1680 P2P Rodrigo Fonseca

Lecture 11: Middleboxes and NAT (Duct tape for IPv4)

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University

Taming the Flood: How I Learned to Stop Worrying and Love the Swarm Yogesh Vedpathak Cleversafe

CSC 4900 Computer Networks: P2P and Sockets

CS 43: Computer Networks. 14: DHTs and CDNs October 3, 2018

INTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY

CEN5501 Computer Networks Project Description

Peer to Peer Networks

Modeling Leechers Attack in BitTorrent

EE 122: Peer-to-Peer Networks

inria , version 1-6 Sep 2006

12/5/16. Peer to Peer Systems. Peer-to-peer - definitions. Client-Server vs. Peer-to-peer. P2P use case file sharing. Topics

Performance Analysis of BitTorrent Protocol

Scaling Problem Computer Networking. Lecture 23: Peer-Peer Systems. Fall P2P System. Why p2p?

Internet Structural View. The Internet software layers. Package-shipping example TCP UDP

Introduction to Peer-to-Peer Networks

Peer-to-Peer Systems. Network Science: Introduction. P2P History: P2P History: 1999 today

Design Space Analysis for Modeling Incentives in Distributed Systems

arxiv:cs.ni/ v1 21 Nov 2006

ALTO Problem Statement

Introduction to Peer-to-Peer Systems

Distributed Systems. peer-to-peer Johan Montelius ID2201. Distributed Systems ID2201

CS 43: Computer Networks. 08:Network Services and Distributed Systems 19 September

Lesson 9 Applications of DHT: Bittorrent Mainline DHT, the KAD network

BitTorrent from swarms to collectives

Overview Computer Networking Lecture 17: Delivering Content Peer to Peer Examples Peter Steenkiste

The Scalability of Swarming Peer-to-Peer Content Delivery

On Feasibility of P2P Traffic Control through Network Performance Manipulation

Exam - Final. CSCI 1680 Computer Networks Fonseca. Closed Book. Maximum points: 100 NAME: 1. TCP Congestion Control [15 pts]

Merging the best of HTTP and P2P

EnhancedBit: Unleashing the Potential of the Unchoking Policy in the BitTorrent Protocol

BitRiver: Final Report

CE693: Adv. Computer Networking

A Measurement Study of Attacks on BitTorrent Seeds

Bittorrent simulator in Erlang

Joana Margarida Dias de Bragança Gonçalves. Caracterização de utilizadores em sistemas P2P Peer-level characterization of P2P systems

Introduction to Distributed Computing Systems

Further extensions to the Wigan architecture are discussed in this thesis, including possible means of handling data updates.

Distributed Systems. 25. Distributed Caching & Some Peer-to-Peer Systems Paul Krzyzanowski. Rutgers University. Fall 2017

Traffic Patterns in Peer-to-Peer-Networking. Christian Schindelhauer. joint work with Amir Alsbih Thomas Janson

CS 640 Introduction to Computer Networks. Today s lecture. What is P2P? Lecture30. Peer to peer applications

WIRELESS ACCESS IN VEHICULAR ENVIRONMENTS USING BIT TORRENT AND BARGAINING

Stealing Bandwidth from BitTorrent Seeders

Transcription:

CSCI-351 Data communication and Networks Lecture 17: Peer-to-Peer System and BitTorrent (I swear I only use it for Linux ISOs) The slide is built with the help of Prof. Alan Mislove, Christo Wilson, and David Choffnes's class

2 Outline Peer-to-Peer Overview Example: Bittorrent

Traditional Internet Services Model 3 Client-server! Many clients, 1 (or more) server(s)! Web servers, DNS, file downloads, video streaming Problems! Scalability: how many users can a server support? What happens when user traffic overload servers? Limited resources (bandwidth, CPU, storage)! Reliability: if # of servers is small, what happens when they break, fail, get disconnected, are mismanaged by humans?! Efficiency: if your users are spread across the entire globe, how do you make sure you answer their requests quickly?

The Alternative: Peer-to-Peer 4 A simple idea! Users bring their own resources to the table! A cooperative model: clients = peers = servers The benefits! Scalability: # of servers grows with users BYOR: bring your own resources (storage, CPU, B/W)! Reliability: load spread across many peers Probability of them all failing is very low! Efficiency: peers are distributed Peers can try and get service from nearby peers

The Peer-to-Peer Challenge 5 What are the key components for leveraging P2P?! Communication: how do peers talk to each other! Service/data location: how do peers know who to talk to New reliability challenges! Network reachability, i.e. dealing with NATs! Dealing with churn, i.e. short peer uptimes What about security?! Malicious peers and cheating! The Sybil attack

Centralized Approach 6 The original: Napster! 1999-2001! Shawn Fanning, Sean Parker! Specialized in MP3s (but not for long) Centralized index server(s)! Supported all queries What caused its downfall?! Not scalable! Centralization of liability

Napster Architecture 7 Napster Central Server B and C have the file Log-in, upload list Search of for files Gangnam Style A B C D E F G

What is BitTorrent 8 Designed for fast, efficient content distribution! Ideal for large files, e.g. movies, DVDs, ISOs, etc.! Uses P2P file swarming Not a full fledged P2P system! Does not support searching for files! File swarms must be located out-of-band! Trackers acts a centralized swarm coordinators Fully P2P, trackerless torrents are now possible Insanely popular! 35-70% of all Internet traffic in early 2010

BitTorrent Overview 9 Tracker Swarm Seeder Leechers

.torrent File 10 Contains all meta-data related to a torrent! File name(s), sizes! Torrent hash: hash of the whole file! URL of tracker(s) BitTorrent breaks files into pieces! 64 KB 1 MB per piece!.torrent contains the size and SHA-1 hash of each piece Basically, a.torrent tells you! Everything about a given file! Where to go to start downloading

Torrent Sites 11 Just standard web servers! Allow users to upload.torrent files! Search, ratings, comments, etc. Some also host trackers Many famous ones! Mostly because they host illegal content Legitimate.torrents! Linux distribution! World of Warcraft patches

Torrent Trackers Tracker 12 Really, just a highly specialized webserver! BitTorrent protocol is built on top of HTTP Keeps a database of swarms! Swarms identified by torrent hash! State of each peer in each swarm IP address, port, peer ID, TTL Status: leeching or seeding Optional: upload/download stats (to track fairness)! Returns a random list of peers to new leechers

Peer Selection 13 Tracker provides each client with a list of peers! Which peers are best? Fastest bandwidth Option 1: learn dynamically! Try downloading from many peers! Keep only the best peers! Strategy used by BitTorrent Option 2: use external information! E.g. Some torrent clients prefer peers in the same ISP

Sharing Pieces 14 Initial Seeder 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 Leecher Seeder Leecher Seeder

The Beauty of BitTorrent 15 More leechers = more replicas of pieces More replicas = faster downloads! Multiple, redundant sources for each piece Even while downloading, leechers take load off the seed(s)! Great for content distribution! Cost is shared among the swarm

Typical Swarm Behavior 16

Sub-Pieces and Pipelining 17 Each piece is broken into sub-pieces! ~16 KB in size TCP Pipelining! For performance, you want long lived TCP connections (to get out of slow start)! Peers generally request 5 sub-pieces at a time! When one finished, immediately request another! Don t start a new piece until previous is complete Prioritizes complete pieces Only complete pieces can be shared with other peers

Piece Selection 18 Piece download order is critical! Worst-case scenario: all leeches have identical pieces Nobody can share anything :(! Worst-case scenario: the initial seed disappears If a piece is missing from the swarm, the torrent is broken What is the best strategy for selecting pieces?! Trick question! It depends on how many pieces you already have

Download Phases 19 0% % Downloaded 100% Bootstrap: random selection! Initially, you have no pieces to trade! Essentially, beg for free pieces at random Steady-state: rarest piece first! Ensures that common pieces are saved for last Endgame! Simultaneously request final pieces from multiple peers! Cancel connections to slow peers! Ensures that final pieces arrive quickly

Upload and Download Control 20 How does each peer decide who to trade with? Incentive mechanism! Based on tit-for-tat, game theory! If you give a piece to me, I ll give a piece to you! If you screw me over, you get nothing! Two mechanisms: choking and optimistic unchoke

A Bit of Game Theory 21 Iterated prisoner s dilemma Very simple game, two players, multiple rounds! Both players agree: +2 points each! One player defects: +5 for defector, +0 to other! Both players defect: +0 for each Maps well to trading pieces in BitTorrent! Both peers trade, they both get useful data! If both peers do nothing, they both get nothing! If one peer defects, he gets a free piece, other peer gets nothing What is the best strategy for this game?

Tit-for-Tat 22 Best general strategy for iterated prisoner s dilemma Meaning: Equivalent Retaliation Rules 1. Initially: cooperate 2. If opponent cooperates, cooperate next round 3. If opponent defects, defect next round Round Points 1 Cooperate Cooperate +2 / +2 2 Cooperate Defect +0 / +5 3 Defect Cooperate +5 / +0 4 Cooperate Cooperate +2 / +2 5 Cooperate Defect +0 / +5 6 Defect Defect +0 / +0 7 Defect Cooperate +5 / +0 Totals: +14 / +14

Choking 23 Choke is a temporary refusal to upload! Tit-for-tat: choke free riders! Cap the number of simultaneous uploads Too many connections congests your network! Periodically unchoke to test the network connection Choked peer might have better bandwidth

Optimistic Unchoke 24 Each peer has one optimistic unchoke slot! Uploads to one random peer! Peer rotates every 30 seconds Reasons for optimistic unchoke! Help to bootstrap peers without pieces! Discover new peers with fast connections

BitTorrent Protocol Fundamentals 25 1 2 3 Leecher Leecher BitTorrent divides time into rounds! Each round, decide who to upload to/download from! Rounds are typically 30 seconds Each connection to a peer is controlled by four states! Interested / uninterested do I want a piece from you?! Choked / unchoked am I currently downloading from you? Connections are bidirectional! You decide interest/choking on each peer! Each peer decides interest/chocking on you 4

Connection States 26 Error states. Connection should be closed. Download control! d interested and choked! D interested and unchoked! K uninterested and unchoked! S snubbed (no data received in 60 seconds)! F piece(s) failed to hash Upload control! u interested and choked! U interested and unchoked! O optimistic unchoke!? uninterested and unchoked Connection information! I incoming connection! E/e Using protocol encryption Most peers are d or D. No need to connect with uninteresting peers.! h used UDP hole punching! P connection uses µtp How was this peer located?! H DHT (distributed hash table)! L local peer discovery (multicast)! X peer exchange More on this later

Upload-Only Mode 27 Once a peer completes a torrent, it becomes a seed! No downloads, no tit-for-tat! Who to upload to first? BitTorrent policy! Upload to the fastest known peer! Why?! Faster uploads = more available pieces! More available pieces helps the swarm

BitTorrent and TCP 28 BitTorrent accounts for 35-70% of all Internet traffic Thus, BitTorrent s behavior impacts everyone BitTorrent s use of TCP causes problems! Long lived, BitTorrent TCP flows are elephants Ramp up past slow start, dominate router queues! Many applications are mice, get trampled by elephants Short lived flows (e.g. HTTP traffic) Delay sensitive apps (i.e. VoIP, SSH, online games) Have you ever tried using SSH while using BitTorrent?

Conclusions 29 BitTorrent is an extremely efficient tool for content distribution! Strong incentive system based on game theory! Most popular file sharing client since 2001! More active users than YouTube and Facebook combined However, BitTorrent is a large system with many different mechanisms! Ample room to modify the client, alter behavior