Presentation is loading. Please wait.

Presentation is loading. Please wait.

A simple model for analyzing P2P streaming protocols. Seminar on advanced Internet applications and systems Amit Farkash. 1.

Similar presentations


Presentation on theme: "A simple model for analyzing P2P streaming protocols. Seminar on advanced Internet applications and systems Amit Farkash. 1."— Presentation transcript:

1 A simple model for analyzing P2P streaming protocols. Seminar on advanced Internet applications and systems Amit Farkash. 1

2 The problem: Streaming video from a server to a single client is well studied and understood. Not scalable to serve a large number of clients simultaneously. P2P streaming tries to achieve scalability (like P2P file distribution) while at the same time meet real time playback requirements. It is a challenging problem still not well understood. 2

3 Introduction P2P Streaming System - P2P resolves this scalability problem by using all resources of all clients. It is like using multiple trees simultaneously to deliver content. Server Peer Fully connected Peers maintain: * buffer * neighbor list

4 P2P streaming vs. P2P file sharing: P2P streaming is less demanding – no need for entire file. 1) Peers join the video session from the point of their arrival times. 2) Missing “just a few” frames is tolerable. P2P streaming is more demanding - real time requirements! 4

5 Basic model How buffer works?  Server sends out chunks sequentially.  Peer downloads one chunk every time slot  Buffer shits ahead one position one time slot playback server 1 t=1 2 1 t=2 3 2 1 t=3 Buffer ……….

6 Model & Chunk Selection Strategies M peers with the same playback requirement Each has a playback buffer In each time slot, the server randomly selects one peer and uploads one chunk Users’ metric is the continuity, defined as p(n), the probability chunk n available To compute p(n), recursively compute p(i). p(i) is defined as: p(i)=prob(position i filled) 1 2 …………… n … M peers playback server 1/M

7 Basic model Pk(i)[t] – probability that B(i) of peer k is filled (with the correct) chunk at time t. Assumption: this probability reaches a steady state for large t, namely Pk(i)[t] = Pk(i). We call Pk(i) the buffer occupancy probability of peer k. Simple case - only server is distributing chunks:  P k (1) = P(1) = 1/M. ∀ k.  P k (i+1) = P(i+1) = P(i). i=1,…,n-1. ∀ k.  Obviously very poor playback for any M>1. 7

8 Improvement: Each peer selects another peer in each time slot to try and download a chunk not already in its buffer. If the selected peer has no useful chunk, no chunk is downloaded in that time slot All peers use the same selection strategy, therefore have the same distribution P(i) Assume peers are selected randomly. 8

9 Improvement: Since peers are selected randomly the probability for a peer, A,to be selected by K≥0 peers is: A(k) = If M=100, A(3) is only about 1.8 % assume A's peer's upload capacity is large enough to serve all requests in each time slot. 9

10 P2p technology effect Model & Chunk Selection Strategies Each peer’s buffer is a sliding window In each time slot, each peer downloads a chunk from server or its neighbor q(i) = the probability Buf[i] gets filled at this time slot, for i>1 1 2 …………… n p(1)=1/M p(n)=? time=t 1 2 …………… n t+1 p(1)=1/M sliding window P(1) = 1/M (Boundary)

11 Chunk selection policy: P(i+1) = P(i) + Q(i) = P(i) + Pr[WANT(K,i)∩Pr[HAVE(H,i)]∩Pr[SELECT(H,K,i)] Assume all peers are independent so P(i) is the same for each K, therefore: WANT(K,i) = 1-P(i). Assume large enough number of peers so that knowing the state of one does not significantly affect the probability of the state of another peer, therefore: Pr[HAVE(H,i)|WANT(K,i)] ≈ Pr[HAVE(H,i)]=P(i). Assume chunks are independently distributed in the network, so the probability distribution for position i is not strongly affected by the knowledge of the state of other positions, therefore: Pr[SELECT(H,K,i)|WANT(K,i) ∩ HAVE(H,i)] ≈ Pr[SELECT(H,K,i)] = SELECT(i). 11

12 Model & Chunk Selection Strategies  w(i) = probability peer wants to fill Buf[i] w(i)=1-p(i)  h(i) = probability the selected peer has the content for Buf[i] h(i)=p(i)  s(i) = Buf[i] determined by chunk selection strategy  P(i) + [1-P(i)] P(i) SELECT(i) 1 2 …… i … n p(1)=1/M p(n) peer 1 2.….. i … n neighbor p(1)=1/M sliding window

13 Buffer mapX X 1 2 3 4 5 6 7 8 playback Model & Chunk Selection Strategies Greedy Strategy -try to fill the empty buffer closest to playback Rarest First Strategy -try to fill the empty buffer for the newest chunk since p(i) is an increasing function, this means “Rarest First” An example RF SelectionGreedy Selection

14 Performance metrics: We will compare downloading strategies based on two performance metrics: Continuity – probability of continues playback. Startup latency – expected time to start playback. 14

15 Greedy: Pr[chunk isn't downloaded to B(j)] = ¬Pr[WANT(K,j)HAVE(H,j)] = Pr[K has j] + Pr[K doesn't have j] * Pr[H doesn't have j] = Pk(j) + (1-Pk(j)) (1-Ph(j)) = P(j) + (1-P(j))² Therefore: SELECTG(i) Proposition: SELECTG(i) = 1 - (P(n) - P(i+1)) - P(1) For Proof see paper, proposition 1.paper 15

16 Rarest first Peer K will select to download chunk to B(i) if B(j) are filled for every 1≤j<i and it was not distributed a chunk by the server: Therefore: SELECTRF(i) Proposition: SELECTRF(i) = 1 – P(i) For Proof see paper, proposition 2paper 16

17 Difference equation & Differential equation Greedy p(i+1)=p(i)+ (1-p(i)) * p(i) * (1-p(1)-p(n)+p(i+1)) Rarest first p(i+1)=p(i)+ (1-p(i)) * p(i) * (1-p(i)) Derive differential equation from difference equation s(i)h(i)w(i) h(i)s(i)

18 Differential equations Solve previous differential equations, derive continuous model Based on continuous model, derive partial differential equation Greedy : Rarest First :

19 Mixed strategy Partition the buffer at point m. Try to download a chunk using Rarest first to positions 1…m. If no chunk can be downloaded using Rarest first, use Greedy for positions m+1…n. For B(1) to B(m) same as Rarest first: P(1) = 1/M. P(i+1) ≈ P(i) + P(i) [1-P(i)]² For B(m+1) to B(n) same as Greedy but substitute B(m) for B(1): P(i+1) ≈ P(i) + P(i) [1-P(i)] [ 1-P(m)-P(n)+P(i+1)] 19

20 Evaluating performances: We already have Continuity: P(n) Start up latency: time a peer should wait before starting playback. Assuming all other peers have already reached steady states A newly arriving peer should wait until its buffer has reached steady state as well 20

21 Models from comparison: Discrete model – The solution for the buffer state distribution P(i) is derived numerically  Greedy Strategy : given P(n) a fixed value, substitutes n steps inversely from P(n) to P(1) and compare P(1) with 1/M  Greedy Strategy : substitute p(i) from p(l) until p(n) Mixed Strategy : Continuous model – Generally solved numerically using MatLab. Simulation model – Based on the discrete model. o One server and M peers. o In each time slot the server distributes one chunk to a random peer. o Each peer selects one random peer to download one chunk from and can upload up to two peers. 21

22 Validation M=1000 N=40 In simulation, – # neighbors=60 – Uploads at most 2 in each time slot for one peer Validate our model

23 SimRarest first vs. Greedy vs. Mixed 1000 peers, 40 buffer Compare three strategies, especially the curve for Mixed. Rarest First Greedy Mixed

24 Rarest first vs. Greedy vs. Mixed: 1000 peers, buffer length varies from 20 to 40. For different buffer sizes Mixed achieves best continuity than both RF and Greedy Mixed has better start-up latency than RF Mixed RF Greedy RF Mixed Greedy

25 Optimizing the Mixed Strategy: Fix n to 40 and vary m: 25

26 Performance for Small Scale Networks n=15 Timeslot = 3000

27 Performance for Small Scale Networks For (a), there are 40 peers. Greedy is better. For (b), the continuity requirement is fixed at 0.93. RF is better RF Greedy RF

28 Study of Dynamics Simulate 1000 peers, 2000 time slots, n=40 Continuity is the average continuity of all peers Continuity for Mixed is more consistent, as well highest Mixed

29 Study of Dynamics Start up latency = 16 Arrive at t = 1000 – 16 Start playback at t = 1000

30 Optimizing the Mixed Strategy: Adapting to peer population: One way is to observe the value of P(m). Set a target value, say P m = 0.3 When a peer finds the average of P(m) to be less than P m the peer increases m, else the peer decreases m Simulation: Initial value of m is 10. Calculate average of P(m) for 20 time slots and then set new value of m. Initially M = 100 and every 100 time slots add another 100 peers (with empty buffers). 30

31 Optimizing the Mixed Strategy: Adjust m so that p(m) achieves a target probability (e.g. 0.3) In simulation study, 100 new peers arrive every 100 slots m adapts to a larger value as population increases How to adapt m for the mixed strategy Mixed RF


Download ppt "A simple model for analyzing P2P streaming protocols. Seminar on advanced Internet applications and systems Amit Farkash. 1."

Similar presentations


Ads by Google