HAL Id: inria-00121974
https://hal.inria.fr/inria-00121974v2
Submitted on 27 Dec 2006
HAL is a multi-disciplinary open access archive for the deposit and dissemination of sci- entific research documents, whether they are pub- lished or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.
Stratification in P2P Networks - Application to BitTorrent
Anh-Tuan Gai, Fabien Mathieu, Julien Reynier, Fabien de Montgolfier
To cite this version:
Anh-Tuan Gai, Fabien Mathieu, Julien Reynier, Fabien de Montgolfier. Stratification in P2P Networks - Application to BitTorrent. [Research Report] RR-6081, INRIA. 2006, pp.19. �inria-00121974v2�
inria-00121974, version 2 - 27 Dec 2006
a p p o r t
d e r e c h e r c h e
N0249-6399ISRNINRIA/RR--6081--FR+ENG
Thème COM
Stratification in P2P Networks Application to BitTorrent
Anh-Tuan Gai — Fabien Mathieu — Julien Reynier — Fabien de Montgolfier
N° 6081
December 2006
Unité de recherche INRIA Rocquencourt
Domaine de Voluceau, Rocquencourt, BP 105, 78153 Le Chesnay Cedex (France)
Anh-Tuan Gai
∗
, Fabien Mathieu
†
, Julien Reynier
‡
, Fabien de Montgoler
§
ThèmeCOM Systèmesommuniants
ProjetsGyroweb
Rapportdereherhe n° 6081Deember200619pages
Abstrat: Weintrodueamodelfordeentralizednetworkswithollaboratingpeers. Themodelisbasedon
thestablemathingtheorywhihisappliedtosystemswithaglobalrankingutilityfuntion. Weonsider the
dynamis of peers searhing for eient ollaboratorsand weprovethat auniquestable solution exists. We
provethatthesystemonvergestowardsthestablesolutionandanalyzeitsspeedofonvergene.Wealsostudy
the stratiation properties of the model, bothwhen all ollaborationsare possible and for random possible
ollaborations. Wepresenttheorrespondinguidlimitonthehoieofollaboratorsintherandomase.
Asapratialexample,westudytheBitTorrentTit-for-Tatpoliy. Forthissystem,ourmodelprovidesan
interestinginsightonpeerdownloadratesandapossiblewaytooptimizepeerstrategy.
Key-words: P2P, stable marriagetheory, rationalhoietheory, ollaborativesystems, BitTorrent,overlay
network,mathings, graphtheory
CRCMARDI
∗
INRIA,domainedeVolueaux,78153LeChesnayedex,Frane
†
FraneTeleomR&D,3840,ruedugénéralLeler,92130IssylesMoulineaux,Frane
‡
LIENS,45rued'Ulm,75230ParisCedex05,Frane
§
LIAFA,175,rueduChevaleret,75013ParisFrane
Appliation à BitTorrent
Résumé : Cet artilevise àintroduire unnouveaumodèle d'analyse desréseauxdéentralisésbasés surdes
ollaborations entre pairs. Ce modèle repose sur la théorie des mariages stables appliquée à des systèmes
possédantune fontiond'utilitéglobale. Nousétudionsladynamiqueinduiteparlareherhepourhaundes
meilleurspartenairespossiblesetmontronsunthéorèmed'existeneuniité. Nousobservonsunerapidevitesse
de onvergeneet étudionslephénomènedestratiation danslasolutionstable, dansleasoùlegraphedes
ollaborationsréalisablesestompletetdanseluioùilestaléatoire. Pourleasaléatoire,nousprésentonsune
limite uidedelasolution.
Commeexemplepratique,nousétudionslapolitiquedonnantdonnant employéedanslelogiieldepartage
BitTorrent. Pouresystème,notremodèlefournitdesintuitionspertinentessurlesvitessesdetéléhargements
ainsiquesurlespossibilitésd'optimisationdesparamètres.
Mots-lés: pair-à-pair,mariagesstables,hoixrationnels,systèmesollaboratifs,BitTorrent,réseauxoverlay,
ouplages,graphes
1 Introdution
Motivation Collaboration-baseddistributed appliations aresuessfully applied to large salesystems. A
systemissaidtobeollaborativewhenpartiipatingpeersollaborateinordertoreahtheirowngoal(inluding
beingaltruisti). Apartfrom well-knownontentdistribution appliations[4, 5℄, ollaboratinganbeapplied
to numerousappliations suh asdistributedomputing, onlinegaming,orooperativebakup. The ommon
propertyof suh systems isthat partiipating peer exhange resoures. The underlying mehanism provided
byprotoolsforsuhappliationsonsists in seletingwhihpeersto ollaboratewithto maximizeone'speer
benet with regards to its personal interest. This mehanism generally uses a utility funtion taking loal
information as input. One an ask if this approah an provide desirable properties of ollaboration-based
ontentdistributionprotoolslikesalabilityandreliability.
Toahievethese properties, thefamous protool BitTorrent[4℄ implements aTit-for-Tat (TFT)exhange
poliy. More preisely, eah node knows a subsetof all other nodes of the system and ollaborates with the
bestonesfromitspointofview: ituploadstotheontatsithasmostdownloadedfrominthelast10seonds.
In other words,the utility of peer p for node q is equalto the quantity of data peer q hasdownloadedfrom p (in the last measurementperiod). The main interest in using the TFT poliy is the resultinginentive to ooperate. Thenatureoftheutilityfuntionthenleadstoalusteringproesswhihgatherpeerswithsimilar
uploadperformanestogether,alledstratiation.
Reently,muhresearhhasbeendevotedtothestudyofthephenomenon. Sofar,however,whileithasbeen
measuredandobservedbysimulations,ithasnotbeenformallyproved. Understandingstratiation isarst
steptowardsabetteromprehensionoftheimpatof theutilityfuntion onasystembehavior. Atheoretial
frameworktoanalyzeandomparedierentutilityfuntionisneeded: hoosingautilityfuntionthatbestsuits
agivenappliationisquitediult. Moreimportantly,itisnotlearwhethertheutilityfuntionsimplemented
lead to desirable properties. We introdue a generi framework that allows an instantiation of (known and
novel) utilityfuntions that model ollaboration. We further present athorough analysis of alass ofutility
funtions basedonglobalrankingagreements,suhasthatofBitTorrentTFTpoliy. Thisframeworkalsots
gossip-basedprotoolsusedbyapeertodisoveritsrank[8℄.
Contribution First,weproposeamodel basedonthestablemathing theory. Thismodel desribesdeen-
tralizednetworkswherepeersrankeahothersandtrytoollaboratewiththebest peersforthem.
Seond,wefousonsystemswithaglobalrankingutilityfuntion (eahpeerhasanintrinsivalue)in the
framework of stable mathing. We provethat suh asystem alwaysadmits a uniquestable solution towards
whih itonverges. Weverifythroughsimulationsthespeedof onvergene withoutandwith hurn (arrivals
ansdepartures).
Third,westudystratiation inatoymodel offullyonnetednetworkswhere everypeer anollaborate
with all other peers. If every peer tries to ollaborate with the same number of peers, we observe disjoint
lustering. Butwithavariablenumberofollaborationsperpeer,lusteringturns intostrongstratiation.
Fourth,wedesribestratiationinrandomgraphs. ForErdös-Rényigraphs,thedistributionofollaborat-
ingpeershasauidlimit. Thislimitingdistributionshowsthatstratiationisasalableresult.
Lastly, wepropose apratialappliation of ourresultsto the BitTorrentTFT poliy. Assumingontent
availabilityisnotabottlenekinaBitTorrentswarm,ourmodelleadstoaninterestingharaterizationofthe
downloadrateapeer anexpet asafuntion of itsuploadrate. This desriptionleadsto possiblestrategies
foroptimizingthedownloadforagivenuploadrate.
Roadmap InSetion2wedeneourmodel. Setion3presentsastudyontheproblemdynamis. Setion4
desribesstratiationinaompleteneighborhoodgraphandSetion5,inrandomgraphs. Setion6disusses
theappliationofourresultsto BitTorrentandSetion 7onludesthepaper.
2 Model
P2Pnetworksareformedbyestablishinganoverlaynetworkbetweenpeers. Apeeratsbothasaserveranda
lient. Eahpeerphasaboundednumberb(p)ofollaborationslots. Asthenetworkevolves,peersontinuously searhafternew(orbetter)partners.Eah protoolhasitsownapproahtohandlingthese dynamihanges.
Forexample,aprotoollikeeDonkey[5, 1℄ optimizesindependently twopreferenelists ontheserverandon
the lientsides. More reent protools, like BitTorrent [4℄, make ause ofa gametheoreti approah, where
eahpeertriestoimproveitsownpayo. Itresultsinkeepingone preferenelistpernode.
Letus suppose that eahpeer phasaglobal mark S(p), whih mayrepresentits available bandwidth,its
omputational apaities, or its sharedstorage apaity. Eah peer wantsto ollaborate with best partners
who havehighest marksS(p). This models manynetworks preferenes systems,albeitnot allnetworks have
suhranking. Forinstane, inhessplaying,playershaveanintrinsivalue(ELOrating),although theydon't
generallywantto engagepeople farbetterorworsethanthem.
Somepeersmightnotbewilling toooperatewithsomeothers. Forinstane, peersthat haveno ommon
interest orareunaware ofeah other. We introdue anaeptanegraph torepresentompatibilities. A pair
(p, q)belongsto theaeptanegraphif,and onlyif(i)bothpeersare interestedin ollaboration. Without lossofgenerality, wean supposeaeptabilityis asymmetrirelation: ifpis unaeptableforq,q willnever
be able to ollaborate with pso we anassume q is also unaeptablefor p. We denote by onguration or
mathing thesubgraphoftheaeptanegraphthatrepresentstheeetiveollaborationbetweenpeers. The
degreeofapeerpinaongurationisboundedbyb(p).
A bloking pair foragivenongurationis aset of twopeers unmathed togetherwishing to bemathed
together(evenifitmeansdropping oneoftheirurrentollaborations). Aongurationwithoutblokingpair
issaidtobestable. Inastableonguration,asinglepeerannotimproveitssituation:itisaNashequilibrium.
If a number of olloborations is limitedto 1, the problem is known asthe stable roommates problem [7℄.
It is an extension of the famous stable marriage problem introdued by Gale and Shapley in 1962 [6℄. If we
assumeeahpeerpwantstoollaboratewithuptob(p)otherpeers,theframeworkisalled stableb-mathing
problem 1
[3℄.
As it holds for all theories of stable mathings, the existene of a stable onguration depends on the
preferenerulesusedtorankpartiipantandontheaeptanegraph. Inthisworkwestudytheimpatofthe
rulesderivedfromaglobalrankingonapeer-to-peernetworkbehavior. Inpartiular,wendthepropertiesof
thestableongurations.
3 Existene and onvergene properties of a stable onguration
Global rankingmathingisoneofthesimplestasesofmathingproblems. Tan[13℄hasshownthat existene
and uniqueness ofstable solutionswere relatedto prefereneylesin theutilityfuntion. A prefereneyle
of length k is a set i1, . . . , ik of k distint peers suh that eah peer of the yle prefers its suessor to its
predeessor. AsprovedbyTan,astableongurationexistsithereisnooddprefereneyleoflengthgreater
than 1. He also provedthat if noeven yle of lengthgreater than 2 exists, then the stable ongurationis
unique. If peers havean intrinsivalue, nostrit preferenes yleanour(see belowfor ties), so aglobal
rankingmathingproblemhasoneandonlyonestable solution.
ThissolutionisveryeasytoomputeknowingtheglobalrankingS,bandtheaeptanegraph. Theproess
is given byAlgorithm 1: eah peer pstartswith b(p)available onnetions. First, thebest peerp1 piks the
bestb(p1)peersfromitsaeptanelist. Asp1isthebest,thehosenpeersgladlyaept(realltheaeptane
graph is symmetri) and the resulting ollaborations are stable (no bloking pairan unmath them). Note
thatifthereisnotenoughaeptablepeers,p1maynotsatisfyallitsonnetions. Peershosenbyp1haveone
lessonnetion available. Then seond best peer p2 doesthe same,andso on...Byimmediatereurrene,all
onnetionsmadearestable. Whentheproessreahesthelastpeer,theonnetionsarethestableonguration
for the problem. As it was saidbefore, allonnetions are not neessarilysatised. Forinstane, if the last
peerstillhasavailableonnetionswhenitsturn omes,hisonnetionswillnotbefethed, asallpeersabove
him havebyonstrutionspentall theironnetions. Thisis, of ourse, aentralizedalgorithm,but weshall
see belowthatdeentralizedalgorithmsworkaswell.
Note on ties Ties in preferene lists make the mathing problems more diult to resolve [11℄ without
bringing moreinsightaboutthestratiationissuesstudiedin thispaper. Simulationshaveshownourresults
hold ifweallowties,but equationsarehardto proveasexisteneof astable mathingannot beguaranteed.
Thusforthesakeofsimpliity,weshallsuppose utilitiesaredistint, thatisS(q)6=S(p)foranyp6=q.
Convergene Oneanaskwhat isthepointinstudying astable ongurationin adynamialontextsuh
asP2Psystems,wherepeersarriveanddepartwhenevertheywish,andwhereutilityfuntionsandaeptane
listsanutuate. Wehavenotprovedyetthattheproessofpeerstryingindependentlytoollaboratetothe
bestpeerstheyknowanreahthestable state.
1
inthispaperthewordmathingstandsforb-mathing(unlessotherwisestated)
Algorithm1: Stableongurationin globalranking
Data: An aeptanegraphGwithnpeers,aglobalrankingS(p),andmaximalnumberofonnetions b(p)
Result: Theuniquestable ongurationoftheb-mathing problem
Letabeavetorinitializedwithb
foreahpeer isortedininreasing S(p)(bestpeer rst)do
foreahpeer j sortedin inreasing S(p) startingjustafter ido
if (i, j)∈Ganda(i)>0 anda(j)>0 then
onnet(i, j) a(i) =a(i)−1 a(j) =a(j)−1
end
end
end
Weintroduetheoneptofinitiative to modeltheproessbywhih apeermayhange itsmates. Given
aongurationC, wesaythat peerptakes the initiative when itproposes toother peersto beits newmate.
Basially,pmayproposepartnershipto anyaeptable peer. ButonlyblokingpairsofC representaninter-
esting newpartnership. Ifpanndsuh abloking mate,theinitiativeisalledative beauseitsueedsin
modifyingtheonguration(bothpeerswillhangetheirsetofmates).
Tondablokingmate,pontatspeersfromitsaeptanelist. Weidentify severalstrategiesdepending
onhowpsansitsaeptanelist:
best mate whenthepeerseletsthebest(if any)availableblokingmate. This happensifpknowstherank
ofallitsaeptablepeersandwhether theywillollaborateornot,
deremental when thelist is irularly sannedstartingfrom the last asked peer. This happens ifpknows
therankofallitsaeptablepeers, butnotiftheywillollaborate,
random whenasinglepeerisseletedatrandom. Thishappensifphasnoinformationonitsneighborsuntil itasks.
Ofourse, whenbest mate initiativeispossible,itseemstobethebest strategytomaximizeapeer'sown
prot,but itsupposesagoodknowledgeofthesystemismaintained.
We an now omplete our model with initiatives: starting from any initial onguration, an instane of
our model evolvesbeauseof initiativestaken bypeers. Infat,it anonlyevolvetowardsthe uniquestable
onguration,asshownbyTheorem 1.
Theorem1 The stable solution anbe reahed inB/2initiatives, whereB=P
pb(p)isthe maximalnumber
of onnetions. Moreover, any sequeneof ative initiatives starting from any initial onguration eventually
reahes thestable onguration.
Proof: InAlgorithm1,eahonnetionanbe obtainedbyinitiative. As thestable ongurationpossesses
uptoB/2pairings,thisensurestherstpartofthetheorem. Weprovetheonvergenebyshowingasequene
of ative initiatives an never produe twie the same onguration. There is a nite number of possible
ongurations,soifwekeepalteringtheongurationthroughinitiatives,weeventuallyreahaonguration
that annotbealteredwithanyinitiative: thestableonguration.
Theproofisindeedsimple. Ifasequeneofinitiativesinduesayleofatleasttwodistintongurations,
then oneanextrat aprefereneyleoflengthgreaterthan3: letp1 beapeerwhosemateshangethrough
theyle. Callp2 thebestpeerp1 isunstablypairedwithduringtheyle,andp3 thebestpeerp2isunstably
pairedwith duringtheyle. p1 isnotp3and p2 prefersp3to p1, otherwisethepair{p1, p2} wouldnotbreak
duringtheyle. Iteratingtheproess,webuildasequeneofpeer(pk)suhthatpk preferspk+1topk−1,until
wend i < j suh that pi =pj. Theirular list(pi, pi+1, . . . , pj−1) is apreferene yle. As global ranking
doesnotallowprefereneyles,thisisnotpossible,soasequeneofativeinitiativesanneverproduetwie
thesameonguration.
Theorem1provesthat instati onditions(nojoin ordeparture, onstantutility funtion), aP2Psystem
will onverge to the stable state. Toprove this stable state is worthstudying, we haveto show onvergene
0 5 10 15 20 25 30 35 40 0
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Initiatives per peer
Disorder
n=100,d=50 n=1000,d=10 n=1000,d=50
Figure1: Starting fromC∅, onvergenetowardsthestablestatefordierentparameters
is fast in pratie (Algorithm1is optimal in numberof initiativesbut diult to implement in alargesale
system) andansustainaertainamountofhurn. As aompleteformal proofofthisis beyondthesopeof
this paper,weusedsimulations.
In oursimulations, peers were labeled from 1 to n (the numberof peers). These labels dene the global
ranking,1beingthebestpeerandntheworst(ifi < j,peeriisbetterthanpeerj). WeuseErdös-Renyiloopless symmetrigraphsG(n, d)asaeptanegraphs,wheredistheexpeteddegree(eahedgeexistsindependently withprobability
d
n−1). Only1-mathingwasonsidered.
FormeasuringthedierenebetweentwoongurationsC1 andC2 weusethedistane
D(C1, C2) = Σni=1kσ(C1, i)−σ(C2, i)k. 2 n(n+ 1),
where σ(C, i)denotesthemateofiin C(byonvention,σ(C, i) =n+ 1 ifiisunmatedinC).
D isnormalized: thedistane betweenaomplete mathingandtheemptyongurationC∅ isequalto 1.
Thedisorder denotesthedistanebetweentheurrentongurationandthestableonguration.
Ateahstepoftheproesswesimulate,apeerishosenatrandomandperformsabestmateinitiative(the
initiativeanbeativeornot). Toomparesimulationswith dierentnumbern ofpeers, wetakeasequene
ofnsuessiveinitiativesasabase unit(thatanbeseenasoneexpetedinitiativeper peer).
Arst setof simulationsismadeto provearapidonvergenewhenthe aeptanegraphis stati. Inall
simulations,the disorderquiklydereases, and the stable ongurationis reahedin lessthan ndinitiatives (that is d base unit). Figure 1 shows onvergene starting from the empty onguration for three typial
parameters: (n, d) = (100,50),(n, d) = (1000,10),(n, d) = (1000,50).
Thenweinvestigatetheimpatofanatomialterationofthesystem. Startingfromthestableonguration,
weremoveapeerfromthesystemandobservetheonvergenetowardsthenewstableonguration. Weobserve
bigvarianesinonvergenepatterns,butonvergenealwaystakeslessthandbaseunitsanddisorderisalways
small. Note,that duetoadominoeet,removingagoodpeergenerallyinduesmoredisorderthanremoving
a bad peer. This is shown by Figure 2. We ran the simulations 100 times and seleted four representative trajetories,aswedidnotwishtoaverageoutinterestingpatterns.
Finally, we investigate ontinuous hurn. A peer an be removed or introdued in the system anytime,
aordingto ahurn rate parameter. Simulations showthat asthehurn rateinreases,the systembeomes
unable to reah the instant stable onguration. However, the disorder is kept under ontrol. That means