Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Analysis of Optimal Stream Merging Solutions for Media-on- Demand Amotz Bar-Noy CUNY and Brooklyn College Richard Ladner University of Washington.

Similar presentations


Presentation on theme: "The Analysis of Optimal Stream Merging Solutions for Media-on- Demand Amotz Bar-Noy CUNY and Brooklyn College Richard Ladner University of Washington."— Presentation transcript:

1 The Analysis of Optimal Stream Merging Solutions for Media-on- Demand Amotz Bar-Noy CUNY and Brooklyn College Richard Ladner University of Washington

2 AofA 20042 Media-On-Demand Type of Media –Two hour movie –5 minute song –2 minute news video clip Demand on Media –Broadcast for very popular media –Unicast for the heavy tail

3 AofA 20043 Stream Merging Eager, Vernon, Zahorjan (1999) Goal to minimize cost = total server bandwidth Uses multicast –Many clients receive the same transmission simultaneously. Clients receive multiple channels –Clients receive different parts of the media simultaneously. We focus on receive-2. Clients use local buffers –Some data received is played back immediately while other data is stored for future play back.

4 AofA 20044 Stream Merging System - Receive Two Server Client Buffer Player Multicast Channels old stream new stream

5 AofA 20045 Stream Merging System Server Buffer Player Multicast Channels Client

6 AofA 20046 Stream Merging System Server Buffer Player Multicast Channels Client

7 AofA 20047 Stream Merging System Server Buffer Player Multicast Channels Client

8 AofA 20048 Stream Merging System Server Buffer Player Multicast Channels Client

9 AofA 20049 Batching client startup delay guarantee stream 6 5 4 7 1 2 3 6 5 4 7 1 2 3 Cost = 14

10 AofA 200410 Stream Merging with Batching client startup delay guarantee stream AB 1 2 3 6 5 4 7 1 2 3 Cost = 10

11 AofA 200411 Delay vs. Bandwidth Tradeoff 2 hour movie 720 arrivals per movie

12 AofA 200412 Off-line vs. On-line Off-line –Arrival sequence is known in advance –Used as a basis to compare with on-line algorithms On-line –Future arrivals not known –Server must add new streams and lengthen old streams to accommodate new arrivals

13 AofA 200413 Outline Model –Merge cost vs. Full cost Optimal merge cost Optimal full cost Fully loaded arrivals

14 AofA 200414 Merge Cost vs. Full Cost Optimal Merge cost –Minimum total bandwidth (sum of the lengths of the streams) required to merge to a full stream –M(t 1,…,t n ) Optimal Full cost –Minimum total bandwidth required for a media of length L. –F(L,t 1,…,t n )

15 AofA 200415 Length of Streams The length of streams ABCD x = B z(x) = D p(x) = A

16 AofA 200416 Optimality Principle for Merge Cost Given arrivals t 1,…,t n there is k such that in optimal stream merging –t k is the last stream to merge to t 1 –Streams t 1,…,t k-1 optimally merge eventually to t 1 –Streams t k+1,…,t m optimally merge eventually to t k

17 AofA 200417 Dynamic Program for Optimal Merge Cost Setup –Arrivals t 1,t 2, …,t n –M(i,j) = minimum merge cost of a merge tree for the arrivals t i,t 2, …,t j –M(1,n) is the optimal merge cost Recurrence –M(i,i) = 0 –M(i,j) = min i < k < j {M(i,k-1) + M(k,j) + (t k - t i ) + 2(t j - t k )} O(n 3 ) time, O(n 2 ) storage –Aggarwal, Wolf, Yu (1996), Eager,Vernon, Zahorjan (1999)

18 AofA 200418 O(n 2 ) Optimal Algorithm Setup Arrivals t 1,t 2, …,t n r(i,j) = the right most stream that merges to the root of an optimal merge tree for the arrivals t i,…,t j. Monotonicity (Knuth ‘71, F. Yao ’80, Borchers, Gupta ‘94) r(i,j - 1) < r(i,j) < r(i + 1,j) optimal M(i,j) = min r(i,j-1) < k < r(i+1,j) {M(i,k-1) + M(k,j) + (t k - t i ) + 2(t j - t k )}

19 AofA 200419 New Algorithm Behavior O(n 2 ) time M(i,j) r(i,j-1) r(i+1,j) r(i,j-1)r(i+1,j)

20 AofA 200420 New Algorithm Behavior O(n 2 ) time

21 AofA 200421 Optimal Full Cost L = 8 Optimal Full CostOptimal Merge Cost + L

22 AofA 200422 Optimal Full Cost Algorithm Setup –Arrivals t 1,t 2, …,t n –G(i) = the optimal full cost for the last n-i+1 arrivals t i,t i+1, …,t n –G(1) is the optimal full cost Recurrence –G(n+1) = 0 –G(i) = L + min{ M(i,k-1) + G(k) : i < k < m i } where m i = maximum m such that t m-1 - t i < L-1.

23 AofA 200423 Complexity of Full Cost Algorithm Phase 1: Precompute M(i,i) to M(i,m i ) for all i. Phase 2: Compute G(n+1) to G(1) time using monotonicity time from the recurrence for G where m is the average number of arrivals in an interval of length L that starts with an arrival

24 AofA 200424 Fully Loaded Arrivals Merge Cost Streams at 0,1,2,3,4,…,n-1

25 AofA 200425 Recurrence Merge recurrence for fully loaded arrivals Examples n12345678910111213 M(n)013691317212631364146

26 AofA 200426 Fibonacci Rules! Recurrence Fibonacci numbers –0,1,1, 2, 3, 5, 8,13, 21, 34, 55, 89, … –F 0 = 0, F 1 = 1, F k = F k-1 + F k-2 Solution

27 AofA 200427 Induction Hypothesis Design 21 {13}, 22 {13, 14}, 23 {13, 14, 15}, 24 {13, 14, 15, 16}, 25 {13, 14, 15, 16, 17}, 26 {13, 14, 15, 16, 17, 18}, 27 {14, 15, 16, 17, 18, 19}, 28 {15, 16, 17, 18, 19, 20}, 29 {16, 17, 18, 19, 20, 21}, 30 {17, 18, 19, 20, 21}, 31 {18, 19, 20, 21}, 32 {19, 20, 21}, 33 {20, 21}, 34 {21}, 35 {21, 22}, 36 {21, 22, 23}, 37 {21, 22, 23, 24}, 38 {21, 22, 23, 24, 25}, 39 {21, 22, 23, 24, 25, 26}, 40 {21, 22, 23, 24, 25, 26, 27}, 41 {21, 22, 23, 24, 25, 26, 27, 28}, 42 {21, 22, 23, 24, 25, 26, 27, 28, 29}, 43 {22, 23, 24, 25, 26, 27, 28, 29, 30}, 44 {23, 24, 25, 26, 27, 28, 29, 30, 31}, 45 {24, 25, 26, 27, 28, 29, 30, 31, 32}, 46 {25, 26, 27, 28, 29, 30, 31, 32, 33}, 47 {26, 27, 28, 29, 30, 31, 32, 33, 34}, 48 {27, 28, 29, 30, 31, 32, 33, 34}, 49 {28, 29, 30, 31, 32, 33, 34}, 50 {29, 30, 31, 32, 33, 34}, 51 {30, 31, 32, 33, 34}, 52 {31, 32, 33, 34}, 53 {32, 33, 34}, 54 {33, 34}, 2 {1}, 3 {2}, 4 {2, 3}, 5 {3}, 6 {3, 4}, 7 {4, 5}, 8 {5}, 9 {5, 6}, 10 {5, 6, 7}, 11 {6, 7, 8}, 12 {7, 8}, 13 {8}, 14 {8, 9}, 15 {8, 9, 10}, 16 {8, 9, 10, 11}, 17 {9, 10, 11, 12}, 18 {10, 11, 12, 13}, 19 {11, 12, 13}, 20 {12, 13}, 55 {34}, 56 {34, 35}, 57 {34, 35, 36}, 58 {34, 35, 36, 37}, 59 {34, 35, 36, 37, 38}, 60 {34, 35, 36, 37, 38, 39}, 61 {34, 35, 36, 37, 38, 39, 40}, 62 {34, 35, 36, 37, 38, 39, 40, 41}, 63 {34, 35, 36, 37, 38, 39, 40, 41, 42}, 64 {34, 35, 36, 37, 38, 39, 40, 41, 42, 43}, 65 {34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44}, 66 {34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45}, 67 {34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46}, 68 {34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}, 69 {35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48}, 70 {36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49}, 71 {37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50}, 72 {38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51}, 73 {39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52}, 74 {40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53}, 75 {41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54}, 76 {42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55}, 77 {43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55}, 78 {44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55}, 79 {45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55}, 80 {46, 47, 48, 49, 50, 51, 52, 53, 54, 55}, 81 {47, 48, 49, 50, 51, 52, 53, 54, 55}, 82 {48, 49, 50, 51, 52, 53, 54, 55}, 83 {49, 50, 51, 52, 53, 54, 55}, 84 {50, 51, 52, 53, 54, 55}, 85 {51, 52, 53, 54, 55}, 86 {52, 53, 54, 55}, 87 {53, 54, 55}, 88 {54, 55}, 89 {55}, 3 3 2 5 5 3 8 8 5 13 8

28 AofA 200428 Optimal Full Cost L = 24 and n = 39 Cost = 210 Full steam merged steam

29 AofA 200429 Optimal Full Cost Define F(L,n,s) to be the optimal full cost when there are exactly s full streams. s opt minimizes F(L,n,s) F(L,n) = F(L,n, s opt ) Theorem F(L,n,s) = sL + rM(p+1) + (s-r)M(p) where n = ps + r

30 AofA 200430 Shape of F(L,n,s) s opt = 182

31 AofA 200431 Convexity of F(L,n,s) Define F k(s) < n/s < F k(s)+1 Theorem –F k(s+1)+2 F(L,n,s+1) –F k(s)+2 > L + 2 implies F(L,n,s) < F(L,n,s+1)

32 AofA 200432 Finding s opt Direct approach –Compute h, such that F h+1 < L+2 < F h+2 –s opt = n / F h or n / F h + 1 Example –n = 10,000 and L = 100 –h = 10 and F h = 55 – n / F h = 181

33 AofA 200433 Conclusions Optimal stream merging can be solved efficiently. Optimal fully loaded stream merging has an elegant closed form solution.


Download ppt "The Analysis of Optimal Stream Merging Solutions for Media-on- Demand Amotz Bar-Noy CUNY and Brooklyn College Richard Ladner University of Washington."

Similar presentations


Ads by Google