P2PSP (Peer-to-Peer Straighforward Protocol) is an application-layer multicast protocol that provides real-time broadcasting of media streams in the Internet. The peers relay the stream split into chunks, using an UDP push communication model. The data ﬂow is controlled by the source(s) of the stream, and the peers use a congestion control method based on the relaying of chunks, only when chunks are received. The topology of the overlay is dynamic and adapts to the requirements of the physical topology and startup latency required, which is proportional to the maximum number of peers in the P2P overlay. In absence of connectivity restrictions (such as the imposed by NATs) and selﬁsh peers, all peers have an input/output ratio close to 1. P2PSP can use IP Multicast communications, when available.
Cursive is used the ﬁrst time a P2PSP-related term/concept is introduced, and for key concepts or ideas.
P2PSP has a modular design organized in sets of rules, where each module is especialized in implementing diﬀerent functionalities.
Note: Finished but not implemented.
LBS describes the bootstrap procedure that peers must follow in order to join the overlay. LBS is an standalone set of rules, and it is compatible with any other set.
P2PSP supposes that there is a collection of streams (usually, video) that are broadcasted in parallel.1 The streams are available at one or more2 streaming servers, and each stream has a diﬀerent Universal Resource Locator, usually expressed as a Web address with the structure:
Notice that a server can be serving several channels.
P2PSP does not perform data-ﬂow control over the stream. The transmission bit-rate between P2PSP entities is controlled by the servers (Icecast servers, for example), which provides the stream to the P2PSP teams. Fig. 1 shows an example of a streaming overlay where several servers relay a set of channels generated by a set of source-clients, directly or through other servers. As can be seen, a listener (which usually plays the stream) can be replaced by a splitter, a P2PSP entity that sends the received stream (a single channel) to a set of P2PSP peers.
In a pure CDN system, users request the channels directly to the servers. Unfortunately, this simple procedure has a drawback: normally, users do not know the load nor the distance to the servers. This problem can be solved by using a load balancer. The listeners, which know the URL of the required channel, connects ﬁrst to a load balancer which redirects them (with an HTTP 302 code) to a suitable server.
This idea can be extended to minimize the response time of hybrid CDN/P2PSP structures. When a user (who knows an URL of the channel) runs a local peer, it provides to his peer the URL of the channel (the URL pointing to a server and a mount point). Then, the peer (as any other listener does) contacts a load balancer which in this case sends a list of splitters which are broadcasting the channel.3 Then, the peer tries to connect with all the splitters in parallel, and the ﬁrst establised connection determines the selected splitter (the rest of connections are closed). If only those splitters with space in their teams answer to the peer, this procedure should select the “nearest” splitter for the peer in terms of response time.
For the case of the incorporation of new splitters to the network, the procedure is similar. A new splitter (which is instantiated knowing an URL of a channel) contacts the load balancer which returns a list of servers and peers, which are serving the channel. Then, the splitter tries to connect with all of them in parallel, and the ﬁrst successfull connection is ﬁnally selected.4
Using the idea of the extended load balancer, when a player (listener) connects to it, if there is a local peer running in the same host or the same private network that the player, the balancer will redirect the player to the local peer.
Finally, it is compulsory that all the splitters associated to the same channel to generate exactly the same chunks (content and header).
Note: Finished and implemented.
Note: DBS is the most basic set of rules. The rest of sets extends or modify its functionality.
DBS provides ALM of a media stream in unicat environments. The media is sent by a streaming server (which is not related to P2PSP), and it is received by a splitter. (see Sec. 1) The splitter divides the stream into a sequence of chunks of data, and relays them to a team of peers, following a round-robing schema. Each peer of a team gathers the chunks from the splitter and the rest of peers of the team, and sends them to at least one player.Peer should run even if no player(s) are connected to it. Peers are organized in a unstructured topology (all peers perform the same tasks).
A team is a set of one or more peers (referenced by their end-points) that share the same stream. By deﬁnition, in a team at least one peer is a monitor. Monitors are deployed by the overlay administrator to check diﬀerent aspects of the broadcasting, such as, the expected quality of the rendered video at the peers or the estimated latency.
The number of peers (normal peers and monitors) in a team has a maximum (see Tab. 1). This parameter has an signiﬁcative impact on the maximum latency of the protocol (see Sec. 2.4), and is usually deﬁned by the administrator of the overlay.
|:||Maximum number of peers in a team|
|:||Buﬀer size, in chunks, used by the peers|
|:||Length of the list of the last peers served by the splitter|
|:||Diameter of the ﬂooding tree|
|:||Maximum allowed number of lost chunks|
|:||Number of monitors|
|:||Average bit-rate of the media|
|:||The list of peers in the team|
|:||Number of peers in the team|
|:||Number of lost chunks|
|:||Protocol (buﬀering) jitter|
|:||Physical (network) latency|
|:||The played chunk index|
The splitter divides the stream into chunks of constant length , and sends exclusively each chunk to a diﬀerent origin5 peer, using a round-robin schema. Chunks are enumerated to distinguish them, and this information is transmitted as a part of a chunk header.
A round is deﬁned as the process of transmitting diﬀerent chunks from the splitter to a team of peers (therefore, all the peers of the team are origin of a diﬀerent chunk, in each round). For a team of size , the average round-time can be estimated as
where is the chunk time, deﬁned as
where is the length of the chunks (all the chunks are split with the same length) and is the average transmission bit-rate, that should match the average bit-rate of the stream in order to achieve a seamsless playing.
After connecting with a splitter6 , incoming peers request (using a reliable communication) to the splitter the current list of peers in the team . To minimize the joining time, the peer sends a message to each other peer of the team, in parallel with the reception of the list. When a peer of the team receives a , it adds the sender of the message to the team list7 and to a jagged array of peers called (see in peer.py). If a peer has an entry , then each chunk received by and originated at will be forwarded to . When an incoming peer has received the list of peers, its forwarding table has been initialized to . Notice that, as long as the forwarding table contains this information, all the chunks received from the splitter will be forwarded to the rest of the team, directly (in one single hop/chunk). So, in absence of communication constraints, the team will be organized as a full-connected overlay (see Fig. ??).
The splitter, in an inﬁnite loop: (1) listens to the incoming peers, (2) sends to them the list of peers of the team, (3) includes the incoming peer to the list, and (4) send a copy of the stream to the team using a round-robing, as a sequence of chunks. Notice that only those peers that are in the list of peers of the splitter are considered to be in the team served by such splitter.
Note: See in peer_dbs.py.
In order to hide the jitter generated by the physical network and the protocol itself, peers need to store the received chunks in a buﬀer during a period of time, before sending them to a player. A chunk with number is inserted in the position of the buﬀer, where is the maximum number of chunks that the buﬀer stores before start playing the ﬁrst chunk. In a peer’s life, is a constant speciﬁed by the user, but it is not compulsory that all peers of a team use the same buﬀer size.
The buﬀer is implemented as a circular array of chunks, that is ﬁlled with up to chunks during the buﬀering time . Such time is the main component of the start-up time experienced by users. The oldest chunk in the buﬀer is sent to the player each time a new chunk is received.
The start-up time is the latency that the end-user experiments during the redering of the media. , deﬁned as
is the sum of the physical delay and the buﬀering time , where
is the time that has elapsed since the peer receives two chunks distanced positions in the buﬀer, being the buﬀer size (in chunks), and the chunk time (considering a constant8 ). In other words, the buﬀering time is the delay in the rendering of the media required to expect a seamless playing. Notice that Eq. 4 does not assume that the chunks completely ﬁll the buﬀer during the buﬀering time.
To minimize , and should be as small as possible. How to minimize is out of the scope of this discussion. However, to minimize , we can reduce and/or , but these actions carry two main drawbacks. On the one hand, should be large enough to reduce the overhead of the headers used by the transport protocol. On the other hand, if is too small (for instance ), the peer will not have enough space to buﬀer all the chunks of a round, causing that some incoming chunks overwrite others before they can be played. This problem also arises even if , because the maximum protocol jitter, , that a chunk can experiment is the sum of the jitter produced by the splitter for this peer, that can as high as , and the jitter produced by the ﬂooding of the chunk to the rest of the team, that also can be has high as . Notice that this jitter is the same for two extreme topologies of the overlay: (1) a full-connected mesh (Fig. ??), or (2) a ring (Fig. ??), when the chunks travel only in one direction9 . Therefore, in the case of a full-connected mesh, peers have to use a
in order to avoid the loss of chunks due to high . We will refeer to as the critical buﬀer size.
Lets analyze the buﬀering time in two interesting cases. Lets suppose that the number of the ﬁrst received chunk is and that the rest of chunks of the buﬀer of size are received10 , being the chunk the last one (the best scenario). In this case, the can still be estimated by Eq. 4. Lets imagine now that after receiving the chunk is received (chunks have been lost or delayed too much), and the playing starts (probably, with severe artifacts). In this case, also corresponds to Eq. 4, because the chunk was generated chunk times after , and we cannot wait more during the buﬀering time if we want to dimension . After considering these two extreme situations, we can deduce that the start-up time does not depend on the chunk loss ratio during the buﬀering-time (for loss ratios smaller than one), but only on , and .
Finally, notice that the time that passes from an incoming peer request to join a team to a splitter until it accepts the peer, and the buﬀering time that the player can require, have not been considered in this discussion. However, both times should be, in general, signiﬁcantly lower than , that in the case of P2PSP corresponds to the that end-users experiment.
DBS is a push-based protocol. When a peer receives a chunk, it can be retransmitted to a large number of neighbors, depending on the number of peers in its forwarding table. Therefore, even if the chunk rate is controlled by the streaming servers, some kind of ﬂow control must be performed by the peers in order to reduce network congestion while the overlay is ﬂooded.
The congestion may be avoided following the next idea: only if I have received a chunk, I send (not necessary to the sender) a chunk (and not necessary the received chunk). In a fully connected overlay (see Fig. ??), this allows to control the data ﬂow. However, in more realistic scenarios, where the physical media imposes interconnection constraints (such as those generated by ﬁrewalls and symmetric NATs), peers could not be directly “connected” with the rest the team. Therefore, if the splitter follows a pure round-robin strategy, some peers will send more chunks than they receive, as happens for example in Fig. ??. In such scenarios, the simple idea of sending a chunk for each received one does not work.
Fortunately, the initial congestion algorithm can be adapted to handle a variable connectivity degree (also called neighborhood degree). Each peer uses a table of lists, , indexed by the neighbor’s end-points, where each list references the indexes in the buﬀer of those chunks in the current peer that must be transmitted to the corresponding neighbor the next time such neighbor is selected in the ﬂooding process. For example, if , chunks found at positions and of the buﬀer have to be sent to peer .
Notice that using this procedure, more than one chunk can be sent to a neighbor in a transmission burst. This could congest the physical devices in very unbalanced overlays (see the Fig. ??), although these cases are rare. As an advantage, all the chunks of the burst travel between the two same hosts when a burst is produced, which usually increases the performance of the layer-3 routing. Additionally, several chunks could be grouped in one single packet, reducing the protocol overhead.
Note: An example of the temporal evolution of a team using the ﬂooding algorithm has been described in the Figures 3 to 7.
Chunks can be lost under bandwidth and buﬀering time constraints. A chunk is lost when it is time to send it to the player, i.e. when it is pointed by , and the chunk has not been received. Therefore, when a peer realizes that a chunk has been lost, nothing can be done to recover it.
In order to mitigate this drawback, peers can pre-fetch “potentially lost” chunks at the buﬀer position , where is the pre-fetching horizon. Setting , the pre-fetching is disabled and only those chunks that really are lost will be “requested”11 . On the contrary, the higher the , the more aggressive the pre-fetching is.
For each (potentially, if ) lost chunk with number , peers send a message to a random12 peer of the team. When a peer receives a request message from , adds to , where is the origin peer of the chunk stored in the position of ’s buﬀer, in case this chunk has been received (otherwise, the request is ignored because cannot determine ). Therefore, if the requested chunk is in ’s buﬀer, will start forwarding the chunks originated at to .
As a consequece of the request messages, redundant routes can be created. Therefore, some chunks could be received more than once. To avoid future chunk duplicates, peers send pruning messages to those peers that send duplicates. The receiver of a message received from , removes of , where is the origin peer of the chunk stored in the position of ’s buﬀer.
Now, we can deﬁne with more accuracy the neighborhood degree (see Sec. 2.6) as the number of diﬀerent destination peers for each possible origin that a peer forwards. For example, if a peer forwards chunks from the origin to neighbors, the neighborhood degree of for itself is , and if the peer also forwards chunks from an origin to neighbors, the neighborhood degree of for the origin is .
Initially, peers have, for the chunks originated in themselves, a neighborhood degree equal to , and the table has only one entry. As long as the topology of the overlay is optimized by the route discovery algorithm, peers insert new entries in the forwarding table and the length of this entry tend to be smaller. Therefore, the lists of forwarded peers for each origin changes with the processing of the requesting and pruning messages.
An outgoing peer must to: (1) say to the splitter and the neighbor peers (in this order), (2) relay any pending (received but yet not sent) chunks, and (3) wait for a from the splitter. In case of timeout13 , the leaving procedure is reset a number of times.
When a peer receives a from , removes from all the lists (all the possible origins) of table. The splitter removes the outgoing peer from the list of peers as soon as the is received, to avoid sending chunks to it.
Monitor peers (which are trusted peers) complain to their splitter with a for each lost chunk that they detect. The splitter only considers these type of messages if they come from a monitor.
The splitter remembers which chunk, of a list of the last transmitted chunks, was sent to each origin peer of the team. The splitter also counts of lost chunks for each peer of the team. The corresponding counter is incremented for each lost chunk reported by a monitor and, if the counter of a peer goes over a threshold , the corresponding peer is removed from the list of peers, and the rest of counters are reset. Notice that the smaller the , the higher the belligerence with the selﬁsh peers. The selection of should be also proportional to the number of monitor peers .
Peers check the sending activity of the rest of peers of the team, with the objective of stop sending chunks to selﬁsh peers. Such activities are represented by an array of counters, indexed by the origin of the received chunks. For each chunk received by and originated at , increases . In each new round (when a chunk is received from the splitter), decreases , and if (in this case, is the maximum allowed number of chunks that a peer can “lost” with other peer), no more chunks nor control messages will be delivered to . However, notice that this last consequence can be reversed if resumes its sending activity with .
Note: Unﬁnished. This set is incompatible with FCS (see Sec. 4).
ACS relaxes the peer’s uploading requirements imposed by DBS. ACS is based on the idea of using the information that the splitter knows about the number of chunks that each peer has lost (see Sec. 2.10), to send to the more reliable peers a higher number of chunks. In other words, ACS adapts the round-time of each peer to its capacity, in such a way that the higher the capacity, the lower the round-time. Notice that ACS only aﬀects the behavior of the splitter.
ACS should be used if we want some peers to contribute with the uploading capacity than others cannot provide. A possible situation could be when we want to mix the CS and P2P models, sending more chunks from the contents provider’s hosts to the users’s peers, with the objective, for example, of incrementing the QoS. Because monitors should lost a minimum number of chunks (supposedly the hosts of the contents provider should have enough capacity), the ratio of chunks emitted by the contents provider’s hosts can be controlled if a high enough number of monitor peers (the more monitors, the higher the ratio).
Note: Finished but not implemented. This set is incompatible with ACS (see Sec 3).
FCS (Free-riding Control Set) modiﬁes the functionality of DBS.
DBS does not imposes any control over the grade of solidarity of the peers. This means that selﬁsh peers (or simply peers with reduced upload capacity) can stay in the team thanks to the generosity of the rest of peers, even if they never achieve to deliver a chunk to any peer of the team. FCS precludes this possible behavior by imposing a minimum degree of solidarity between neighbor peers.
To know the level of solidarity between neighbor peers, each peer uses a table of chunk debts, . Every time a peer sends a chunk to , increments , and decrements when receives a chunk from .
Using DBS, peers forward chunks to their neighbors using a simple round-robing scheduler. FCS modiﬁes this behavior:
Using FCS, supportive peers will be served ﬁrst, incrementing the QoE of the users of the corresponding peers. On the other hand, those peers with a higher chunk debt will tend to be unserved if no enough bandwidth is available. Notice that FCS is incompatible with ACS.
Note: The prioritized round-robin neighbor selection has not yet been implemented as it has been explained here. The structure exists, but is used for a diﬀerent purporse.
Note: Finished and implemented. IMS modiﬁes the functionality of DBS.
IMS runs on the top of DBS and provides eﬃcient native IPM, where available. IMS is available in LANs (Local Are Networks) and VLANs (Virtual LANs) , but not in the global Internet .
All peers in the same LAN or VLAN have the same network address. When a joining peer receives the list of peers from its splitter, ﬁrst checks if there are neighbors in the same subnet. For all those peers, uses the IP address (all systems on this subnet), (default) port , to multicast (only) the chunks received from the splitter. Therefore, all peers in the same local network communicate using this multicast group address and port. The rest of external peers will be referenced using their public end-points.
In TAS, the splitter request to each peer of the team the list of neighbors (peers that send chunks directly, in one hop). This communication is reliable (TCP) and transmits the lists as a collection of end-points. The number of requests per round is limited by the available bandwidth in the overlay, and by the request-ratio deﬁned at the splitter. Obviously, the higher the ratio, a more accurate description of the real connectivity in the overlay will be obtained.
After knowing the connectivity degree of each peer, the slitter can adapt the round-robin scheduling of the origin peers by sending a number of chunks proportional to the inverse of the degree of the origin peer.
Note: Finished but not implemented.
MRS extends DBS (or an extension of it) to retransmit massively-lost chunks. MRS should be implemented if error-prone communications are expected, specially if these channels are used by the splitter. MRS is based on the use of monitors (see Sec: 2.10). The idea is: the splitter will resend lost chunks to one or more the monitors when all monitors report their loss. To increase the probability of receiving on time the resent chunk (by normal peers), monitors halves the number of chunks in their buﬀers in relation to common peers. Notice that MRS only modiﬁes the behavior of the splitters and the monitors (normal peers does no need to implement LRS or its extensions).
Note: Finished but not implemented.
Most of the peers run inside of “private” networks, i.e. behind NAT devices. NTS14 is an DBS extension which provides peer connectivity for some NAT conﬁgurations where DBS can not provide direct peer communication.15
Peers behind the same NAT will use the same external (also called “public”, because in most cases we have not nested NAT conﬁgurations) IP address of the NAT. Basically, there exist two diﬀerent types of NATs: (1) cone, and (2) symmetric. At the same time, NATs can implement diﬀerent ﬁltering strategies for the packets that comes from the external side: (a) no ﬁltering, (b) source IP ﬁltering, and (c) source end-point ﬁltering. Finally, NATs can use several port allocation algorithms, among which, the most frequent are: (i) port preservation and (ii) random port. Notice that in this discussion, only UDP transmissions will be considered.
Lets suppose a team in which, for the sake of simplicity, there is only one external (public) peer , and that a new internal (private) peer has sent the sequence of ’s (see Sec 2.3). Lets denote ’s NAT as . When no ﬁltering is used at all, forwards to any external packet that arrives to it (obviously, if it was sent to the entry in ’s translation table that was created during the transmission of the sequence of ’s), independently on the source end-points of the packets. In the case of source (IP) address ﬁltering, will forward the packets only if they come from ’s host. When source end-point ﬁltering is used, also checks the source port, i.e., that the packets were originated at ’s end-point.
Cone NATs use the same external end-point for every packet that comes from the same internal end-point, independently on the destination of the packets (see Fig. 9). For the external peer , the situation is identical to the case in which the NATed peer would be running in a public host.
Symmetric NATs use diﬀerent external end-points for diﬀerent packets that comes from the same internal end-point, when these packets have diﬀerent destination end-points (see Fig. ??). Thus, two diﬀerent external peers will see two diﬀerent public end-points of .
In the case of port preservation, if : is the private end-point (IP address:port) of a UDP packet, the NAT will use the public port , if available (notice that cound have been assigned to a previous communcation). If were unavailable, the NAT usually will assign the closer free port (this is called “sequentially port allocation”), usually by increasing the port value, although this behavior has not been standarized at all.
When random port allocation is implemented, the public port will be assigned at random. Notice that, even in SN-PPA conﬁgurations, in most of the real situations (where peers must compete with the rest of processes that use the network for the same NAT resources,) some kind of randomization should be always expected during a the port assignment.
An incoming peer can determine its NAT behavior using the following steps:
for , the port distances gathered by .
where GCD is the Greatest Common Divisor operator.
Table 2 shows the theoretical traversal success of DBS (or an extension of it) for diﬀerent NAT type combinations. Peer1 represents to a peer already joined to the team, and Peer2 to an incoming peer. The entries labeled with “DBS” are those that will be handled by DBS, out-of-the-box. An explanation of why the DBS handshake works for such conﬁgurations is shown in Fig. 10. Notice that source end-point ﬁltering has been used in this example, although a similar results should be obtained for simple source address ﬁltering. On the other hand, the combinations labeled with “-” or “NTS” will not work with DBS (see Fig.11). In fact, only the “NTS” entries should work, in general, with NTS, depending on the port prediction algorithm and the number of tries.
Fig. 12 shows an example of an NTS (NAT traversal) success. When the new NATed peers, and , arrive at the team, the following events happen:
Summarizing, NTS can provide connectivity for those peers that are behind port-preservation symmetric NATs with sequential port allocation.
When both peers, Peer1 and Peer2, are behind symmetric NATs, both must predict the port that the NAT of the interlocutor peer will use to send the packets towards it. And obviously, this must be performed by each already incorporated peer that is behind a symmetric NAT.
The list of predicted ports that a a peer performs is determined by:
where “” denotes the concatenation of lists and is the number of guessed ports, is the ﬁrst external port (the port used to communicate with ) assigned to the incoming peer and is the (maximum) port step measured for the incoming peer’s NAT.
When using MDC , SVC , or for emulating the CS model, it can be interesting for peers to belong to more than one team. To implement MCS, peers must replicate the P2PSP modules (DBS at least) for each team (channel), except the buﬀer.
The use of MDC is trivial: the higher the number received descriptions (channels), even partially, the higher the quality of the playback. However, when transmitting SVC media, peers should prioritize the reception of the most important layers.
When a peer belongs to more than one team, and the teams broadcast exactly the same stream (the same chunks and headers), it could move between teams seamless (without losts of signal).
A pure CS service could be provided if the corresponding splitter announces one empty team and sends each chunk so many times as teams (with one peer/team) there are.
A variety of techniques to ﬁght pollution in P2P live streaming systems are available in the literature, including hash-based signature and data encryption techniques.
 Pierpaolo Baccichet, Jeonghun Noh, Eric Setton, and Bernd Girod. Content-aware p2p video streaming with low latency. In Multimedia and Expo, 2007 IEEE International Conference on, pages 400–403. IEEE, 2007.
 Xiaowen Chu, Kaiyong Zhao, Zongpeng Li, and Anirban Mahanti. Auction-based on-demand p2p min-cost media streaming with network coding. IEEE Transactions on Parallel and Distributed Systems, 20(12):1816–1829, 2009.