Post on 12-Jan-2016
1
LYU0502LYU0502P2P Digital TV RecorderP2P Digital TV Recorder
Supervisor: Professor Michael R. Lyu
Prepared by:Ho Tsz Wing, AndyLau Wai Shun, Jack
2
Outline• Motivation• Objective• Development Platform • Approach• Performance Enhancement• Erasure Code Analysis • Future Work• Conclusion• Q&A
3
Motivation• Watching TV is a major entertainment activi
ty for people• People often miss their favorite program be
cause they have to work overtime or go out to travel
• People need to schedule the recording of the programs
4
Objective• Allow people view to back previous TV
program without doing scheduling themselves
• Let the user view the program on demand
• Increase the availability of the TV program
• Achieve load balancing among the participating peers
5
Develop Platform• Windows XP Media Center Edition• First released in Aug. 2003• Capable of watching DVD, recording TV, list
ening to music and sharing digital photos• Media Center Edition 2005 SDK – Click-To-R
ecord Feature• Enables applications to programmatically sche
dule the recording of TV programs• Supported in Visual C#.Net
6
Windows XP Media Center Edition• Need an Electronic Program Guide (EPG) in
order to schedule the recording• Use TVxb to convert the schedule obtained fro
m webpage to an XML format• Use Quickguide to convert the XML schema to
the EPG
8
Approach• There are different types of peer-to-peer fil
e sharing architectures according to their “degree of centralization”• Hybrid decentralized architectures (Napster)• Purely decentralized P2P architectures (Gnutell
a)• Partially centralized systems (KaZaA)
9
Approach• In this term, we choose to implement
our system using the hybrid decentralized architectures
• There is a centralized server maintaining the list of online peers and the directories of the shared files
• The server is also responsible to schedule the recording to the online peers in a fair and efficient way
10
Approach• On the other hand, the peers are
responsible to handle the scheduling request made by the server
• Also, they need to serve the downloading request from other peers
11
Approach• Reasons to choose the hybrid
decentralized architectures• It is simpler to implement• It serves as a model for us to investigate
the feasibility of the project and measure the performance of the system under different peers behavior
• After implementing our system using the hybrid decentralized architectures, it is relatively easier for us to deploy it to the purely decentralized P2P architectures
12
Approach• Component of the server
• p2p.mdb – database which maintains the peer table and share table
• Login.asp – make entries in the peer table and share table when a user login
• Search.asp – search the file requested by the user and generate suitable response
• Userlist.asp – return the list which contains the information of the currently logged-in peers
• Updateshare.asp – update the share table after a user recorded or downloaded a program
• Xml.asp – return the schedule of all the channels in a particular date
• Logout.asp - delete entries in the peer table and share table when the user logout
13
Approach• The client side application
Start
Login to the system through login.asp
Listen to incoming connection
Upload requestRecording request
Upload the requestedfile to the peers
Schedule the recordingUsing click-to-record
feature
Download request
Search peers usingsearch.asp
Connect to the peersand start downloading
No
YesYes
Logout the system through logout.asp
Stop
14
Approach
Alice Bob
Suppose Alice wants to see the program “ The Apprentice (III) “She will send a query to the serverThe server will reply to Alice with the list of peers
(Bob) that have a copy of “The Apprentice (III) “
She will then make a direct connection to Bob to get the file
The Apprentice (III)
15
Performance enhancement• How to schedule the recording tasks to
the peers effectively?• How to increase the availability of the
video files? • How to improve the performance of
retrieving the video files from peers?
16
Scheduling policies• Policies:
• Do scheduling 15 minutes before the program start
• Select the peers randomly• N peers will be scheduled• In this project, N is assigned to be 2
• Assumptions:• The selected peers will not leave manually• The peer who gets the whole video file has
the responsibility to do the encoding process
17
Scheduling policies• The server side application
Start
Obtain the schedule of allchannel at 5:40 am everyday
Schedule the recording ofall program
Send the xml recordingrequest to the selected peers
Get 2 randomly selectedpeers from userlist.asp
15 minutes before thestart of a program
18
Scheduling policies
Alice Bob
15 minutes before the program starts, the server will randomly send it’s schedule to any two of the online peers
19
Availability enhancement• Whole file replication (WFR)
Advantages: 1) Multiple access of the video files
2) No decoding neededDisadvantages: 1) Storage overhead is large
2) Replication time is long
• Erasure Code replication (ECR)Advantages: 1) Multiple access of the video files
2) Storage overhead is smallDisadvantages: 1) Encoding and decoding time
2) Difficult to implement
20
TVBNews.dvr-ms
Whole File Replication• Do replication on the whole file• Redistribute the file to other peers
21
• Replication factor r• Peers availability P• Total Number of Peers N• Availability
• Independent of N• When P 1, A(w) 1• When r , A(w) 1
Whole File Replication
rPwA 11)(
22
Erasure Code - BackgroundMessage n blocks
Encoding (to m blocks, where m > n)
Decoding (Requires any n blocks)
Message n blocks
23
Erasure Code - Implementation• Divide the video file into n fragments• Code these n fragments in m (m>n)• Any n (unique) fragments are able to
reconstruct the video files• Send the fragments to random peers
24
TVBNews.dvr-ms
Erasure Code• Do encoding on the whole file • Redistribute part of file to other peers
4
3 2
1
25
Erasure Code - Analysis• Replication factor r• Divide the video file into n fragments• Code these n fragments in m (m>n)• Stretch factor s = m/n• Any n (unique) fragments are able to
reconstruct the video files
26
Comparison – WFR Vs. ECR•Whole File Replciation - Availability
irir
i
r
i
rrrr
r
rr
C
CCwA
1
11)(
1
11
1
•Erasure Code Replciation - Availability
rm
ni
irmirm
i
rmrmrmrm
n
nrmnrm
n
C
CCSA
1
1...1
27
Availability Analysis - µ = 0.1
Peer Availability (=0.1)
0
0.2
0.4
0.6
0.8
1
0 5 10 15 20
A(w)
A(E)
28
Availability Analysis - µ = 0.3
Peer Availability (=0.3)
0
0.2
0.4
0.6
0.8
1
1.2
0 5 10 15 20
A(w)
A(E)
29
Availability Analysis - µ = 0.5
Peer Availability (=0.5)
0
0.2
0.4
0.6
0.8
1
1.2
0 5 10 15 20
A(w)
A(E)
30
Availability Analysis - µ = 0.5
Peer Availability (=0.5)
0.96
0.97
0.98
0.99
1
1.01
1.02
0 5 10 15 20
A(w)
A(E)
31
Availability Analysis - Conclusion• If the storage is not limited, ECRperforms better than WFR in most cases.
• When peer availability large than 0.5, the performance of WFR tends to ECR if the replication factor increases.
• However, the storage is limited in real world
32
Storage Analysis - µ = 0.7
Peer Availability (=0.7)
0.90
0.92
0.94
0.96
0.98
1.00
2 3 4 5 6 7 8
A(w)
A(E)
33
Storage Analysis - Conclusion• If the peers availability is high, ECR is more storage-effective than WFR.
Adopted from : Replication Strategies for Highly Available Peer to Peer Networks,Ranjita Bhagwan et. al,
34
Block Size Analysis – r = 2• If the storage is limited, the performance
of erasure code replication will highly depends on the peer availability
Adopted from : Erasure Code Replication Revisited,W.K. Lin, D.M. Chiu, Y.B. Lee
35
Future Work• Implement the system in Server-less way• Design a algorithm for placing the
encoded check blocks • Investigate the relationships between
popularity and download frequency of a TV program (Dynamic replication factor)
• Implement choking algorithm to encourage users to share their own contents.
36
Conclusion• We have implemented the P2P system
in the Server-Client model.• The availability of the TV Programs are
enhanced by using Erasure Code Replication.
40
Availability Analysis - µ = 0.1
Whole File Replication
Replication factor (r) File Availability (A)
5 0.40951
10 0.65132
15 0.79411
20 0.878423
Erasure Code Replication
r No of data block Total No of block Availability
5 4 20 0.13295
10 4 40 0.57687
15 4 60 0.86260
20 4 80 0.96469
41
Availability Analysis - µ = 0.3
Whole File Replication
Replication factor (r) File Availability (A)
5 0.83193
10 0.97175
15 0.99525
20 0.99920
Erasure Code Replication
r No of data block Total No of block Availability
5 4 20 0.89291
10 4 40 0.99940
15 4 60 0.99999
20 4 80 0.99999
42
Availability Analysis - µ = 0.5
Whole File Replication
Replication factor (r) File Availability (A)
5 0.968750
10 0.999023
15 0.999969
20 0.999999
Erasure Code Replication
r No of data block Total No of block Availability
5 4 20 0.998712
10 4 40 0.999999
15 4 60 0.999999
20 4 80 0.999999