You are on page 1of 10

JOURNAL OF COMPUTING, VOLUME 5, ISSUE 4, APRIL 2013, ISSN (Online) 2151-9617 https://sites.google.com/site/journalofcomputing WWW.JOURNALOFCOMPUTING.

ORG

Hybrid Network Coding Peer-to-Peer Content Distribution


Dinh Nguyen and Hidenori Nakazato
Abstract Network coding has been applied successfully in peer-to-peer systems to shorten the distribution time. Pieces of data, i.e. blocks, are combined, i.e. encoded, by the sending peers before being forwarded to other peers. Even though requiring all peers to encode might achieve shortest distribution time, it is not necessarily optimal in terms of computational resource consumption. Short finish time, in many cases, can be achieved with just a subset of carefully chosen peers. Peer-topeer systems, in addition, tend to be heterogeneous in which some peers, such as hand-held devices, would not have the required capacity to encode. We therefore envision a P2P system where some peers encode to improve distribution time and other peers, due to limited computational capacity or due to some system-wide optimization, do not encode. Such a system gives rise to a design problem which has never happened in both pure non-coding and full network coding-enabled P2P systems. We identify the problem and propose our solutions to address it. Simulation evaluation confirms robust performance of our proposed hybrid network coding peer-to-peer content distribution. Index Termscontent distribution, network coding, peer-to-peer

1 INTRODUCTION

ETWORK cod ing [1][13], w hich allow s content to be cod ed at interm ed iate nod es w hile being forw ard ed in the netw ork, has been show n to achieve significantly shorter d istribu tion tim e in peer -to-peer (P2P) content d istribu tion [4][16]. It is, how ever, too expensive and in m any cases im possible to requ ire encod ing at every peer. Recent w ork has d em onstrated that encod ing is only need ed at a su bset of carefu lly chosen peers, and in som e particu lar instances, only at the sou rce, to achieve com p arable perform ance to netw ork cod ing [11][12][15]. Many other stu d ies have focu sed on m inim izing the nu m ber of requ ired netw ork cod ers to achieve optim al m u lticast throu ghpu t [8][21][22]. P2P netw orks in reality u su ally consist of heterogeneou s peers w ith qu ite d ifferent cap abilities. More pow erfu l peers can be read y for netw ork cod ing-enabled operations, yet su ch jobs are beyond the cap acity of resou rce-lim ited peers like hand -held and m obile d evices. A su ccessfu l netw ork cod ing solu tion to optim ize P2P netw ork perform ance, therefore, cannot im pose encod ing at every netw ork nod e. Interested in u sing netw ork cod ing to shorten d istrib u tion tim e in P2P netw ork, w e envision a P2P system w here encod ing is ap plied at som e peers w hile other peers, d u e to resou rce lim itation or d u e to optim ization reasons, m ight not cod e. The system , w hich w e call a hybrid network coding P2P system , gives rise to a d esign problem w hich has never hap pened before. In pu re BitTorrent P2P system [3], the sou rce and all peers exchange pieces, i.e. blocks, of the file u sing rarest-block selection to qu ickly d issem inate the file into the system . A peer chooses the rarest blocks in the neighborhood to d ow nload first. In fu ll netw ork cod ing-enabled P2P, all peers cod e. Before d ow nload ing from a neighbor, a peer co m

m u nicates w ith the neighbor to d eterm ine if it can provid e w ith new d ata. When som e peers encod e and others d o not, there are m ixtu res of cod ed and non -cod ed blocks in the neighborhood for each peer to choose from . The qu estion is how w e can d esign a protocol and a block selection algorithm to hand le su ch a m ixtu re of cod ed and non-cod ed blocks and at the sam e tim e preserve the efficiency and sim plicity of BitTorrent protocol. In this p aper, w e d esign ou r hybrid netw ork cod ing P2P system . Ou r contribu tions are follow s. 1) We d evise inform ation exchange p rotocols w hich enable hybrid netw ork cod ing system s to w ork seam lessly. Ou r d esign, backw ard -com p atible to BitTorrent, requ ires only an ad d ition of one field in the m eta-exchange m essages. 2) We propose a block-selection algorithm for a p artly netw ork cod ing-enabled system to operate efficien tly. Ou r block-selection algorithm , an extension from BitTorrents rarest-first selection, is d erived from extensive observations of the w ay netw ork cod ed d ata benefit content d istribu tion. Ou r d esign and algorithm noticeably im prove system perform ance in term s of d istribu tion tim e com pared w ith cu rrent netw ork cod ing P2P system s. In the rem aining parts, w e review related w ork in se ction 2. The system m od el is given in section 3. We d escribe the protocol for peers to com m u nicate in section 4. Section 5 focu ses on the block-selection p roblem and ou r proposed algorithm . Section 6 presents perform ance evalu ation resu lts and finally, w e conclu d e the p aper in section 7.

2 RELATED WORK
BitTorrent [3], a popu lar P2P file sharing w ith p arallel d ow nload s to accelerate d ow nload speed , d ivid es the file into equ al-size blocks, i.e. chu nks, pieces, w hich peers

The authors are with W aseda University, Tokyo 169-0051, Japan. This work has been extended from a previous paper[14].

JOURNAL OF COMPUTING, VOLUME 5, ISSUE 4, APRIL 2013, ISSN (Online) 2151-9617 https://sites.google.com/site/journalofcomputing WWW.JOURNALOFCOMPUTING.ORG

send and receive in parallel, u tilizing both available u pload and d ow nload band w id th. Each new ly joining peer connects to a set of rand om existing peers, su ch that to constru ct a m esh overlay netw ork w ith rand om topologies. Fu rtherm ore, rarest blocks are chosen first by receiving peers to qu ickly d issem inate the w hole file into the system . To encou rage peers to contribu te u pload ing band w id th to the system , a p eer u pload s to, i.e. u nchokes, a certain nu m ber of neighboring peers at a tim e, those provid e it w ith best d ow nload ing rates. Rarest first block selection and u nchoking are show n to be the reasons u nd erlying BitTorrent excellent perform ance [5]. N etw ork cod ing [1][2][13], w hich allow s interm ed iate nod es to encod e, have been ap plied to BitTorrent in o rd er to shorten d istribu tion tim e [4][16]. Whenever there is an op portu nity to transm it, a peer com bines all b locks it has to m ake new cod ed blocks and send s to the requ esting peer. For fu ll-scale netw ork cod ing P2P w here all peers encod e, [4][6] p rop oses a m echanism by w hich before d ow nload ing from a neighbor, a peer checks if the neig hbor can provid e it w ith m eaningfu l blocks, i.e. blocks w hich are linearly ind epend ent from its ow n set of blocks. We call that a try-and-download approach w hich, com pared to BitTorrent, requ ires a m ajor u p d ate in the w ay peers exchange m etad ata: 1. a peer send s a requ est m essage to its neighbor, 2. the neighbor replies either w ith a new ly genera ted encoding vector or w ith its decoding matrix 1, 3. requ esting peer d ow nload s a new ly cod ed block from the neighbor if the encod ing vector or the neighbors d ecod ing m atrix is ind epend ent from its ow n d ecod ing m atrix. Try-and-download is synchronou s in the sense that a peer has to be in synch w ith its neighbors by continu ou sly checking if they can provid e it w ith new d ata. Moreover, a receiving peer cannot know in ad vance exactly w hich and how m any blocks it is going to receive from each neighbor to m ake a better choice. Su ch know led ge w ill help the receiving peers to d ecid e w hich blocks are m ost valu able to it. In fu ll-scale netw ork cod ing system s w here peers are som ehow hom ogeneou s in term s of com pu tational resou rces to encod e, try-and-download is feasible, yet w ith a protocol overhead . Within a hybrid netw ork cod ing P2P system , how ever, it is not necessarily that all peers can cod e. In su ch a scenario, requ iring a resou rce-lim ited peer to frequ ently com p are its ow n d ecod ing m atrix w ith d ecod ing m atrices of its neighbors is beyond its cap acity. We need a sim ple, yet effective, w ay to d o that w hich every peer, encod ing-enabled or not, can d o. To facilitate hybrid netw ork cod ing P2P system s w h ere encod ing and non-encod ing nod es m ix together, w e d epart from try-and-download ap proach to introd u ce an extension to BitTorrent m etad ata exchange. We fu rtherm ore propose a block selection algorithm to im prove d istrib u tion tim e. Ou r proposed solu tion is backw ard -com p atible w ith BitTorrent and virtu ally requ ires no m ore protocol
1

overhead than pu re BitTorrent, yet the perform ance im provem ent is noticeable com pared w ith original netw ork cod ing P2P system s.

3 SYSTEM MODEL
3.1 Hybrid Network Coding Peer-to-Peer System We consid er a P2P content d istribu tion from a sou rce to m any peers in w hich each peer m aintains overlay connections to som e rand om peers, i.e. its neighbors, to exchange d ata. A file exists at the sou rce and is d istribu ted to all peers w hich, at the beginning, d o not have any part of the file. The file is originally d ivid ed into K equ al blocks, the sam e as in [3], w hich are transferred in the system in parallel. To accelerate throu ghpu t, som e peers in the system encod e w hile other peers d o not. Since cod ed d ata exist in the system , all peers w hich have received cod ed d ata, how ever, are requ ired to d ecod e to recover the original d ata. As in BitTorrent system s [3][4], block exchange com plies w ith tw o ru les: (1) rarest block first selection at the re ceivers sid e: receivers choose rarest blocks in its neig hborhood to d ow nload , and (2) an incentive schem e at the send ers sid e: send ers send blocks to their neighbors r eciprocally. 3.2 Random Linear Network Coding Encod ers in ou r system u se rand om linear netw ork cod ing (RLN C) [2][6] to create new cod ed blocks from the blocks they have received . In RLN C, an encoding vector of K coefficients is attached to each cod ed block to specify how that cod ed block is generated from the K original blocks. Su ppose w e h ave a cod ed block C 0 w ith encod ing vector (c01,c02,...,c0K), and K original blocks, B1, B2, ...,BK. That m eans C 0= c01B1+ c02B2+...+ c0KBK. The coefficients and m u ltiplication and ad d ition operations are taken place in a Galois field , e.g. GF(28). N ow su pp ose a peer A, having received 2 blocks C 1 and C 2, w ants to m ake a new cod ed block to send to a neighboring peer. Peer A w ill pick u p tw o rand om coefficients a 1 and a 2 and generate a new cod ed block C: C = a 1C 1+ a 2C 2 = (a 1 c11+ a 2 c21)B1+(a 1c12+ a 2c22)B2+...+(a 1c1K+ a 2c2K)BK. The cod ed block C together w ith K coefficients above is sent to the requ esting peer. At the receiving peer, all encod ing vectors are stored in a decoding matrix w ith correspond ing cod ed d ata blocks. After a peer collects K ind epend ent cod ed blocks, i.e. the K associated encod ing vectors form a fu ll-rank m atrix, it can d ecod e to get the K original blocks by solving the set of K linear equ ations. 3.3 Network Coder Assignment Since only som e peers in the system encod e, the qu estion s are w hich peers w ill becom e netw ork cod er and w ho is resp onsible for assigning them . In ou r view , peers at key locations of the netw ork can selectively be assigned as netw ork cod ers. We d iscu ss this problem in d etail in [15] w here w e propose to place net-

We exp lain encod ing vector and d ecod ing m atrix in section 3.2.

JOURNAL OF COMPUTING, VOLUME 5, ISSUE 4, APRIL 2013, ISSN (Online) 2151-9617 https://sites.google.com/site/journalofcomputing WWW.JOURNALOFCOMPUTING.ORG

10

w ork cod ers at nod es w ith high centrality [17][18] valu es. This ap proach, how ever, requ ires a centralized server to com pu te and assign cod ers. Practically, in P2P system s su ch as BitTorrent [3][4][19], w e can allow trackers to d o that task since the trackers know w hich peers cu rrently join the torrents. N etw ork cod ers can also be assigned in a d istribu ted m anner w ithou t any centralized server by u sing, for exam ple, d egree inform ation .2 Given a threshold , peers w ith d egrees higher than the given valu e w ill becom e encod ers. In scenarios w here com pu tational resou rces are lim ited , w e can approxim ately pred ict the am ou nt of r equ ired resou rces based on w hich a peer can d eterm ine, by itself, to becom e an encod er if it m eets the resou rce r equ irem ents. Su ch an encod er assignm ent d oes not need a centralized server either.

Fig. 1. Notification and data block formats with the newly proposed encoder-id field.

4 INFORMATION EXCHANGE PROTOCOL


In pu re BitTorrent w ithou t netw ork cod ing, there are tw o phases to d istribu te blocks. These tw o phases interlace and take place asynchronou sly.

N otification phase: after d ow nload ing a block, the d ow nload ing peer notifies its neighbors abou t the block it has ju st d ow nload ed .

Selection phase: w henever band w id th is available for d ow nload ing, a peer, based on the inform ation it has abou t w hich blocks are available in the neighborhood , chooses one block to d ow nload u sing a block selection algorithm . The d ow nload , then, can proceed if the d ow nload ing peer is cu rrently u nchocked by its neighbor w ho has the ch osen block and the neighbor has enou gh band w id th to su stain su ch d ow n load . If that fails, the peer can repeat this p rocess to choose another block. This phase stops w hen the peer ru ns ou t of band w id th or has no m ore blocks to choose from . In the follow ing su bsections, w e concentrate on the protocols u sed to com m u nicate betw een peers and the form at of the exchanged m etad ata. We d iscu ss the block selection algorithm in d etail in the next section. BitTorrent u nchocking algorithm is one topic in itself to hand le fairness and free-rid er issu es and is not d iscu ssed in this p aper. We instead assu m e peers in ou r system are altru istic and w illing to contribu te their band w id th.

ou r block selection algorithm , the block-id is generated in increasing ord er: a new block-id generated by a particu lar encod er is greater than all pr eviou s block-ids generated by that encod er. With netw ork cod ing, an encoding vector is attached to each cod ed block as d escribed in the previou s section. We propose an ad d itional encoder-id field (Fig. 1) w hich stores the id entification of the encod er w ho generated the cod ed block. Encoder-id w ill be u sed in ou r selection alg orithm later on. For each block, the m etad ata exchanged betw een neighbors in a notification m essage, thu s, consists of three field s: block-id, its encoder-id, and its encoding vector (Fig. 1(a)). The d ata block consists of block-id, encoder-id, and the payload d ata (Fig. 1(b)). If the notification or d ata block is a non -cod ed one, its encoding vector and encoder-id can be om itted . H aving d efined the block form ats, w e next present d etails of tw o com m u nication protocols, either of w hich can be u sed in the hybrid netw ork cod ing system .

4.1 Block Format To id entify d ata blocks, each block is associated w ith one u niqu e block-id. H ow ever, one extension is need ed to su pp ort netw ork cod ing. Unlike non-cod ing system s in w hich the assignm ent is d one by the sou rce w here all the blocks originate, in netw ork cod ing P2P system s, that assignm ent is d one w here the block is created or origina ted : both at the sou rce and at all the encod ers. To assist
2 Degree-based routing has been p rop osed in [20]. In this p ap er, how ever, w e d o not p rop ose any netw ork cod er p lacem ent but d evote ou rselves to d esigning the p rotocol and d ata selection algorithm for the hybrid netw ork cod ing system.

Fig. 2. Pre-code protocol peers used to communicate. There are two asynchronous phases: notification phase and selection phase. This protocol is an extension from BitTorrent: the notification messages and data blocks have an additional encoder-id. Encoding vectors are also attached to the notification messages as described in section 3.2.

JOURNAL OF COMPUTING, VOLUME 5, ISSUE 4, APRIL 2013, ISSN (Online) 2151-9617 https://sites.google.com/site/journalofcomputing WWW.JOURNALOFCOMPUTING.ORG

11

Pre-code protocol: encod ing vectors of cod ed blocks

are generated in the notification phase w hen encod ers notify their neighbor abou t new ly cod ed blocks.
Post-code protocol: encod ing vector for a given cod ed

block is generated in the selection phase, ju st before the block is d ow nload ed . We d iscu ss the pros and cons of those tw o protocols su bsequ ently.

4.2 Pre-code Protocol Withou t the assu m ption that every peer can cod e, w e propose a sim ple ad aptation to BitTorrent m etad ata exchange m echanism . To facilitate cod ing, in ou r system , if a peer is an encod er, for each new ly d ow nload ed block, the peer notifies each of its neighbors w ith m etad ata of one new ly encod ed block. The new ly encod ed block is d ifferent from one neighbor to another neighbor. We note that to save com pu tation al resou rces, only the m etad ata, i.e. encoder-id, block-id, and the new ly generated encoding vector of the encod ed block (Fig. 1(a)), are notified to the neighbors in a notification m essage. Only w hen a neighbor d ecid es to chooses the notified cod ed block is the actu al d ata of that block encod ed . For an ord inary non encod ing peer, the m etad ata exchange is the sam e as in BitTorrent: the peer notifies its neighbors of the block it has ju st received . The com m u nication protocol is illu strated in Fig. 2. Since the system is a hybrid netw ork cod ing, notifications (message 1) and d ata blocks (message 3) transferred betw een peers can be either encod ed or original ones. One m ight argu e to u se try-and-download here, bu t that w ill m ake the operation m ore com plicated becau se each peer has to im plem ent tw o protocols: one for encod ing enabled neighbors, one for ord inary neighbors. With ou r ap proach, all a peer has to d o is to choose from cand id ate blocks one particu lar block to d ow nload based on the m etad ata it received in notification phase, w hich is the sam e as w hat hap pens in a p u re BitTorrent system . When a peer receives notification of a new ly encod ed block by a neighbor, i.e. message 1 in Fig. 2, the peer stores that block in a cand id ate list if the block is ind epend ent from all blocks it has d ow nload ed . Otherw ise, it ignores the notification. Unlike encod ing-enabled peers, non encod ing peers d o not encod e bu t forw ard w hat they have received : a m ixtu re of cod ed and non -cod ed blocks. As in BitTorrent, w hen receiving notification from a non encod ing neighbor, a peer w ill u pd ate the cou nt of that block, i.e. at how m any neighbors the block exists. When a peer can d ow nload , it send s a block requ est to the correspond ing neighbor ( message 2), and if the requ est is accepted , the neighbor w ill u pload the d ata block to the requ esting peer (message 3). Cod ing generates a large nu m ber of cod ed blocks, u su ally larger than the nu m ber of original blocks, of w hich m any blocks are red u nd ant. As a peer continu ou sly d ow nload s new blocks, som e blocks in its cand id ate list m ight becom e d epend ent on w hat it has d ow nload ed . Each peer is therefore requ ired to check and d iscard ca nd id ate blocks w hich are d epend ent on w hat has been d ow nload ed .

Fig. 3. Using post-code protocol, the encoding vector is generated not in the notification phase but just before the requested block is sent to the receiving peer.

4.3 Post-code Protocol As w e m entioned before, notification phase and selection phase are asynchronou s. That is, after peer A notifies an encod ed block in message 1, som e am ou nt of tim e p asses before peer B requ ests that encod ed block in message 2. The elapsed tim e can arbitrarily be long if, for exam ple, peer B d ecid es to d ow nload several blocks from other neighbors before choosing the encod ed block from peer A. In the m eantim e, peer A m ight receive som e new blocks. Using pre-cod e protocol, that new inform ation is not inclu d ed in the encod ed block since the w ay the block is generated , i.e. its encod ing vector, w as fixed at the notification tim e. Encod ers com bine the blocks they cu rrently have to m ake new cod ed blocks. If w e can d elay the act of encod ing ju st before the cod ed blocks are d ow nload ed , w e can provid e the receiving peers w ith the m ost u pd ated inform ation. Based on the above observation, w e pr oposed an

Fig. 4. Node E and F receive notification from node A, G, and H about the candidate blocks the two nodes can download. Of which B1 and B2 are non-coded blocks from node G and H; A1-A4 are newly encoded blocks from encoder A.

JOURNAL OF COMPUTING, VOLUME 5, ISSUE 4, APRIL 2013, ISSN (Online) 2151-9617 https://sites.google.com/site/journalofcomputing WWW.JOURNALOFCOMPUTING.ORG

12

alternative protocol, nam ely post-code protocol, w hich is illu strated in Fig. 3. The d ifferences of the post-cod e p rotocol from p recod e protocol are as follow s. Encoding vector is not inclu d ed in the notification

m essage, i.e. message 1 in Fig. 3. Only encoder-id and block-id are notified to the neighbor (peer B) each tim e peer A d ow nload s a new block. As stated b efore, encoder-id is the ID of peer A and block-id is an increasing nu m ber generated by peer A.

Fig. 5. With original rarest-first selection, there is a probability 1/8 that node E and F choose the same block B1 or B2. The result is that node T can only download one new block while its bandwidth allows two blocks.

Fig. 6. If coded blocks from encoder A are preferred, node E and F can always download independent blocks. As a result, node T can utilize all its bandwidth to download 2 new independent blocks.

Fig. 7. Encoder A, having 2 blocks B1 and B2, notifies node E and node F with newly encoded blocks A1-A4.

Fig. 8. Encoder A, after downloading 2 new blocks B 3 and B4, notifies node E and node F with blocks A5-A8 encoded from all 4 blocks B1-B4.

Fig. 9. With original rarest-first selection, there is a probability 1/9 that node E chooses block A3 and node F chooses block A4. The result is node T can only download 2 independent blocks A1 and A2 in 2 units of time. Blocks A3 and A4 in node E and node F are not useful to node T because they are dependent on A1 and A2.

Fig. 10. If the newest blocks are preferred, the 4 blocks downloaded by node E and node F are independent, which means node T can download in total 4 independent blocks in 2 units of time.

JOURNAL OF COMPUTING, VOLUME 5, ISSUE 4, APRIL 2013, ISSN (Online) 2151-9617 https://sites.google.com/site/journalofcomputing WWW.JOURNALOFCOMPUTING.ORG

13

The encod er (peer A) actu ally generates the encoding vector and send s to the receiving peer in the selection phase (message 3) ju st before the actu al cod ed d ata (message 5). The receiving peer (peer B) need s to check if that encoding vector is ind epend ent from its ow n decoding matrix before requ esting the encod ed block (message 4).

equ ally im portant. In other cases, the m ost recently cod ed blocks likely contain m ore inform ation. To m ake it clear, w e illu strate the problem in tw o follow ing exam ples. Example 1 (Fig. 46) illu strates a partial overlay top ology w ith 6 nod es: A, G, H , E, F, T of w hich A is the only encod er. N od es A, G, H each has tw o blocks B1 and B2. Encod er A has notified nod e E, F w ith 4 blocks A 1-A 4, each nod e w ith tw o new ly cod ed blocks. N od es G, H have notified E, F w ith blocks B1 and B2. The cou nt of each block in the neighborhood is given in the tables (Fig. 4). Su pp ose d u e to bottlenecks, E and F, each can only d ow nload one new block. If E and F select blocks u sing original rarest-first algorithm , there is 1/ 8 chance that both w ill d ow nload the sam e block B1 or B2 w hich resu lts in nod e T can only d ow nload one new block w hile its available band w id th allow s tw o (Fig. 5). In Fig. 6, if E and F prefer cod ed blocks from encod er A over other blocks, T can alw ays d ow nload tw o new blocks. Example 2 (Fig. 710) consid ers a p artial overlay topology in w hich an encod er A is d elivering cod ed blocks to non-cod ing nod es E, F, and T. At the beginning, A has tw o blocks B1 and B2, and notifies E and F of 4 new ly encod ed blocks: A 1-A 4, tw o blocks for each nod e (Fig. 7). N od e E and nod e F then each can d ow nload one block, e.g. A 1 and A 2 d u e to band w id th lim it. In the m eantim e, A d ow nload s tw o m ore blocks: B3 and B4, and send s new notifications abou t blocks A 5-A 8 to E and F (Fig. 8). If E and F select blocks u sing rarest-first, there is 1/ 9 chance that E chooses A 3 and F chooses A 4 w hich resu lts in peer T being only able to obtain 2 ind epend ent blocks in 2 u nits of tim e (Fig. 9). In contrast, T can d ow nload 4 new blocks if E and F prefer new encod ed blocks over old ones (Fig. 10). The problem therefore is: given a m ixtu re of cod ed and non-cod ed blocks in the neighborhood , w hich blocks shou ld a peer choose to d ow nload .

Post-cod e p rotocol has the ad vantage of prod u cing fresher cod ed blocks w hich expected ly accelerate content d istribu tion. The lim itation, how ever, is that it requ ires m ore protocol overhead : in total 5 m essages for each d ow nload ed block com p ared w ith 3 m essages in case of pre-cod e protocol.

5 BLOCK SELECTION PROBLEM


In this section, w e d escribe in d etail the block selection problem associated w ith hybrid netw ork cod ing sy stem s and propose ou r solu tion for it. The proposed block sele ction, w hich can be u sed w ith either of the tw o protocols in the last section, com pletes ou r proposal for an efficient, high-perform ance P2P content d istribu tion w ith netw ork cod ing. We begin by d escribing the d u plication p roblem in su ch a system u sing the original rarest -first block selection.

5.1 Duplication Problem with Current Rarest-first Block Selection The block selection algorithm u sed by BitTorrent is rarest first by w hich peers choose the rarest block in the neig hborhood to d ow nload first. If there are several rarest blocks, a rand om one is selected from those rarest blocks 3. Rarest-first selection is not enou gh becau se of tw o reasons. 1) Encod ers com bine m ore inform ation in the neig hborhood . When there is lim ited available ban d w id th, for exam ple w hen a bottleneck exists, non cod ed blocks and cod ed blocks cannot be given the sam e attention. Cod ed blocks from the encod ers shou ld be preferred becau se they contain, in a sense, m ore inform ation and can accelerate content d istribu tion throu gh the bottleneck.
2) Cod ed blocks are not equ ally im portant. Each cod ed block even thou gh is alw ays u niqu e, i.e. rare, in the sense that alm ost alw ays no tw o cod ed blocks are id entical, the level of importance of each cod ed block is d ifferent. Cod ed blocks are created progressively from all the blocks an encod er has d ow nloa d ed . In the beginning, as there are only a few blocks to encod e, the cod ed blocks created then contain w ithin them only the inform ation from that few blocks. The m ore blocks an encod er has, the m ore d ata are com bined to create new cod ed blocks. Becau se of that, only at the sou rce or w hen an encod er has d ow nload ed the fu ll file, are the cod ed blocks
3 In the beginning of the d istribu tion section w hen p eers have no blocks to exchange w ith others, BitTorrent u ses rand om block selection by w hich p eers choose a rand om block in the neighborhood to d ow nload . N evertheless, after a p eer has acqu ired som e blocks, it sw itches to rarest block selection.

5.2 Proposed Block Selection Algorithm


Ou r proposed algorithm is given in Algorithm 1. It w orks seam lessly in all types of netw orks: pu re non -cod ing, fu llscale netw ork cod ing, and hybrid netw ork cod ing. We ALGORITHM 1 PROPOSED BLOCK SELECTION ALGORITHM Given a set of cod ed and non -cod ed blocks w ith their correspond ing nu m ber of occu rrence 1. 2. Sort blocks in d escend ing ord er of their rar eness (i.e. ascend ing ord er of their occu rrence). Choose the rarest block for dow nload . If there are several blocks w ith the sam e rareness choose a block in the follow ing ord er a block encoded by one neighbor, i.e. a cod ed block w hich has encoder-id of the neighbor; if there are several cod ed blocks from a neighbor, prefer the block w ith largest block-id (m ost recent one) a block at random (cod ed or non-cod ed )

a.

b.

JOURNAL OF COMPUTING, VOLUME 5, ISSUE 4, APRIL 2013, ISSN (Online) 2151-9617 https://sites.google.com/site/journalofcomputing WWW.JOURNALOFCOMPUTING.ORG

14

extend rarest-first selection to give preference to cod ed blocks from im m ed iate neighbors over other ones (Alg orithm 1 2a). Also, from the sam e encod ing neighbor, new er cod ed blocks are preferred over old er ones. In d oing so, w e allow valu able new ly encod ed blocks in the neighborhood to be qu ickly d issem inated w hile preserving the pow er of rarest-first in d istribu ting new inform ation. Ou r algorithm im provem ent is generally significant. Withou t it, new ly cod ed blocks, virtu ally w ith m ore inform ation, are arbitrarily blocked in the netw ork b ecau se neighboring peers m ay choose not to d ow nload them .

Fig. 11. A 2-cluster topology with a middle node i.

6 PERFORMANCE EVALUATION
We im plem ented a C++ sim u lator of the hybrid netw ork cod ing P2P content d istribu tion system . We evalu ate the proposed block-selection algorithm in section 5 u sing either pre-cod e or post-cod e protocol in section 4 and com pare the perform ance w ith a baseline netw ork cod ing BitTorrent system . The baseline system u ses Bit Torrents original rarest first block selection and the pre-cod e protocol. A file is d istribu ted from the sou rce to all particip ating peers, am ong w hich a p reset nu m ber of peers are allow ed to encod e. The file is d ivid ed into sm aller fix-sized parts, i.e. blocks. The sou rce and all peers exchange blocks u ntil all peers acqu ire enou gh blocks to constru ct the original file; then the sim u lation finishes. The sim u lations are rou nd -based . Each peer chooses blocks to d ow nload accord ing to its available band w id th, rarest block first selection, and the incentive schem e at the beginning of each rou nd . The chosen blocks are d ow nload ed by the peer at the end of the rou nd and then the system m oves to the next rou nd . After a peer has collected enou gh blocks, it stops d ow nload ing bu t keeps staying in the system to serve other peers. Each overlay link capacity is m easu red by block per rou nd , i.e. how m any blocks can be transferred throu gh the link in a rou nd . We d isregard the overhead of send ing encod ing coefficients associated w ith rand om linear cod ing. To captu re the essence of the system , w e assu m e a sta tic scenario, i.e. there is no change in the physical topology and the overlay topology d u ring a content d istribu tion session. The insight obtained from this static case is crit ically im portant for fu tu re w ork w hich investigates the d ynam ic scenario. We im plem ented m u tu al exchange incentive schem e in the sim u lations: w hen there is contention for u pload ing, a send ing peer preferably u p load s to the neighbors from w hom it is also d ow nload ing. After su ch peers are e xhau sted , other neighbors are chosen for u pload . This kind of incentive schem es has p reviou sly been u sed in [4]. For a given netw ork topology w e ru n sim u lations 100 tim es and collect the average finish tim e of all peers.

Fig. 12. Finish time of the proposed system compared with baseline system in a clustered topology.

blocks are com ing p rogressively to nod e i. Within a clu ster, peers are arranged in k-regu lar rand om topologies w here k is from 3 to 6. Each clu ster has 1000 nod es w ith 1 block per rou nd band w id th betw een neighbors w ithin a clu ster. Sou rce band w id th to nod e i is 8 blocks per rou nd and from nod e i to each clu ster is 4 blocks per rou nd . The tw o clu sters are connected by a link w ith a capacity of 1 block/ rou nd . The sou rce d elivers a 200-block file to all peers. Fig. 12 com pares the finish tim e of ou r system u sing the proposed block selection algorithm (w ith either precod e or post-cod e protocol) and the finish tim e of the baseline system in three cases: no coding, cod ing at nod e i, and network coding. As w e expect, no coding finish tim e is the sam e for both system s. Finish tim e im provem ent of the prop osed system becom es evid ent w hen nod e i cod es (arou nd 5%) and w hen all nod es cod e (arou nd 10%). In this topology, the finish tim e is the sam e for both precod e and post-cod e protocols.

6.1 Clustered Topologies We first evalu ate perform ance in a sim ple topology of tw o clu sters (Fig. 11). A m id d le nod e i intercepts betw een the sou rce and the clu sters to sim u late a situ ation w here

6.2 Small-world Network Topologies P2P netw orks have been show n to exhibit small-world properties [10]. We u se Watts and Strogatz sm all-w orld netw ork m od el [7] to generate m ore com plex topologies w ith 5000 peers. By varying the sm all-w orld netw orks rew iring probability p w e can change the netw ork topology. We set capacity of all links to 1 block/ rou nd , the d egree k=6, and change the rew iring probability p in sim u lations. We sim u late tw o real-life scenarios.
1) Optimization scenario : encod ers are placed at se-

JOURNAL OF COMPUTING, VOLUME 5, ISSUE 4, APRIL 2013, ISSN (Online) 2151-9617 https://sites.google.com/site/journalofcomputing WWW.JOURNALOFCOMPUTING.ORG

15

Fig. 13. Finish time of the proposed system when choosing nodes with highest betweenness centrality as encoders compared with finish time of baseline system.

Fig. 14. Finish time using the proposed system compared with a baseline system in case encoders are placed at highdegree peers

lected peers to m inim ized d istribu tion tim e. We u se tw o placem ent m ethod s: betweenness centrality placem ent [15]: nod es w ith high betw eenness centrality valu es [9] are chosen as encod ers. Betw eenness centrality m easu res the d egree that a nod e lies in the shortest p aths b etw een other nod es. Cod ing at high betw eenness centrality peers can im prove content d istribu tion to m ore d ow nstream peers 4. degree-based placem ent: encod ers are placed at nod es w ith high d egrees first. 2) Resource-constraint scenario : nod es w ith higher cap acity can encod e, nod es having lim ited resou rces cannot. Am ong peers, w e set som e rand om ones w ith rich resou rces and assign them as encod ers. We increase the nu m ber of encod ers from 0 (no coding) to 5000 (network coding) and com pare the perform ance of the proposed system w ith the baseline system in tw o scenarios above. The resu lts are given in Fig. 13, Fig. 14, and Fig. 15 w ith rew iring p robability p=0.02. When betw eenness centrality is u sed to optim ize encod er placem ent, the proposed block selection together w ith pre-cod e p rotocol shortens d istribu tion tim e by abou t 15% com pared to the baseline system w ith only 250 encod ers (Fig. 13). With m ore encod ers, the im provem ent is higher and reaches m ore than 25% w hen all nod es encod es. The finish tim e of no coding, i.e. the nu mber of encod ers is zero, is the sam e regard less of w hich block selection algorithm and protocol are u sed . With 2000 or less encod ers chosen at rand om , i.e. a set of rand om peers are allow ed to encod e, there is not m u ch finish tim e im provem ent u sing both rarest-first and the proposed block selection (Fig. 15). That is becau se a few encod ers at rand om , w ithou t a proper p lacem ent, are not effective in im proving d istribu tion tim e. When a large nu m ber of encod ers, e.g. 3000 or 4000 encod ers, are ra nd om ly d eployed , the proposed block selection w ith precod e p rotocol can im prove d istribu tion tim e by arou nd 15% com p ared to baseline system . The finish tim e u sing d egree-based placem ent lies be4

Fig. 15. The performance of the proposed system compared with baseline system in resource-constraint scenario when only (random) high-capacity peers are allowed to encode.

tw een the other tw o placem ents. As before, the proposed system achieves noticeable finish tim e im provem ent com pared to the baseline system u sing rarest selection (Fig. 14). We next change the rew iring probability p from 0.02 to 0.05 to evalu ate ou r system in a w id e range of top ologies. Using 250 encod ers am ong the total of 5000 peers, the finish tim e im provem ent com pared w ith non -cod ing BitTorrent (w ith no encod er) is presented in Fig. 16, Fig. 17, and Fig. 18. Ou r proposed system (proposed selection + pre-code and proposed selection + post-code) alw ays achieves im proved perform ance com pared w ith the baseline system . The im provem ent, how ever, is more visible in topologies w ith low rew iring probabilities (p=0.02). H igh rew iring probabilities generate alm ost rand om topologies in w hich the effect of cod ing, in general, is not so noticeable. The perform ance of post-cod e protocol (proposed selection + post-code) is better than pre-cod e protocol (proposed selection + pre-code) in low -rew iring topologies p=0.02 (Fig. 13-15). The reason is becau se w ith post-cod e protocol encod ers can com bine m ore u pd ated inform ation to send to the receivers as w e have d iscu ssed before. In topologies w ith higher rew iring probabilities ( p0.1) (Fig. 16, 17, and

We d iscu ss the strategy to p lace encod ers in another w ork [15].

JOURNAL OF COMPUTING, VOLUME 5, ISSUE 4, APRIL 2013, ISSN (Online) 2151-9617 https://sites.google.com/site/journalofcomputing WWW.JOURNALOFCOMPUTING.ORG

16

Fig. 16. Finish time improvement of the proposed system and baseline system using 250 encoder placed at high betweenness centrality peers compared with non-coding BitTorrent.

Fig. 17. Finish time improvement of the proposed system and baseline system using 250 encoder placed at highdegree peers compared with non-coding BitTorrent.

18), since new inform ation can transfer throu gh m ore r ew iring links, post-cod e protocol is no longer m ore effective than pre-cod e protocol. We note that in the sim u lations, w e have not taken into accou nt the overhead of protocols u sed to com m u nicate betw een peers.

7 CONCLUSION
We have proposed inform ation exchange protocols and its associated block-selection algorithm to im prove perform ance of a hybrid netw ork cod ing P2P system in w hich encod ing-enabled and non -encod ing peers coexist. Ou r d esign is sim ple, backw ard com p atible to BitTorrent, yet efficient in the w ay it hand les blocks of d ata: cod ed and non-cod ed alike. We prop osed tw o protocols. The first one, pre-code protocol, is an extension of BitTorrent w ith the ad d ition of an encoder-id field in the exchanged m essages to id entify from w hom the blocks are generated . The second one, nam ely post-code, by postp oning the encod ing process, can com bine and d eliver m ore u pd ated inform ation to the receivers and achieve shorter finish tim e. Post-code protocol is m ore effective in severely bottlenecked topologies. The trad e-off is, how ever, higher protocol overhead . Ou r block-selection algorithm is d erived from observ ation on the benefit of netw ork cod ing in elim inating d ata d u plication. Using ou r p roposed algorithm , peers can effectively choose blocks to d ow nload w hich resu lts in consid erable im p rovem ent in d istribu tion tim e. We believe ou r proposed solu tion, w hich prom otes netw ork cod ing as a m ethod to shorten d istribu tion tim e even if encod ing is not fu lly enabled at every peer, w ill be of great u se in heterogeneou s P2P system s and / or w hen there is a need to m inim ize resou rce consu m ption. For fu tu re w ork, w e plan to evalu ate the proposed d esign and block selection algorithm in a d ynam ic setting. We are also interested in im plem enting the proposal in a real system , especially to evalu ate the actu al trad e-off and effectiveness of the post-cod e protocol. In this paper, w e have not ad d ressed incentive issu es: how to m otivate peers to en cod e, w hich is another interesting problem w e leave for fu tu re w ork.

Fig. 18. Finish time improvement of the proposed system and baseline system using 250 encoder placed at random peers compared with non-coding BitTorrent.

ACKNOWLEDGMENT
This w ork w as su p ported by JSPS KAKEN H I Grant N u m ber (24500098).

REFERENCES
R. Ahlswede, N. Cai, S. R. Li, and R. W. Yeung, Network Information Flow, IEEE Transactions on Information Theory, July 2000. [2] T. Ho, R. Koetter, M. Medard, D. Karger, and M. Effros, The Benefits of Coding over Routing in a Randomized Setting, ISIT, Japan, 2003. [3] B. Cohen, Incentives Build Robustness in BitTorrent, P2P Economics Workshop, 2003. [4] C. Gkantsidis and P. R. Rodriguez, "Network Coding for Large Scale Content Distribution", IEEE INFOCOM, March 2005. [5] A. Legout, G. Urvoy-Keller, and P. Michiardi, Rarest first and choke algorithms are enough, ACM SIGCOMM IMC 2006. [6] P. Chou, Y. Wu, and K. Jain, Practical network coding, in Proc. Annual Allerton Conference 2003. [7] Watts, Duncan J., Strogatz, Steven H. (June 1998) "Collective dynamics of 'small-world' networks", Nature 393 (6684): 440442. [8] M. Langberg, A. Sprintson, and J. Bruck, "The encoding complexity of network coding", IEEE Trans. on Information Theory, pp. 2386 - 2397, June 2006. [9] L.C. Freeman, A set of measures of centrality based on betweenness, 1977, Sociometry, vol. 40, No. 1, 35-41. [10] N Leibowitz, M. Ripeanu, A. Wierzbicki, Deconstructing the kazaa network, in proceedings of WIAPP 2003. [1]

JOURNAL OF COMPUTING, VOLUME 5, ISSUE 4, APRIL 2013, ISSN (Online) 2151-9617 https://sites.google.com/site/journalofcomputing WWW.JOURNALOFCOMPUTING.ORG

17

[11] D. Nguyen, H. Nakazato, Peer-to-Peer Content Distribution in Clustered Topologies with Sou rce Coding, IEEE GLOBECOM 2011, Dec. 2011. [12] N. Cleju, N. Thomos, P. Frossard, Network Coding Node Placement for Delay Minimization in Streaming Overlays, IEEE ICC 2010. [13] S. Li, R. Yeung, and N. Cai, Linear network coding, IEEE Transa ctions on Information Theory, 2003. [14] D. Nguyen, H. Nakazato, Rarest-first and Coding Are Not Engough , IEEE GLOBECOM 2012, Dec. 2012. [15] D. Nguyen, H. Nakazato, Network Coder Placement for Peer -to-Peer Con tent Distribution, IEICE Tech. Report CS2012-74, Nov. 2012. [16] C Gkantsidis, J Miller, P Rodriguez, "Comprehensive view of a live network coding P2P system," ACM SIGCOM IMC '06. [17] L.C. Freeman, A set of measures of centrality based on betweenness, 1977, Sociometry, vol. 40, No. 1, 35-41. [18] L.C. Freeman, S.P. Borgatti, D.R. White, "Centrality in valued graphs: a measure of betweenness based on network flow", Social Networks 13, 141154, 1991. [19] A Legout, G Urvoy-Keller, P Michiardi, "Understanding BitTorrent: An Experimental Perspective," Tech. Report, INRIA-00000156, VERSION 3 - Nov. 2005. [20] C. Yin, B. Wang, W. Wang, T. Zhou, and H. Yang, Efficient routing on scale-free networks based on local information, Physics Letters A, Vol. 351, Issues 4-5, 6 March 2006, pp.220-224. [21] M. Kim, M. Medard, V. Aggarwal, U.-M. O'Reilly, W. Kim, C. W. Ahn, and M. Effros, ``Evolutionary Approaches to Minimizing Network Coding Resources,'' Proc. IEEE INFOCOM 2007, May 2007. [22] K. Bhattad, N. Ratnakar, R. Koetter, and K. R. Narayanan, ``Minimal network coding for multicast,'' Proc. IEEE ISIT 2005, Sep. 2005.

Dinh Nguyen received his Bachelor of Electronics and Telecomm. degree from Hanoi University of Technology, Vietnam, in 1999. From 1999 he was with NetNam ISP Corporation. He received his MSc in 2006 and currently is a Ph.D. candidate at Graduate School of Global Information and Telecommunications Studies, Waseda University, Tokyo, Japan. His research interests include peer-to-peer systems, network coding, and content distribution systems. Hidenori Nakazato received his B. Engineering degree in electronics and telecommunications from Waseda University in 1982 and his MS and Ph.D. degrees in computer science from University of Illinois in 1989 and 1993, respectively. He was with Oki Electric from 1982 to 2000. Since 2000, he has been a faculty member of Graduate School of Global Information and Telecommunications Studies, Waseda University. He served as the editor of IEICE Transactions on Communications from 1999 to 2002 and other positions in the executive committee of IEICE Communication Society from 1997 to 2004, and from 2008 to now. He also served as an executive committee member of IEEE Region 10 and is serving as a member of several IEEE Member and Geographic Activity committees. His research interests include performance issues in distributed systems and networks. He is a member of ACM, IEEE, and IPSJ.

You might also like