• Nem Talált Eredményt

Chapter 5. Bursty Content Sharing Protocol

for Mobile Devices 79

It should also be noted that sending out the requests to regular peers happens sequentially in a very short amount of time. The regular peers lock their next serving period for the requester until a timed request message is received or a certain timeout has been passed. Furthermore, although the two transfers depicted as if they were performed with some delay in the sequence diagram, in reality they should start at the same time.

In the version of the BurstTorrent protocol we implemented as a simulation, the priorities assigned to the bursty peers are based on the last time they were served, giving lower priority to those peers that were served more recently. The actual request times, which correspond to the priorities, are scattered uniformly in the period between tr and ts. The larger exclusive periods are available for bursty peers to make the next request, the less important is the correct timing, making the system less error-prone.

Uopt = 1 peers randomly. The first set of peers is called the regularly unchoked peers, while peers belonging to the second set are the optimistically unchoked peers. It should be noted that peers that have not uploaded any data recently are excluded from the candidates for regular unchoking. This means that it is possible that less than Ureg peers are unchoked as regularly unchoked peers, even if there are more than Ureg interested peers. This mechanism implements BitTorrent’s Tit-for-tat philosophy, serving those that contribute the most.

5.3.2 Serving time calculation in BurstTorrent

When determining serving time (Ts), a BurstTorrent regular peer categorizes each interested partners as either regular or bursty. The principal goal of the algorithm is to give regular peers the same amount of bandwidth as if standard BitTorrent were used instead of the bursty scheduled transfers of BurstTorrent. This is carried out by calling BitTorrent’s choking algorithm, and based on the ratio of bursty and regular peers returned, it can be calculated how much time it would take for standard BitTorrent to serve the bursty peer. Our model treats all bursty peers as if they were free riders, always excluding them from the regular unchokes. This does not affect the bandwidth allocation significantly since bursty peers can only upload during active periods, resulting in that they are outperformed by regular peers anyway. Furthermore, we assumed that at least Uopt peers are available for the optimistic unchoking. Since by defaultUopt = 1, and bursty peers can only be unchoked optimistically, the assumption is always valid if at least one bursty peer is interested in the choking peer’s data.

Definition 5.5 (Choking model symbols).

Chapter 5. Bursty Content Sharing Protocol

for Mobile Devices 81

Ureg: Maximum number of regular unchokes ureg : Actual number of regular unchokes Uopt: Number of optimistic unchokes

nra : Number of active interested regular peers nri : Number of inactive interested regular peers nb : Number of bursty peers

br : Fraction of the bandwidth reserved for regular peers

∆Tsi: Length of transfer period i

Tsi : Earliest serving time for transfer period i

di : Size of data transferred during transfer period i in bytes Su : Maximum upload speed for the regular peer serving the data

When determining the next value of the earliest serving time, BurstTorrent treats all bursty pears equally: it does not matter which bursty peer is the re-questor. The only thing that matters is how the bandwidth would be divided between the two groups (regular/legacy and bursty) if standard BitTorrent were used.

Definition 5.6 (Active peer). A peer is active in the context of the choking algo-rithm if it has upload any data to the peer executing the choking algoalgo-rithm during the last three choking periods.

First, Eq.(5.1) is used to determine the number of regular unchokes (ureg) which is a function of the number of regular active peers (nra). Only active peers are taken into account by regular unchoking.

ureg(nra) = min (Ureg, nra) (5.1) Based on the formula used by BitTorrent’s choking algorithm to select the peers to be served, the fraction of the bandwidth reserved for regular peers (br) is defined by Eq.(5.2). In addition to the regular unchokes, which in our case are all regular peers, optimistic unchokes are divided equally between the regular and the bursty peers.

Lemma 5.7.

br(nra, nri, nb) = ureg+Uopt· nnra+nri

ra+nri+nb

ureg+Uopt

(5.2)

Proof. The bandwidth is divided between regular and bursty peers according to the number ofunchoke slots the peers in each category get. Peers can be unchoked as regular unchokes or optimistic unchokes, thus at any given time the total number of unchokes by a single peer isureg+Uopt. We want to determine how many of these go to regular peers and based on that how the bandwidth is distributed between the two categories. Since all bursty peers are treated as free riders, all regular unchokes (ureg) goes to regular peers. Optimistic unchokes are evenly distributed between the two categories, which means that the ratio can be calculated based on the number of peers. The number of regular peers that are taken into account by the algorithm is nra+nri. Dividing this value with the total number of peers gives us the fraction of optimistic unchokes in which regular peers are selected:

nra+nri

nra+nri+nb. Finally, br can be calculated by dividing the number of unchoke slots assigned to regular peers with the total number of unchoke slots.

To determine the earliest serving time for transfer period i (Tsi), first we de-termine the length of the previous (i−1th) transfer period: ∆Tsi (see Figure 5.1 for a visual aid on transfer periods). Let N(t) = (nra(t), nri(t), nb(t)) be a triple corresponding to the number of active regular, inactive regular and bursty peers that are interested in the choking peer at time t. The formula for∆Tsi is given by Eq.(5.3).

Lemma 5.8.

∆Tsi = di−1

[1−br(N(ti−1r ))]·Su

(5.3) Proof. The formula calculates the fraction of the bandwidth bursty peers would get at the point of the i−1th request, then based on this determines the time it would take them to download the content normally. The number of peers when the request arrives isN(ti−1r ). The fraction of bandwidth allocated to bursty peers at ti−1r is 1−br(N(ti−1r ). Multiplying this with the maximum upload speed of regular peers Su gives us the bandwidth a limited peer should receive according to standard BitTorrent choking algorithm. Finally, the length of the ith transfer period is determined by dividing the size of the content transferred during the i−1th period with the calculated speed.

Chapter 5. Bursty Content Sharing Protocol

for Mobile Devices 83

∆Tsi is the amount of time in which the bursty peer would get the content anyway, using standard BitTorrent, thus sending a high speed burst after this time does not harm the performance of the regular peers. This mimics invoking BitTorrent’s choking algorithm when the first request arrives.

Finally, the earliest serving time in BurstTorrent is determined by adding ∆Tsi to the previous value of the earliest serving time:

Tsi =Tsi−1+ ∆Tsi (5.4)