peer - to - peer ( p2p ) communication in the internet is provided through the sharing of widely distributed resources typically involving end users computers acting as both clients and servers . in an unstructured peer - to - peer network , such as _ bittorrent _
@xcite , a file is divided into many pieces .
seeds , which hold all pieces , distribute pieces to peers .
new peers continually arrive into the network ; they simultaneously download pieces from a seed or other peers and upload pieces to other peers .
peers exit the system after they collect all pieces .
determining whether a given p2p network is stable can be difficult .
roughly speaking , the aggregate transfer capacity scales up in proportion to the number of peers in the network , but it has to be in the right places .
many p2p systems have performed well in practice , and they incorporate a variety of mechanisms to help achieve stability . a broad problem , which we address in part , is to provide a better understanding of which mechanisms are the most effective under various network settings .
these mechanisms include    * _ rarest first piece selection policies , _ such as the one implemented in bittorrent , whereby peers determine which pieces are rarest among their neighbors and preferentially download such pieces . * _ tit - for - tat participation constraints , _ such as the one implemented in bittorrent , whereby peers are choked off from receiving pieces from other peers unless they upload pieces to those same peers .
this mechanism provides an important incentive for peers to participate in uploading pieces , but it may also be beneficial in balancing the distribution of pieces . * _ peers dwelling in the network after completing download , _ to provide extra upload capacity . *
_ network coding @xcite , _ whereby data pieces are combined to form coded pieces , giving peers numerous ways to collect enough information to recover the original data file .
this paper determines what parameter values yield stability for a simple model of a p2p file sharing network .
the main model does not include the enhancements mentioned in the previous paragraph , but extensions and discussion regarding the above mechanisms is given .
the model includes a fixed seed in the network that uploads with a constant rate .
new peers arrive according to a poisson process , and have no pieces at the time of arrival .
_ random peer contact _ is assumed ; each peer contacts a randomly selected target peer periodically .
_ random useful piece selection _ is also assumed ; each peer chooses which piece to download uniformly at random from the set of pieces that its selected target has and it itself does not have . as in the bittorrent system , we assume that new peers arrive with no pieces ; in effect a peer must first obtain a piece from another peer or the fixed seed before it can begin uploading to other peers .
we also assume that peers depart as soon as they have completed their collection .    in a p2p network ,
the last few pieces to be downloaded by a peer are often rare in the network , so it usually takes the peer a long time to finish downloading .
this phenomenon has been referred to as the _ delay in endgame mode _
@xcite ( or _ last piece problem _ ) .
we refer to the specific situation that there are many peers in the network and most of them are missing only one piece which is the same for all peers , as the _ missing piece syndrome_. in that situation , peers lucky enough to get the missing piece usually depart immediately after getting the piece , so their ability to spread the missing piece is limited .
the main result in this paper is to show , as suggested by the missing piece syndrome , that the bottleneck for stability is the upload capacity of the seed .
specifically , if the arrival rate of new peers is greater than the seed upload rate , the number of peers in the system converges to infinity almost surely ; if the arrival rate of new peers is less than the seed upload rate , the system is positive recurrent and the mean number of peers in the system in equilibrium is finite .
the next section gives the precise problem formulation , simulation results illustrating the missing piece syndrome , and the main proposition .
the proposition is proved in sections [ sec : instability ] and [ sec : stability ] , with the help of some lemmas given in the appendix .
section [ sec : extensions ] provides extensions of the result , including consideration of the enhancement mechanisms mentioned above .
in particular , it is shown that the region of network stability is not increased if rarest first piece selection policies , or network coding policies , are applied .
section [ sec : extensions ] also provides a conjecture regarding a refinement of the main proposition for the borderline case when the arrival rate is equal to the seeding rate ; it is suggested that whether the system is stable then depends on the rate that peers contact each other .
the model in this paper is similar to the flat case of the open system of massouli and vojnovi @xcite .
the model in @xcite is slightly different in that , rather than having a fixed seed , it assumes that new peers each arrive with a randomly selected piece .
a fluid model , based on the theory of density - dependent jump markov processes ( see @xcite ) , is derived and studied in @xcite .
it is shown that there is a finite resting point of the fluid ordinary differential equation .
the analysis in this paper is different and complementary . rather than appealing to fluid limits , we focus on direct stochastic analysis methods , namely using coupling to prove transience for some parameter values and the foster - lyapunov stability criterion to prove positive recurrence for complementary parameter values .
furthermore , our work shows the importance of considering asymmetric sample paths even for symmetric system dynamics .
forthcoming work described in @xcite provides analysis of p2p networks with peers having pieces upon arrival , as in @xcite , and with peers remaining for some time in the system after obtaining a complete collection .
some other works related to stability and the missing piece syndrome are the following .
the instability phenomenon identified in this paper was discovered independently by norros et al .
norros et al .
@xcite proved a version of our main proposition for a similar model , for the case of two pieces . in the model of @xcite
a peer receives one piece on arrival , with the distribution of the piece number ( either one or two ) being determined by sampling uniformly from the group consisting of a fixed seed and the population of peers already in the system .
menasch et al @xcite pointed out that in their simulation studies , their  smooth download assumption " and  swarm sustainability " break down if the seed upload rate is not sufficiently large .
leskel et al .
@xcite investigate stability conditions for a single piece file , or a two piece file when the pieces are obtained sequentially , when peers remain in the system for some time after obtaining the piece .
the earliest papers to analytically study unstructured peer - to - peer files systems with arrivals of new peers are @xcite .
these papers provide simple models in which a two dimensional differential equation is used that does not take into account the stages of service as peers gain more pieces .
the model in this paper is a composite of models in @xcite .
it incorporates poisson arrivals , fixed seed , random uniform contacts , and random useful piece selection , as follows .
the parameters of the model are an integer @xmath0 and strictly positive constants @xmath1 and @xmath2    * there are @xmath3 pieces and @xmath4 so that @xmath5 indexes all the pieces . * the set of proper subsets of @xmath5 is denoted by @xmath6 * a peer with set of pieces @xmath7 for some @xmath8 is called a _ type @xmath9 peer_. * a type @xmath9 peer becomes a type @xmath10 peer if it downloads piece @xmath11 for some @xmath12 * a markov state is @xmath13 with @xmath14 denoting the number of type @xmath9 peers , @xmath15 denoting the number of peers in the system , and @xmath16 denoting the state space of the system . * peers arrive exogenously one at a time with no pieces ; the times of arrival form a rate @xmath17 poisson process . *
each peer contacts other peers , chosen uniformly at random from among all peers , for opportunities to download a piece ( i.e. pull ) from the other peers , according to a poisson process of rate @xmath18 mathematically , an equivalent assumption is the following .
each peer contacts other peers , chosen uniformly at random from among all peers , for opportunities to upload a piece ( i.e. push ) to the other peers , according to a poisson process of rate @xmath18 * downloads are modeled as being instantaneous .
this assumption is reasonable in the context of the previous assumption . *
random useful piece selection is used , meaning that when a peer of type @xmath9 has an opportunity to download a piece from a peer of type @xmath19 the opportunity results in no change of state if @xmath20 otherwise , the type @xmath9 peer downloads one piece selected at random from @xmath21 , with all @xmath22 possibilities having equal probability .
* there is one fixed seed , which at each time in a sequence of times forming a poisson process of rate @xmath23 selects a peer at random and uploads a random useful piece to the selected peer .
* peers leave immediately after obtaining a complete collection .    given a state @xmath24 ,
let @xmath25 denote the new state resulting from the arrival of a new peer .
given @xmath8 @xmath26 such that @xmath27 and a state @xmath24 such that @xmath28 let @xmath29 denote the new state resulting from a type @xmath9 peer downloading piece @xmath30 the positive entries of the generator matrix @xmath31 of the markov process are given by : @xmath32    to provide some intuition , we present some simulation results .
figure [ fig.peers_sim ] shows simulations of the system for @xmath33 and @xmath34 pieces .
( dashed ) and @xmath35 ( solid ) , and the second is for @xmath36 ( dashed ) and @xmath37 ( solid ) .
[ fig.peers_sim ] , title="fig:",width=226 ]   ( dashed ) and @xmath35 ( solid ) , and the second is for @xmath36 ( dashed ) and @xmath37 ( solid ) .
[ fig.peers_sim ] , title="fig:",width=226 ]    the first plot shows apparently stable behavior . after an initial spike
, the number of peers in the system seems to hover around 30 ( for @xmath38 ) or 45 ( for @xmath35 ) , which by little s law is consistent with a mean time in system around 50 to 60 time units ( or about 25% to 50% larger than the sum of the download times ) .
however , the second plot shows that for @xmath36 or @xmath39 the number of peers in the system does not appear to stabilize , but rather to grow linearly .
the explanation for this instability is indicated in figure [ fig.pieces_sim ] , which shows the time - averaged number of peers that held each given piece during the simulations , for @xmath38 in the first plot and for @xmath37 in the second plot .
the first plot shows that the 40 pieces had nearly equal presence in the peers , with piece 7 being the least represented .
the second plot shows that 39 pieces had nearly equal presence and most of the peers had these pieces most of the time , but only a small number of peers held piece 3 .      and the second is for @xmath40 the dashed lines indicate time - average number of peers in system .
[ fig.pieces_sim ] , title="fig:",width=377 ]   and the second is for @xmath40 the dashed lines indicate time - average number of peers in system .
[ fig.pieces_sim ] , title="fig:",width=377 ]    the following proposition , which is the main result of this paper , confirms that the intuition behind the simulation results is correct .
[ prop.seed_only ] ( i ) if @xmath41 then the markov process is transient , and the number of peers in the system converges to infinity with probability one .
( ii ) if @xmath42 the markov process with generator @xmath43 is positive recurrent , and the equilibrium distribution @xmath44 is such that @xmath45    in the remainder of this section , we give an intuitive explanation for the proposition , which also guides the proof .
we first give an intuitive justification of proposition [ prop.seed_only](i ) , so assume @xmath46 under this condition , eventually , due to random fluctuations , there will be many peers in the system that are all missing the same piece . while any of the @xmath3 pieces could be the missing one , to be definite we focus on the case that the peers are missing piece one .
a peer is said to be in the _ one club _ , or to be a one - club peer , if it has all pieces except piece one .
we consider the system starting from an initial state in which there are many peers in the system , and all of them are in the one club .
the system then evolves as shown in figure [ fig.oneclub ] .
, title="fig:",width=264 ]    the large size of the box showing the one club indicates that most peers are one club peers .
a peer not in the one club is said to be a _ young peer _ , and
a young peer is said to be _ normal _ if it does not have piece one and _ infected _ if it does have piece one .
since there are so many one club peers to download from , a peer does nt stay young very long ; most of the young peers join the one club soon after arrival .
however , due to the fixed seed uploading pieces , some of the normal young peers become infected peers .
those infected peers can infect yet more young peers , thereby forming a branching process .
but typically the infected young peers do not infect other young peers , so that the branching process is highly subcritical .
therefore , the rate of departures from the one club due to uploads of piece one from infected peers is small .
therefore , most peers eventually enter the one club , and the main way that peers leave the one club is to receive piece one directly from the fixed seed .
so the long term arrival rate at the one club is close to @xmath17 and the departure rate from the one club is close to @xmath2 therefore , the one club can grow at rate close to @xmath47 while the number of young peers will stay about constant .
these ideas are made precise in the proof .
to understand why the system is stable for @xmath48 the rough idea is to show that whenever there are many peers in the system , no matter what the distribution of pieces they hold , the system moves towards emptying out .
if there are many peers in the system , one of the following two cases holds .
the first case is that most of the peers have the same number , say @xmath49 , of pieces .
intuitively , the worst case would be for all peers with @xmath49 pieces to have identical collections of pieces , in which case no peer with @xmath49 pieces would be useful to another .
however , if @xmath48 such a state ca nt persist , because peers with @xmath49 pieces get additional pieces from the fixed seed at an aggregate rate near @xmath23 while the long term rate that new peers with exactly @xmath49 pieces can appear is less than or equal to @xmath50 if the system is not in the first case just described , then there are at least two sizeable groups of peers , so that all the peers in the first group have one number of pieces and all peers in the second group have some larger number of pieces
. then all peers in the second group can be helpful to any peer in the first group , so that there will be a large rate of downloads .
thus , if there are many peers in the system , no distribution of the pieces they hold can persist . to prove stability
, it is still necessary to show that the state ca nt spiral out to ever increasing loads through some quasi - periodic behavior .
this is achieved through the use of a potential function and the foster - lyapunov stability criterion .
proposition [ prop.seed_only](i ) is proved in this section ; it can be read independently of the proof of proposition [ prop.seed_only](ii ) in the next section .
the proof follows along the lines of the intuitive explanation given just after the statement of the proposition in section [ sec : formulation ] , and an additional explanation of the proof is provided in a remark at the end of the section .
assume @xmath46 if @xmath51 the system reduces to an @xmath52 queueing system with arrival rate @xmath17 and departure rate @xmath53 , in which case the number of peers in the system converges to infinity with probability one .
so for the remainder of this proof assume @xmath54 to begin :    * select @xmath55 so that @xmath56 * select @xmath57 so that @xmath58 and @xmath59 it follows from that @xmath60 * select @xmath61 small enough that @xmath62 * select @xmath63 large enough that @xmath64}2^{-b}}{1 - 2^{-\epsilon_o}}\leq 0.1 ,   \label{eq.bmminfty }   \\ \frac{64k^2 \xi u_s}{2b(\epsilon-4k\xi u_s ) } \leq 0.1 ,     \label{eq.bmm1 }   \\ \frac{\lambda}{2b\epsilon } \leq 0.1,~~\mbox{and}~~\frac{u_s}{2b\epsilon } \leq 0.1 . \label{eq.bpoi}\end{aligned}\ ] ] * select @xmath65 large enough that @xmath66 .
we shall use the notions of one club , young peer , and infected young peer , as described in the paragraph after proposition [ prop.seed_only ] . for a given time
@xmath67 define the following random variables :    * @xmath68 cumulative number of arrivals , up to time @xmath69 * @xmath70 number of peers at time @xmath69 * @xmath71 number of young peers at time @xmath69 * @xmath72 cumulative number of uploads of piece one by infected peers , up to time @xmath69 * @xmath73 cumulative number of uploads of piece one by the fixed seed , up to time @xmath69    the system is modeled by an irreducible , countable - state markov process .
a property of such random processes is that either all states are transient , or no state is transient .
therefore , to prove proposition [ prop.seed_only](i ) , it is sufficient to prove that some particular state is transient . with that in mind , we assume that the initial state is the one with @xmath65 peers , and all of them are one - club peers . let @xmath74 be the extended stopping time defined by @xmath75 with the usual convention that @xmath76 if @xmath77 for all @xmath78 it suffices to prove that @xmath79    the equation depends on the transition rates of the system out of states such that @xmath80 thus , we can and will prove instead for an alternative system , that has the same initial state , and the same out - going transition rates for all states such that @xmath81 as the original system .
the alternative system is defined by modifying the original system by letting the rate of downloads from the set of one - club peers by each young peer be @xmath82 , and the aggregate rate of downloads from the fixed seed to the set of young peers be @xmath83 note that the rates used for this definition are equal to the original ones on the states such that @xmath84 as required .
the alternative system has the following two properties :    1 .
each young peer receives opportunities to download from one - club peers at rate greater than or equal to @xmath85 2 .
the fixed seed contacts the entire population of young peers at aggregate rate less than or equal to @xmath86    _ for the remainder of this proof we consider the alternative system , but for brevity of notation , use the same notation for it as for the original system , and refer to it as the original system .
_    the following four inequalities will be established , for @xmath87 and @xmath65 satisfying the conditions given near the beginning of the section .
@xmath88    let @xmath89 be the intersection of the four events on the left sides of - .
since @xmath90 is greater than or equal to the number of peers in the system that do nt have piece one , on @xmath89 , + @xmath91 for all @xmath92 therefore , on @xmath89 , for any @xmath67 @xmath93 thus , @xmath89 is a subset of the event in .
therefore , if - hold , @xmath94 and is implied .
so to complete the proof , it remains to prove - .
the process @xmath95 is a poisson process with rate @xmath17 , and @xmath96 is stochastically dominated by a poisson process with rate @xmath53 .
thus , both and follow from kingman s moment bound ( see lemma [ lemma : kingman ] in the appendix ) and the conditions in on @xmath97    turning next to the proof of , we shall use the following observation about _
stochastic domination _
( the notion of stochastic domination is reviewed in the appendix ) .
the observation is a mathematical version of the statement that the number of young peers remains roughly bounded because peers do nt stay young for long .
[ lemma.mg1compare ] the process @xmath98 is stochastically dominated by the number of customers in an @xmath99 queueing system with initial state zero , arrival rate @xmath100 and service times having the gamma distribution with parameters @xmath101 and @xmath85    the idea of the proof is to show how , with a possible enlargement of the underlying probability space , an @xmath99 system can be constructed on the same probability space as the original system , so that for any time @xmath69 , @xmath102 is less than or equal to the number of peers in the @xmath99 system . let the @xmath99 system have the same arrival process as the original system  it is a poisson process of rate @xmath50 for any young peer , the intensity of downloads from the one club ( i.e. from any peer in the one club ) is always greater than or equal to @xmath103 for the original system , where we use the fact @xmath104 which is true by and the assumption @xmath54 we can thus suppose that each young peer has an internal poisson clock , which generates ticks at rate @xmath103 , and is such that whenever the internal clock of a young peer ticks , that young peer downloads a piece from the one club .
we declare that a peer remains in the @xmath99 system until its internal clock ticks @xmath101 times .
this gives the correct service time distribution , and the service times of different peers in the @xmath99 system are independent , as required .
a young peer can possibly leave the original system sooner than it leaves the @xmath99 system , because a young peer in the original system can possibly download pieces at times when its internal clock does nt tick .
but if a young peer is still in the original system , it is in the @xmath99 system .    given this lemma ,
follows from lemma [ lemma.mginfty ] with @xmath105 in the lemma equal to @xmath106 , and @xmath107 in the lemma equal to @xmath108 and .
it remains to prove .
+ consider the following construction of a stochastic system that is similar to the original one , with random variables that have similar interpretations , but with different joint distributions .
we call it the _ comparison system . _
it focuses on the infected peers and the uploads by infected peers , and it is specified in table [ table.compare ] .
.specification of comparison system [ cols="<,<",options="header " , ]     it should be clear to the reader that both the original system and the comparison system can be constructed on the same underlying probability space such that any infected peer in the original system at a given time is also in the comparison system .
when such a peer becomes infected in the original system , we require that it also arrives to the comparison system , it discards all pieces it may have downloaded before becoming infected , and it subsequently ignores all opportunities to download except those occurring at the times its internal clock ( described in the proof of lemma [ lemma.mg1compare ] ) ticks . because infected young peers possibly stay longer in the comparison system than in the original system , some of the peers in the comparison system correspond to peers that already departed from the original system .
there can also be some infected peers in the comparison system that never existed in the original system because the arrival rate of infected peers to the comparison system is greater than the arrival rate for the original system .
but whenever there is an infected peer in the original system , that peer is also in the comparison system , and the following property holds .
whenever any one of the following events happens in the original system , it also happens in the comparison system :    * the fixed seed creates an infected peer .
* an infected peer creates an infected peer * an infected peer uploads piece one to a one - club peer    events of the second and third type just listed correspond to the two possible ways that infected peers can upload piece one .
therefore , the property implies the following lemma , where @xmath109 is the cumulative number of uploads of piece one by infected peers , up to time @xmath69 , in the comparison system .
[ lemma.onecompare ] the process @xmath110 is stochastically dominated by @xmath111    we can identify two kinds of infected peers in the comparison system  the _ root peers _ , which are those created by the fixed seed , and the infected peers created by other infected peers .
we can imagine that each root peer affixes its unique signature on the copy of piece one that it receives from the fixed seed .
the signature is inherited by all copies of piece one subsequently generated from that piece through all generations of the replication process , in which infected peers upload piece one when creating new infected peers . in this way
, any upload of piece one by an infected peer can be traced back to a unique root peer . in summary , the jumps of @xmath109 can be partitioned according to which root peer generated them . of course , the jumps of @xmath109 associated with a root peer happen after the root peer arrives .
let @xmath112 denote a new process which results when all of the uploads of piece one generated by a root peer ( in the comparison system ) are counted at the arrival time of the root peer . since @xmath113 counts the same events as @xmath114 but does so earlier , @xmath115 for all @xmath92 in view of this and lemma [ lemma.onecompare ] , it is sufficient to prove with @xmath116 replaced by @xmath117    the random process @xmath113 is a compound poisson process .
jumps occur at the arrival times of root peers in the comparison system , which form a poisson process of rate @xmath86 let @xmath118 denote the size of the jump of @xmath113 associated with a typical root peer .
the distribution of @xmath118 can be described by referring to an @xmath119 queueing system with arrival rate @xmath120 and service times having the distribution of a random variable @xmath121 which has the gamma distribution with parameters @xmath101 and @xmath85 note that @xmath122 in is the usual load factor for the reference queueing system : @xmath123.$ ] the reference queueing system is similar to the number of infected peers in the comparison system , except that the customers in the @xmath119 queueing system are served one at a time .
we have @xmath124 where    * @xmath125 is the number of infected peers that are descendants of the root peer ( not counting the root peer itself . ) that includes peers directly created by the root peer , peers created by peers created by the root peer , and so on , for all generations .
@xmath125 has the same distribution as the number of customers in a busy period of the reference queueing system , not counting the customer that started the busy period .
* @xmath126 is the number of uploads of piece one to one - club peers by either the root peer or any of the descendants of the root peer .
the sum of all the times that the root peer and its descendants are in the comparison system is the same as the duration , @xmath127 of a busy period of the reference queueing system .
while in the comparison system , those peers upload piece one to the one club with intensity @xmath128 so @xmath129=\mu e[l]$ ] and @xmath130=\mu^2 e[l]^2 + \mu e[l].$ ]    using this stochastic description , the formulas for the busy period in an @xmath119 queueing system ( and in the appendix ) , and the facts @xmath131 @xmath132=2(k-1)/\mu,$ ] and @xmath133 yields @xmath134 & = &   e[j_1]+e[j_2 ]   =   \frac{1+\mu e[\widehat { x}]}{1-\rho } -1\\ &   \leq    & 2[1 + 2(k-1 ) ] \leq 4k\end{aligned}\ ] ] and @xmath135 \leq e[(j_1 + 1)^2 ] = \frac{1+(\xi u_s)^2 \mbox{var}(\widehat { x})}{(1-\rho)^3 } \leq \frac{1+\rho^2}{(1-\rho)^3}\ ] ] @xmath136 & = &   e [ e[j_2 ^ 2 | l ] ] = \mu e[l ] + \mu^2 e[l^2 ] \\ &   = &   \frac{\mu e[\widehat { x}]}{1-\rho } + \frac{\mu^2 e[\widehat { x}^2 ] } { ( 1-\rho)^3}\end{aligned}\ ] ] @xmath137}\\   & = & e[(j_1 + j_2)^2 ] \leq 2\ { e[j_1 ^ 2 ] + e[j_2 ^ 2 ] \ }   \\ & \leq &   16\ { 2    + \mu e[\widehat { x } ] + \mu^2 e[\widehat { x}^2 ] \ }   \\ & = & 16\left\ { 2    + 2(k-1 ) + 4(k-1 ) + 4(k-1)^2 \right\ } \\ & =   & 16\left\ {   4k^2 - 2k   \right \ }     \leq    64k^2 \end{aligned}\ ] ] thus , @xmath113 is a compound poisson process with arrival rate of batches equal to @xmath138 and batch sizes with first and second moments of the batch sizes bounded by @xmath139 and @xmath140 respectively .
hence , with @xmath116 replaced by @xmath113 follows from corollary [ cor : compoundkingman ] and .
the proof of proposition [ prop.seed_only](i ) is complete .
we briefly explain why the comparison system was introduced in the above proof , to provide a better understanding of the proof technique .
the intuitive idea behind the definition of the comparison system is that it is based on worst case assumptions regarding the number of peers that are infected by the fixed seed ( i.e. the number of root peers ) and the number of uploads of piece one that can be caused by each root peer .
the advantage is then that the arrivals of root peers form a poisson process and the total number of uploads of piece one that can be traced back to different root peers are independent in the comparison system , so that kingman s bound for compound poisson processes , which is a form of the law of large numbers , can be applied .
proposition [ prop.seed_only](ii ) is proved in this section , using the version of the foster - lyapunov stability criterion given in the appendix , and the intuition given in the last paragraph of section [ sec : formulation ] .
if @xmath141 is a function on the state space @xmath142 then @xmath143 is the corresponding drift function , defined by @xmath144 .
$ ] if , as usual , the diagonal entries of @xmath43 are defined to make the row sums zero , then the drift function is also given by matrix - vector multiplication : @xmath145    suppose @xmath146 given a state @xmath24 , let @xmath147 that is , @xmath148 is the number of peers with precisely @xmath11 pieces .
when the dependence on @xmath24 is clear , we write @xmath149 instead of @xmath150 we shall use the foster - lyapunov criteria with the following potential function : @xmath151 where @xmath152 are positive constants and @xmath153      the following two lemmas and their proofs correspond to the two cases described in the intuitive description given in the last paragraph of section [ sec : formulation ] .    [
lem : d_lf_k ] there exist positive values @xmath170 and @xmath171 so that @xmath172 whenever : @xmath173 and , for some @xmath11 , @xmath174    [ lem : d_lf_nk ] let @xmath175 be as in lemma [ lem : d_lf_k ] .
there exist positive values @xmath176 and
@xmath177 so that @xmath178 whenever : @xmath179 and , for all @xmath11 , @xmath180    lemmas [ lem : d_lf_k ] and [ lem : d_lf_nk ] imply that @xmath181 whenever @xmath182 , so that @xmath43 and @xmath141 satisfy the conditions of proposition [ cor.fostercompcontinuous ] with @xmath183 and @xmath184 where @xmath185 therefore , to complete the proof of proposition [ prop.seed_only](ii ) it remains to prove lemmas [ lem : d_lf_k ] and [ lem : d_lf_nk ] .
( proof of lemma [ lem : d_lf_k ] . )
it suffices to prove the lemma for an arbitrary choice of @xmath30 so fix @xmath186 and consider a state @xmath24 such that @xmath187 ( and , in particular , @xmath188 ) .
then for any @xmath189 , @xmath190 use and and an interchange of summation ( @xmath191 ) to get @xmath192 notice that according to , @xmath193 and @xmath194 thus , if @xmath175 is small enough and @xmath195 is large enough , the quantity within braces in is negative .
therefore , if @xmath175 and @xmath107 are small enough , and @xmath171 is large enough , @xmath196 under the conditions of the lemma , whenever @xmath197 lemma [ lem : d_lf_k ] is proved .
( proof of lemma [ lem : d_lf_nk ] . )
let @xmath175 be given by lemma [ lem : d_lf_k ] , and consider a state @xmath24 such that @xmath198 for all @xmath11 .
it follows that there exists @xmath199 and @xmath200 with @xmath201 such that @xmath202 and @xmath203 then @xmath204 the conclusion of the lemma follows because of the term in that is quadratic in @xmath205
a piece selection policy is used by a peer to choose which piece to download whenever it contacts another peer .
the random useful piece selection policy is assumed above , but the results extend to a large class of piece selection policies .
essentially the only restriction needed is that if the contacted peer has a useful piece for the contacting peer , then a useful piece must be downloaded .
this restriction is similar to a work conserving restriction in the theory of service systems . in particular , the results hold for a broad class of rarest first piece selection policies .
peers can estimate which pieces are more rare in a distributed way , by exchanging information with the peers they contact .
even more general policies would allow the piece selection to depend in an arbitrary way on the piece collections of all peers .
interestingly enough , the results extend even to seemingly bad piece selection policies .
for example , it includes the sequential piece selection policy , in which peers obtain the pieces in order , beginning with piece one .
the sequential policy can be viewed as a _ most abundant first _ useful piece selection policy , or just the opposite of rarest piece first .    to be specific , consider the following family @xmath206 of piece selection policies .
each policy in @xmath206 corresponds to a mapping @xmath207 from @xmath208 to the set of probability distributions on @xmath209 satisfying the usefulness constraint : @xmath210 with the following meaning of @xmath207 :    * when a type @xmath95 peer selects a piece to download from a type @xmath63 peer and the state of the entire network is @xmath211 piece @xmath11 is selected with probability @xmath212 for @xmath213 *
when the fixed seed selects a piece to upload to a type @xmath95 peer and the state of the entire network is @xmath211 piece @xmath11 is selected with probability @xmath214 for @xmath213    the piece selection policies noted above are included in @xmath215    reconsider the proof of transience in section [ sec : instability ] under a piece selection policy in @xmath206 . from any state it is possible to reach the empty state , and from the empty state it is possible to reach a state with one peer in the network having all pieces except some piece @xmath216 from that state , for any @xmath217
, it is possible to reach the state with @xmath65 peers missing only piece @xmath218 and no other peers in the network
. it may be impossible for @xmath219 to equal one , but by renumbering the pieces if necessary , it can be assumed without loss of generality that @xmath219 is one .
thus , whatever piece selection policy in @xmath206 is applied , beginning from any initial state , for any @xmath220 in a finite time with a positive probability , the system can arrive into the state where there are @xmath65 peers and all of them are one - club peers .
thus , as in section [ sec : instability ] , to prove transience it suffices to show that from such an initial state , there is a positive probability that the number of peers converges to infinity .
the arrival rate of new peers and the upload rate of the seed does not depend on the piece selection policy , so and are valid for any piece selection policies in @xmath206 .
moreover , lemma [ lemma.mg1compare ] and lemma [ lemma.onecompare ] are valid for any piece selection policies in @xmath206 because the two lemmas depend on the properties that peer selection is uniformly random and the piece selection is useful if a useful piece is available .
therefore and are also valid for any piece selection policy in @xmath206 .
thus , we conclude that the proof of proposition [ prop.seed_only](i ) in section [ sec : instability ] works for any piece selection policy in @xmath215    reconsider next the proof of positive recurrence in section [ sec : stability ] , but for an arbitrary piece selection policy in @xmath215 the inequalities developed for the proofs of lemmas [ lem : d_lf_k ] and [ lem : d_lf_nk ] hold with the same lyapunov function ; useful piece selection suffices .
thus , if @xmath48 it can be shown that the lyapunov stability condition , namely @xmath221 for @xmath15 sufficiently large , still holds .
the final conclusion has to be modified , however , because under some policies in @xmath222 the markov process might no longer be irreducible .
for example , with the sequential useful piece selection policy , the set of states such that every peer holds a set of pieces of the form @xmath223 for some @xmath118 with @xmath224 is a closed subset of states , in the terminology of classification of states of discrete - state markov processes . in general ,
the set of all states that are reachable from the empty state is the unique minimal closed set of states , and the process restricted to that set of states is irreducible . by a minor variation of the foster - lyapunov stability proposition
, the lyapunov stability condition implies that the markov process restricted to that closed set of states is positive recurrent , and the mean time to reach the empty state beginning from an arbitrary initial state is finite .
we summarize the discussion of the previous two paragraphs as a proposition .
( stability conditions for general useful piece selection policies ) suppose a useful piece selection policy from @xmath206 is used , for a network with random peer contacts and parameters @xmath3 , @xmath17 , @xmath23 and @xmath225 as in section [ sec : formulation ] .
there is a single class of closed states containing the empty state , and all other states are transient .
( i ) if @xmath41 then the markov process is transient , and the number of peers in the system converges to infinity with probability one .
( ii ) if @xmath42 the markov process with generator @xmath43 restricted to the closed set of states is positive recurrent , the mean time to reach the empty state from any initial state has finite mean , and the equilibrium distribution @xmath44 is such that @xmath45    thus , with the exception of the borderline case @xmath226 rarest first piece selection does not increase the region of stability , nor does most abundant first piece selection decrease the region of stability .
network coding , introduced by ahlswede , cai , and yeung , @xcite , can be naturally incorporated into p2p distribution networks , as noted in @xcite
. the related work @xcite considers all to all exchange of pieces among a fixed population of peers through random contacts and network coding .
the method can be described as follows .
the file to be transmitted is divided into @xmath3 data pieces , @xmath227 the data pieces are taken to be vectors of some fixed length @xmath228 over a finite field @xmath229 with @xmath230 elements , where @xmath230 is some power of a prime number . if the piece size is @xmath231 bits , this can be done by viewing each message as an @xmath232 dimensional vector over @xmath233 any coded piece @xmath234 is a linear combination of the original @xmath3 data pieces : @xmath235 the vector of coefficients @xmath236 is called the _ coding vector _ of the coded piece ; the coding vector is included whenever a coded piece is sent .
the fixed seed uploads coded pieces to peers , and peers exchange coded pieces . in this context , the type of a peer @xmath95 is the subspace @xmath237 of @xmath238 spanned by the coding vectors of the coded pieces it has received .
once the dimension of @xmath237 reaches @xmath3 , peer @xmath95 can recover the original message .
when peer a contacts peer b , suppose peer b sends peer a a random linear combination of its coded pieces , where the coefficients are independent and uniformly distributed over @xmath233 equivalently , the coding vector of the coded piece sent from @xmath63 is uniformly distributed over @xmath239 the coded piece is considered useful to @xmath95 if adding it to @xmath95 s collection of coded pieces increases the dimension of @xmath240 equivalently , the piece from @xmath63 is useful to @xmath95 if its coding vector is not in the subspace @xmath241 the probability the piece is useful to @xmath95 is therefore given by @xmath242 if peer @xmath63 can possibly help peer @xmath95 , meaning @xmath243 ( true , for example , if @xmath244 ) , the probability that a random coded piece from b is helpful to a is greater than or equal to @xmath245 the probability a random coded piece from the seed is useful to a peer @xmath95 with @xmath246 is precisely @xmath245 therefore , when all peers have the same state and the common state has dimension @xmath101 , the departure rate from the network is @xmath247    the network state @xmath24 specifies the number of peers in the network of each type .
there are only finitely many types , so the overall state space is still countably infinite .
moreover , the markov process is easily seen to be irreducible .
reconsider the proof of transience in section [ sec : instability ] , but now under network coding . fix any subspace @xmath248 of @xmath238 with dimension @xmath249 call a peer a one - club peer if its state is @xmath250 for any @xmath217 , it is possible to reach the state with @xmath65 one - club peers and no other peers in the network . as
before , call a peer a young peer if it is not a one - club peer . in the case of network coding , call a peer infected if its state is not a subspace of @xmath250 the only way a peer can become infected is by downloading a piece either from the seed or from an infected peer .
lemmas [ eq.aineq ] and [ eq.zineq ] are valid for network coding , if the condition @xmath41 is replaced by @xmath251 moreover , lemma [ lemma.mg1compare ] and lemma [ lemma.onecompare ] are valid for network coding because the two lemmas depend on the properties that peer selection is uniformly random and the rate useful pieces are delivered by the seed to one - club peers is arbitrarily close to @xmath252 thus , we conclude that proposition [ prop.seed_only](i ) in section [ sec : instability ] , with @xmath53 replaced by @xmath253 extends to the case of network coding .
reconsider the proof of positive recurrence in section [ sec : stability ] , but with random useful piece selection replaced by network coding as described , and @xmath53 replaced by @xmath254 suppose the same lyapunov function is used , except the new meaning of @xmath255 or @xmath149 for short , is the number of peers @xmath95 with @xmath256 lemmas [ lem : d_lf_k ] and [ lem : d_lf_nk ] are valid for network coding , if the condition @xmath42 is replaced by @xmath257 thus , if @xmath258 it can be shown that the lyapunov stability condition , namely @xmath221 for @xmath15 sufficiently large , still holds , and the foster - lyapunov stability criterion applies .
we summarize the discussion of the previous two paragraphs as a proposition .
( stability conditions for network coding based system ) suppose random linear network coding with vectors over @xmath238 is used , with random peer contacts and parameters @xmath3 , @xmath17 , @xmath23 and @xmath225 as in section [ sec : formulation ] .
( i ) if @xmath259 then the markov process is transient , and the number of peers in the system converges to infinity with probability one .
( ii ) if @xmath260 the markov process is positive recurrent , and the equilibrium distribution @xmath44 is such that @xmath45    thus , as @xmath261 the stability region for the system with network coding converges to that for useful piece selection .
network coding has the advantage that no exchange of state information among peers is needed because there is no need to identify useful pieces .      in many unstructured peer - to - peer systems , such as bittorrent
, peers often dwell in the network awhile after they have collected all the pieces . in effect , these peers temporarily become seeds , called peer seeds .
the uploading provided by peer seeds is able to mitigate the missing piece syndrome and enlarge the stability region .
intuitively , if every peer can upload , on average , just one more piece after collecting all pieces , then every peer can help one one - club peer to depart , so the missing piece syndrome would not persist .
this is explored for the case of @xmath262 and @xmath263 ( for the sequential piece selection policy ) in @xcite and for random useful piece selection with arbitrary @xmath0 in @xcite .
another way to overcome the missing piece syndrome relies on peer selection policies . for instance ,
if young peers contact infected peers preferentially , or if the seed uploads to young peers preferentially , the network can be stabilized by the resulting increase in the number of infected peers .
so some sort of coordination policy , providing the identification of rare pieces and young peers , and the transmission of the rare pieces to the young peers , can counter the missing piece syndrome . a mechanism built into bittorrent , called tit - for - tat operation ,
may alter the peer selection policy enough to yield stability for any choice of @xmath1 and @xmath2 under tit - for - tat operation , peers upload almost exclusively to peers from which they can simultaneously download .
an obvious benefit of tit - for - tat is to give peers incentive to upload , thereby helping other peers , but it also may be effective against the missing piece syndrome . specifically , tit - for - tat encourages one - club peers to reduce their rate of download to the young peers , because the young peers have nothing to upload to the one - club members .
this increases the amount of time that peers remain young , giving them a greater chance to obtain a rare piece from the fixed seed .
also , infected peers would preferentially send to young peers , because often a normal young peer and an infected young peer would be able to help each other .
while it is thus clear that tit - for - tat operation helps combat the missing piece syndrome , we leave open the problem of quantifying the effect for a specific model .
we have shown that , for any @xmath264 the system is stable if @xmath42 and unstable if @xmath265 and this result is insensitive to the value of @xmath225 and to the piece selection policy , as long as a useful piece is selected whenvever possible . while it may not be interesting from a practical point of view , we comment on the case @xmath266 first , we give a precise result for a limiting case of the original system , and then we offer a conjecture .
a simpler network model results by taking a limit as @xmath267 call a state _ slow _ if all peers in the system have the same type , which includes the state such that there are no peers in the system . otherwise , call a state _ fast_. the total rate of transition out of any slow state does not depend on @xmath268 and the total rate out of any fast state is greater than or equal to @xmath85 for very large values of @xmath268 the process spends most of its time in slow states .
the original markov process can be transformed into a new one by _ watching _ the original process while it is in the set of slow states .
this means removing the portions of each sample path during which the process is in fast states , and time - shifting the remaining parts of the sample path to leave no gaps in time .
the limiting markov process , which we call the @xmath269 process , is the weak limit ( defined as usual for probability measures on the space of cdlg sample paths equipped with the skorohod topology ) of the original process watched in the set of slow states , as @xmath267 by symmetry of the model , the state space of the @xmath269 process can be reduced further , to @xmath270 where a state @xmath271 corresponds to @xmath272 peers in the system which all possess the same set of @xmath273 pieces .
the positive transition rates of the @xmath269 process are given by : @xmath274 and the transition rate diagram is pictured in figure [ fig.mu_infinity ] for @xmath275      system for @xmath275,title="fig:",width=226 ]    the top layer of states consists of those for which all peers have @xmath101 pieces .
these states correspond to all peers being in the one club , or all missing some other piece . from any state the process reaches the top layer in mean time less than or equal to @xmath276 and within the top layer the process behaves like a birth - death process with birth rate @xmath17 and death rate @xmath2 since such birth - death processes are null - recurrent if @xmath277 it follows that _ the @xmath269 model is null - recurrent if @xmath266 _    consider the original process with @xmath278 and finite @xmath128 suppose the process is in a state with a very large one club which includes all or nearly all the peers ; let @xmath272 be the number of peers in the one club .
new young peers arrive at rate @xmath17 , and they are in the system for approximately @xmath279 time units while they are holding exactly @xmath273 pieces for @xmath280 .
thus , over the short term , the mean number of young peers in the system holding @xmath273 pieces is near @xmath281 for @xmath280 the average fraction of peers that are young peers holding @xmath273 pieces is thus approximately @xmath282 for @xmath280 the average total rate that young peers holding @xmath273 pieces become infected is dominated by the rate the fixed seed downloads piece one to them and is thus approximately @xmath283 where the factor @xmath284 comes the assumption of uniform random useful piece selection for downloads from the seed .
a young peer that becomes infected when it has @xmath273 pieces will eventually release , on average , about @xmath285 other peers from the one club .
thus , to a first order approximation , for large @xmath272 , the number of peers in the system behaves like a birth - death process with arrival rate @xmath17 and state dependent departure rate @xmath286 where @xmath287 the elementary theory of birth - death processes shows that a birth - death process with constant birth rate @xmath17 and state - dependent death rate @xmath288 is positive recurrent if @xmath289 and null - recurrent if @xmath290 this strongly suggests the following to be true :    if @xmath278 , the process is positive recurrent if @xmath291 and is null recurrent if @xmath292    we also expect similar results to be true for other piece selection policies , but the value of @xmath293 would depend on the piece selection policy .
suppose @xmath294 and @xmath295 are two random processes , either both discrete - time random processes , or both continuous time , cdlg random processes
. then @xmath95 is _ stochastically dominated _ by @xmath63 if there is a single probability space @xmath296 , and two random processes @xmath297 and @xmath298 on @xmath296 , such that +              let @xmath302 be a random process with stationary , independent increments with @xmath303 suppose the sample paths are cdlg ( i.e. right - continuous with finite left limits ) .
suppose @xmath304 $ ] is finite , so there are finite constants @xmath225 and @xmath305 such that @xmath306= \mu t$ ] and @xmath307 for all @xmath92 let @xmath308      for each integer @xmath313 , let @xmath314 denote the random walk process @xmath315 let @xmath316 by kingman s moment bound for discrete time processes , @xmath317 \leq \frac{\mbox{var}(s_1^n)}{-2e[s_1^n ] }   = \frac{\sigma^2}{-2\mu}\ ] ] since @xmath318 is nondecreasing in @xmath272 and converges a.s .
to @xmath319 the first conclusion of the lemma follows .
the second conclusion follows from the first by markov s inequality .
[ cor : compoundkingman ] let @xmath320 be a compound poisson process with @xmath321 , with jump times given by a poisson process of rate @xmath322 , and jump sizes having mean @xmath323 and mean square value @xmath324 then for all @xmath325 and @xmath326 @xmath327        [ lemma.mginfty ] let @xmath231 denote the number of customers in an @xmath99 queueing system , with arrival rate @xmath17 and mean service time @xmath334 suppose that @xmath335 then for @xmath336 , @xmath337    our idea is to find another @xmath99 system whose number of customers sampled at integer times can be used to bound @xmath338 suppose we let every customer for the original process stay in the system for one extra unit time after they have been served .
let @xmath339 be the number of customers in this new @xmath99 system at time @xmath69 .
note that @xmath340 is also the number in an @xmath99 system , with arrival rate @xmath17 and mean service time @xmath341 by a well - known property of @xmath99 systems , for any time @xmath69 , @xmath339 is a poisson random variable . since the initial state is zero , the mean number in the system at any time @xmath69 is less than @xmath342 which is the mean number in the system in equilibrium .
if @xmath343 represents a poisson random variable with mean @xmath225 , then the chernoff inequality yields @xmath344 , and taking @xmath345 yields @xmath346 for any integer @xmath347 , if @xmath348,$ ] then @xmath349 therefore , @xmath350   \ }   \\ &   \leq   & \sum_{i=1}^\infty    p\ { m^\sharp_i \geq b+\epsilon ( i-1 ) \ }    \\ &   \leq &    \sum_{i=1}^\infty    e^{\lambda(m+1 ) }   2^{-(b+\epsilon ( i-1 ) ) } \\ & = &   \frac { e^{\lambda(m+1 ) } 2^{-b } } { 1 - 2^{-\epsilon}}\end{aligned}\ ] ]      consider an @xmath119 queue with arrival rate @xmath50 let @xmath351 denote the number of customers served in a busy period , let @xmath171 denote the length of a busy period , and let @xmath329 denote the service time of a typical customer .
let @xmath352.$ ] it @xmath353 then @xmath354=\frac{1}{1-\rho } ~~~~~~~~ e[n^2]=\frac{1+\lambda^2 \mbox{var}(x)}{(1-\rho)^3 } \label{eq.n } \\ e[l]=\frac{e[x]}{1-\rho }   ~~~   e[l^2 ] = \frac{e[x^2]}{(1-\rho)^3 } ~~~~ \label{eq.l } \\
\mbox{cov}(n , l ) = \frac{\lambda e[x^2]}{(1-\rho)^3}~~~~~~~~~~~~~~~\end{aligned}\ ] ]    the lemma can be proved by the well - known branching process method .
let @xmath329 denote the service time of a customer starting a new busy period .
let @xmath98 denote the number of arrivals while the first customer is being served .
then , given @xmath355 , the conditional distribution of @xmath98 is poisson with mean @xmath356 view any customer in the busy period that arrives after the first customer , to be the offspring of the customer in the server at the time of arrival .
this gives the well known representation for @xmath351 and @xmath171 : @xmath357 where @xmath358 is a sequence of independent random 2-vectors such that for each @xmath11 , @xmath359 has the same distribution as @xmath360 using wald s identity , these equations can be used to prove the lemma .
[ cor.fostercompcontinuous ] _ combined foster - lyapunov stability criterion and moment bound  continuous time _
( see @xcite . )
suppose @xmath329 is a continuous - time , irreducible markov process on a countable state space @xmath361 with generator matrix @xmath362 suppose @xmath141 , @xmath363 , and @xmath364 are nonnegative functions on @xmath365 such that @xmath366 for all @xmath367 , and , for some @xmath368 , the set @xmath320 defined by @xmath369 is finite .
suppose also that @xmath370 is finite for all @xmath3 .
then @xmath329 is positive recurrent and , if @xmath44 denotes the equilibrium distribution , @xmath371 .
kurtz , t.  g. ( 1981 ) .
_ approximation of population processes_. cbms - nsf regional conference series in applied mathematics , vol .  *
36*. society for industrial and applied mathematics ( siam ) , philadelphia , pa .      massouli , l. and vojnovi , m. ( 2005 ) .
coupon replication systems . in _
sigmetrics 05 : proceedings of the 2005 acm sigmetrics international conference on measurement and modeling of computer systems_. acm , new york , ny , usa , 213 .
menasch , d.  s. , de  arago  rocha , a.  a. , de  souza  e silva , e. , leo , r. m.  m. , towsley , d.  f. , and venkataramani , a. ( 2010 ) .
estimating self - sustainability in peer - to - peer swarming systems .