Fairtorrent: Bringing Fairness to Peer-To-Peer Systems
Total Page:16
File Type:pdf, Size:1020Kb
FairTorrent: Bringing Fairness to Peer-to-Peer Systems Alex Sherman, Jason Nieh, and Cliff Stein Department of Computer Science Columbia University Technical Report CUCS-029-08 May, 2008 {asherman, nieh, cliff}@cs.columbia.edu Abstract to take as much as possible from the system while con- tributing little resources, and a lack of quality-of-service The lack of fair bandwidth allocation in Peer-to-Peer guarantees to support streaming applications. systems causes many performance problems, includ- Fair bandwidth allocation in P2P systems can be diffi- ing users being disincentivized from contributing upload cult to achieve for several reasons. First, bandwidth re- bandwidth, free riders taking as much from the system sources belong to and are controlled by individual peers, as possible while contributing as little as possible, and a not by a single party. Unlike a router or a server, there lack of quality-of-service guarantees to support stream- is no central entity that controls and arbitrates access ing applications. We present FairTorrent, a simple dis- to all resources. Second, bandwidth resources are dis- tributed scheduling algorithm for Peer-to-Peer systems tributed all over the Internet, and therefore vary geo- that fosters fair bandwidth allocation among peers. For graphically and also are limited by the various Internet each peer, FairTorrent maintains a deficit counter which Service Providers. Third, the amount of bandwidth re- represents the number of bytes uploaded to a peer mi- sources available is not known in advance and peers can- nus the number of bytes downloaded from it. It then not be relied upon to specify their own resources hon- uploads to the peer with the lowest deficit counter. Fair- estly. Fourth, bandwidth resources may vary over time Torrent automatically adjusts to variations in bandwidth for several reasons, including network conditions, mo- among peers and is resilient to exploitation by free-riding bile peers connecting at different access points, and a peers. We have implemented FairTorrent inside a BitTor- user using the available bandwidth for other activities. rent client without modifications to the BitTorrent proto- Finally, any fair allocation mechanism must be strong col, and compared its performance on PlanetLab against enough to withstand attempts by free riders to manipu- other widely-used BitTorrent clients. Our results show late the system. that FairTorrent can provide up to two orders of magni- tude better fairness and up to five times better download Of course, fairness is not the only desirable property performance for high contributing peers. It thereby gives in a peer-to-peer system, users also desire good perfor- users an incentive to contribute more bandwidth, and im- mance, measured by download time. We show that im- prove overall system performance. proving fairness leads to improved performance, some- times, with substantial gains. 1 Introduction Many approaches have attempted to address the prob- In the past decade, the usage of Peer-to-Peer (P2P) file- lem of fair bandwidth exchange. One approach, which is sharing applications on the Internet has experienced ex- employed by the popular file-sharing system BitTorrent, plosive growth. Many users and businesses now rely on is to use a tit-for-tat (TFT) heuristic. However, recent P2P file-sharing for distributing videos, software, and studies [27, 21, 15] have demonstrated weaknesses in the documents. Although P2P file-sharing is now an inte- BitTorrent TFT mechanism that can be exploited by free- gral part of our overall computing experience, these ap- riding clients to take advantage of high-bandwidth con- plications are plagued by a fundamental problem of un- tributors. For example, the LargeView exploit client [27] fairness in how bandwidth among peers is used and al- takes advantage of the fact that BitTorrent uses a fraction located. Unfairness causes many performance problems, of its bandwidth to upload optimistically to randomly including users being disincentivized from contributing chosen peers. By opening connections to many peers, the upload bandwidth, a growing number of free riders, users LargeView client allows a large number of its neighbors who cap their upload bandwidth to zero or a small value to pick it as the target for their optimistically-spent band- 1 width. As another example, the BitTyrant client [21] is Tyrant [21], a modified Azureus 2.5 client that was opti- based on the observation that even though BitTorrent at- mized for improved download performance. tempts to find reciprocating neighbors, it is often willing For peers with widely different bandwidths across to upload to peers who reciprocate at a much lower rate. a uniform distribution, our measurements demonstrate BitTyrant attempts to find peers where it can maximize that FairTorrent provides more than an order of mag- the difference between what it receives from them versus nitude better fairness and up to 50% faster download what it uploads to them. performance compared to other BitTorrent implementa- To address these problems, we present FairTorrent, tions. Furthermore, FairTorrent makes more efficient use a new P2P scheduling algorithm that fosters fair band- of available upload bandwidth and provides download width allocation among peers. In its simplest form, at times that are strongly correlated with the peers’ upload each peer, FairTorrent maintains a deficit counter for each capacities, incentivizing peers to upload more. For a high neighboring peer which represents the number of bytes it bandwidth uploader in the presence of many low con- uploaded to this neighbor minus the number of bytes it tributors, our measurements demonstrate that FairTorrent downloaded from it. When it is ready to send a packet can provide two orders of magnitude better fairness and of data, FairTorrent identifies the peer with the lowest up to five times faster download performance compared deficit counter and sends data to that peer. to other BitTorrent implementations. We also show that Our main result is that this surprisingly simple ap- FairTorrent provides improved fairness and performance proach provides much better fairness while simultane- even if low contributors run other BitTorrent clients, in- ously decreasing most download times, often by a sig- cluding clients designed to exploit unmodified BitTorrent nificant amount. Download times are also more corre- for better performance. lated with the peers’ upload rates, thereby incentivizing This paper describes the design, implementation, and peers to upload more. FairTorrent has a number of ad- evaluation of FairTorrent. Section 2 discusses related ditional useful properties: (1) FairTorrent provides fair work. Section 3 presents FairTorrent, which is analyzed bandwidth allocation, operating only at individual peers, in Section 4. Section 5 presents experimental results on in a distributed manner that does not require any central- PlanetLab comparing FairTorrent performance to other ized control of peers or other P2P resources. (2) Fair- BitTorrent implementations. Finally, we present some Torrent does not need to measure available download concluding remarks. bandwidth, allocate precise upload or download rates for any peers, or rely on estimates or advanced knowledge 2 Background and Related Work of available bandwidth from users or other peers. (3) BitTorrent [7] employs a rate-based tit-for-tat (TFT) FairTorrent allows a peer to automatically adjust to dy- heuristic to incentivize peers to upload and attempts to namic network conditions and any changes in the rate at provide fair exchange of bandwidth between peers. Peers which peers contribute bandwidth, avoiding long discov- participating in the download of the same target file form ery times of like-uploading peers as evidenced in BitTor- a swarm. The target file is conceptually broken up into rent [21]. (4) FairTorrent provides low variance in band- pieces, typically 256 KB in size. Peers tell one another width allocation, enabling it to be useful for streaming which pieces of the target file they already have and re- applications. (5) FairTorrent has no magic parameters quest missing pieces from one another. Requests are typ- and requires no tuning, is simple to implement, and re- ically made for 16 KB sub-pieces. Peers that already quires no changes to the BitTorrent protocol, making it have the entire file are seeds. Peers that are still down- easy to deploy with existing P2P systems. loading pieces of the file are leechers. TFT is used in We have analyzed, implemented, and measured Fair- a swarm to enable fair bandwidth exchange during the Torrent to evaluate its effectiveness. Our analysis results current download of a file. It operates by having each show that FairTorrent runs efficiently, using O(log k) BitTorrent client upload to N other peers in round-robin time per transmission in a network with k peers. We fashion, where N − k of the peers have provided the best have proved for a small network that the algorithm has download rate during the most recent time period, and k fairness bounds independent of the amount of data sent, peers are randomly selected to help discover other peers and conjecture that a similar result holds for any network. with similar upload rates. (N is typically between 5 and We have implemented FairTorrent inside a BitTorrent 10). The set of peers to which a client uploads is periodi- client without changing the BitTorrent protocol, making cally changed based on measurements of their download it compatible with existing BitTorrent implementations. rates. BitTorrent refers to the selection and deselection of We evaluated its performance on PlanetLab against three a peer for uploading as unchoking and choking, respec- other BitTorrent implementations, the original BitTorrent tively. Python client by Bram Cohen [7], the latest version of Much work has been done in studying the behavior of the popular Azureus Java BitTorrent client [3], and Bit- BitTorrent. Qiu and Srikant [23] show that under some 2 bandwidth distributions, the system eventually converges download, one model proposes to optimize average per- to a Nash equilibrium.