Design and Implementation on the P2p Vod System Based on the Rf-ips Algorithm

This paper presents a P2P VOD system based on the RF-IPS algorithm, and this system consists of two parts, server-side and clients. We put emphasis on the piece selection module of server-side, and in this part we apply the RF-IPS algorithm proposed in the past. In the piece selection module, we also proposed a weight-ing function except the RF-IPS algorithm. Using this function we will find the best server peers effectively and quickly, it will enhance the performance of this system. We carry on experiments on RF-IPS algorithm, and the results show this algorithm is efficient. Overall, we believe that the RF-IPS algorithm is feasible to further improve system performance and provide a cost-effective P2P VOD service with acceptable user experience.


Introduction
Video-on-Demand (VOD) has becoming one of the most important streaming service and catches many people's research interest.VOD connection is an active connection between the client and the server or the client and the client, and people can select the video resources as they pleased at any time and can do some VCR operations, such as FORWARD, BACKWARD and REWIND [1].In the traditional VOD system, users only download video resource from the server, and the server becomes the bottleneck of the system when the users reach a certain numbers.Once the server failure, the whole system would be paralyzed.But in the mode of P2P VOD technology, video resource is uploaded or downloaded between the clients, that are peer nodes, and it is effective to avoid the bottleneck of the system.As the P2P network can provide the basic network support for the large-scale VOD applications, many of the emerging P2P VOD distribution strategies are able to provide the most basic way of data transmission in the P2P network.Described in this paper based on the RF-IPS algorithm of P2P VOD system also has a server part, but it is not the traditional sense of the server, just as a super-node has more service capabilities.The client is the peer node in the P2P network, and it can be the family PC, laptop computer and smart cell phones and so on [2].

Related Work
VOD system is on-demand video system and a major application of streaming technology.It is great to challenge the traditional video services, where the users can only receive the broadcast programs passively, and can not afford the program content [3].But somewhat differently, the VOD service system equipped with a large video library, and users can browse the video directory and choose one of the programs on demand at any time, while the system plays the corresponding broadcast program based on the users' requests.Traditional VOD system consists of server system, network system and client system.

Server System
Server system consists of three modules, service module [4], application service module and management module.The media service module is mainly used to provide users with multimedia and service information.The application service module is mainly used to accept users' requests and download a variety of user terminals, achieve the data exchange with external network and offer users access interface.The management module is responsible for the running of the whole system and record the relevant information.In addition [5], server system also includes a Web-based management system, where administrators can manage the system via any terminals after certifications in any location.

Network System
Network system is responsible for the real-time transmission of a stream of video information, and it is a very critical part to affect the performance of continuous media web services.Including some network transmission equipments, you can use the mode of LAN or WAN [6].Also include the QoS of the network and some application layer protocols.If only reasonably choose the available network protocols and make the network bandwidth and latency time to maintain a certain level, the video data can smoothly playback on the client node.

Client System
Client system mainly includes some user terminals, achieved by personal computers and special set-top boxes.High performance personal computer can be achieved by loading software [7].Lower performance personal computers can be achieved by Decompression Card to complete the decoding.We can watch TV by using a special set-top box.
This system is based on the C/S mode [8], and the server connects with each user by the way of unicast.The P2P VOD technology is that the media server sends only a few media flow to several users connected firstly.Users connected later get data from the previous users but not from the server directly.In the P2P VOD system, the function of the server is no longer a traditional server but a peer with better service abilities.It is just achieved to guide the clients to download, maintain the information of the users and the video.

Structure Design and Implementation
This system consists of two parts, server and client.The server is not in the traditional sense, can be understood as a super node in the P2P network, and is mainly responsible for maintaining the users' state, updating the resource list, maintaining the hot video resource, piece selection and guiding the client to download resource.The client is not in the traditional sense either, and it is the peer in the P2P network, and is responsible for uploading and downloading resource, maintaining the media buffer, and searching and classifying some information.Figure 1 shows the structure of this system.

Client Modules
The client in the P2P network has dual roles, is both the video provider and the video receiver.However, the function of cache management should be considered when we designed, and ensure to upload the existing resource and download and play the needed resource.
The following is the proceeding and handling methods for each module, and include buffer management module, P2P network module and video playback module.The relationship among these modules is complementary as Figure 2. The P2P network module is achieved to the message communication and data transmission between server and client, or among the clients.The buffer management module receives the data from P2P network module and manages the data effectively.

Server Modules
The server can be divided into two parts, Index Server Figure 3 shows the processing modules between the two servers.

1) The function of piece selection module
The main function of piece selection module is to receive the ID information of requests peers, and calculate   the piece ID and its download address based on the RF-IPS algorithm for this peer.In order to minimize the users' processing, these functions are both implemented on the server.In this module, we adopt the RF-IPS algorithm to choose the server peers.Figure 4

show the main function of this module
There are a variety of peers with different performances distributed in the P2P network.When many Peers owned the video resource users needed at the same time, how to choose the server peers becomes one of the functions of this module.Specific methods are as follows: a) Scan table Res_ID_Peers and table Res_ID_Pieces, and get the list of user information owned the piece.Table Res_ID_Peers is used to save the information of the users owned the relevant resource and table Res_ID_Pieces is used to save the information of the resource.b) According to the weighting function, get the first numbers of users owned the maximum weight.
The weighting function is as follows: In this function, a is relevant to user's IP, b is relevant to the user's level, c is relevant to user whether to be mobile, d is relevant to the user's maximum weight, and k 1 , k 2 , k 3 , k 4 are weights.c) Return the piece number and the list of download address to the client.2) The RF-IPS algorithm In this algorithm, we use buffer to record the states of every piece of a peer and partition it into three parts.We call each part an interval.According to the degree of urgently need for the pieces, put the pieces into intervals accordingly, and the pieces in different intervals are downloaded by using the sequential downloading strategy, RF downloading strategy, and random downloading strategy separately [9].
Figure 5 shows the partitioned buffer, where p and g are two pointers which respectively point to the current playback position and the position of data obtained.The pieces have already downloaded are in t0 and those have downloaded but not to be played are in t 1 .The pieces need to be downloaded later are in t 2 , which will be partitioned into three parts, -interval t 3 , interval t 4 , and interval t 5 .
The current data in t 3 will be played immediately, so it is more urgently needed than the data in other intervals.We adopt sequential downloading strategy and set higher selection priority to the pieces in this interval at a time.
The pieces in t 4 are not so urgently needed than those in t 3 , but more urgently needed than those in t 5 .In order to ensure the harmonious distribution of data in the P2P network we adopt RF strategy in t 4 .
Interval t 5 is the farthest away from the playback position, so in this interval we adopt random selection mechanism.
Figure 6 shows the processing procedure of the RF-IPS algorithm.

Experiments
The experiments we describe below were performed on a  50 peers of Inter(R) Pentium(R) D CPU 2.80GHz, 1GB Memory, running Red Hat Linux 3.2.3-47with kernel 2.4.21-27 using network bandwidth of 100Mb/s in the lab of our university.One peer executed the index server to guide client-side to download, whereas other peers executed multiple instances of clients.The format of a movie is "wmv", the code rate is 756 Kb/s, the length is 120 minutes, and the piece size is 256 K.
In order to ensure the fair results for every algorithm, we designed five systems to represent five algorithms and tested them respectively at the same conditions.We present performance results of our experiments in these parts: the initial delay time and the delay time after 4 times fast-forward operations, including Played at 10 s, fast forward to 120 s, Played at 10 min, fast forward to 20 min, Played at 30 min, fast forward to 70 min and Played at 71 min, fast forward to 119 min.Table 1 presents all results of our experiments.
From Table 1, we obtain that the RF-IPS algorithm and sequential downloading algorithm both have the shortest initial delay time.When played at 0.17 min, fast-forward to 2 min, the delay time of five algorithms is similar, only the RF-IPS algorithm has the shortest delay.Yet, the delay time of the five algorithms have a great difference when the time interval increased gradually, the delay time of RF-IPS is steady, while the others increase dramatically.So we come to the conclusion that the performance of our proposed algorithm is optimal and the algorithm can improve user experience.

Conclusions
It is a challenging job to provide VOD service on the Internet.The rapid development of P2P technology makes it become the powerful tool to build the large-scale distributed system in the WAN.The P2P VOD system becomes a hot topic in the recent distributed system area as one of the most application of P2P technology.Although the applications of P2P at the aspect of streaming have researched and implemented at some degree, their performances and results are still not ideal and mature.This paper examines the RF-IPS algorithm in the P2P VOD system, and achieves the P2P VOD system as a basis.Although this system solve the key problem in the VOD transmission system, and achieve the RF-IPS algorithm, there are many problem existed, because of limited time.With the further improvement of the network bandwidth and the enhancement of the computer performance, we believe that more and better VOD system will be broadly applied.
(IS) and Entry Server (ES).The IS part consists of four main function modules, including User Information Maintain module, Resource List Maintain module, Video and User Synchronize module and the Expired Resource Deletion module.The ES part also consists of four main function modules, including Hot Resource Maintain module, Resource Transmission module, Buffer Management module and Piece Selection module.

Figure 1 .
Figure 1.The structure of the P2P VOD system.

Figure 2 .
Figure 2. The relationship among three modules.

Figure 3 .
Figure 3.The processing between the two servers.

Figure 4 .
Figure 4.The main function of this module.

Figure 5 .
Figure 5.The buffer partitions in RF-IPS algorithm.

Figure 6 .
Figure 6.The processing of the RF-IPS algorithm.