+ All Categories
Home > Technology > Shao (2012] [num, optimization] reverse engineering bit torrent- a markov approximation perspective

Shao (2012] [num, optimization] reverse engineering bit torrent- a markov approximation perspective

Date post: 30-Oct-2014
Category:
Upload: danielbilar
View: 821 times
Download: 0 times
Share this document with a friend
Description:
 
Popular Tags:
15
1 Reverse-Engineering BitTorrent: A Markov Approximation Perspective Ziyu Shao , Hao Zhang + , Minghua Chen , and Kannan Ramchandran + Department of Information Engineering The Chinese University of Hong Kong, Shatin, N.T., Hong Kong Email: {zyshao, minghua}@ie.cuhk.edu.hk + Department of Electrical Engineering and Computer Sciences, UC Berkeley, USA Email: {zhanghao, kannanr}@eecs.berkeley.edu Abstract—BitTorrent has been the most popular P2P (Peer-to- Peer) paradigm during recent years. Built upon great intuition, the piece-selection and neighbor-selection modules rooted in BitTorrent are critical for efficiency and scalability of many P2P systems, such as file-sharing and video-and-demand. Yet the theoretical underpin of these two modules remain largely undis- covered. In this paper we reverse-engineer BitTorrent protocol from a Markov approximation perspective. We show that to- gether with the underlying rate control algorithm, the rarest first and choking algorithms in BitTorrent protocol implicitly solve a cooperative combinatorial network utility maximization problem by implementing a Markov chain in a distributed manner. This understanding allows us to access properties of BitTorrent from a fresh perspective, including performance optimality, convergence and impacts of design parameters. Our numerical evaluations validate the analytical results. The insights obtained by studying BitTorrent not only help design better P2P systems, but also provide useful ingredients for synthesizing distributed algorithms for combinatorial problems in other domains. I. I NTRODUCTION In recent years the BitTorrent has attracted the attention of both industry and academia, eager to understand the remark- able success of this simple yet powerful protocol. A central element of the design philosophy that shaped the BitTorrent is the cooperative swarming mechanism, and a key illustration of the mechanism is provided by the rarest first and choking algorithms. Why does BitTorrent work so well? How might, or should, it evolve in the future? Answers to these questions will help the fundamental understanding of BitTorrent, which facilitates not only the improved design of P2P systems in a systematic way rather than the way with ad-hoc heuristics, but also distributed algorithms for other combinatorial network optimization problems. A lot of efforts have been made to answer these questions, including real data measurements, game-theoretic analysis and differential-equation based macroscopic analysis. Through these efforts, it is clear now that piece and neighbor selection strategies are the two keys of efficient and scalable P2P systems. For each peer, piece and neighbor selection strategies decide which peers to upload to and which pieces to download from which service peers. It is observed that rarest first algorithm, a piece selection scheme, guarantees close to ideal diversity of the pieces among peers; and choking algorithm, a neighbor selection scheme, provides an effective sharing incentive by implementing a tit-for-tat mechanism. Overall, BitTorrent is shown to be remarkably robust and scalable at ensuring high uplink bandwidth utilization [1]–[4]. These observations and insights made by existing efforts enrich the fundamental understandings of BitTorrent and greatly sharpen the design skills of P2P systems. We will discuss more details in the related Work section (Section II). Encouraged by the results from these exciting work, we further explore answers to the questions and reverse engineer BitTorrent from a new perspective, with the hope to reveal new hidden facts and provide new insights for future design. Our new perspective is based on the Markov approximation framework [5]. The main results are summarized in Table I. Detailed statements of results and contributions are listed as follows: We find that with underlying rate-control algorithms such as TCP, BitTorrent actually implements a Markov chain solving the following global optimization problem: maximize the aggregate downloading rates of all peers given the underlying physical edge capacity constraints and concurrent uploading connections limit. BitTorrent solves this problem by combining three components (rate control, piece selection and neighbor selection) in three separated time scales respectively. More precisely, we consider all peer neighboring configu- rations satisfying concurrent uploading connections limit. First, the rate control algorithm assigns overlay edge capacity given the peer neighboring configuration and arbitrary underlying physical edge capacity constraints. By doing so, BitTorrent actually goes beyond a common assumption made in almost all P2P algorithm designs (except [6], [7]) that uplink and (or) downlink of peers is the only rate-limiting bottleneck. Second, rarest first algorithm, the piece selection component of BitTorrent, implicitly maximizes the aggregate downloading rates of all peers given the peer neighboring configuration and overlay edge capacity. Third, choking algorithm, the neighbor selection component of BitTorrent, implicitly finding the best peer neighboring configuration by im- plementing a Markov chain over all configurations and
Transcript
Page 1: Shao (2012] [num, optimization] reverse engineering bit torrent- a markov  approximation perspective

1

Reverse-Engineering BitTorrent: A MarkovApproximation Perspective

Ziyu Shao∗, Hao Zhang+, Minghua Chen∗, and Kannan Ramchandran+

∗Department of Information EngineeringThe Chinese University of Hong Kong, Shatin, N.T., Hong Kong

Email: {zyshao, minghua}@ie.cuhk.edu.hk+Department of Electrical Engineering and Computer Sciences, UC Berkeley, USA

Email: {zhanghao, kannanr}@eecs.berkeley.edu

Abstract—BitTorrent has been the most popular P2P (Peer-to-Peer) paradigm during recent years. Built upon great intuition,the piece-selection and neighbor-selection modules rooted inBitTorrent are critical for efficiency and scalability of manyP2P systems, such as file-sharing and video-and-demand. Yet thetheoretical underpin of these two modules remain largely undis-covered. In this paper we reverse-engineer BitTorrent protocolfrom a Markov approximation perspective. We show that to-gether with the underlying rate control algorithm, the rarest firstand choking algorithms in BitTorrent protocol implicitly solve acooperative combinatorial network utility maximization problemby implementing a Markov chain in a distributed manner. Thisunderstanding allows us to access properties of BitTorrent from afresh perspective, including performance optimality, convergenceand impacts of design parameters. Our numerical evaluationsvalidate the analytical results. The insights obtained by studyingBitTorrent not only help design better P2P systems, but alsoprovide useful ingredients for synthesizing distributed algorithmsfor combinatorial problems in other domains.

I. INTRODUCTION

In recent years the BitTorrent has attracted the attention ofboth industry and academia, eager to understand the remark-able success of this simple yet powerful protocol. A centralelement of the design philosophy that shaped the BitTorrentis the cooperative swarming mechanism, and a key illustrationof the mechanism is provided by the rarest first and chokingalgorithms. Why does BitTorrent work so well? How might,or should, it evolve in the future? Answers to these questionswill help the fundamental understanding of BitTorrent, whichfacilitates not only the improved design of P2P systems ina systematic way rather than the way with ad-hoc heuristics,but also distributed algorithms for other combinatorial networkoptimization problems.

A lot of efforts have been made to answer these questions,including real data measurements, game-theoretic analysisand differential-equation based macroscopic analysis. Throughthese efforts, it is clear now that piece and neighbor selectionstrategies are the two keys of efficient and scalable P2Psystems. For each peer, piece and neighbor selection strategiesdecide which peers to upload to and which pieces to downloadfrom which service peers. It is observed that rarest firstalgorithm, a piece selection scheme, guarantees close to idealdiversity of the pieces among peers; and choking algorithm,

a neighbor selection scheme, provides an effective sharingincentive by implementing a tit-for-tat mechanism. Overall,BitTorrent is shown to be remarkably robust and scalableat ensuring high uplink bandwidth utilization [1]–[4]. Theseobservations and insights made by existing efforts enrich thefundamental understandings of BitTorrent and greatly sharpenthe design skills of P2P systems. We will discuss more detailsin the related Work section (Section II).

Encouraged by the results from these exciting work, wefurther explore answers to the questions and reverse engineerBitTorrent from a new perspective, with the hope to revealnew hidden facts and provide new insights for future design.Our new perspective is based on the Markov approximationframework [5]. The main results are summarized in Table I.Detailed statements of results and contributions are listed asfollows:

• We find that with underlying rate-control algorithmssuch as TCP, BitTorrent actually implements a Markovchain solving the following global optimization problem:maximize the aggregate downloading rates of all peersgiven the underlying physical edge capacity constraintsand concurrent uploading connections limit. BitTorrentsolves this problem by combining three components (ratecontrol, piece selection and neighbor selection) in threeseparated time scales respectively.

• More precisely, we consider all peer neighboring configu-rations satisfying concurrent uploading connections limit.First, the rate control algorithm assigns overlay edgecapacity given the peer neighboring configuration andarbitrary underlying physical edge capacity constraints.By doing so, BitTorrent actually goes beyond a commonassumption made in almost all P2P algorithm designs(except [6], [7]) that uplink and (or) downlink of peersis the only rate-limiting bottleneck. Second, rarest firstalgorithm, the piece selection component of BitTorrent,implicitly maximizes the aggregate downloading ratesof all peers given the peer neighboring configurationand overlay edge capacity. Third, choking algorithm, theneighbor selection component of BitTorrent, implicitlyfinding the best peer neighboring configuration by im-plementing a Markov chain over all configurations and

Page 2: Shao (2012] [num, optimization] reverse engineering bit torrent- a markov  approximation perspective

2

statistically hopping towards the best configuration.• We characterize the following properties of the corre-

sponding Markov chain: approximation gap, perturbationerror bound, insensitivity of count-down time, mixingtime, and trade-off between approximation gap and mix-ing time. These studies enable us to analyze propertiesof BitTorrent protocol including performance optimality,convergence and impacts of design parameters. Insightsobtained from these studies further improves not onlyP2P system design, but also distributed algorithms forcombinatorial network optimization problems in otherdomain.

The remainder of this paper is organized as follows. InSection II, we discuss the related work on BitTorrent. InSection III, we introduce the system model for BitTorrentand our perspective. In Section IV, we discuss the neighborselection component for BitTorrent and corresponding Markovchain design in details. Numerical results are provided inSection V, and conclusions are drawn in Section VI.

II. RELATED WORK

Bram Cohen, the BitTorrent protocol’s creator, has de-scribed BitTorrent’s main mechanisms and the design rationalein [17]. Since then, the widespread popularity of BitTorrenthas attracted the attention from the research community toconduct various performance studies in order to understandthe behavior of the BitTorrent protocol, its mechanisms andthe overall application performance. Here we intend to notenumerate all approaches in the literature, but three mainapproaches related to our work.

The first approach is based on real measurements [1],[3], [4], [18]–[20]. These measurements usually lasted forseveral months, either collecting tracker logs obtained fromthe trackers or collecting event logs by joining an ongoingtorrent with a modified client. The track logs enable us tohave the global view of BitTorrent performance whereas eventlogs enable us to observe the individual behavior of peers.Observations based on real measurements indeed give us somead-hoc design heuristics. In contrast, our work enable us tohave a systematic design.

The second approach is based on game-theoretic analysis[14], [21]–[25]. This line of work follows economic flavor,including Tit-for-Tat (TFT) strategy analysis, feasibility ofselfish behavior (free-riding), incentive compatibility, and auc-tion analysis. Major parts of these studies are characterizingthe existence, uniqueness, stability and other key properties ofNash equilibrium of gaming BitTorrent. These studies proveus a clear picture of economic flavor of BitTorrent. In contrast,our work is orthogonal to these studies. We do not considerthe economic incentive issue and focus on the cooperativebehavior of BitTorrent.

The third approach is differential-equation based macro-scopic analysis [14], [26]–[29]. In [14], a refined fluid modelof BitTorrent is proposed and the high efficiency of BitTorrentis shown. i.e., its capacity of service does not scale with thenumber of peers. However, this model assumes peer selectionbased on global knowledge of all peers in the torrent, as well as

uniform distribution of pieces. In contrast, our work does notassume global knowledge and each peer has only a limitedlocal view of networks. This is a more realistic modelingof BitTorrent protocol. In [26], a coupon replication modelof BitTorrent-like system is proposed by considering peerswith only limited upload. It is argued that overall systemperformance does not depend critically on either altruistic peerbehavior or the rarest-first piece selection strategy. In [27], anextend coupon replication model is proposed by consideringpeers with limited upload and download capacity. With thesame access link bottleneck assumption, in [28], a model isproposed to capture the trade-off between performance andfairness. In contrast, our model assume that the bottleneck linkcan be anywhere, which is more realistic. In [29], an improvedpiece selection strategy is proposed and analyzed. In contrast,in our work, we can characterize system trade-offs ( such asperformance vs. convergence) by both analytical modeling andsimulation. Further, our results access properties which arehard to analyze before. For example, we are able to quantifythe impact of each component (including rate-control,pieceselection and neighbor selection)individually in BitTorrent.

We believe that our results provide a fresh perspective toreverse engineering BitTorrent protocols. Together with theexisting works, our results forms a comprehensive basis uponwhich we have a fundamental understanding of BitTorrentprotocols including performance optimality, convergence andimpacts of design parameters.

Note that previously we apply Markov approximationframework to design P2P systems [11], [30]. Though ourcurrent work indeed borrows techniques from these worksincluding extended Markov chain model and insensitivityof count-down time, our current work is different from theprevious designs [11], [30] in the following aspects:

• Our current work is reverse engineering the BitTorrentprotocol while previous designs focus on forward engi-neering of P2P system.

• Our current work provides new and non-trivial results,including new bounds on mixing time analysis of Markovchain, new analysis on the trade-off between approxima-tion gap and mixing time, and a tighter bound on systemutility gap due to perturbation.

III. MODELING BITTORRENT

A. BitTorrent

Here we give an concise introduction of BitTorrent protocol.Files transferred using BitTorrent are split in pieces of typi-cally 256 kB, and each piece is split in blocks of 16 kB. Thereare two key components in BitTorrent: torrent and tracker. Atorrent defines a session of transfer of a single content to aset of peers. The tracker of this torrent keeps track of thepeers currently involved in the torrent and collect statistics onthe torrent. When a peer joins a torrent, the tracker will giveit a list of neighboring peers involved in this torrent, whichis called the neighbor set. Each peer knows the distributionof the pieces for each peers in its neighbor set. Further, apeer can only upload data to a subset of its neighbor setsimultaneously, and we call this subset the active neighbor set.

Page 3: Shao (2012] [num, optimization] reverse engineering bit torrent- a markov  approximation perspective

3

TABLE ISUMMARY OF RESULTS FOR REVERSE ENGINEERING BITTORRENT(BT) PROTOCOL

BT Components Functionality Time Scale Critical Issues Proof Techniques Sections and References

Rate Control Assigning overlay edge rates Fast Optimality NUM Sec. III-C-1) & [8]–[10]Convergence Lyapunov Function [8]–[10]

Piece Selection∗ Maximizing the aggregate downloading rates of all peers NormalOptimality Linear Programming Sec. III-C-2) & [8]–[10]

Convergence Lyapunov Function [8]–[10]

Neighbor Selection Choosing the best peer neighboring configuration SlowOptimality Markov approximation and perturbation analysis Sec. III-C-3), IV & [5], [11]

Convergence Markov approximation and mixing time Sec. III-C-3), IV-G & [5], [12], [13]∗ Note that our formulation is complementary to existing formulations of piece selection component [14]–[16].

The difference between neighbor set and active neighbor set iscalled potential neighbor set. For piece selection and neighborselection strategies, we focus here on two core algorithms ofBitTorrent:

1) Rarest First Algorithm for Piece Selection: In general,a peer has a choice of several blocks that it coulddownload from its neighbors. It employs a local rarestfirst (LRF) policy in picking which block to download:it tries to download the block that is least replicatedamong its neighbors.

2) choking Algorithm for Neighbor Selection: Each peerlimits the number of concurrent uploads to a smallnumber, typically 4 ∼ 7. The mechanism used to limitthe number of concurrent uploads is called choking.Choking is temporary refusal to upload; it stops upload-ing, but downloading can still happen.

• Rate-based Tit-for-Tat Choking Policy: Every 10seconds, a peer reevaluates the download rate pro-viding by its neighbors, then it chokes one activeneighbor which providing the worst downloadingrate and unchokes a new neighbor.

• Optimistic Unchoking Policy: Every 30 seconds,a peer unchokes a randomly chosen neighbor re-gardless of the download rate achieved from thatneighbor.

B. Notations

Consider an underlying physical network modeled as adirected graph G = (N ,L), where V is the set of all physicalnodes, including peering nodes and other intermediate nodessuch as routers, and L is the set of all physical links. Eachlink l ∈ L has a nonnegative capacity Cl.

Consider a P2P file sharing system over G. Note that inthis paper, we do not consider dynamic scenarios, i.e., peerscome and go. We use V ⊆ N to denote the set of all peeringnodes. We use E to denote the set of directed overlay linksbetween these peers. Note an overlay link (u, v) means u cansend data to v by setting up connections. For all e ∈ E andl ∈ L, we define

al,e =

{1, if overlay link e passes physical link l;

0, otherwise.(1)

For any edge e ∈ E, we denote ze as the associated edgerate. We denote Ef is the edge set of overlay graph under f .We also denote zf = [ze, e ∈ Ef ]

T and al = [al,e, e ∈ Ef ]T .

Each peer v has a neighbor set denoted by Nv and the sizeof Nv is denoted by Δ. However, each peer v can upload

to at most δ neighbors simultaneously. We denote f as peerneighboring configuration, i.e., a specific peer neighboringrelationship satisfying limits on the number of concurrentuploading connections. Let N f

v denote the active neighbor setof peer v under configuration f . We also denote F as the setof all possible peer neighboring configurations. For any peeru ∈ V , let xf

uv denote the peer u’s downloading rate frompeer v under f , and xf = {xf

uv} denote the vector of peers’downloading rates given configuration f .

C. Our Perspective

We adopt the deterministic fluid model. Overall, togetherwith TCP rate control algorithms, BitTorrent solves a globaloptimization problem: given the underlying physical capacityconstraints and concurrent uploading connections limit, maxi-mize the aggregate downloading rates of all peers. This globaloptimization problem is formulated as follows:

maxf,xf>0

∑u∈V

∑v∈Nu

xfuv (2)

s.t. xf ∈ Γ(zf ), (3)

f ∈ F . (4)

where Γ(zf ) is the feasible region for downloading rates xf

given configuration f and overlay edge rates zf , and zf isthe optimal solution of the following rate-control problem:

RC : maxzf≥0 U(zf ) (5)

s.t. aTl · zf ≤ Cl, ∀l ∈ L (6)

Here U(·) is the TCP utility function, and the constraint in (6)is the physical link capacity constraint.

The above global optimization problem is challenging tosolve due to its combinatorial nature. BitTorrent solves thisglobal optimization problem by combining three components(rate control, piece selection and neighbor selection) with threetime scales (Trs, Tps, Tns) respectively. The smaller the timescale, the faster the corresponding component converges. Wemake the time scale separation assumption, represented byTrs � Tps � Tns.

1) Rate Control Component. The purpose of this componentis to determine the overlay link rate given the overlay configu-ration f . This part is formulated as problem RC. By [8]–[10]we know that TCP protocol is reverse engineered to solvethe problem RC. More specifically, TCP protocol allocatesoverlay edge rates subject to underlay edge capacity accordingto TCP utility maximization. For example, when TCP Renoprotocol is adopted, U(zf ) is shown to be

∑e∈Ef

− 1zede

[9],where de is some delay metric on link e. The proofs for both

Page 4: Shao (2012] [num, optimization] reverse engineering bit torrent- a markov  approximation perspective

4

optimality and convergence to optimality are standard routineby adopting Lyapunov technique [8]–[10].

Remarks: In practice, some ISPs (internet serviceproviders) such as Comcast started to throttle the BitTorrentTraffic, creating bottlenecks at ISP peeing points. Moreover,the capacity bottleneck can be anywhere in the network, notnecessarily at the edge of the network [31], [32]. Our abovemodel and formulation allows us to access the performance ofBitTorrent over arbitrary network topologies where bottleneckscan be anywhere in the network. This is different from mostother P2P models that assume the peer uplinks/downlinks arethe only rate-limiting bottleneck.

2) Piece Selection Component. The purpose of this com-ponent is to maximize the summation of aggregate downlinkrates of all peers given the overlay configuration f and overlyedge rates zf . This part is formulated as follows:

PS : maxxf>0

∑u∈V

∑v∈Nu

xfuv (7)

s.t. xf ∈ Γ(zf ) (8)

This is the linear programming problem and we can adoptstandard Lyapunov technique [8]–[10] to show optimality andconvergence of corresponding subgradient algorithms.

How to relate this fluid flow model with the schedulingof discrete file pieces? In our opinion, for every downloadingrate computed by PS component, piece selection algorithms inBitTorrent such as rarest first strategy and others [3], [14]–[16]aim at achieving such downloading rate by carefully exchangefile pieces so that every receiving bit is ensured to be useful forthe receivers. It remains open to investigate the correctness ofthis conjecture. In this paper, we focus on fluid model basedstudy to reveal the big picture and in particular understandthe neighbor selection in BitTorrent. The investigation on theabove conjecture is left for future work.

Note that there are several other formulations for piece se-lection problems [14]–[16]. Our formulation is complementaryto existing models.

3) Neighbor Selection Component. Suppose the optimalsolution to problem PS given configuration f is denoted bygf =

∑u∈V

∑v∈Nu

x∗fuv , which represents the system utility

under f . The purpose of this component is to find the bestconfiguration such that its corresponding system utility gf ismaximum. This part is formulated as follows:

NS : maxf∈F

gf (9)

This is a combinatorial optimization problem. In general, thesize of F , i.e., the number of all possible peer neighboringconfigurations, can be exponential in the number of peernodes. We have the following result:

Proposition 1. In general, for any δ ≥ 2, the problem NSis NP-complete and APX-hard (no effective polynomial-timeapproximate solution).

This proof is based on a polynomial-time reduction withdegree-bounded-subgraph problem, a problem known as NP-complete and APX-hard [33], [34]. The proof adopts themethod in [35] and we omit details here.

Choking algorithm, a neighbor selection component, ap-proximately solves the problem NS in a distributed way.Details are provided in next section.

IV. NEIGHBOR SELECTION OF BITTORRENT

Based on Markov approximation framework [5], the prob-lem of NS are solved approximately by designing a Markovchain in a distributed way. We first design a specific Markovchain that gives a distributed algorithm solving the problemNS approximately. We then show how the resulting algorithmaccurately corresponds to the BitTorrent protocol.

A. Markov Approximation Framework

Original paper in [5] explains the framework from theoptimization perspective. Here we present the framework fromthe sampling perspective.

Without loss of generality, we assume that the optimalsolution for problem NS is unique and denote it as follows:

fo = argmaxf∈F

gf (10)

We associate with each configuration f ∈ F a probabilitypf . Then we can see that solving problem NS is equivalent tosampling the configuration space F from the following Diracdistribution:

pf =

{1 if f = fo

0 otherwise(11)

However, Dirac distribution is hard to obtain since f o isunknown to us. Therefore, we need to sample the configurationspace F from a new target distribution, which needs to satisfytwo conditions:

• C1: it can be obtained without knowing the exact valueof f o.

• C2: f o is the configuration with the largest probability(not necessary to be 1).

It turns out a product-form distribution parameterized byβ > 0 is a choice of this target distribution, shown as follows:

p∗f (g) =exp (βgf )∑

f ′∈Fexp (βgf ′)

, ∀f ∈ F , (12)

As we will see later that this product-form distributioncan be obtained by designing a time-reversible Markov chainwithout knowing the value of f o [36]. On the other hand,given a positive constant β, it is not hard to see f o =argmaxf∈F p∗f (g). Thus both conditions C1 and C2 aresatisfied.

Then when we sample the configuration space F from thedistribution p∗f (g) in (12), i.e., time-sharing among differentconfigurations according to distribution p∗

f (g) in (12), weactually solve the problem NS approximately and obtain aclose-to-optimal system utility.

By Markov approximation framework [5], we know that bydoing so, we actually approximate the maximum system utilityby a log-sum-exp function:

maxf∈F

gf ≈ 1

βlog

⎡⎣∑f∈F

exp (βgf )

⎤⎦ , (13)

Page 5: Shao (2012] [num, optimization] reverse engineering bit torrent- a markov  approximation perspective

5

Dirac Distribution Product-form Distribution

Fig. 1. Illustration of log-sum-exp approximation and sampling. We showthe sampling distribution pf , ∀f ∈ F and the corresponding performancemetric

∑f∈F pf ·gf − 1

β

∑f∈F pf log pf , i.e., sampling average of system

utility∑

f∈F pf · gf off by an entropy item 1β

∑f∈F pf log pf . On the

left hand side, we sampling from the Dirac distribution and the correspondingperformance metric is maxf∈F gf . On the right hand side, we samplingfrom the product-form distribution and the corresponding performance metricis 1

βlog

(∑f∈F exp

(βgf

)).

and the approximation accuracy is known as follows [5]:

0 ≤ 1

βlog

⎡⎣∑f∈F

exp (βgf )

⎤⎦−max

f∈Fgf ≤ 1

βlog |F|, (14)

where |F| denote the size of the set F . The whole relationshipis illustrated in Fig.1.

After log-sum-exp approximation, we need to design aMarkov chain such that its state space is F (all feasible peerneighboring configurations) and its stationary distribution isp∗f (g) in (12).

In the following, we design a Markov chain to satisfythe above requirement and its construction requires globalinformation of P2P systems. We call it “perfect Markov chain”and use it as a benchmark for further performance comparison.Then we will show that neighbor selection of BitTorrentactually implements a local perturbation of perfect Markovchain. We call this Markov chain as “BitTorrent Markovchain”. Performance guarantee of BitTorrent Markov chain isalso provided.

B. Perfect Markov Chain Design

First, we design the topology structure of state space. Directtransitions between two configurations f, f ′ ∈ F can happenif and only if:

• there ∃f such that f = f ∪ f ′ , f ⊇ f, f ⊇ f ′, |f \ f | =|f \ f | = 1;

• Link f \ f and link f \ f ′ originates from the same peer,denoted as v(f, f ′).

We call the above conditions as direct transition condition.In other words, we only allow direct transition that correspondto only a single peer unchoking a new inactive neighbor andchoking an active neighbor. It can be shown that in this way,the topology of state space is connected and irreducibility issatisfied.

Since the rates of indirect transitions are all zero, we focuson the design of direct transition rates. For convenience, westate some notations. For any two configurations f, f ′ ∈ Fsatisfying direct transition condition, and any node w ∈ f =f ∪ f ′, we define

Aw,f ={f ′′ ∈ F | f ′′ = f\ {(w, u)} , ∀u ∈ N f

w

}. (15)

We can see that any configuration f ′′ can be reached fromf by node w choking one active neighbor in N f

w . Then forany two configurations f, f ′ ∈ F satisfying direct transitioncondition, we set the transition rates as:

qf,f ′ = τexp

(β(gf ′ − gf

))∑

f ′′∈Av(f,f′),f

exp(β(gf ′′ − gf

)) (16)

qf ′,f = τexp

(β(gf − gf

))∑

f ′′∈Av(f,f′),f

exp(β(gf ′′ − gf

)) (17)

where τ > 0 is a constant and f = f ∪ f ′.We have the following results:

Proposition 2. The designed perfect Markov chain is a time-reversible Markov chain with the desired stationary distribu-tion in p∗f(g) in (12).

The proof is relegated to Appendix-A.One possible implementation is shown as follows:

Perfect Markov Chain Implementation• The following procedure runs on each individual peer

independently. We focus on a particular peer v ∈ V .• Initialization: Peer v randomly selects δ neighbors from

its neighbor list Nv and builds connections with theseselected neighbors.

• Step 1: Denote by f the current configuration. Peerv independently generates an exponentially distributedrandom number with mean 1

τ(Δ−δ) and counts downaccording to this number.

• Step 2: When the count-down expires, peer v randomuniformly unchokes a new inactive neighbor w from N v

potential set. This happens with probability 1Δ−δ , and the

system transits to a temporary configuration f .• Step 3: Peer v chokes an active neighbor u with proba-

bility

exp(β(gf ′ − gf

))∑

f ′′∈Av(f,f′),f

exp(β(gf ′′ − gf

)) , (18)

where f ′ = f\{(v, u)}. Peer v then repeats Step 1.

We observe the following fact:

Page 6: Shao (2012] [num, optimization] reverse engineering bit torrent- a markov  approximation perspective

6

Proposition 3. By the perfect Markov chain design, for anytwo configurations f, f ′ ∈ F satisfying direct transitioncondition, the transition rates are exactly the desired ones in(16).

The proof is relegated to Appendix-B.However, one drawback of the design above is that it is hard

to implement the perfect Markov chain in a distributed mannersince it requires every peer v ∈ V to know global informationgf ′′ − gf for every adjacent configuration f ′′ ∈ Av,f .

In the following, we propose to use local estimation to re-place the required global information. This lead to a fully dis-tributed implementation named as “soft choking algorithm”.However, we no longer implement the perfect Markov chainbut a perturbed one which we call “BitTorrent Markov chain”.We present the soft choking algorithm firstly, map it to theneighbor selection schemes of BitTorrent, then we characterizeits performance.

C. BitTorrent Markov Chain Design

We keep the same topology construction of state spaceas the one for perfect Markov chain. However, for directtransition rates, we modified them as follows: for any twoconfigurations f, f ′ ∈ F satisfying direct transition condition,

qf,f ′ = τexp

(−βxf\f ′

)∑

f ′′∈Av(f,f′),f

exp(−βxf\f ′′

) (19)

qf,f ′ = τexp

(−βxf\f

)∑

f ′′∈Av(f,f′),f

exp(−βxf\f ′′

) (20)

where τ > 0 is a constant and f = f ∪ f ′.Note that transition rates (19) are perturbation of transition

rates in (16) by using local measurement quantity −x f\f ′ toreplace global information quantity gf ′ − gf . Consequently,the perturbed Markov chain can be implemented in a fullydistributed manner, shown in Algorithm 1.

We have the following result:

Proposition 4. By running soft choking algorithm (Algorithm1), for any two configurations f, f ′ ∈ F satisfying directtransition condition, the transition rates are exactly the desiredones in (19).

The proof is similar to the proof of proposition 3 and weomit the details.

D. Mapping Algorithm 1 to BitTorrent Protocol

We now mapping Algorithm 1 (the implementation ofBitTorrent Markov chain) to BitTorrent protocol.

First, Step 1 of Algorithm 1 is exactly the same as theinitialization of BitTorrent protocol.

Second, Step 2 of Algorithm 1 is nearly the same asthe optimistic unchoking algorithm of BitTorrent protocol.The difference lies in the distribution of counter-time. TheBitTorrent protocol used in practice adopts a constant count-down time, while Algorithm 1 adopts exponential distribution

Algorithm 1 :Soft Choking Algorithm1: The following procedure runs on each individual peer

independently. We focus on a particular peer v ∈ V .

2: procedure INITIALIZATION

3: Nfv ← δ neighbors randomly picked from Nv

4: Builds connection with these neighbors.5: end procedure

6: procedure STEP 1: COUNT-DOWN PROCESS(v)7: Generates a timer

Tv ∼ exp (τ (Δ− δ))

an begins counting down.8: end procedure

9: procedure STEP 2: OPTIMISTIC UNCHOKING(v)10: Count-down expires.11: f ← a new inactive neighbor w unchoked randomly

from the peer v’s in active neighbor set.12: end procedure

13: procedure STEP 3: SOFT-WORST-NEIGHBOR-CHOKING(v)

14: Measures the downloading rates from each activeneighbor u ∈ N f

v .15: Chokes an active neighbor u with probability

exp (−βxfvu)∑

u′∈N fvexp (−βxf

vu′ ), (21)

where f ′ = f\{(v, u)}.16: end procedure17: Repeats Step 1.

of count-down time. As it will see later in next subsection(subsection IV-E), the stationary distribution of Markov chainis insensitive to the distribution of count-down time. In thissense, we can say Step 2 of Algorithm 1 is performingoptimistic unchoking scheme.

Third, Step 3 of Algorithm 1 (Soft-Worst-Neighbor-Choking) is a generalization of the Choking algorithm ofBitTorrent protocol, including choking algorithm as a specialcase. In soft-worst-neighbor-choking scheme, we can see thatthe lower the downloading rates, the more likely the corre-sponding active neighbor will be choked and vice versa. Asβ →∞, we can see that with probability 1, peer v chokes theneighbor with the worst downloading rates. Thus, soft-worst-neighbor-choking scheme degenerates to worst-neighbor-choke scheme in BitTorrent as β → ∞. Therefore, chokingalgorithm of BitTorrent protocol is an asymptotic version ofour soft-worst-neighbor-choking algorithm (as β →∞).

After building mapping from Algorithm 1 to BitTorrentProtocol, we can investigate properties of BitTorrent protocolby studying the properties of the corresponding Markov chain,including performance optimality, convergence and impacts of

Page 7: Shao (2012] [num, optimization] reverse engineering bit torrent- a markov  approximation perspective

7

design parameters.

E. Insensitivity of Count-down Time Distribution

For implementations of perfect Markov chain and BitTor-rent Markov chain, the probability distribution of count-downtime are both exponential. However, in practice, the count-down time can be constant. For example, the count-downtime before the optimistic unchoking is 30 seconds in realBitTorrent implementations [17]. In general, the distributionof count-down time is not exponential and the transitions ofpeer neighboring configurations do not form Markov chainsany more. To analyze the stationary distribution of this non-Markov process, we adopt the supplementary variable method[37]–[39]. First, we extend the state by including both con-figuration and residual count-down time. The transitions ofextended states form a continuous Markov process. Second,we analyze its equilibrium distributions. Then we obtain thestationary distribution of configurations by averaging over thedistribution of residual count-down times. We observe thefollowing insensitivity result:

Theorem 1. In implementations of perfect Markov chain, if wechange the distribution of count-down time from exponentialdistribution to general distribution and keep the same meanof count-down time ( 1

τ(Δ−δ) ), then the stationary distributionof any configuration f ∈ F is still p∗f (g) in (12).

The proof is relegated to Appendix-C. In the same way, sim-ilar insensitivity results can be obtained for implementationsof BitTorrent Markov chain.

We make the following remarks.

• Insensitivity property is very important because the count-down times in practical BitTorrent and other P2P systemimplementations are not exponential in general.

• As a corollary, the optimality gaps shown in (24) and (25)are also insensitive to the distribution of count-down timeif the mean of count-down time is still 1

τ(Δ−δ) .

F. Impacts of Local Perturbation

For any direct transition from f ∈ F to f ′ ∈ F , theperturbation error is defined as

ωf,f ′ = [gf ′ − gf ]− (−xf\f ′) (22)

where f = f ∪ f ′.Recall that g(·) is the summation of all peers’ aggregate

downloading rates given configuration and f ′ is obtained fromf by dropping one link f\f ′. Therefore, 0 ≤ gf−gf ′ ≤ xf\f ′ ,and ωf,f ′ ≥ 0. Without loss of generality, we assume ωf,f ′ isbounded and takes values between 0 and Λmax.

Perturbation errors are incurred by replacing global knowl-edge [gf ′ − gf ] with local estimation −xf\f ′ , thus the sta-tionary distribution of BitTorrent Markov chain is differentfrom the one of Perfect Markov chain. Based on a recentlydeveloped analysis on two-dimensional perturbation errors[40], we have the following result:

Theorem 2. (a) The stationary distribution of BitTorrentMarkov chain is

pf (g) =σf exp (βgf )∑

f ′∈F σf ′ exp (βgf ′), ∀f ∈ F (23)

where σf =∑nf

k=0 ρfk exp(β kΛmax

nf

), nf , ∀f ∈ F is the level

of quantization errors and ρfk (0 ≤ k ≤ nf ) is the distributionof quantized perturbation errors.(b) Let gmax = maxf∈F gf denote the optimal system utility,g∗ave =

∑f∈F p∗f · gf denote the expected system utility with

perfect Markov chain, and gave =∑

f∈F pf · gf denoteexpected system utility with BitTorrent Markov chain. Thenthe optimality gap are shown as follows:

0 ≤ gmax − g∗ave ≤log |F|

β(24)

0 ≤ gmax − gave ≤ log |F|β

+ Λmax (25)

We omit details here since the proof is very similar to [40].We observe the following properties:

• When Λmax = 0, i.e., all perturbation bounds are zero,BitTorrent Markov chain degenerates into the perfectMarkov chain.

• The upper bound on optimality gap of BitTorrent Markovchain shown in (25) is quite general, as it is independentof the values of nf , f ∈ F , and the distributions ofperturbation errors ρfk (0 ≤ k ≤ nf , f ∈ F).

• The upper bound on optimality gap of BitTorrent Markovchain decreases linear with the maximum perturbationerror Λmax.

• When β increases, the optimality gap for both perfectMarkov chain and BitTorrent Markov chain decreases.

• The upper bound on optimality gap of BitTorrent Markovchain is loose than the counterpart of perfect Markovchain because of perturbation errors. The difference isΛmax and we call it “the price of local perturbation”.

Remarks: Existing perturbation theory of Markov chain[41], [42] is based on general matrix analysis approach andcan be applied for arbitrary Markov chains. The obtainedbounds may not be tight for time-reversible Markov chains.In contrast, we exploit the structure of time-reversible Markovchains and develop the extended Markov chain approach. Thisextended Markov chain approach is dedicated for studyingperturbation analysis of time-reversible Markov chains.

G. Mixing Time of The Designed Markov Chain

The convergence time of BitTorrent mainly depend on theconvergence time of neighbor selection component, which canbe characterized by the mixing time of Markov random filed.This is open in general. However, by the insensitivity resultsabove, we can study the implementations with exponentiallydistributed count-down times, i.e., perfect Markov chain andBitTorrent Markov chain. We focus on the mixing time ofperfect Markov chain. By studying mixing time, we canquantify the convergence time of BitTorrent protocols andexplore the design space.

Page 8: Shao (2012] [num, optimization] reverse engineering bit torrent- a markov  approximation perspective

8

Recall that p∗ (12) is the stationary distribution of theperfect Markov chain. Let H t(f) denote the probabilitydistribution of all states in F at time t given that the initialstate is f . We define mixing time of perfect Markov chain asfollows:

tmix(ε) � inf

{t ≥ 0 : max

f∈FdTV (Ht(f),p

∗) ≤ ε

}(26)

where the total variance distance of any two probabilitydistributions p,p′ is defined as [13]:

dTV (p,p′) � 1

2

∑f∈F|pf − p′f | (27)

We have the following results.

Theorem 3. The mixing time tmix(ε) for perfect Markov chainis bounded as follows:(a) for general β ∈ (0,∞),

tmix(ε) ≥ exp (−β (gmax − gmin))

2τ · δn−1(Δ− δ)nln

1

2ε(28)

tmix(ε) ≤ 2δn+1(Δ− δ)n

τ

δ

)2n

exp(5β(gmax − gmin))

· [ln 1

2ε+

n

2ln

δ

)+

1

2β(gmax − gmin)] (29)

where gmax = maxf∈F gf , gmin = minf∈F gf and n = |V |denotes the number of peers in system.(b) When

0 < β <1

gmax − gminln[(1 +

1

δ)(1 +

1

Δ− δ − 1)] (30)

, we have a tighter upper bound:

tmix(ε) ≤1

τ(Δ−δ) · ln nδε

1− (1 − 1Δ−δ ) · ( δ

δ+1 exp(β(gmax − gmin)))

(31)

The proof is relegated to Appendix-D.Remarks: We discuss the trad-off between optimality gap

(Theorem 2) and mixing time (Theorem 3). We consider twoends of this spectrum.

• As β →∞, the optimality gap approaches zero while theupper bound of mixing time scales with exp(Ω(n)) andapproaches infinity (slow-mixing).

• As β → 0, the optimality gap approaches infinity whilethe upper bound of mixing time scales with O(log(n))and remain limited (fast-mixing).

This resembles the phase transition phenomenon in statisticsphysics field: when β ≤ βth, the whole system is fast mixing,while when β > βth, the whole system is slow mixing. Hereβth is the threshold value for phase transition. In our case,βth = 1

gmax−gminln[(1 + 1

δ )(1 + 1Δ−δ−1 )], a small value. As

we will see later, βth can be larger in experiments.

TABLE IIDISTRIBUTION OF PEERS’ UPLOAD BANDWIDTH

Upload (kbps) 256 378 512 768 1024 2048Fraction (%) 40 5 5 5 5 40

V. EXPERIMENTAL RESULTS

A. Setup and Purpose

The system parameters are chosen as follows: number ofpeers |V | = 1000, peers’ upload neighbor size Δ = 20, peers’upload degree bound δ = 4. Two types of bottlenecks are setto exist in the network, i.e., peers’ upload capacity bottleneckand download capacity bottleneck. We assume upload capacityfollow the distribution shown in Table II. This distribution ischosen based on practical data in commercialized P2P sys-tems [43]. For simplicity, we assume all peers’ have the samedownload capacity of 512kpbs. TCP is run to facilitate therate allocation given any neighboring topology configuration,and the proposed neighbor selection algorithm is run on top ofTCP. It is worth mentioning that any rate allocation algorithmcan be used, and our proposed solution is independent of theunderlying rate control scheme.

With the above setup, we aim to demonstrate our algorithm’sperformance and compare the results with random neighborchoking (essentially a special case of our algorithm at β = 0),BitTorrent’s worst neighbor choking (another special casewhen β = ∞), and no choking. We show that our proposedsolution is able to achieve the theoretical upper bound ofsystem utility. We then compare the convergence time atdifferent β’s and number of nodes |V |.

B. Effectiveness of Neighbor Choking

In Fig.2(a), we show system’s total utility versus simulationtime of different algorithms. When β = 0, the schemeessentially applies random neighbor choking, in which peersrandomly select a neighbor to choke. In the no choking case,peers stick to their initial randomly-chosen neighbor connec-tions without changing neighbors. In all the above cases, τ ischosen such that each peer has a constant count-down time of30 seconds. In Fig.2(b), our algorithm is shown for various β’s.BitTorrent’s worst neighbor choking algorithm can be thoughtof a special case when β = ∞. From the above figures,we can see that the proposed solution achieve much betterperformance compared to other algorithms, and achieve betterperformance at larger β’s. All algorithms converge reasonablyfast, in about 200 to 400 seconds. The scheme can also achieveclose to optimal solution when β is large.

C. Performance-Convergence Trade-off

In this section, we take a closer look of convergence timeof the algorithm at different β’s and |V |’s while keeping otherparameters the same, where convergence time is defined asthe time when the system’s average utility does not changewithin 0.01% of its current value. Fig.2 (c) shows that theconvergence time increases almost linearly with β, and sub-linear in the network size |V |. From Fig.2 (b) however, wesee that the algorithm approaches to very close to optimalvalue when β = 10, and even in this case, the convergence

Page 9: Shao (2012] [num, optimization] reverse engineering bit torrent- a markov  approximation perspective

9

1 100 200 300 4001

1.1

1.2

1.3

1.4x 105

time (seconds)

ov

eral

l u

tili

ty

no chokingSWNC, β = 0(random choking)SWNC, β = 10upper bound

(a) effectiveness of neighbor selection

100 200 300 400 5001.32

1.33

1.34

1.35

1.36

1.37x 105

time (seconds)

ov

eral

l u

tili

ty

SWNC, β = 2SWNC, β = 3SWNC, β = 10upper bound

(b) different β’s

0 2 4 6 8 10100

200

300

400

500

β

tim

e

|V| = 100|V| = 1000|V| = 2000

(c) convergence time

Fig. 2. (a) compares no choking, random choking, and soft-worst-neighbor choking; (b) compares different β’s and ; (c) shows convergence time for variousβ’s and |V |’s.

time is small, i.e., less than 500 seconds. While the theoreticalbounds provide a guidance to the mixing time, in practicethe algorithms performance much better, and the system willstabilize in less than 10 minutes for a reasonably large swarmsize.

VI. CONCLUSION

In this paper, based on Markov approximation frame-work, we reverse-engineered BitTorrent protocol from a freshperspective. We find that BitTorrent actually implements aMarkov chain solving a challenging combinatorial optimiza-tion problem: maximize the aggregate downloading rates of allpeers given the underlying physical edge capacity constraintsand concurrent uploading connections limit. BitTorrent solvesthis problem by combining three components (rate control,piece selection and neighbor selection) with three separatedtime scales respectively. After briefly discussing the rate-control component and the piece selection component, we turnour focus to the neighbor selection component.

By applying Markov approximation framework, we design aperfect Markov chain requiring global information to approxi-mately solve the above challenging combinatorial optimizationproblem in a distributed manner. We also design a BitTorrentMarkov chain requiring only local information by a localperturbation of the perfect Markov chain. We map the imple-mentation of BitTorrent Markov chain to BitTorrent protocol.Thus properties of BitTorrent protocol can be analyzed bystudying properties of Markov chain.

To characterize the impacts of Markov approximation andlocal perturbation, we show the bounds of system utilitygap, which depend on approximation factor and maximumperturbation error bound. We then show the insensitivity ofcount-down time distribution, which includes real BitTorrentscenario (constant count-down time). Further, we study theconvergence time of Markov chain through the mixing timemetric. By conductance method and coupling method, weobtain both upper and lower bounds of mixing time. Wealso characterize the trade-off between the performance andconvergence of BitTorrent via the approximation gap and mix-ing time of the designed Markov chain. This characterizationprovides insights for future design of P2P systems. We presentnumerical results that validate our findings. A possible futurestep is to incorporate session-level stochastic dynamics of P2Psystems where each peer stays in the system for a finite time.

In summary, our work brings fresh perspectives into un-derstanding and improving P2P system designs and othercombinatorial network optimization problems.

REFERENCES

[1] J. Pouwelse, P. Garbacki, D. Epema, and H. Sips, “The bittorrent p2pfile-sharing system: Measurements and analysis,” in IPTPS, 2005, pp.205–216.

[2] A. Bharambe, C. Herley, and V. Padmanabhan, “Analyzing and improv-ing a bittorrent network’s performance mechanisms,” in Proc. of IEEEINFOCOM’06, 2006.

[3] A. Legout, G. Urvoy-Keller, and P. Michiardi, “Rarest first and chokealgorithms are enough,” in Proceedings of the 6th ACM SIGCOMMconference on Internet measurement, 2006, pp. 203–216.

[4] A. Legout, N. Liogkas, E. Kohler, and L. Zhang, “Clustering and sharingincentives in bittorrent systems,” in Proceedings of the 2007 ACMSIGMETRICS, 2007, pp. 301–312.

[5] M. Chen, S. Liew, Z. Shao, and C. Kai, “Markov approximation forcombinatorial network optimization,” in Proc. of IEEE INFOCOM 2010,2010, pp. 1–9.

[6] N. Laoutaris, D. Carra, and P. Michiardi, “Uplink allocation beyondchoke/unchoke,” in Proc. of ACM CoNEXT’08, 2008.

[7] X. Chen, M. Chen, B. Li, Y. Zhao, Y. Wu, and J. Li, “Celerity: A low de-lay multiparty conferencing solution,” in Proc. of ACM Multimedia’11,2011.

[8] F. Kelly, A. Maulloo, and D. Tan, “Rate control for communicationnetworks: shadow prices, proportional fairness and stability,” Journal ofthe Operational Research society, vol. 49, no. 3, pp. 237–252, 1998.

[9] S. H. Low, “A duality model of tcp and queue management algorithms,”IEEE/ACM Transactions on Networking, vol. 11, no. 4, pp. 525–536,2003.

[10] M. Chiang, S. H. Low, A. Calderbank, and J. Doyle, “Layering asoptimization decomposition: A mathematical theory of network archi-tectures,” Proceedings of the IEEE, vol. 95, no. 1, pp. 255–312, 2007.

[11] S. Zhang, Z. Shao, and M. Chen, “Optimal distributed p2p streamingunder node degree bounds,” in Proc. of IEEE ICNP 2010, 2010, pp.253–262.

[12] D. Levin, Y. Peres, and E. Wilmer, Markov Chains and Mixing Times.American Mathematical Society, 2009.

[13] P. Diaconis and D. Stroock, “Geometric bounds for eigenvalues ofMarkov chains,” The Annals of Applied Probability, vol. 1, no. 1, pp.36–61, 1991.

[14] D. Qiu and R. Srikant, “Modeling and performance analysis ofbittorrent-like peer-to-peer networks,” in Proc. of ACM SIGCOMM 04,2004, pp. 367–378.

[15] T. Bonald, L. Massoulie, F. Mathieu, D. Perino, and A. Twigg, “Epi-demic live streaming: optimal performance trade-offs,” in Proc. of ACMSigmetrics’08, 2008, pp. 325–336.

[16] R. Xia and J. Muppala, “A survey of bittorrent performance,” IEEECommunications Surveys & Tutorials, vol. 12, no. 2, pp. 140–158, 2010.

[17] B. Cohen, “Incentives build robustness in BitTorrent,” in Workshop onEconomics of Peer-to-Peer systems, vol. 6, 2003, pp. 68–72.

[18] M. Izal, G. Urvoy-Keller, E. Biersack, P. Felber, A. Al Hamra, andL. Garces-Erice, “Dissecting bittorrent: Five months in a torrent’slifetime,” Passive and Active Network Measurement, pp. 1–11, 2004.

Page 10: Shao (2012] [num, optimization] reverse engineering bit torrent- a markov  approximation perspective

10

[19] A. Bellissimo, B. Levine, and P. Shenoy, “Exploring the use of bittorrentas the basis for a large trace repository,” University of MassachusettsTechnical Report, pp. 04–41, 2004.

[20] N. Andrade, M. Mowbray, A. Lima, G. Wagner, and M. Ripeanu,“Influences on cooperation in bittorrent communities,” in Proceedingsof the 2005 ACM SIGCOMM workshop on Economics of peer-to-peersystems, 2005, pp. 111–115.

[21] M. Feldman, K. Lai, I. Stoica, and J. Chuang, “Robust incentivetechniques for peer-to-peer networks,” in Proceedings of the 5th ACMconference on Electronic commerce, 2004, pp. 102–111.

[22] S. Jun and M. Ahamad, “Incentives in bittorrent induce free riding,” inProceedings of the 2005 ACM SIGCOMM workshop on Economics ofpeer-to-peer systems. ACM, 2005, pp. 116–121.

[23] M. Piatek, T. Isdal, T. Anderson, A. Krishnamurthy, and A. Venkatara-mani, “Do incentives build robustness in bittorrent,” in Proc. of NSDI,2007.

[24] G. Neglia, G. Presti, H. Zhang, and D. Towsley, “A network formationgame approach to study bittorrent tit-for-tat,” Network Control andOptimization, pp. 13–22, 2007.

[25] D. Levin, K. LaCurts, N. Spring, and B. Bhattacharjee, “Bittorrent isan auction: analyzing and improving bittorrent’s incentives,” in Proc. ofACM SIGCOMM 2008, 2008, pp. 243–254.

[26] L. Massoulie and M. Vojnovic, “Coupon replication systems,”IEEE/ACM Transactions on Networking (TON), vol. 16, no. 3, pp. 603–616, 2008.

[27] M. Lin, B. Fan, J. Lui, and D. Chiu, “Stochastic analysis of file-swarming systems,” Performance Evaluation, vol. 64, no. 9-12, pp. 856–875, 2007.

[28] B. Fan, D. Chiu, and J. Lui, “The delicate tradeoffs in bittorrent-like filesharing protocol design,” in Proc. of IEEE ICNP’06., 2006, pp. 239–248.

[29] P. Michiardi, K. Ramachandran, and B. Sikdar, “Modeling seed schedul-ing strategies in bittorrent,” NETWORKING 2007. Ad Hoc and SensorNetworks, Wireless Networks, Next Generation Internet, pp. 606–616,2007.

[30] H. Zhang, Z. Shao, M. Chen, and K. Ramchandran, “Optimal NeighborSelection in BitTorrent-like Peer-to-Peer Networks,” in Proceedings ofACM SIGMETRICS, 2011.

[31] A. Akella, S. Seshan, and A. Shaikh, “An empirical evaluation ofwide-area internet bottlenecks,” in Proc. of the 3rd ACM SIGCOMMConference on Internet Measurement, 2003, pp. 101–114.

[32] N. Hu, L. Li, Z. Mao, P. Steenkiste, and J. Wang, “Locating internetbottlenecks: Algorithms, measurements, and implications,” in ACMSIGCOMM, 2004.

[33] M. Garey and D. Johnson, Computers and Intractability: A Guide tothe Theory of NP-completeness. WH Freeman & Co. New York, NY,USA, 1979.

[34] G. Ausiello, Complexity and Approximation: Combinatorial Optimiza-tion Problems and Their Approximability Properties. Springer Verlag,1999.

[35] S. Liu, M. Chen, S. Sengupta, M. Chiang, J. Li, and P. Chou, “P2pstreaming capacity under node degree bound,” in Proc. of IEEE ICDCS2010, 2010, pp. 587–598.

[36] F. Kelly, Reversibility and Stochastic Networks. Wiley,Chichester, 1979.[37] B. Sevastyanov, “An ergodic theorem for Markov processes and its

application to telephone systems with refusals,” Theory of probabilityand its applications, vol. 2, p. 104, 1957.

[38] K. Chandy, J. Howard Jr, and D. Towsley, “Product form and localbalance in queueing networks,” Journal of the ACM (JACM), vol. 24,no. 2, pp. 250–263, 1977.

[39] S. Liew, C. Kai, H. Leung, and P. Wong, “Back-of-the-envelope com-putation of throughput distributions in CSMA wireless networks,” IEEETransactions on Mobile Computing, vol. 9, pp. 1319–1331, 2010.

[40] H. Zhang, Z. Shao, M. Chen, and K. Ramchandran, “An OptimizedVideo-on-Demand System Based on Distributed Caching,” TechnicalReport, 2011.

[41] G. Cho and C. Meyer, “Comparison of perturbation bounds for thestationary distribution of a markov chain,” Linear Algebra and itsApplications, vol. 335, no. 1-3, pp. 137–150, 2001.

[42] A. Mitrophanov, “The spectral gap and perturbation bounds for re-versible continuous-time markov chains,” Journal of applied probability,vol. 41, no. 4, pp. 1219–1222, 2004.

[43] PPStream. http://www.ppstream.com/.[44] R. Bubley and M. Dyer, “Path coupling: A technique for proving rapid

mixing in markov chains,” in FOCS, 1997, pp. 223–231.

APPENDIX

A. Proof for Proposition 2

By direct transition condition, we know that all configura-tions can reach each other within a finite number of transitions,thus the constructed Markov chain is irreducible. Further, it isa finite state ergodic Markov chain with a unique stationarydistribution. We now show that the stationary distribution isindeed (12).

Based on the transition rate specified in (16), we seethat p∗f (g)qf,f ′ = p∗f ′(g)qf ′,f , ∀f, f ′ ∈ F , i.e., the detailedbalance equations hold. Thus the constructed Markov chainis time-reversible and its stationary distribution is indeed (12)according to Theorem 1.3 and Theorem 1.14 in [36].

B. Proof for Proposition 3

We know that for any direct transition from f to f ′, thereexists a temporary state f = f ∪f ′, a peer v unchokes peer wand choke peer u. Since the count-down rate for peer v in fis τ(Δ− δ), the probability for peer v to unchoke w is 1

Δ−δ ,and the probability for peer v to choke u is

exp(β(gf ′ − gf

))∑

f ′′∈Av(f,f′),f

exp(β(gf ′′ − gf

)) (32)

It follows that the transition rate from f to f ′ is

qf,f ′ = τ(Δ − δ) · 1

Δ− δ·

exp(β(gf ′ − gf

))∑

f ′′∈Av(f,f′),f

exp(β(gf ′′ − gf

))(33)

= τexp

(β(gf ′ − gf

))∑

f ′′∈Av(f,f′),f

exp(β(gf ′′ − gf

)) (34)

This concludes the proof.

C. Proof for Theorem 1

We suppose that within any configuration f ∈ F , the count-down time for each peer v ∈ V are i.i.d with probabilitydensity function lv,f and mean 1

τ(Δ−δ) . Previously we modelthe peer neighboring state as peer configurations f ∈ F . Thismodel is complete under the exponential count-down timeassumption because of the memoryless property of the expo-nential distribution. In general, for each configuration f ∈ F ,we define an extended state Yf = (f, {Rv(f), v ∈ V }),where Rv(f) ∈ [0,+∞), ∀v ∈ V is the residual count-downtime. Rv(f) decreases continuously and its rate of decreaseis dRv(f)

dt = −1. Since there are infinite possible values forRv(f), the state space is infinite. Therefore Y = {Yf , f ∈ F}is a continuous-state Markov process and we denote y =(f, {rv(f), v ∈ V }) as a realization.

Let pY (t, y) be the state probability density at time t. Itsderivative with respect to t is

dpY (t, y)

dt= lim

�t→0

pY (t+�t, y)− pY (t, y)

�t(35)

Page 11: Shao (2012] [num, optimization] reverse engineering bit torrent- a markov  approximation perspective

11

At the time interval from t to t + �t, the state changesas a result of peer finishing counter-down and peer continuingcounter-down. There is only one type of jump events that causea discontinuity in the evolution of y: a peer finishing count-down. For small values of�t, multiple jump events occur withprobability in order o(�t) and can be disregarded. Betweenthe jump events, peers are continue counting down, in whichcase y changes continuously without f being changed. For aparticular realization y, we have

pY (t+�t, y) = A+B + o(�t), (36)

where A is the contribution due to count-down-to-zero jumpevents, and B is the contribution due to ordinary countingdown without any jump events, and lim�t→0

o(�t)�t = 0.

A. Let y = (f, {rv(f)}v∈V ) be the state at t +�t. Thenwe have

A =∑v∈V

pY (t, RCv0+(y))lv,f (rv(f))�t (37)

where RCv0+(y) is the operation that sets rv(f) in f to be 0+

(i.e, just before the counter-down of peer v completes), andlv,f (rv(f)) is the probability density of a newly generatedcount-down time for peer v.

B. Let y = (f, {rv(f)}v∈V ) be the state at t + �t andsuppose that no count-down-to-zero events occur during theinterval from t to t+�t. Then the state at time t must havebeen y = (f, {rv(f) + �t}v∈V , for the rv(f) decrease atrate −1. Therefore,the contribution is B = pY (t, (f, {rv(f)+�t}v∈V . By expanding in a Taylor series about each rv(f),we have

B = pY (t, (f, {rv(f) +�t}v∈V (38)

= pY (t, y) +∑v∈V

∂pY (t, y)

∂rv(f)�t+ o(�t) (39)

Putting (37) and (39) into (36), and applying the definitionof derivative in (35), we have

dpY (t, y)

dt=

∑v∈V

[pY (t, RCv0+(y))lv,f (rv(f)) +

∂pY (t, y)

∂rv(f)

].

(40)

In stationary, the derivative with respect to time t cancel, sothat dpY (t,y)

dt = 0 and we have the following balance equation

∑v∈V

[pY (RCv0+(y))lv,f (rv(f)) +

∂pY (y)

∂rv(f)

]= 0 (41)

Next, we will show that the stationary probability densityof Y is:

pY (y) = p∗f∏v∈V

(1− ∫ rv(f)

0lv,f(t)dt)

1τ(Δ−δ)

(42)

where p∗f is given by (12).In other words, we will show that the stationary probability

density in (42) satisfies the balance equation (41). In fact, wewill show that[

pY (RCv0+(y))lv,f (rv(f)) +∂pY (y)

∂rv(f)

]= 0, ∀v ∈ V. (43)

Under (42), ∀v ∈ V ,

− ∂pY (y)

∂rv(f)

= −d

(1−∫ rv(f)

0 lv,f (t)dt)

1τ(Δ−δ)

drv(f)· p∗f ·

∏v′∈V −{v}

(1− ∫ rv′ (f)0

lv′,f (t)dt)1

τ(Δ−δ)

(44)

=lv,f (rv(f))

1τ(Δ−δ)

· p∗f ·∏

v′∈V−{v}

(1 − ∫ rv′ (f)0 lv′,f (t)dt)

1τ(Δ−δ)

(45)

On the other hand, in state y, ∀v ∈ V , it is not hard to seethe probability density function of residual count-down time

rv(f) is (1−∫ rv(f)0 lv,f (t)dt)

1τ(Δ−δ)

[37], [39]. Then we have

pY (RCv0+(y))lv,f (rv(f))

= lv,f (rv(f)) ·(1− ∫ 0+

0 lv,f (t)dt)1

τ(Δ−δ)

· p∗f

·∏

v′∈V −{v}

(1− ∫ rv′ (f)0

lv′,f (t)dt)1

τ(Δ−δ)

(46)

=lv,f (rv(f))

1τ(Δ−δ)

· p∗f ·∏

v′∈V−{v}

(1− ∫ rv′ (f)0

lv′,f (t)dt)1

τ(Δ−δ)

(47)

Thus by comparing (45) and (47), we know that

−∂pY (y)

∂rv(f)= pY (RCv0+(y))lv,f (rv(f)), ∀v ∈ V (48)

Therefore, the stationary probability density in (42) satisfiesthe balance equation (41).

By integrating pY (y) in (42) overall all possible values ofrv(f), ∀v ∈ V , we see that the stationary distribution for anyconfiguration f ∈ F is p∗f in (12). This means the stationarydistribution of configuration f is insensitive to the distributionof count-down times.

This concludes the proof.

D. Proof for Theorem 3

(a). The proof for part (a) is based on the spectral analysismethod [12], [13].

The perfect Markov chain is a continuous-time Markovchain and its stationary distribution is

p∗f(g) =exp[βgf ]∑

f ′∈Fexp[βgf ′ ]

, ∀f ∈ F

Since∑

f ′∈Fexp[βgf ′ ] ≤ |F| exp(βgmax) and |F| ≤ (

Δδ

)n,

the minimal probability in the stationary distribution

pmin � minf∈F

p∗f (g) ≥exp(βgmin)

|F| · exp(βgmax)(49)

≥ 1(Δδ

)n exp(−β(gmax − gmin)) (50)

To utilize the existing bounds on convergence to the station-ary distribution of discrete-time Markov chain, we uniformize

Page 12: Shao (2012] [num, optimization] reverse engineering bit torrent- a markov  approximation perspective

12

the perfect Markov chain. Uniformization plays the role ofbridge between discrete-time Markov chain and continuous-time Markov chain.

Denote Q={qf,f ′} as the transition rate matrix of perfectMarkov chain. Construct a discrete-time Markov chain Z(n)with its probability transition matrix P = I+ Q

θ , where I is theidentity matrix. Then consider a system that successive statesvisited form a Markov chain Z(n) and the times at which thesystem changes its state form a Poisson process N(t). HereN(t) is an independent Poisson process with rate θ. Then thestate of this system at time t is denoted by Z(N(t)), which iscalled a subordinated Markov chain.

Let

θ = δn(Δ− δ)n · τδexp (β(gmax − gmin)) (51)

where gmin = minf∈F

gf and gmax = maxf∈F

gf .

Since ∀f, f ′ ∈ F ,

qf,f ′ ≤ τexp

(β(gf ′ − gf

))∑

f ′′∈Av(f,f′),f

exp(β(gf ′′ − gf

)) (52)

= τexp (β (gf ′))∑

f ′′∈Av(f,f′),f

exp (β (gf ′′))(53)

≤ τexp (βgmax)

δ exp (βgmin)=

τ

δexp (β(gmax − gmin)) (54)

and f can at most transit to [δ(Δ − δ)]n other states, thus∑f ′ �=f

qf,f ′ ≤ δn(Δ− δ)n · τδ exp (β(gmax − gmin)) = θ. Then

by uniformization theorem [12] , perfect Markov chain andits discrete-time counterpart Z(N(t)) has the same distribution.Further, p∗ is also the stationary distribution of Z(n).

Let ρ2 denotes the second largest eigenvalue of transitionmatrix P for Markov chain Z(n). By spectral gap inequality[12], [13] we have

exp(−θ(1− ρ2)t)

2≤ max

f∈FdTV (Ht(f),p

∗) ≤ exp(−θ(1− ρ2)t)

2√pmin

(55)

Therefore,

1

θ(1 − ρ2)ln

1

2ε≤ tmix(ε) ≤ 1

θ(1 − ρ2)[ln

1

2ε+

1

2ln

1

pmin]

(56)

Now we bound ρ2 by Cheeger’s inequality [12], [13]:

1− 2Φ ≤ ρ2 ≤ 1− 1

2Φ2 (57)

where Φ is the “Conductance” of P, defined as

Φ � minN⊂F ,πN∈(0,1/2]

F (N,N c)

πN (g)(58)

Here πN (g) =∑f∈N

p∗f(g) and F (N,N c) =∑f∈N,f ′∈Nc

p∗f (g)P (f, f ′).

Combining (56) and (57), we have

1

2θΦln

1

2ε≤ tmix(ε) ≤ 2

θΦ2[ln

1

2ε+

1

2ln

1

pmin] (59)

First, we give an upper bound of Φ. For any N ′ ⊂F , π(N ′) ∈ (0, 1/2]

Φ = minN⊂F ,π(N)∈(0,1/2]

F (N,N c)

πN (g)(60)

≤ 1

πN ′(g)

∑f∈N ′,f ′∈N ′c

p∗f (g)P (f, f ′). (61)

=1

πN ′(g)

∑f∈N ′

p∗f (g) · (∑

f ′∈N ′cP (f, f ′)) (62)

≤ 1

πN ′(g)

∑f∈N ′

p∗f (g) (63)

= 1 (64)

Combining (51), (59) and (64), we have

tmix(ε) ≥ 1

2θln

1

2ε(65)

=exp (−β (gmax − gmin))

2τ · δn−1(Δ− δ)nln

1

2ε(66)

Now we give a lower bound of Φ. When qf,f ′ �= 0, ∀ ∈ F ,by (16),

qf,f ′ = τexp

(β(gf ′ − gf

))∑

f ′′∈Av(f,f′),f

exp(β(gf ′′ − gf

)) (67)

= τexp (β (gf ′))∑

f ′′∈Av(f,f′),f

exp (β (gf ′′))(68)

≥ τexp (βgmin)

δ exp (βgmax)=

τ

δexp (−β(gmax − gmin)) (69)

Combining (58) and (69), we have

Φ ≥ minN⊂F ,π(N)∈(0,1/2]

F (N,N c) (70)

≥ minf �=f ′,P (f,f ′)>0

F (f, f ′) (71)

= minf �=f ′,P (f,f ′)>0

p∗f (g)P (f, f ′) (72)

= minf �=f ′,P (f,f ′)>0

p∗f (g) ·qf,f ′

θ(73)

≥ pmin

θ· τδexp (−β (gmax − gmin)) (74)

Combining (59), (50) and (51), we have

tmix(ε) ≤ 2

θΦ2[ln

1

2ε+

1

2ln

1

pmin] (75)

≤ 2θδ2 exp(2β(gmax − gmin))

p2minτ2

[ln1

2ε+

1

2ln

1

pmin]

(76)

≤ 2θδ2

τ2

δ

)2n

exp(4β(gmax − gmin))

· [ln 1

2ε+

n

2ln

δ

)+

1

2β(gmax − gmin)] (77)

≤ 2δn+1(Δ− δ)n

τ

δ

)2n

exp(5β(gmax − gmin))

· [ln 1

2ε+

n

2ln

δ

)+

1

2β(gmax − gmin)] (78)

Page 13: Shao (2012] [num, optimization] reverse engineering bit torrent- a markov  approximation perspective

13

This concludes the proof for part (a). Next, we show theproof for part (b).

(b). The proof for part (b) is based on the coupling method[12].

First, we obtain a discrete-time Markov chain by uni-formization of continuous-time perfect Markov chain. Denotethis discrete-time Markov chain as M. M is designed tosample from a given probability distribution p∗ (12) on a statespace F . At each step, it selects a peer v ∈ V uniformlyat random and modified the active neighbor set of v. Moreprecisely, in feasible configuration f ∈ M, it does thefollowing:

1) pick w ∈ V uniformly at random (with probability 1n =

1|V | );

2) unchoke a new neighbor v from peer w ′s inactive neigh-bor set uniformly at random (with probability 1

Δ−δ ); Thesystem transits to a temporary configuration f .

3) choke an active neighbor u of peer w with probability

exp(β(gf ′ − gf

))∑

f ′′∈Av(f,f′),f

exp(β(gf ′′ − gf

)) , (79)

where f = f ∩ {(w, v)}, f ′ = f\{(w, u)}.It can be shown thatM has a transition matrix P ′ = I+Q/θ′,where I is the identity matrix, θ ′ = nτ(Δ− δ).

Now we apply coupling method to bound the mixing timeof M. By a “coupling” for this chain, we mean a jointstochastic process (Xt, Yt) on F × F such that each ofthe processes (Xt) and (Yt) is a Markov chain on F withtransition matrix P ′. Typically, after defining the distancemetric d : F × F → {0, 1, . . . , dmax}, we try to constructa one-step distance-decreasing coupling (X0, Y0)→ (X1, Y1)such that

E(d(X1, Y1)|X0, Y0) ≤ α · d(X0, Y0) (80)

for all (X0, Y0) ∈ F × F , where 0 ≤ α < 1. Applying thiscoupling iteratively results in a t-step coupling and a mixingtime analysis.

In general, defining and analyzing a coupling for all pairsXt, Yt ∈ F is difficult. The path coupling technique [45]simplifies the approach by restricting attention to pairs in aconnected subset S ⊆ F ×F . It then suffices to define a one-step coupling such that (80) holds for all (X0, Y0) ∈ S. Thenthe path coupling theorem [45] constructs, via simple compo-sitions, a one-step coupling satisfying (80) for all X0, Y0 ∈ F .

Given any two configurations X,Y ∈ F , let d(X,Y )denote the Hamming distance between X and Y , which equalsto the number of different node-pairs. Now we denote S asconfiguration pairs X,Y ∈ F such that differ at exactly onepeer-neighbor pair. Then we have

S = {(X,Y ) ∈ F × F : d(X,Y ) = 1}. (81)

For any peer v ∈ V , denote vX as the set of pairsof active neighbors under configuration X . For example, ifpeer v has 3 active neighbors j, k, l under X , then vX ={(v, j), (v, k), (v, l)}. Now we design a one-step coupling.

More precisely, consider a configuration pair (X0, Y0) ∈ S.Without loss of generality, we have

X0 = (vX01 , . . . , vX0

n ) (82)

Y0 = (vY01 , . . . , vY0

n ) (83)

where V X0

j = V Y0

j , ∀j = 2, . . . , n, and

vX01 = {(v1, a), (v1, z1), . . . , (v1, zδ−1)} (84)

vY01 = {(v1, b), (v1, z1), . . . , (v1, zδ−1)} (85)

A peer w ∈ V is chosen uniformly at random. Atevery step, both chains update the same peer w. Thecoupling for the update at time 1 is a grand coupling(X0, Y0) → (X, Y ) → (X1, Y1), where (X0, Y0) → (X, Y )denotes the unchoking operation and (X, Y ) → (X1, Y1)denotes the choking operation. Let wX0 (+)

(wY0 (+)

)denote the peer unchoked by w under X0 (Y0), and wX(−)(wY (−)

)denote the peer choked by w under X (Y ). Then

the coupling is shown as follows:

(1). if w �= v1, then we can make the identical updates atpeer w for both chains. This leads to wX0(+) = wY0(+),wX(−) = wY (−) and d(X1, Y1) = 1.

(2). otherwise, w = v1.

(2)-1. if vX01 (+) = b, then vY0

1 (+) = a. This leads toX = Y . So next we can make vX

1 (−) = vY1 (−) and we haved(X1, Y1) = 0.

(2)-2. else if vX01 (+) = c �= b for any inactive neighbor c

of v1 under X0, then vY01 (+) = c. In this case, we have

vX1 = {(v1, a), (v1, z1), . . . , (v1, zδ−1), (v1, c)} (86)

vY1 = {(v1, b), (v1, z1), . . . , (v1, zδ−1), (v1, c)}. (87)

For convenience, we denote zδ = c. Let pk , qk be theprobability of peer v1 choking neighbor zk for X and Yrespectively, 1 ≤ k ≤ δ. We also denote p0 (q0) as theprobability of peer v1 choking neighbor a (b) for X (Y ). Wethen take rk = min{pk, qk} for any k ∈ [0, δ]. Now We definea random variable H satisfying

Pr(H = i) =

⎧⎪⎨⎪⎩ri if 0 ≤ i ≤ δ

1−∑δi=0 if i = δ + 1

0 otherwise

(88)

We update X, Y according to the following rules.

1) If H = 0, then vX1 (−) = a and vY1 (−) = b.2) If H = i where 1 ≤ i ≤ δ, then vX

1 (−) = vY1 (−) = zi.3) If H = δ + 1, then update X, Y independently.

a) Pr(vX1 (−) = a|H = δ + 1) = p0−r01−∑

δj=0 rj

b) Pr(vY1 (−) = b|H = δ + 1) = q0−r01−∑δ

j=0 rj

c) Pr(vX1 (−) = zi|H = δ + 1) = pi−ri1−∑δ

j=0 rj, ∀i ∈

{1, . . . , δ}

Page 14: Shao (2012] [num, optimization] reverse engineering bit torrent- a markov  approximation perspective

14

d) Pr(vY1 (−) = zi|H = δ + 1) = qi−ri1−∑δ

j=0 rj, ∀i ∈

{1, . . . , δ}

It is not hard to show the one-step coupling designedabove is a valid coupling. Now we analyze distance metricE(d(X1, Y1)− 1|X0, Y0) = 0.

We know that E(d(X1, Y1) − 1|X0, Y0, w �= v1) = 0. Wealso can see that scenario (2) − 1 happens with probability

1Δ−δ and corresponding distance d(X1, Y1) = 0. On the otherhand, given any c �= a, b, scenario (2) − 2 also happens withprobability 1

Δ−δ . Under this scenario, we know that

• Case A. vX1 (−) = a and vY1 (−) = b, then d(X1, Y1) = 0.• Case B. vX1 (−) �= a and vY1 (−) = b , then d(X1, Y1) =

1.• Case C. vX1 (−) = a and vY1 (−) �= b , then d(X1, Y1) =

1.• Case D. vX1 (−) �= a and vY1 (−) �= b , then d(X1, Y1) = 1

if vX1 (−) = vY1 (−) and d(X1, Y1) = 2 if vX1 (−) �=vY1 (−).

Since probability of case A is P (A) = r0 and probabilityof case D is

P (D) (89)

=

δ∑j=1

rj + (1 −δ∑

j=0

rj)(1− p0 − r0

1−∑δj=0 rj

)(1 − q0 − r0

1−∑δj=0 rj

)

(90)

=δ∑

j=1

rj + (1 −δ∑

j=0

rj)(1− p0 − r0

1−∑δj=0 rj

− q0 − r0

1−∑δj=0 rj

)

(91)

=

δ∑j=1

rj + (1 −δ∑

j=0

rj − p0 − q0 + 2r0) (92)

where we utilize the fact that (pi − ri)(qi − ri) = 0, ∀i ∈{0, . . . , δ}.

On the other hand,

P ((vX1 (−) = vY1 (−)) ∩D) =

δ∑j=1

rj (93)

Therefore,

E(d(X1, Y1)− 1|w = v1, X0, Y0, (2)− 2, c) (94)

= P (A)(−1) + P ((vX1 (−) �= vY1 (−)) ∩D) (95)

= −r0 + (P (D)− P ((vX1 (−) = vY1 (−)) ∩D)) (96)

= 1−δ∑

j=0

rj − p0 − q0 + r0 (97)

= (1− p0) + (1− q0)−δ∑

j=1

rj − 1 (98)

=

δ∑j=1

(pj + qj − rj)− 1 (99)

=

δ∑j=1

max(pj , qj)− 1 (100)

≤δ∑

j=1

1

δ + 1exp(β(gmax − gmin))− 1 (101)

δ + 1exp(β(gmax − gmin))− 1 (102)

It follows that

E[d(X1, Y1)− 1|X0, Y0] (103)

= P (w �= v1) · 0 + P (w = v1) · E[d(X1, Y1)− 1|X0, Y0, w = v1](104)

=1

n·E[d(X1, Y1)− 1|X0, Y0, w = v1] (105)

=1

n· [− 1

Δ− δ+∑c �=a

E(d(X1, Y1)− 1|w = v1, X0, Y0, (2)− 2, c)]

Δ− δ]

(106)

≤ 1

n· [− 1

Δ− δ+ (1− 1

Δ− δ) · ( δ

δ + 1exp(β(gmax − gmin))− 1)]

(107)

=1

n· [−1 + (1− 1

Δ− δ) · ( δ

δ + 1exp(β(gmax − gmin)))]

(108)

For convenience, let

K = 1− (1− 1

Δ− δ) · ( δ

δ + 1exp(β(gmax − gmin)))

(109)

Then when ,

0 < β <1

gmax − gminln[(1 +

1

δ)(1 +

1

Δ− δ − 1)], (110)

we have K > 0. It follows that for any (X0, Y0) ∈ S

E[d(X1, Y1)|X0, Y0] < 1− K

n= (1− K

n) · d(X0, Y0).

(111)

By path coupling theorem [45] we know that for any(X0, Y0) ∈ F × F ,

E[d(X1, Y1)|X0, Y0] < (1− K

n) · d(X0, Y0) = λ · d(X0, Y0).

(112)

Page 15: Shao (2012] [num, optimization] reverse engineering bit torrent- a markov  approximation perspective

15

where λ = 1− Kn .

Applying this one-step coupling iteratively results in a t-stepcoupling, and we have for any t, (X t, Yt) ∈ F × F ,

P [Xt �= Yt] = P [d(Xt, Yt) ≥ 1] (113)

≤ E[d(Xt, Yt)] (114)

≤ λt · diam(F) (115)

≤ nδ · λt (116)

Thus for discrete-time Markov chain M,

dTV (Pt(X0, ·), P t(Y0, ·)) ≤ nδ · λt (117)

Then by uniformization theorem [12], we know that for anyf ∈ F ,

dTV (Ht(f),p∗) = dTV [

∑∞j=0

(θ′t)j

j!exp(−θ′t)Pn(f, ·),p∗]

(118)

≤∑∞

j=0

(θ′t)j

j!exp(−θ′t)dTV (P

j(f, ·),p∗)

(119)

≤ nδ ·∑∞

j=0

(θ′tλ)j

j!exp(−θ′t) (120)

= nδ · exp(−θ′(1− λ)t) (121)

= nδ · exp(−θ′ · Kt

n) (122)

= nδ · exp(−τ(Δ− δ) ·Kt) (123)

Thus we have

tmix(ε) ≤ln nδ

ε

τ(Δ − δ)(1− (1 − 1Δ−δ ) · ( δ

δ+1 exp(β(gmax − gmin))))

(124)

This concludes the proof for part (b).


Recommended