A kind of robust based on point-to-point stream scheduling method
Technical field
The invention belongs to the information dissemination technology field, relate in particular to a kind of P2P stream scheduling method based on the high robust under the live network environment.
Background technology
Along with popularizing rapidly of the development of Internet, particularly broadband services, people no longer have been satisfied with simple information such as text, image are only arranged.And to content rich video more, media services such as audio frequency have had increasing demand.Content of multimedia in the network, especially continuous media content (video and audio frequency), promptly streaming medium content promptly increases.Streaming Media is the cross discipline of multimedia and network service.In the Streaming Media application, the video data partition packing back after content providers will be compressed is transferred to the recipient in the mode of " stream " simultaneously by network, on one side the recipient receives data, Yi Bian the packet that will receive is recombinated, decodes, play.Other transmission mode has essential distinction in this transmission mode and the network.
This new network service needed of video multicast realizes that any is to the communication of multiple spot on the network.And current, client/server structure is all generally adopted in the various services on the Internet, perhaps is called IP unicast.This service model is simple in structure, is easy to realize, it is popularized in the process at computer network and has brought into play enormous function.But along with the scale of network service is huge day by day, this structure drawback is also more and more obvious: for can be to more customer service, it needs server from strength to strength, and more and more higher to the network egress bandwidth requirement at server end.Particularly in the Video service field, because the code check of video flowing is often all very high, generally at least at hundreds of kilobits per second (kbits/s), thus very big to server stress, almost can not satisfy the user's request that enlarges day by day.Especially in video multicast the inside, server in fact sends identical video data for a large amount of clients, and this not only brings added burden to server, and is wastes greatly to bandwidth resources.The calculated performance that is to say server has become topmost bottleneck with the network bandwidth.
In view of the existing problems of IP multicast, realize that in application layer the idea of multicast functionality is suggested thereupon.Here it is so-called application layer multicast, its basic thought are exactly that function with multicast is put into application layer and finishes.But the most employing of application layer multicast is set up reliable server in the network various piece and is finished the multicast task, and safeguards that these servers need a large amount of costs.
Summary of the invention
The objective of the invention is for overcoming the weak point of prior art, propose a kind of robust based on point-to-point stream scheduling method, this method synthesis the advantage of P2P technology, ip multicast technology and network agent technology, try hard to save to the full extent the network bandwidth.Adopt the multi-data source technology to strengthen the robustness of multicast network in the method.The low correlation of multi-data source provides advantage for retransmitting the wrong recovery of equal difference.
The stream scheduling method based on P2P of a kind of robust that the present invention proposes comprises network-building method and dispatching method, and wherein said network-building method may further comprise the steps:
(1) in live network, dispatch server (Trace Server) is the client node that client node (Peer) finds other, and notification streams media server (Streaming Server) provides Media Stream to client node;
(2) streaming media server provides stable Media Stream to client node;
(3) client node receives from streaming media server or the Media Stream of the client node of Media Stream is provided, and buffered media stream, in this client node playing media flow data, provide Media Stream to other client nodes by P2P (Peer-to-Peer) mode;
(4) client node in the step (3), if in the P2P transmission course, provide Media Stream to other client nodes, then this client node is called the client node (supplying peer) that Media Stream is provided, otherwise this client node is called bottom client node (leaf peer);
(5) client node in the step (3), if in the P2P transmission course, reception provides the Media Stream of the client node of Media Stream from streaming media server or reception, and then this client node is called the client node (receiving peer) of receiving media stream;
(6) client node in the step (3) if be positioned at some subnets inside, and provides Media Stream to other client nodes, and then this client node is called multicast client node (multicasting peer);
(7) client node in the step (3), if be positioned at some subnets inside, and receive only Media Stream from other multicast client nodes in the same subnet, simultaneously not to subnet outside other clients Media Stream is provided, then this client node is called multicast reception client node (multicasting receiver);
(8) client node in the step (3), can provide the client node of Media Stream, the client node and the multicast client node of receiving media stream simultaneously, but as long as it provides the client node of Media Stream, the client node and the multicast client node thrin of receiving media stream, it just can not be that multicast receives client node;
(9) client node in the step (3), if asking to add live network, then this client node is called the client node (requesting peer) that request adds;
(10) client node in the step (3), if asking or withdrawing from by force live network, then this client node is called the client node (quitting peer) that withdraws from;
(11) client node in the step (3), if directly obtain Media Stream from streaming media server, then this client node is called seed client node (seed peer);
(12) streaming media server is positioned at the 0th layer (layer) of this network; The seed client node is positioned at the 1st layer of this network; If certain client node provides the client node of Media Stream that Media Stream is provided by several, then its level of being arranged in network is that all provide the maximum level of client node of Media Stream to add one; If certain client node is to provide Media Stream by certain multicast client node, then its level is that the level of multicast client node adds one; The middle-level sequence number of network is to be used for estimating the delay that Media Stream produces in network;
Described dispatching method comprises the steps;
(13) when new client node application adds live network, must be connected with described dispatch server earlier, distribute client node that Media Stream is provided or multicast client node to provide Media Stream (this dispatch server cannot receive client node with any multicast offer the client node that request adds, in order to avoid cause the output flow of this subnet big unusually) by dispatch server for it;
(14) when certain client node withdraws from live network, dispatch server will be according to the current network topology situation, (dispatch server is if select the bottom client node to select a multicast reception client node or bottom client node to substitute the client node that withdraws from, then generally select number of plies maximum, the information such as distance, delay of also can taking into account select);
(15) dispatch server is preserved this topology of networks network topology table of a detail record, and when client node adds or withdraws from this network (network topology structure changes), this network topology table also dynamic real-time is upgraded;
(16) in the scheduling process of dispatch server, the hierachy number of the client node that Media Stream is provided of each client node is all than the hierachy number of this client node little (thereby guaranteeing that dispatch server does not produce the loop network structure in the stream scheduling process, guarantee that each client node can obtain up-to-date media stream data from streaming media server directly or indirectly);
(19) in the scheduling process of dispatch server,, make it become the bottom client node with each lowermost end that can not externally provide the client node of Media Stream to be assigned to live network;
(20) have the processing of a plurality of channels under the living broadcast environment, can move a plurality of dispatch servers simultaneously, also can open different port on same dispatch server and support, each dispatch server or each port are all logically safeguarded network separately.
When new client node application added live network, the dispatching method of dispatch server specifically may further comprise the steps in above-mentioned (13) step:
(13.1) if when not having or having only other a client node in the client node place subnet that request adds (can think client node that request adds not in this subnet), several (quantity can often) client nodes or streaming media server the give request client node conduct that add the candidate client node (Supplying Candidates) that Media Stream be provided of dispatch server beyond the client node that request adds distributes this subnet then, the client node that request adds is by relatively (as relatively and the delay between them, compare their historical information or the like), select several client nodes as the client node that Media Stream is provided, the client node that this moment, request added is operated in P2P pattern (Peer-to-Peer Mode);
(13.2) if client node more than 2 or 2 is arranged in the client node place subnet that request adds, then can adopt P2P pattern (method as step (13.1) as described in), also can adopt multicast pattern (MulticastingMode) to join in the whole live network;
(13.3) in step (13.2),, then, determine the dispatching method that new client node adds according to whether existing other multicasts to receive client node in original this subnet if the client node that request adds adopts multicast mode to add live network;
(13.4) in step (13.3), if exist other multicasts to receive client node in original this subnet, then dispatch server will ask the address and the port numbers of the client node of adding to inform the all-multicast client node that this subnet is interior, and each multicast client node will ask the information of the client node of adding to join in each contented multicast list;
(13.5) in step (13.3), if do not exist other multicasts to receive client node in original this subnet, then dispatch server will be informed all client nodes that are operated under the P2P pattern in this subnet, make them enter multicast state, return step (13.4) afterwards.
In above-mentioned (14) step, when certain client node withdrawed from live network, the dispatching method of dispatch server specifically may further comprise the steps:
(14.1) if the subnet inside at the client node place of withdrawing from exists multicast to receive client node, and the client node that withdraws from itself is a multicast client node, then a multicast of the work of the client node that withdraws from all being transferred in this subnet receives on the client node, this multicast reception client node provides the client node of Media Stream to connect with all of the client node that withdraws from, thereby obtain all media stream datas, the request of the client node of all receiving medias streams of the client node that acceptance is simultaneously withdrawed from;
(14.2) if the subnet inside at the client node place of withdrawing from exists multicast to receive client node, and the client node that withdraws from itself is that a multicast receives client node, and then the client node that this is withdrawed from is deleted from the topology table of this network;
(14.3) if the subnet inside at the client node place of withdrawing from does not exist multicast to receive client node (can think that the client node of asking to add is not in this subnet), (the bottom client node of distribution generally is that hierachy number is bigger then to distribute a bottom client node to replace the client node that withdraws from, like this can be so that the hierachy number of whole multicast network remains on the less level, help reducing network delay, also should take into account factors such as distance, bandwidth simultaneously);
(14.4) if the client node that withdraws from is the bottom client node, then the client node that this is withdrawed from is deleted from the topology table of this network;
In above-mentioned (15) step, topology table dynamic real-time method for updating specifically may further comprise the steps:
(15.1) each client node all must regularly send survival (Alive) signal to dispatch server, represent that oneself still is in the network, and in work, if certain client node does not send the survival signal in given time threshold (Timeout), think that then this client node has withdrawed from live network, and it is deleted from topology table, the dispatching method that withdraws from by client node is handled afterwards;
(15.2) in step (15.1), each client node sends time interval change at random (according to information setting time interval excursions such as cache size, delays) in a given scope of survival signal to dispatch server;
(15.3) when the scale of multicast network during greater than the size threshold set, the method that adopts classification to monitor dynamically updates topology table; This classification monitor method is: the seed client node is unique client node that directly sends the survival signal to dispatch server; All client nodes except that the seed client node directly send the survival signal to client node that Media Stream is provided or multicast client node; If the client node of Media Stream or the multicast client node is not received certain client node in this time threshold survival signal are provided, directly notify dispatch server; Dispatch server will not send the client node of survival signal and will delete from topology table in this time threshold, the dispatching method that withdraws from by client node is handled afterwards.
Characteristics of the present invention and technique effect:
The inventive method combines the advantage of P2P technology, ip multicast technology and network agent technology, tries hard to save to the full extent the network bandwidth.Adopt the multi-data source technology to strengthen the robustness of multicast network in the method.The low correlation of multi-data source provides advantage for retransmitting the wrong recovery of equal difference.
Description of drawings
Fig. 1 is the networking structure embodiment schematic diagram of the inventive method;
Fig. 2 is the dispatching method schematic diagram when client node in subnet withdraws from live network in the present embodiment;
Fig. 3 is the dispatching method schematic diagram when client node outside subnet withdraws from live network in the present embodiment.
Embodiment
The reaching embodiment in conjunction with the accompanying drawings based on point-to-point stream scheduling method and be described in detail as follows of a kind of robust that the present invention proposes:
The networking structure embodiment of the inventive method as shown in Figure 1,1 to 5 all is client nodes among the figure, 1 is the seed client node simultaneously wherein, the client node of Media Stream and the client node of receiving media stream be provided; 2 is the client node of seed client node, multicast client node, the client node that Media Stream is provided and receiving media stream simultaneously; The 3rd, multicast receives client node; 4 provide the client node of Media Stream and the client node of receiving media stream simultaneously; 5 is the client node and the bottom client node of receiving media stream simultaneously; The 6th, media stream data route is provided; The 7th, dispatch server is to the scheduling of Media Stream.
The network-building method of present embodiment may further comprise the steps:
(1) in the present embodiment network, dispatch server is the client node that client node (as the client node 1-5 among Fig. 1) finds other, and the notification streams media server provides Media Stream to client node;
(2) streaming media server provides stable Media Stream to client node;
(3) client node (as the client node 1-5 among Fig. 1) receives from streaming media server or the Media Stream of the client node of Media Stream is provided, and buffered media stream, in this client node playing media flow data, provide Media Stream to other client nodes by the P2P mode;
(4) client node in the step (3), if in the P2P transmission course, provide Media Stream to other client nodes, then this client node be called Media Stream is provided client node (as the client node among Fig. 11,2,4), otherwise this client node is called bottom client node (as the client node among Fig. 1 5);
(5) client node in the step (3), if in the P2P transmission course, reception provides the Media Stream of the client node of Media Stream from streaming media server or reception, then this client node is called the client node of receiving media stream (as the client node among Fig. 11,2,4,5);
(6) client node in the step (3) if be positioned at some subnets inside, and provides Media Stream to other client nodes, and then this client node is called multicast client node (as the client node among Fig. 1 2);
(7) client node in the step (3), if be positioned at some subnets inside, and receive only Media Stream from other multicast client nodes in the same subnet, simultaneously not to subnet outside other clients Media Stream is provided, then this client node is called multicast reception client node (as the client node among Fig. 1 3).
(8) client node in the step (3), can provide the client node of Media Stream, the client node and the multicast client node of receiving media stream simultaneously, but as long as it provides the client node of Media Stream, the client node and the multicast client node thrin of receiving media stream, it just can not be that multicast receives client node;
(9) client node in the step (3), if asking to add live network, then this client node is called the client node (can be as the client node among Fig. 1 5) that request adds;
(10) client node in the step (3), if asking or withdrawing from by force live network, then this client node is called the client node (can be as the client node 1-5 among Fig. 1) that withdraws from;
(11) client node in the step (3), if directly obtain Media Stream from streaming media server, then this client node is called seed client node (as the client node among Fig. 11,2);
(12) streaming media server is positioned at the 0th layer of this network; Seed client node (as the client node among Fig. 11,2) is positioned at the 1st layer of this network; If certain client node provides the client node of Media Stream that Media Stream is provided by several, then its level of being arranged in network is that all provide the maximum level of client node of Media Stream to add one (client node 3,4 as Fig. 1 is the 2nd layer, and client node 5 is the 3rd layer); If certain client node is to provide Media Stream by certain multicast client node, then its level is that the level of multicast client node (as the client node among Fig. 1 2) adds one.The middle-level sequence number of network is to be used for estimating the delay that Media Stream produces in network;
The dispatching method of present embodiment is described as follows in conjunction with shown in Fig. 1,2,3:
(13) (can be the client node 3 among Fig. 1 as new client node, when 5) application adds live network, must be connected with described dispatch server earlier, distribute client node that Media Stream is provided or multicast client node to provide Media Stream (this dispatch server cannot receive client node with any multicast offer the client node that request adds, in order to avoid cause the output flow of this subnet big unusually) by dispatch server for it;
(14) as certain client node (can be the client node 1-5 among Fig. 1) when withdrawing from live network, dispatch server will be according to the current network topology situation, (dispatch server is if select the bottom client node to select a multicast reception client node or bottom client node to substitute the client node that withdraws from, then generally select number of plies maximum, the information such as distance, delay of also can taking into account select);
(15) dispatch server is preserved this topology of networks network topology table of a detail record, and when client node adds or withdraws from this network (network topology structure changes), this network topology table also dynamic real-time is upgraded;
(16) in the scheduling process of dispatch server, the hierachy number of the client node that Media Stream is provided of each client node is all than the hierachy number of this client node little (thereby guaranteeing that dispatch server does not produce the loop network structure in the stream scheduling process, guarantee that each client node can obtain up-to-date media stream data from streaming media server directly or indirectly);
(19) in the scheduling process of dispatch server,, make it become the bottom client node with each lowermost end that can not externally provide the client node of Media Stream to be assigned to live network;
(20) have the processing of a plurality of channels under the living broadcast environment, can move a plurality of dispatch servers simultaneously, also can open different port on same dispatch server and support, each dispatch server or each port are all logically safeguarded network separately.
When new client node application added live network, the dispatching method of dispatch server specifically may further comprise the steps in above-mentioned (13) step:
(13.1) if when not having or having only other a client node in client node (as the client node among Fig. 1 5) the place subnet that request adds (can think client node that request adds not in this subnet), several (quantity can often) client nodes or streaming media server the give request client node conduct that add the candidate client node that Media Stream be provided of dispatch server beyond the client node that request adds distributes this subnet then, the client node that request adds is by relatively (as relatively and the delay between them, compare their historical information or the like), select several client nodes as the client node that Media Stream is provided, the client node that this moment, request added is operated in the P2P pattern;
(13.2) if the client node that request adds (as the client node among Fig. 13,5) client node more than 2 or 2 is arranged in the subnet of place, then can adopt P2P pattern (method as step (13.1) as described in), also can adopt multicast pattern to join in the whole live network;
(13.3) in step (13.2), if the client node (as the client node among Fig. 1 5) that request adds adopts multicast mode to add live network, then, determine the dispatching method that new client node adds according to whether existing other multicasts to receive client node in original this subnet;
(13.4) in step (13.3), if exist other multicasts to receive client node in original this subnet, then dispatch server will ask the address and the port numbers of the client node of adding to inform the all-multicast client node that this subnet is interior, and each multicast client node will ask the information of the client node of adding to join in each contented multicast list;
(13.5) in step (13.3), if do not exist other multicasts to receive client node in original this subnet, then dispatch server will be informed all client nodes that are operated under the P2P pattern in this subnet, make them enter multicast state, return step (13.4) afterwards.
In above-mentioned (14) step, when certain client node withdrawed from live network, the dispatching method of dispatch server specifically may further comprise the steps:
(14.1) if the subnet inside at the client node that withdraws from (as the client node among Fig. 2 2) place exists multicast to receive client node, and the client node that withdraws from itself is a multicast client node, then a multicast of the work of the client node that withdraws from all being transferred in this subnet receives on the client node, this multicast reception client node provides the client node of Media Stream to connect with all of the client node that withdraws from, thereby obtain all media stream datas, the request of the client node of all receiving medias streams of the client node that acceptance is simultaneously withdrawed from;
(14.2) if the subnet inside at the client node that withdraws from (as the client node among Fig. 2 3) place exists multicast to receive client node, and the client node that withdraws from itself is that a multicast receives client node, and then the client node that this is withdrawed from is deleted from the topology table of this network;
(14.3) if the subnet inside at the client node that withdraws from (as the client node among Fig. 3 4) place does not exist multicast to receive client node (can think that the client node of asking to add is not in this subnet), (the bottom client node of distribution generally is that hierachy number is bigger then to distribute a bottom client node to replace the client node that withdraws from, like this can be so that the hierachy number of whole multicast network remains on the less level, help reducing network delay, also should take into account factors such as distance, bandwidth simultaneously).
(14.4) if the client node that withdraws from is bottom client node (as the client node among Fig. 3 5), then the client node that this is withdrawed from is deleted from the topology table of this network;
In above-mentioned (15) step, topology table dynamic real-time method for updating specifically may further comprise the steps:
(15.1) each client node all must regularly send the survival signal to dispatch server, represent that oneself still is in the network, and in work, if certain client node does not send the survival signal in given time threshold (for example 120 seconds), think that then this client node has withdrawed from live network, and it is deleted from topology table, the dispatching method that withdraws from by client node is handled afterwards;
(15.2) in step (15.1), each client node sends time interval change at random in a given scope of survival signal to dispatch server, congested to prevent, require this scope within the timeout threshold that server is provided with (for example, 80~110 seconds, according to information setting time interval excursions such as cache size, delays);
(15.3) when the scale of multicast network during greater than the size threshold of setting (all being to adopt classification to monitor strategy at present), the method that adopts classification to monitor dynamically updates topology table, and the timeout threshold that general classification monitoring sets is in the timeout threshold than server little (as 20 seconds); The concrete grammar that this classification is monitored is: seed client node (as the client node among Fig. 11,2) is unique client node that directly sends the survival signal to dispatch server; All client nodes except that the seed client node (as the client node 3-5 among Fig. 1), directly (send the survival signals to client node 2 as the client node among Fig. 13 to client node that Media Stream is provided or multicast client node transmission survival signal, client node 4 sends the survival signal to client node 2 or 3, and client node 5 sends the survival signal to client node 4); If the client node of Media Stream or the multicast client node is not received certain client node in this time threshold survival signal are provided, directly notify dispatch server; Dispatch server will not send the client node of survival signal and will delete from topology table in this time threshold, the dispatching method that withdraws from by client node is handled afterwards.