SLIDE 1 Optimal File Distribution in Peer-to-Peer Networks
Kai-Simon Goetzmann
Technische Universität Berlin goetzmann@math.tu-berlin.de joint work with Tobias Harks, Max Klimm, and Konstantin Miller ISAAC 2011, Yokohama
SLIDE 2
Motivation
SLIDE 3
Motivation
Question:
How can peer-to-peer downloads be scheduled optimally?
SLIDE 4
Outline
⊲ Part I: Problem Statement ⊲ Part II: Hardness ⊲ Part III: Approximation
SLIDE 5
Part I Problem Statement
SLIDE 6 Problem Statement
core 1 2 . . . n cu cu
1
cd
1
cu
2
cd
2
cu
n
cd
n
Instance I = (N, cd
N, cu N)
⊲ set N = {1, . . ., n} of peers ⊲ peer 0 (server) owns file of unit size at time 0 ⊲ download capacity cd
i of peer i
⊲ upload capacity cu
i of peer i
⊲ si,j :
R≥0 → R≥0 (integrable) sending rate function
⊲ xi(t) =
t
- k∈N sk,i(τ)dτ fraction of file owned by i at t
SLIDE 7 Problem Statement
core 1 2 . . . n cu cu
1
cd
1
cu
2
cd
2
cu
n
cd
n
Instance I = (N, cd
N, cu N)
⊲ set N = {1, . . ., n} of peers ⊲ peer 0 (server) owns file of unit size at time 0 ⊲ download capacity cd
i of peer i
⊲ upload capacity cu
i of peer i
⊲ si,j :
R≥0 → R≥0 (integrable) sending rate function
⊲ xi(t) =
t
- k∈N sk,i(τ)dτ fraction of file owned by i at t
Symmetric peers: cd
i = cu i =: ci for all i ∈ N.
SLIDE 8 Feasible solution
Feasible solution S = (si,j)i,j∈N ⊲ si,j :
R≥0 → R≥0 is an integrable function
⊲ unique sender: ∀i ∈ N ∃p(i) ∈ N : sk,i ≡ 0 ∀k p(i) ⊲ download completed: si,j(t) = 0 ∀i, j ∈N\{0}, t ∈
R≥0 : xi(t)dτ < 1
⊲ upload capacity:
j∈N si,j(t) ≤ cu i
∀i ∈ N, t ∈
R≥0
⊲ download capacity: sp(j),j(t) ≤ cd
j
∀j ∈ N, t ∈
R≥0
SLIDE 9 Feasible solution
Feasible solution S = (si,j)i,j∈N ⊲ si,j :
R≥0 → R≥0 is an integrable function
⊲ unique sender: ∀i ∈ N ∃p(i) ∈ N : sk,i ≡ 0 ∀k p(i) ⊲ download completed: si,j(t) = 0 ∀i, j ∈N\{0}, t ∈
R≥0 : xi(t)dτ < 1
⊲ upload capacity:
j∈N si,j(t) ≤ cu i
∀i ∈ N, t ∈
R≥0
⊲ download capacity: sp(j),j(t) ≤ cd
j
∀j ∈ N, t ∈
R≥0
Definition
completion time: Ci = inf{t ∈
R≥0 : xi(t) = 1}
makespan: M = maxi∈N Ci
SLIDE 10
Part II Hardness
SLIDE 11 Capacity Expansion Lemma
For a peer i and a time interval [t1, t2], ⊲ total upload of i in [t1, t2]: ui(t1, t2) =
t2
t1
⊲ idleness of i in [t1, t2]: zi(t1, t2) = ci(t2 − max{Ci, t1}) − ui(t1, t2) For t ≥ 0, ⊲ X(t) =
i∈N xi(t)
⊲ Z(t) =
i∈N zi(0, t)
Lemma (Capacity Expansion Lemma)
Let I be an instance with c = maxi∈N ci, Then, for all solutions
- 1. ui(t1, t2) + zi(t1, t2) ≤ max{0, (t2 − t1)ci − 1 + xi(t1)}
- 2. X(k/c) + Z(k/c) ≤ 2k for all k ∈
N
Proof
SLIDE 12 Hardness
Theorem
The peer-to-peer file distribution problem for heterogeneous symmetric peers is strongly NP-hard.
Proof.
By reduction from 3-Partition.
Details
SLIDE 13
Part III Approximation
SLIDE 14 Algorithmic Idea
⊲ need combinatorial lower bound
◮ ui(t1, t2) + zi(t1, t2) ≤ max{0, (t2 − t1)ci − 1 + xi(t1)}
⊲ Algorithmic Idea: let algorithm satisfy this inequality for all peers with xi(t1) > 0 with equality
◮ Every peer downloads at full download rate
⇒ complete peers in order 1, . . . , n where c1 ≥ · · · ≥ cn
◮ no idleness as long not every download started
⊲ Problem: This might not be possible ⊲ Solution: Time-varying resource augmentation
◮ allow to violate upload and download constraints by a
factor of √ 2
SLIDE 15 Scale-Fit Algorithm
⊲ Sort peers such that c1 ≥ · · · ≥ cn (Peer 0 has unused upload capacity c at time 0) ⊲ Consider next point in time t where some peer i has unused upload capacity c
◮ Choose downloaders: Choose next k peers i1, . . . , ik such
that c/ √ 2 ≤
j=i1,...,ik cj ≤
√ 2c
◮ Resource augmentation: ◮ If c < cj, augment upload capacity s.t. c = cj ◮ If cj < c, augment download capacities s.t. c = cj ◮ Peers j = i1, . . . , ik download from i with full capacity ◮ Release capacity: For j = i1, . . . , ik, at time t +
1 αcj
◮ Peer j has unused capacity cj ◮ Peer i has unused capacity cj · c/
j′ cj′
⊲ When all downloads are finished, stop.
SLIDE 16
Scale-Fit Example
Example
c0 = 5, c1 = 3, c2 = 3, c3 = 5/2, c4 = 2, and c5 = 2.
SLIDE 17 Scale-Fit Example
Example
c0 = 5, c1 = 3, c2 = 3, c3 = 5/2, c4 = 2, and c5 = 2. time
1 3 11 15 5 6
c0
SLIDE 18 Scale-Fit Example
Example
c0 = 5, c1 = 3, c2 = 3, c3 = 5/2, c4 = 2, and c5 = 2. time
1 3 11 15 5 6
c0 peer 1
SLIDE 19 Scale-Fit Example
Example
c0 = 5, c1 = 3, c2 = 3, c3 = 5/2, c4 = 2, and c5 = 2. time
1 3 11 15 5 6
c0 peer 1 peer 2
SLIDE 20 Scale-Fit Example
Example
c0 = 5, c1 = 3, c2 = 3, c3 = 5/2, c4 = 2, and c5 = 2. time
1 3 11 15 5 6
c0 peer 1 peer 2 c1
SLIDE 21 Scale-Fit Example
Example
c0 = 5, c1 = 3, c2 = 3, c3 = 5/2, c4 = 2, and c5 = 2. time
1 3 11 15 5 6
c0 peer 1 peer 2 c1 peer 3
SLIDE 22 Scale-Fit Example
Example
c0 = 5, c1 = 3, c2 = 3, c3 = 5/2, c4 = 2, and c5 = 2. time
1 3 11 15 5 6
c0 peer 1 peer 2 c1 peer 3 peer 4
SLIDE 23 Scale-Fit Example
Example
c0 = 5, c1 = 3, c2 = 3, c3 = 5/2, c4 = 2, and c5 = 2. time
1 3 11 15 5 6
c0 peer 1 peer 2 c1 peer 3 peer 4
SLIDE 24 Scale-Fit Example
Example
c0 = 5, c1 = 3, c2 = 3, c3 = 5/2, c4 = 2, and c5 = 2. time
1 3 11 15 5 6
c0 peer 1 peer 2 c1 peer 3 peer 4 peer 5
SLIDE 25 Scale-Fit Example
Example
c0 = 5, c1 = 3, c2 = 3, c3 = 5/2, c4 = 2, and c5 = 2. time
1 3 11 15 5 6
c0 peer 1 peer 2 c1 peer 3 peer 4 peer 5 time
5 12 11 12 25 24
Scaling factor: 5/4 c0
SLIDE 26 Scale-Fit Example
Example
c0 = 5, c1 = 3, c2 = 3, c3 = 5/2, c4 = 2, and c5 = 2. time
1 3 11 15 5 6
c0 peer 1 peer 2 c1 peer 3 peer 4 peer 5 time
5 12 11 12 25 24
Scaling factor: 5/4 c0 peer 1
SLIDE 27 Scale-Fit Example
Example
c0 = 5, c1 = 3, c2 = 3, c3 = 5/2, c4 = 2, and c5 = 2. time
1 3 11 15 5 6
c0 peer 1 peer 2 c1 peer 3 peer 4 peer 5 time
5 12 11 12 25 24
Scaling factor: 5/4 c0 peer 1 peer 2
SLIDE 28 Scale-Fit Example
Example
c0 = 5, c1 = 3, c2 = 3, c3 = 5/2, c4 = 2, and c5 = 2. time
1 3 11 15 5 6
c0 peer 1 peer 2 c1 peer 3 peer 4 peer 5 time
5 12 11 12 25 24
Scaling factor: 5/4 c0 peer 1 peer 2 peer 3 peer 4 c1 peer 5
SLIDE 29
Analysis of Scale-Fit I
Theorem
If c0 ≥ ci ∀i ∈ N, then Scale-Fit is a 2 √ 2-approximation. = M n
SLIDE 30
Analysis of Scale-Fit I
Theorem
If c0 ≥ ci ∀i ∈ N, then Scale-Fit is a 2 √ 2-approximation. n ≤ M∗
SLIDE 31
Analysis of Scale-Fit I
Theorem
If c0 ≥ ci ∀i ∈ N, then Scale-Fit is a 2 √ 2-approximation. n ≤ M∗ T0
SLIDE 32 Analysis of Scale-Fit I
Theorem
If c0 ≥ ci ∀i ∈ N, then Scale-Fit is a 2 √ 2-approximation. n ≤ M∗ T0
!
≤ M∗
SLIDE 33 Analysis of Scale-Fit I
Theorem
If c0 ≥ ci ∀i ∈ N, then Scale-Fit is a 2 √ 2-approximation.
n T0 ⊲ Assume X ∗(T0) = n > X(T0)
SLIDE 34
Analysis of Scale-Fit I
Theorem
If c0 ≥ ci ∀i ∈ N, then Scale-Fit is a 2 √ 2-approximation. n T0 k0 T1 ⊲ Assume X ∗(T0) = n > X(T0) ⊲ T1 = T0 − 1/ck0
SLIDE 35 Analysis of Scale-Fit I
Theorem
If c0 ≥ ci ∀i ∈ N, then Scale-Fit is a 2 √ 2-approximation.
n T0 k0 T1 ⊲ Assume X ∗(T0) = n > X(T0) ⊲ T1 = T0 − 1/ck0 ⊲ X(T1) < X ∗(T1) . . .
SLIDE 36
Analysis of Scale-Fit I
Theorem
If c0 ≥ ci ∀i ∈ N, then Scale-Fit is a 2 √ 2-approximation. n T0 k0 T1 Tℓ kℓ ⊲ Assume X ∗(T0) = n > X(T0) ⊲ T1 = T0 − 1/ck0 ⊲ X(T1) < X ∗(T1) . . . ⊲ X(Tℓ) < X ∗(Tℓ), kℓ = 1 Contradiction!
SLIDE 37 Scale-Fit
Theorem
For the peer-to-peer file distribution problem with heterogeneous symmetric peers, the following holds
- 1. If c0 ≥ c1, Scale-Fit is a 2
√ 2-approximation
- 2. If c0 < c1, uploading the file to peer 1 and applying
Scale-Fit is a (1 + 2 √ 2)-approximation.
SLIDE 38
Conclusion
⊲ Optimal peer-to-peer file distribution with heterogenous symmetric peers is strongly NP-hard ⊲ There is a (1 + 2 √ 2)-approximation Not in this talk: ⊲ Homogenous symmetric peers are easy (even if the server has a different capacity) ⊲ Fixed number of peers is easy Open problems: ⊲ better approximation factor, PTAS, asymmetric peers, restricted connectivity, file divided in chunks...
SLIDE 39
Conclusion
⊲ Optimal peer-to-peer file distribution with heterogenous symmetric peers is strongly NP-hard ⊲ There is a (1 + 2 √ 2)-approximation Not in this talk: ⊲ Homogenous symmetric peers are easy (even if the server has a different capacity) ⊲ Fixed number of peers is easy Open problems: ⊲ better approximation factor, PTAS, asymmetric peers, restricted connectivity, file divided in chunks... Thank you for your attention!
SLIDE 40 AUGUST 19-24 ismp2012.org
THE 21ST INTERNATIONAL SYMPOSIUM ON MATHEMATICAL PROGRAMMING
SLIDE 41 Capacity Expansion Lemma - Proof
ui(t1, t2)+zi(t1, t2) ≤ max{0, (t2−t1)ci −1+xi(t1)}
Proof: ⊲ peer i needs at least (1 − xi(t1))/ci time units to finish download ⊲ ui(t1, t2) + zi(t1, t2) ≤ ci(t2 − t1 − (1 − xi(t1))/ci) ≤ max{0, (t2 − t1)ci − 1 + xi(t1)}
X(k/c) + Z(k/c) ≤ 2k for all k ∈
N
Proof: ⊲ By induction over k, using the first inequality
Back
SLIDE 42 Hardness Proof I
⊲ 3-Partition instance P = {k1, . . . , kn}, n = 3m, B = n
i=1 ki/3, w.l.o.g. m = 2ℓ
⊲ Construct instance I of peer-to-peer distribution problem
◮ m subset peers s1, . . . , sm with csi = B ◮ s1 owns the file at time 0 ◮ for each ki ◮ a master element peer pi
0 with cpi
0 = ki
◮ 2ℓki − 2 element peers pi
1, . . . , pi 2ℓki−2 with
cpi
k = ki/(ℓki − 1)
⊲ P is a yes-instance ⇔ M∗ ≤ ℓ/B + ℓ
SLIDE 43
Hardness Proof II
"⇒":
Example
P = {3, 2, 2, 2, 2, 1} m = 21, ℓ = 1 B = 6 ℓ/B ℓ/B + ℓ
SLIDE 44 Hardness Proof II
"⇒":
peers in [0, ℓ/B]
Example
P = {3, 2, 2, 2, 2, 1} m = 21, ℓ = 1 B = 6 ℓ/B ℓ/B + ℓ
SLIDE 45 Hardness Proof II
"⇒":
peers in [0, ℓ/B]
- 2. use partition serve all
master element peers with full rate
Example
P = {3, 2, 2, 2, 2, 1} m = 21, ℓ = 1 B = 6 ℓ/B ℓ/B + ℓ p1 p2
p3
p4 p5 p6
SLIDE 46 Hardness Proof II
"⇒":
peers in [0, ℓ/B]
- 2. use partition serve all
master element peers with full rate
- 3. serve all element peers
Example
P = {3, 2, 2, 2, 2, 1} m = 21, ℓ = 1 B = 6
Back to Theorem
ℓ/B ℓ/B + ℓ p1 p2
p3
p1
1
p1
2
p2
1
p4 p5 p6 p4
1
p5
1
p6
1 p1
3
p1
4
p2
2
p4
2
p5
2
p6
2
SLIDE 47 Hardness Proof III
"⇐": Useful observations: ⊲ no element peer sends the file to another peer ⊲ suffices to show that there is no solution the subset peers and master element peers with Z(ℓ/B + ℓ) ≥
Case 1: xsi(ℓ/B) = 1 for all subset peers si
⊲ Cap. Exp. Lemma: xi(ℓ/B) = 0 for all master element peers ⊲ P is a no-instance ⇒ not all master element peers can be served at full rate ⊲ Cap. Exp. Lemma: Z(ℓ/B + ℓ) <
i∈P(2ℓki − 2)
SLIDE 48 Hardness Proof IV
Case 2: xi(ℓ/B) < 1 for all master element peers and one subset peer
⊲ capacity not sufficient to serve all peers ⊲ Cap. Exp. Lemma: Z(ℓ/B + ℓ) <
i∈P(2ℓki − 2)
Case 3: xpi
0(ℓ/B) = 1 for a master element peer
⊲ Inequality 2. of Cap. Exp. Lemma is strict ⇒ Z(ℓ/B + ℓ) <
i∈P(2ℓki − 2)
Back to Theorem