280 likes | 456 Views
Improving BitTorrent. Designing a new BitTorrent Client. Overview. How BitTorrent Works Experimental Analyses Modeling: Gittins’ Indices Our New Algorithms Proposed Evaluation HELP!. File Organization. File. 2. 3. 4. 1. Piece 256KB. Block 16KB. Incomplete Piece.
E N D
ImprovingBitTorrent Designing a new BitTorrent Client Dimitri DeFigueiredo – Computer Science
Overview • How BitTorrent Works • Experimental Analyses • Modeling: Gittins’ Indices • Our New Algorithms • Proposed Evaluation • HELP! Dimitri DeFigueiredo – Computer Science
File Organization File 2 3 4 1 Piece256KB Block16KB Incomplete Piece Dimitri DeFigueiredo – Computer Science
HTTP GET MYFILE.torrent MYFILE.torrent http://mytracker.com:6969/ S3F5YHG6FEB FG5467HGF367 F456JI9N5FF4E … “register” list of peers ID1 169.237.234.1:6881 ID2 190.50.34.6:5692 ID3 34.275.89.143:4545 … ID50 231.456.31.95:6882 tracker Peer 40 Peer 1 Peer 2 Initialization webserver user … Dimitri DeFigueiredo – Computer Science
0 1 0 1 “On the Wire” Protocol (Over TCP) Non-keepalive messages: 0 – choke 1 – unchoke 2 – interested 3 – not interested 4 – have 5 – bitfield 6 – request 7 – piece 8 – cancel ID/Infohash Handshake BitField BitField Remote Peer Local Peer Interested = 0choked = 1 Interested = 0choked = 1 Dimitri DeFigueiredo – Computer Science
Piece Selection • Pipelining (5 requests) • Strict Priority • 3 stages: • Random first piece • Rarest First • Endgame mode Dimitri DeFigueiredo – Computer Science
Peer Selection • Focus on Rate • Upload to at most 4 peers • Random Unchoke • Global rate cap only Dimitri DeFigueiredo – Computer Science
Analyses • N. Liogkas et al., “Exploiting BitTorrent For Fun (But Not Profit)”, IPTPS 2006. • A. Legout et al., “Rarest First and Choke Algorithms Are Enough”,June 2006 • A. R. Bharambe et al. “Analyzing and Improving BitTorrent Performance”, Feb 2005. Dimitri DeFigueiredo – Computer Science
Exploitation – Liogkas et al. • PlanetLab & Real Torrent Exploits: • Download only from seeds Median improvement of 7-20% • Download only from fastest peers Contradictory results: good in PlanetLab (+22%) bad in the wild(-1 to -30%) • Advertise false pieces 22% better download rates Dimitri DeFigueiredo – Computer Science
Piece Selection – Legout et al. Dimitri DeFigueiredo – Computer Science
Piece Selection – Legout et al. a = local peer interested in remote peer b = time peers are connected c = remote peer interested in local peer Dimitri DeFigueiredo – Computer Science
Piece Selection – Legout et al. Limitations: • In 25% of the torrents the local peer is not interested. • Who is interested in me? Dimitri DeFigueiredo – Computer Science
Gittins Indices • The Two-armed bandit problem Same prize Unknown winning probabilities Known discount factor • Limitation: Infinitely discounted or fixed horizon Projects remain dormant One project at a time • P. Whittle 1988 Restless bandits m projects “on average” Asymptotically optimal for large m and n Dimitri DeFigueiredo – Computer Science
Piece Selection Key ideas: • We don’t care about piece selection • Keep download pipes full • Peer Queues Assume: We receive pieces at a rate of 1 per second Dimitri DeFigueiredo – Computer Science
2 4 5 7 1 1 2 2 3 3 4 4 5 5 6 6 7 7 1 1 1 2 3 3 3 4 5 6 6 6 7 Piece Selection – Remote Peer Local Peer Dimitri DeFigueiredo – Computer Science
1 4 1 3 3 6 Piece Selection Q1 Peer 1 Q2 Remote Peer Peer 2 Local Peer Q3 Peer 3 Dimitri DeFigueiredo – Computer Science
Piece Selection • Cost of empty queue = Ci per unit time • Discount factor d <1 • Piece consumption rate li (Poison Process) • Queue has length li(t) Dimitri DeFigueiredo – Computer Science
Piece Selection • Minimize: where We can Solve this with Gittins’ Indices! Dimitri DeFigueiredo – Computer Science
Piece Selection Algorithm(alpha version) • Calculate Gittins’ Index for each queue: • Feed the queue with the highest index. Two Problems: 1 piece goes into many queues it takes a while to get the pieces Dimitri DeFigueiredo – Computer Science
Piece Selection Algorithm(beta version) • Calculate Gittins’ Index for each queue: • Calculate Gittins’ index for each piece. n(piece) = SA • Get piece with highest index possible. Dimitri DeFigueiredo – Computer Science
2 5 7 7 5 2 Piece Selection Algorithm highest index Peer 1 Peer 2 lowest index Peer 3 time Dimitri DeFigueiredo – Computer Science
Piece Selection Algorithm(Final Release) • Calculate Gittins’ Index for each queue. • Calculate “Gittins’ index” for each piece. • Extrapolate piece download finishing time. • Order finishing times (earliest first). • Order pieces (highest index first). • Match best piece with earliest finishing time. Dimitri DeFigueiredo – Computer Science
Peer Selection • Key Ideas: • upload rate is a perishable good • Throttle each connection individually • Do not limit number of downloaders to 4 Dimitri DeFigueiredo – Computer Science
Peer Selection – Our Model • Series of rounds • E[download rate] = f(upload rate) • Estimate download rates with “have”. Dimitri DeFigueiredo – Computer Science
Peer Selection Algorithm • Keep clients with best ratios. • Throttle to estimated safe bound. • Solve Knapsack problem: • Total upload bandwidth = max weight • Item value = download rate we are getting • Item weight = estimated upload bound • If download/upload rate ratio is < 1 • Random unchoke Dimitri DeFigueiredo – Computer Science
Evaluation • Simultaneously • Identical machines and network. • Repeat experiment and swap clients. • Different torrents vs. Dimitri DeFigueiredo – Computer Science
HELP! What we need: • An awesome python programmer ;0) What’s in it for you: • We are cool! ;0) • Publications • Open Source Real Estate… Dimitri DeFigueiredo – Computer Science
Thank you! defigued@cs.ucdavis.edu Dimitri DeFigueiredo – Computer Science