Download presentation
Presentation is loading. Please wait.
1
Designing a new BitTorrent Client
Improving BitTorrent Designing a new BitTorrent Client 11/16/2018 Dimitri DeFigueiredo – Computer Science
2
Dimitri DeFigueiredo – Computer Science
Overview How BitTorrent Works Experimental Analyses Modeling: Gittins’ Indices Our New Algorithms Proposed Evaluation HELP! 11/16/2018 Dimitri DeFigueiredo – Computer Science
3
Dimitri DeFigueiredo – Computer Science
File Organization File 1 2 3 4 Piece 256KB Block 16KB Incomplete Piece 11/16/2018 Dimitri DeFigueiredo – Computer Science
4
Dimitri DeFigueiredo – Computer Science
Initialization HTTP GET MYFILE.torrent S3F5YHG6FEB FG5467HGF367 F456JI9N5FF4E … MYFILE.torrent webserver “register” ID :6881 ID :5692 ID :4545 … ID :6882 list of peers user tracker Peer 40 … Peer 1 Peer 2 11/16/2018 Dimitri DeFigueiredo – Computer Science
5
Dimitri DeFigueiredo – Computer Science
“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 1 ID/Infohash Handshake BitField BitField Remote Peer Local Peer Interested = 0 choked = 1 Interested = 0 choked = 1 11/16/2018 Dimitri DeFigueiredo – Computer Science
6
Dimitri DeFigueiredo – Computer Science
Piece Selection Pipelining (5 requests) Strict Priority 3 stages: Random first piece Rarest First Endgame mode 11/16/2018 Dimitri DeFigueiredo – Computer Science
7
Dimitri DeFigueiredo – Computer Science
Peer Selection Focus on Rate Upload to at most 4 peers Random Unchoke Global rate cap only 11/16/2018 Dimitri DeFigueiredo – Computer Science
8
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. 11/16/2018 Dimitri DeFigueiredo – Computer Science
9
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 11/16/2018 Dimitri DeFigueiredo – Computer Science
10
Piece Selection – Legout et al.
11/16/2018 Dimitri DeFigueiredo – Computer Science
11
Piece Selection – Legout et al.
a = local peer interested in remote peer b = time peers are connected c = remote peer interested in local peer 11/16/2018 Dimitri DeFigueiredo – Computer Science
12
Piece Selection – Legout et al.
Limitations: In 25% of the torrents the local peer is not interested. Who is interested in me? 11/16/2018 Dimitri DeFigueiredo – Computer Science
13
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 11/16/2018 Dimitri DeFigueiredo – Computer Science
14
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 11/16/2018 Dimitri DeFigueiredo – Computer Science
15
Dimitri DeFigueiredo – Computer Science
Piece Selection 5 6 7 1 2 3 4 – 1 2 3 4 5 6 7 Remote Peer Local Peer 1 2 3 4 5 6 7 1 3 6 5 6 7 1 2 3 4 11/16/2018 Dimitri DeFigueiredo – Computer Science
16
Dimitri DeFigueiredo – Computer Science
Piece Selection 3 1 Q1 Peer 1 1 3 6 Q2 Remote Peer Peer 2 Local Peer 4 Q3 Peer 3 11/16/2018 Dimitri DeFigueiredo – Computer Science
17
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) 11/16/2018 Dimitri DeFigueiredo – Computer Science
18
Dimitri DeFigueiredo – Computer Science
Piece Selection Minimize: where We can Solve this with Gittins’ Indices! 11/16/2018 Dimitri DeFigueiredo – Computer Science
19
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 11/16/2018 Dimitri DeFigueiredo – Computer Science
20
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. 11/16/2018 Dimitri DeFigueiredo – Computer Science
21
Piece Selection Algorithm
highest index 7 Peer 1 7 5 2 Peer 2 2 lowest index 5 Peer 3 time 11/16/2018 Dimitri DeFigueiredo – Computer Science
22
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. 11/16/2018 Dimitri DeFigueiredo – Computer Science
23
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 11/16/2018 Dimitri DeFigueiredo – Computer Science
24
Peer Selection – Our Model
Series of rounds E[download rate] = f(upload rate) Estimate download rates with “have”. 11/16/2018 Dimitri DeFigueiredo – Computer Science
25
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 11/16/2018 Dimitri DeFigueiredo – Computer Science
26
Dimitri DeFigueiredo – Computer Science
Evaluation Simultaneously Identical machines and network. Repeat experiment and swap clients. Different torrents vs. 11/16/2018 Dimitri DeFigueiredo – Computer Science
27
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… 11/16/2018 Dimitri DeFigueiredo – Computer Science
28
Dimitri DeFigueiredo – Computer Science
Thank you! 11/16/2018 Dimitri DeFigueiredo – Computer Science
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.