• No results found

4.6 Comparison with Fair Scheduling

4.6.1 Fair Scheduling Algorithms

It is insightful to compare FairTorrent with the extensive body of research on fair scheduling algorithms such as the DRR [58], WFQ [16], and WF2Q [7]. The latter

0

Figure 4.12: Maximum deficit over time for a network of 200 nodes under the Uniform upload capacity distribution for 4 different network delay values of 0, 100, 200 and 300 milliseconds.

algorithms are used to achieve fair scheduling of packet flows through a router. Each flow has an associated weight. During a period of backlog, i.e. during the time that the flows have packets waiting to be forwarded, these algorithms try to schedule packets in a way, such that the schedule provides the amount of service (i.e. total number of bytes sent on each flow) in proportion to the normalized weight of each flow.

These algorithms compare their allocation with the allocation under General Pro-cessor Sharing, or GPS, where each flow can be allocated a precise fraction of the bandwidth, in proportion to the flow’s weight. Since GPS can not be achieved in realistic packet-based networks, where a router forwards whole packets rather than scheduling precise bandwidth fractions, these algorithms can only approximate GPS allocation.

Similar to FairTorrent, to measure the difference between the algorithm’s behavior and the ideal allocation under fair GPS scheduling, scheduling algorithms define the maximum positive and the maximum negative service error. The maximum positive

service error is a measure of the maximum service, or the total bytes, that can be allocated to a flow above its ideal fair bandwidth allocation over some time period.

The maximum negative service error is a measure of the service that can be given to a flow below its ideal fair allocation. Since packet sizes can vary, the error is typically measured in terms of the number of maximum size packets above or below the ideal allocation.

Table 4.2 summarizes the bounds on the positive and negative service errors for a few well-known packet-scheduling algorithms. It also lists the running time required per packet in terms of the number of flows. While WF2Q gives the tightest bounds its running time is O(log n) as compared to O(1) for the Deficit-Round-Robin (DRR).

Algorithm Max Pos Error Max Neg Error Run Time

DRR Unbounded Unbounded O(1)

WFQ Unbounded 1 packet O(log n)

WF2Q 1 packet 1 packet O(log n)

Table 4.2: Maximum positive and negative service errors for different scheduling algorithms, and run-time per packet in terms of the number of flows: n

Both WF2Q and WFQ provide a bound of 1 maximum size packet on the negative service error of the scheduling. This means that under both scheduling heuristics for any time period, each flow receives the service that is no more than one packet less than under the GPS allocation scheme. However, while WF2Q also provides a bound of 1 maximum size packet on the positive service error, the positive error for WFQ is unbounded. This means that under WFQ a flow can receive a lot more service than under GPS.

The work in [7] demonstrates the unbounded positive service error of WFQ with an example. We reuse the same example here to compare the scheduling algorithms with FairTorrent.

In this example, a router is forwarding packets for 11 flows: S1 through S11, where

Figure 4.13: GPS: scheduling packets for flow S1 of weight 10 and S2 through S11 of weight 1 under GPS. Each flow is allocated its proportional bandwidth.

S1 has a weight of 10 and S2 through S11 each have a weight of 1. Figures4.13,4.14 and 4.15, copied from [7], demonstrate the scheduling results for this example under the GPS, WFQ and WF2Q algorithms respectively. In these figures the x-axis shows time, and depicts the times that a packet is forwarded for each flow. At time zero all flows have packets waiting to be forwarded.

Under the GPS policy, depicted in Figure 4.13, each flow is allocated a portion of the bandwidth, exactly proportional to the weight of each flow. Thus, 1 packet is sent for the flow S1, when 1/10th of a packet is sent for the flows S2 to S11. Sending of one packet for each of S2 to S11 completes exactly when 10 packets for the flow S1 are completed. Of course, it is not possible to achieve the ideal GPS scheduling in practice, where a router cannot forward an arbitrarily small fraction of a packet.

WFQ’s algorithm approximates GPS. When WFQ selects the next packet to be sent, it selects a packet that would have been the earliest to complete under the GPS schedule. In GPS, the first 9 packets of S1 complete before a single packet for any other flow, and the 10th packet completes at the exact same time as the first packet

Figure 4.14: WFQ: scheduling packets for flow S1 of weight 10 and S2 through S11 of weight 1 under WFQ. Flow S1 gets ahead by 10 packets before any packets from other flows are scheduled. p101 and p111 mark the 10th and the 11th packets sent to the flow S1.

of the other flows. Thus, as Figure4.14shows, WFQ schedules the first 10 packets of S1, before any packet of the other flows. As a result, at time 10, the flow S1 has been allocated five more packets than it would have been allocated under the ideal fair allocation of GPS. (Since S1 accounts for 1/2 of the total weight, it should receive only 5 packets at time 10). This example demonstrates that under FairTorrent the maximum positive error could be made arbitrarily high. For example, if we set the weight of the flow S1 to 1000, followed by a 1000 flows of unit weight, then 1000 packets of flow S1 will be served before any other packets, allowing S1 to receive a service of 500 packets above its fair allocation.

The WF2Q algorithm schedules the next packet similarly to WFQ, but with a slight difference. At the time of the decision to schedule a packet it selects only among those packets that would have started to be sent at this point in time under GPS. The resulting schedule is depicted in Figure 4.15. At time 0, WF2Q schedules the first packet of S1. However, at time 1 it cannot schedule another packet of S1,

Figure 4.15: WF2Q: scheduling packets for flow S1 of weight 10 and S2 through S11 of weight 1 under WF2Q. Flow S1 gets ahead by at most 1 packet ahead of the GPS-based allocation.

as only the first packet has been started to be sent under GPS at time 1. Therefore, at time 1 WF2Q schedules a packet of S2. Similarly, by time 10 only 5 S1 packets can be scheduled. In fact, through the entire experiment no flow gets an allocation of more than 1 packet as compared to its allocation under GPS.

Observe, that under both WFQ and WF2Q, flows S2 to S11 are each allocated exactly 1 packer before time 20 and therefore, do not exhibit a negative service error of more than 1 packet relative to the GPS schedule.

The DRR algorithm works by allocating a quantum, Qi, or the number of bits that can be sent, for each flow Si in each round. Qi is proportional to the weight of the flow. DRR also maintains a counter, DCi, for each flow Si that stores the number of bits, unused in prior rounds. Initially DCi is 0. In each round, DRR loops through the flows and determines the maximum number of queued packets for each flow Si that can be sent such that their total length does not exceed Qi+ DCi. After sending the packets on flow Si, DRR sets DCi to the difference between the previous value of Qi+ DCi and the number of bits used.

It is easy to see, that for the above example, the behavior of DRR will closely match the behavior of WFQ, and DRR can easily have an unbounded maximum positive error. Regardless of the size of the quantum, 10 packets will be sent on flow S1, before a single packet can be sent on any of the remaining flows. (For example, if the quantum allocated per round to flows S2 to S11 is 1 packet, then the quantum allocated to S1 is 10 packets.) This example demonstrates that DRR can allocate many more packets to a single flow than GPS would, and thus it can accumulate a large positive service error.

We can use a slightly different example to show that DRR can also accumulate a large negative service error. Consider the case where S1 and S2 have a weight of 10, and S3 to S12 have a weight of 1. If Q1 = Q2 = 10, then the algorithm begins by sending 10 packets for the flow S1. Since S2 has 1/3 of the total weight of all flows, under GPS it would be allocated 10/3 of the first 10 packets. Therefore S2 accumulates a negative error of 10/3. If S1 and S2 each had a weight of 1000, followed by 1000 flows of unit weight, then S2 could accumulate a negative error of 1000/3 packets. Thus, the negative error of DRR can be arbitrarily large. (WFQ would not accumulate unbounded negative error in this case as it would alternate between sending packets from S1 and S2 based on the completion of these packets under the GPS scheduling).

It is important to note that if DRR were to choose smaller quantum sizes it could reduce its negative error, but then it could not guarantee the O(1) scheduling time.

DRR chooses quantum sizes in such a way that the flow with the smallest weight is allowed to send at least one packet on each round. This choice ensures that the selection of the next packet to be sent takes O(1) time. (Since the algorithm considers flows in a round-robin fashion, on average the next flow it considers will be able to send at least 1 packet. Since on average the algorithm only needs to consider one

flow, it takes O(1) time to select the next packet.) In the example above, DRR must give a quantum of at least 1 packet to the smaller-weight flows, and thus a quantum of at least 10 packets to S1.