Title: Optimizing BitTorrent for OnDemand Streaming
1Optimizing BitTorrentfor On-Demand Streaming
- Nadim Parvez (U. Calgary)
- Carey Williamson (U. Calgary)
- Anirban Mahanti (IIT Delhi)
- Niklas Carlsson (U. Saskatchewan)
(To appear at ACM SIGMETRICS 2008, Annapolis, MD,
June 2008.)
2Introduction and Motivation
- BitTorrent is a popular protocol used for
Peer-to-Peer (P2P) file sharing on the Internet - Very efficient for download of large files, such
as media objects (audio/video) - Question How suitable is BitTorrent for
on-demand stored media streaming?
3Background BitTorrent 101
- Key features of BitTorrent
- a single file (e.g., 100 MB movie) is split
into many fixed-size pieces (e.g., 256 KB) - all peers associated with a file are called
a swarm (tracker, downloaders, and seeds) - peers can download pieces in any order
- Rarest-First piece selection policy makes
prevalence of pieces asymptotically uniform - can download pieces concurrently from one or
more peers (typically 4-5 at a time) - tit-for-tat reciprocity among peers to
encourage cooperation (upload/download)
4Background Streaming
- Download Streaming
- D obtain file first, then do something with it
- S view the file while it is still being obtained
(start-up delay - Media playback must be sequential
- Media file has an inherent media playback rate
(frames per second) - Playback rate must be sustained for the duration
of the media object (uninterrupted)
5Background P2P Streaming
- The P2P paradigm has also been applied to media
streaming applications - CoolStreaming, P2PLive, ZigZag,
- Two types of streaming
- live streaming usually a single source, and many
peers with shared temporal content focus, joining
and leaving at any time - on-demand streaming stored media objects,
accessed at any time, retrieved in entirety - Our focus on-demand P2P streaming
6Research Questions
- Can BitTorrent-like protocols provide scalable
on-demand streaming? - How sensitive is the performance to the
application configuration parameters? - Piece selection policy
- Upload/download bandwidth
- What is the user-perceived performance?
- Startup delay
- Probability of disrupted playback
7Some Theory Highlights
- Mathematical modeling/analysis of BitTorrent-like
P2P system - Fluid flow modeling of system behaviour
- Differential equations describing evolution of
system population (transient and/or
steady-state analysis) - Combinatorics and optimization
- Possible game-theoretic analysis
- Possible security/vulnerability analysis
8A Key Observation
- MediaStreamingProgress (MSP) depends on two
different things - DownloadProgress (DP)
- SequentialProgress (SP)
- These two can be analyzed separately
MSP DP x SP
(useful media pieces per unit time)
(pieces obtained per unit time)
(useful media pieces per pieces obtained)
9Quiz Time Sequential Progress
Q After having retrieved k pieces (at
random) from a file with M pieces, what is the
probability that a peer has (exactly) pieces 1
to j inclusive?
A1 Prob(M,k,j)
A2 P
10Sequential Progress Example
11BitTorrent Model (1 of 2)
Downloader
Seed
Downloader
Seed
Downloader
Torrent (with x downloaders and y seeds)
Arrival rate ?
Departure rate ? y
Downloader
Residence Time 1/ ?
Download Time T
12BitTorrent Model (2 of 2)
Seed
Downloader
Seed
Downloader
U of upload connections C Per connection
throughput
Downloader
Torrent (with x downloaders and y seeds)
Arrival rate ?
Departure rate ? y
D of download connections C Per connection
throughput
Downloader
13Assumptions and Parameters
- Single swarm homogeneous peers
- x downloaders and y seeds at time t
- D download conns U upload conns
- System is demand-driven xD (xy)U
- Download latency T
- Number of pieces in the file M
- Startup delay ?
- Media Playback Rate r
14Fluid Model Overview
Arrivals
x(t)
Conversions
Downloaders
y(t)
Departures
Seeds
15Model Rarest-First
- Conversion of downloaders to seeds at rate
(xy)UC. - Therefore the change of swarm population
16Model Rarest-First
- Download latency
- Sequential progress
- Startup delay
17Rarest-First Observations
- Download latency is independent of the peer
arrival rate (system is scalable). - Latency improves when upload bandwidth or seed
residence time increase. - Sequential progress is very poor (bad
news for on-demand streaming!). - Startup delay approximately equals the download
latency when M is large.
18Strict In-Order Model (naïve)
- Obtain pieces in numerical order
- Best case for sequential progress
- Implications
- Completely breaks the tit-for-tat mechanism!
(only older peers have useful pieces
for you) - Uneven distribution of demand in system (heaviest
at seeds and older peers, who use random
selection with purging to handle load) - Young peers progress quickly, but progress gets
slower and slower with age - Unstable system population (oscillation)
19BitTorrent Model (revisited)
Seed
Downloader
Seed
Downloader
U of upload connections C Per connection
throughput
Downloader
Torrent (with x downloaders and y seeds)
Arrival rate ?
Departure rate ? y
Peers (sorted by age)
20Model Strict In-Order
- The probability of getting a download connection
for a downloader of age t is - Averaging over all downloaders (age 0 to T),
the change of swarm population is
21Model Strict In-Order
- Swarm population
- Download latency
- Startup delay
22Strict In-Order Observations
- System progress is very sluggish due to x/2 term
in the conversion rate. - Number of downloaders is much higher.
- Number of seeds is same as Rarest-First.
- Download latency is almost double compared to
Rarest-First (for ? near 1).
23In-Order(FCFS) Model
- Obtain pieces in numerical order
- Best case for sequential progress
- Features
- Pending requests are queued
- Queues are served in FCFS order
- Closed-loop mechanism for new requests ensures
finite queue size - Load is still uneven, but self-regulated
- System is fair to peers of all ages
24Model Strict In-Order (FCFS)
- Swarm population
- Download latency
- Startup delay
25In-Order(FCFS) Observations
- Population evolution is identical to
Rarest-First. - Download latency is identical to Rarest-First.
- Sequential progress is ideal (unlike
Rarest-First). - Lowest startup delay among policies evaluated.
- We believe this policy is optimal, but do not
have a formal proof at this time. (Help!)
26Model Validation Scenario
- Fluid simulation in ns-2
- Number of pieces M 100
- Range 100 to 200
- Piece size 128 KB
- Media playback rate r 2000 Kbps
- Download capacity 3200 Kbps (D 16 conns)
- Upload capacity 800 Kbps (U 4 conns)
- Range 300 Kbps to 2000 Kbps
- Arrival rate 50 (per media duration)
- Range 6.25 to 100.0
- Seed residence time 20 seconds
- Range 10 seconds to 150 seconds
27Model Validation (1 of 3)
- Swarm population increases linearly with peer
arrival rate - In-Order(random) has higher system pop.
- In-Order(random) is sensitive to seed residence
time, while other policies are not.
28Model Validation (2 of 3)
- Download time improves when the seed residence
time is increased - Download time improves when the upload bandwidth
is increased - Good agreement with analytical models
29Model Validation (3 of 3)
- In-Order(FCFS) achieves lowest startup delay
- Good agreement between simulation results and
analytical model
30Conclusions
- BitTorrent-like protocols can support scalable
and efficient on-demand streaming. - Rarest-First attains poor sequential progress.
- In-Order(FCFS) achieves best performance for
media playback while attaining the same download
latency of Rarest-First. - Our analytic models accurately predict system
performance (simulation validation).
31Key Contributions
- Decoupling of download progress and sequential
progress (key insight). - Download latency and startup delay
characterization for different policies. - Effect of upload U and download D connections,
not just total bandwidth. - Distribution of download time and variability of
progress (stream quality). - Optimal structure for on-demand media streaming
in P2P networks (?)
32BitTorrent Model (optimal?)
Seed
Downloader
Seed
Downloader
U of upload connections C Per connection
throughput
Downloader
Torrent (with x downloaders and y seeds)
Arrival rate ?
Departure rate ? y
Peers (sorted by age)