Sie sind auf Seite 1von 6

A Measurement Study of Cache Rejection in P2P Live Streaming System

Yishuai Chen, Changjia Chen, Chunxi Li


School of Electrical and Information Engineering, Beijing Jiaotong University
chenyishuai@gmail.com, changjiachen@sina.com, cxl@telecom.njtu.edu.cn

Abstract not required. However, in P2P live streaming system,


people usually watch program online and don’t expect
In P2P system, each peer caches the received data local disk is affected. In this case, cache is required
for accessing of other peers. P2P live streaming and the corresponding cache management algorithm
system audience’s TV-like watching pattern brings becomes an important factor to affect the performance
unique characteristics for its cache management of total system. In this paper, we focus on the cache
algorithm. By measuring and studying the cache rejection algorithm.
rejection algorithm used in PPLive with our PPLive In P2P live streaming system, as all audience watch
crawler, we found a simple but interesting cache in same forward pace, the oldest piece of content
rejection algorithm used in PPLive, i.e. the cache usually is rejected firstly. Because the oldest piece of
rejection of peers is synchronized with the chunk content usually is at the head of cache, this cache
upload of media server on chunk offset. We modeled rejection behavior can be looked as the forward of the
this algorithm as a fixed-duration virtual buffer which cache head. We measured the cache rejection behavior
includes the P2P network and peer’s local buffer and of PPLive by actively crawling in PPLive’s network.
then verified it in our trace. We finally gave some We tracked media server’s chunk upload and peers’
analysis and explanations for this algorithm. What we cache rejection. We found all peers reject a chunk with
found is benefit to the future design and modeling of same rejection rate and this rate is equal to the media
P2P live streaming system .1
server’s upload rate of this chunk. This is an
interesting finding because it means the cache rejection
in peers is synchronized with the chunk upload of
1. Introduction server. We then modeled this behavior and found it
meant the latency between peer’s rejection of a chunk
P2P live streaming system is showing its potential and media server’s upload of this chunk always keeps
to change people’s way of watching TV. For example, constant, even if the media rate changes. We then
PPLive [1], a popular P2P online video broadcasting verified this characteristic in our trace. Finally, we
and advertising network, has had 75 million global analyzed the possible reasons and advantages of this
installed base, 20 million monthly active users and algorithm from the view of design of P2P live
more than 600 channels [2]. streaming system.
The advantage of P2P technology in live streaming This paper is organized as follows. In Section 2 we
system is impressing. It is reported that PPLive introduce related work. In Section 3, we briefly
supported 1,480,000 audiences viewing a live play at analyze the characteristic of caching in P2P live
the same time with 1 PC server and 10M bandwidth in streaming system and then give the peer buffer
Q2, 2007 [2]. structure and the data can be obtained by measurement
The essence of P2P technology is peer’s caching of in PPLive. In Section 4, we present the detail of our
received content and sharing it with other peers. Then measurement and the result. Section 5 is the model and
other peers can obtain higher download speed and the its verification in trace. In Section 6, we discuss the
total system becomes more scalable. possible meanings of this cache rejection algorithm for
In some P2P applications, e.g. P2P file sharing P2P live streaming system. Section 7 concludes the
system, all received data are stored in disk and cache is paper.

This work was supported by China 973 2007CB307101, China 2. Related work
NSFC 60672069 and China NSFC 60772043
Peer buffer size is a frequently mentioned system called chunk. Trunks are uploaded to network by a
parameter in design of P2P live streaming systems. In media server one by one, each with a sequence number.
Coolstreaming [3], 120s is used as all peers’ buffer Peer uses this sequence number to assemble the
size because experiment results show that the time lag received trunks and then send them to the local media
between nodes is unlikely higher than 1 minute. In player for playback. The sequence number is usually
Anysee [4], different buffer sizes are used for peers in incremented continuously and can be looked as the
different layers, e.g. 20ms for peers in 1st layer, 41.6ms trunk’s offset to the start point of program, so it is
for peers in 2nd layer, etc. [5] usually uses 1 minute as usually called offset of the chunk. The chunk with
buffer size. In [6], it is found that buffering can smaller offset has earlier playback time than the chunk
dramatically improve performance of P2P streaming with bigger offset has.
system and different buffer sizes, e.g. 0, 30, 60 and The peer’s local buffer in P2P live streaming
120 seconds, are simulated and evaluated. It is system has two functionalities. One is buffer, i.e. it
observed that a 30-second lag is sufficient to obtain holds chunks for reordering and assembling. The other
almost all potential gains from buffering. All these is cache, i.e. it caches data for accessing of partner
work focus on the size of peer’s local buffer. In this peers. For simplicity, we just call it peer buffer.
paper, what we discussed and modeled is a fixed-
duration virtual buffer which includes the P2P network Buffer window
and peers’ local buffer.
The traffic characteristics of controlled peers of Cache part Buffer/Cache part
PPLive were measured in Oct 2005 and Dec 2005 [7].
The high rate of change of parents was found at that
1111111111111…………1111111111 00101101010001
time. The problem of remotely monitoring network- trunk
wide quality was examined in [8] by analyzing the rejected
Media
crawled peer buffer maps. The overlay-based Assembled new
buffer Ro buffer
characteristics were studied in [9] by analyzing the head Point trunk end
crawled peer partner lists. In [10], it was observed that arrived
buffer size in PPLive varied from 7.8 MBytes to
17.1Mbytes by downloading media file from its local Figure 1. Structure of peer‘s local buffer
streaming server after physically disconnecting the PC The structure of peer’s local buffer is shown in
from network. The authors inferred that PPLive figure 1. In this figure, the Media Assembled Point
adaptively allocated buffer size according to the (MAP) points to the last chunk that has been sent to
streaming rate and the buffering time period specified media player. Peer’s local buffer is separated by MAP
by the media source but did not explore the buffer into two parts. One is the cache part. It includes the
management algorithm. This paper provides the space allocated for chunks with offset smaller than or
answer. equal to MAP. The chunks in this part have been
assembled and sent to media player. Therefore, they
3. PPLive peer buffer structure are only cached for accessing of other peers. The other
is the buffer/cache part. It includes the space allocated
In P2P live streaming system, people usually watch for chunks with offset bigger than MAP. Chunks in
as they watch TV. There are two characteristics for this part are waiting for assembling so they are
people to watch TV: (1) The content before audiences’ buffered. On the other side, they can also be accessed
selected start point is not cared by audiences. (2) All by other peers, so they are also cached.
audiences in one channel watch the same scene at the The ‘1’ and ‘0’ in Figure 1 indicate if the chunk has
same time and also keep same forwarding pace. been received by peers. Since chunks in cache part
Therefore, the played content becomes out-of-date have been received and sent to media player, they are
immediately and is not required by any audience any always marked with ‘1’. On the other hand, the
more. We call such a watching pattern as instant received chunks in buffer/cache part are buffered
watching pattern. Such a pattern is also a requirement because they are waiting for earlier chunks to finish
of P2P live streaming system and should be satisfied as assembling, so only the received chunks are marked
much as possible. That is to say, the content in P2P with ‘1’. Such a ‘0/1’ bit pattern is usually called
live streaming system only has limited lifetime and can buffer bitmap.
be rejected from peer’s cache safely after some time. When new trunk is found and peer prepares to
The media data in P2P live streaming system is request it, buffer space is allocated for it and the
usually organized, transmitted and cached in unit corresponding bit in buffer bitmap is initialized to ‘0’.
The buffer end then moves forwards if required. When
a new trunk is received, the corresponding ‘0’ becomes 4.2. Basic observation
‘1’. When continuous ‘1’ block beginning from MAP
appears and can be assembled, chunks are assembled We firstly compared the basic trend of Rs and Ro.
into media block and sent to media player for local To calculate Rs at ti, we used following equation based
playback. MAP move forwards. on our observation in [12], i.e.
As chunk becomes out-of-date, it can be rejected e − hi
from the cache. With Belady's minimum cache R s ,i = i (chunk / s ) (1)
120
rejection principle, i.e. the most efficient caching To obtain Ro, we used N samples {Pj, j ∈
algorithm would be to always discard the information
[ k − N2 , k + N2 − 1 ]} to calculate Pj’s slope on tk. After
that will not be needed for the longest time in the
future, the chunk at the head of the buffer should be We selected N = 12. We also did a running average
rejected because it is the oldest chunk in the buffer and with 24 as window size to smooth the curve.
has the least possibility for future request of other Figure 2 shows the Rs obtained from one tracker
peers. Therefore, it is rejected from the buffer and the and the Ro of a random selected peer.
buffer head move forwards.
When peer receives partner peer’s query for its
available chunks list, it returns its buffer bitmap and
the offset of the chunk at the head of buffer. With this
information, partner peer can schedule its requests for
chunks. Peer can also query the tracker for the status of
media server’s upload buffer. Tracker returns the
information of media server’s buffer window, which
includes the offset of the buffer head and the buffer
end, i.e. all trunks between these two offset are
available.

4. PPLive measurement and result


Figure 2. Comparison of Rs and Ro
In this section, we give the detail of our
measurement of caching rejection algorithm in PPLive We had following observations from Figure 2: (1)
and the obtained result. Rs changes in the range 7-10chunks/s during the
measurement. (2) When Rs changes, Ro also changes to
match the newest Rs. (3) There is latency between the
4.1. Measurement
change of Ro and that of Rs. The latency seems fixed
for one peer, even if there is Rs change.
We executed our measurement and collected data
The first observation is consistent to the
from 1 May to 2 May 2007 on a PPLive channel. The
measurement result of PPLive in [11]. In [11], it was
duration was about 5 hours. 4 trackers and 376 peers
observed that the video play rate varied in range 400k-
were queried frequently for media server’s or peers’
800kbps. With uniformed chunk size used in PPLive,
buffer status.
this result is consistent to our observation. For the 2nd
To query media server’s buffer status, we randomly
and 3rd observations, to our knowledge, this is the first
selected one tracker from total 4 trackers and queried it
time that they are reported. We explore these two
each 10s. When a response was received, we recorded
observations below.
a sample point Si = (ti, hi, ei), ti was the local time, hi
and ei were the offsets of the buffer head and the
buffer end. We then used {Si} to obtain media server’s 4.3. Rs and Ro synchronization on trunk offset
chunk upload rate, Rs.
On peer side, we collected 376 active peers in the We found peers change their Ro at the same chunk
first 20 minutes of measurement and then periodically where media server changes its Rs, i.e. if media server
queried each peer for its buffer bitmap information changes its upload rate from r1 to r2 when it uploads
each 5s. For each received response, we recorded a chunk with offset ni, then peers also change their
sample point Pk = (tk, nk), tk was the local time and nk buffer rejection rate from r1 to r2 when they reject
was the offset of the buffer head. We then use {Pk} to chunk with offset ni. We call this behavior
obtain each peer’s buffer rejection rate, Ro.
synchronization of Ro and Rs on trunk offset. Below is each valid peer to obtain its Ro(n) curve, n∈Z and n∈
the detail of our measurement. D. We then got the offset nm on the interpolated result
We firstly compared the Ro rate change points of all whose corresponding Ro,m is nearest to 9 and used it as
peers and found different peers changed their Ro at the offset of the rate change point of the peer. As result,
different time but at the same chunk. for j peers, we obtained {nm,l, l = 1…j}. We then
To obtain the concise rate change point of Ro, we calculated the standard diversion of {nm,l} and the
did not use the slope method mentioned in section 4.2. maximum difference among different nm,l. The result is
The first reason is tk in Pk is not the accurate remote shown in Table 1.
partner peer’s time for the corresponding nk but the
local time of our measurement machine, which makes
the obtained slope inaccurate. The second reason is
using N samples to fit the slope for a sample point and
then doing running average to smooth the rate change
curve fuzzes the concise rate change point.
Instead, with the known 5s bitmap request period,
we directly used 5 to divide the values of increased
offset in the sampling intervals to get Ro. In detail, for
adjacent two samples Pk=(tk, nk) and Pk+1 =(tk+1, nk+1),
Ro is obtained for sample Pk by following equation:
n − nk
Ro ,k = k +1 (chunk / s ) (2)
5
A difficulty of using this method is the loss of
sampling point. It is very possible that a query has not
a response because either partner peer does not Figure 3. Ro(t) and Ro(n)
response or the request or response is lost in the Table 1. Distribution of rate change offset
network. When responses are not received, the
Range 1 2 3 4 5 6
calculated Ro will be multiplied several times. For
example, when Pk and Pk+2 are received adjacently but Std. Dev. 4.9 7.2 11.1 4.8 7.1 12.6
Pk+1 is not received, Ro shall be doubled of the correct Max Diff 13 20 35 10 22 33
rate because nk+2 - nk = (nk+2 - nk+1) + (nk+1 - nk). Considering 35-50 chunks in one measurement
Therefore, we firstly used slope method to get the interval, i.e. 7-10 chunks/s in 5s interval, the standard
possible rate change ranges in the total measurement diversion and the maximum difference shown in Table
duration. As result, 6 ranges were obtained. Then for 1 are very small. Therefore, we concluded that all
each range, we picked up samples peers that covered peers changed their buffer rejection rate Ro on the
this range and did not lose sample points in this range. same chunk offset.
As result, we obtained 70, 50, 31, 16, 14 and 9 valid We then used following method to calculate Rs. For
samples peers for the 6 ranges respectively. It is noted each sample point Si = {ti, hi, ei}, we used equation (1)
that the decrease of amount of valid samples peers as to calculate a Rs value for all chunks in the reported
time goes on is in anticipation because peers kept buffer window, i.e. for any chunk j∈[hi,ei], we have
leaving during the experiment. Then we calculated Ro e −h
using equation (2) and got the rate change curve for all one Rs,j value for it. Rs , j = i i (chunk / s) . We then
120
valid peers on corresponding rate change range.
By comparing the rate change point of different averaged all obtained Rs,j values of one chunk to obtain
peers, we found different peers changed Ro nearly at this chunk’s average Rs. Finally, we did a running
the same chunk although they did it at different time. average with 128 as windows size to obtain the Rs
Figure 3 show the rate change point of 4 random curve. The obtained Rs curve slopped gently and we
selected peers on the 4th rate change range. Figure (a) used the offset with its rate nearest to 9 as the Rs rate
shows they changed Ro at obviously different time and change offset.
figure (b) shows they changed Ro nearly at the same We then compared the obtained Rs rate change
chunk. Such a pattern is applicable to all valid samples offset with the mean of peers’ Ro rate change offsets on
peers on 6 rate change ranges. all rate change ranges. The differences are shown in
We then obtained the statistic characteristic of the Table 2.
chunk offsets of rate change points. In detail, on each To explain the meaning of Table 2, let us use its
rate change range D, we did linearly interpolation for first column as an example. The first column is for the
1st rate change range in our measured data. As j
Lo = ∑ Di .
mentioned before, we have 70 valid sample peers i =k
covered this rate change range. Therefore, the first Assume at time t, chunk l is rejected and chunk n is
column shows the difference between the average Ro injected, then the buffer duration at time t can be
rate change offset of these 70 peers and the media written as:
server’s Rs rate change offset is only 3 chunks. n n l −1
L(t ) = ∑ Di = L0 + ∑ Ds − ∑ Do (3)
Table 2. Difference of Ro rate change offset i =l s = j +1 o=k
and Rs rate change offset Assume media server uploads chunk with chunk’s
Range 1 2 3 4 5 6 playback rate, i.e. it always uploads 1s’ content in 1s,
n
Diff 3 -72 -42 186 56 -126 so ∑ Ds is always equal to t. And because Rs and Ro
s = j +1
For other rate change ranges, the differences are always keep synchronization on the chunk offset,
bigger than that of the 1st rate change range, but they chunk’s rejection rate is also equal to chunk’s playback
are still acceptable considering the transition slope in rate, i.e. peers also always reject 1s’ content in 1s.
the obtained Rs curves usually covers 1.5K-2K offsets. l −1
Therefore, we concluded that peers’ Ro rate change Therefore, ∑ Do is also always equal to t. Then
o =k
offset is equal to media server’s Rs rate change offset.
equation (3) becomes:
Finally, we concluded all peers changed their buffer
rejection rate Ro on the same chunk offset where media L(t ) = L0 + t − t = L0 (4)
server changed its upload rate Rs. That is to say, the buffer is a fixed duration buffer.
We then verified this property in our PPLive trace.
5. Modeling and verification We obtained the buffer duration by measuring the
buffer time of chunks. To obtain media server’s upload
What’s above finding means? We model it as below. time of chunk k, for the media server buffer status
We model the P2P network and peer’s local buffer sample returned from tracker j, we did linear
together as a virtual buffer. The end of this virtual interpolation on the (ti, ei) and used the ti,j with
buffer is at the media server and the head is at the head corresponding ei = k as the upload time. We then used
of peer’s local buffer. When a chunk is uploaded into the mean of {ti,j, j=1..4} as the upload time of chunk k.
the network by the media server, it is injected into the We then deducted it from this chunk’s buffer rejection
virtual buffer. The injection rate is Rs. When a chunk is time tk to obtain the buffer duration. We especially
rejected from the head of peer’s local buffer, it is paid attention to the variance of buffer duration when
rejected from the virtual buffer. The rejection rate is Ro. chunks’ upload and rejection rate changed. If it is a
The model is shown in Figure 4. fixed duration buffer, the buffer duration shall keep
fixed. We successfully observed this behavior in our
Ro Rs
Virtual Buffer trace. Figure 5 shows the buffer duration of chunks in
three randomly selected peers’ virtual buffers.
Figure 4. Virtual buffer consists of P2P
network and peer local buffer
With above model, we abstract the P2P streaming
network and peers’ local buffer as a FIFO buffer.
There are lags among different peers’ buffer heads, but
all peers have same buffer end, i.e. at the media server.
The injection and rejection of this virtual buffer follow
the rule we found in Section 4, i.e. Ro and Rs
synchronized on trunk offset. Below we prove that this
virtual buffer is a fixed-duration buffer.
Denote the duration of media content included in
trunk i as Di. At t=0, chunk k is rejected from the
buffer and chunk j is injected into the buffer. Because
the chunk is injected into the buffer and rejected from
Figure 5. Buffer duration of chunks
the buffer in sequence, chunks [i,j] are included in the
buffer. So the buffer duration is: The upper subfigure in Figure 5 shows chunks’
upload and rejection rate changed from 10chunks/s to
8chunks/s and then changed back again. However, as We found the cache rejection in PPLive peers is
shown in the lower subfigure, although different peer synchronized with media server’s chunk upload on
has different buffer duration, the buffer duration of one chunk offset, which makes a fixed-duration virtual
peer keeps stable during this time, i.e. the virtual buffer buffer for each peer. We analyzed the possible
is a fixed duration buffer. explanations for this algorithm from the view of design
Then we can prove the observation (3) we made in of P2P live streaming system. What we found also
Section 4.2, i.e. the latency between Ro and Rs is fixed, inspires us to observe and model P2P streaming
even if there is Rs change. network in a new way, i.e. look it as a set of fixed-
duration virtual buffers and look its working
mechanism as the communication among these virtual
6. Why this behavior? buffers to finish the propagation of media streaming.
We are exploring towards this way.
What we found is a simple but interesting cache
rejection algorithm used in P2P live streaming system.
It can be looked as an approximate implementation of
8. References
the fixed-duration peer local buffer method mentioned
[1] www.pplive.com
in miscellaneous P2P documents [3-6] but this is not [2] G. Huang “Experiences with PPLive”, [Online document],
the whole story. We have following possible P2P-TV Workshop in conjunction with SIGCOMM 2007,
explanations for this algorithm. Available HTTP: http://www.sigcomm.org/sigcomm2007
The first explanation is the local media player /p2p-tv/Keynote-P2PTV-GALE_PPLIVE.ppt,
directly uses the rejected chunks as input, so the [3] X. Zhang, J. Liu, B. Li, and T.-S. P. Yum, “DONet/
synchronization of buffer rejection with media server’s CoolStreaming: A Data-driven Overlay Network for Peer-to-
chunk upload makes the local media player obtain Peer Live Media Streaming,” IEEE INFOCOM’05, 2005.
stable media streaming input. [4] X. Liao, H. Jin, Y. Liu, L. M. Ni, and D. Deng, “Anysee:
Scalable Live Streaming”, IEEE INFOCOM’06, 2006.
The second explanation is it help peer’s buffer
[5] M. Zhang, Q. Zhang, L. Sun and S. Yang "Understanding
rejection synchronize with the local media playback. the Power of Pull-based Streaming Protocol: Can We Do
Then peer can infer the status of local media playback Better?" P2P-TV Workshop in conjunction with SIGCOMM
from the status of its local buffer. For example, when 2007
the head of buffer is approaching a chunk position but [6] R. Kumar, Y. Liu, and K. W. Ross, "Stochastic fluid
this chunk is still not received, peer can infer its media theory for P2P streaming systems," in Proceedings of
player is also approaching this chunk position and shall INFOCOM, 2007
have to stop because of the unavailability of this chunk. [7] S. Ali, A. Mathur and H. Zhang "Measurement of
Then peer can start the aggressive download procedure Commercial Peer-To-Peer Live Video Streaming",
as observed in [10]. Workshop in Recent Advances in Peer-to-Peer Streaming,
August, 2006.
The third explanation is it may improve the
[8] X. Hei, Y. Liu, and K. W. Ross, “Inferring Network-
performance of P2P sharing. This algorithm makes the Wide Quality in P2P Live Streaming Systems”, [Online
cache rejection of peers is as stable as media server’s document], 2007, Available HTTP: http://eeweb.poly.edu/
chunk upload, rather than random or burst-like, faculty/yongliu/docs/index-buffermap.pdf,
therefore, it brings some stability to the P2P sharing, [9] L. Vu, I. Gupta, J. Liang, K. Nahrstedt. "Measurement of
which may help peer’s children peers keep stable a Large-scale Overlay for Multimedia Streaming", High
connection with it and then improve the stability of Performance Distributed Computing (Poster - HPDC 2007)
total system. [10] X. Hei, C. Liang, J. Liang, Y. Liu and K. W. Ross,
The final explanation is it adaptively adjusts buffer “Insights into PPLive: A Measurement Study of a Large
Scale P2P IPTV System”, IPTV workshop in conjunction
size according to the streaming rate, which is inferred
with WWW2006, May 2006.
but not explored in [10], i.e. when chunk rate increases, [11] X. Hei, C. Liang, J. Liang, Y. Liu and K. W. Ross, “A
because the duration of content included in each chunk Measurement Study of a Large Scale P2P IPTV System”,
decreases, buffer size is increased accordingly, [Online document], Nov 2006, Available HTTP: http://cis.
Conversely, when rate decreases, the buffer size is poly.edu/~ross/papers/ P2PliveStreamingMeasurement.pdf
decreased to include lesser chunks. Such an adaptive [12] C. Li and C. Chen, “Inferring Playback Rate and Rate
adjustment of chunk size helps save the system Resets on PPLive By Piecewise Line Envelop
resource used for buffer. Approximation”, submitted to TOB, IEEE, Spt, 2007

7. Conclusion

Das könnte Ihnen auch gefallen