Credit-Based Fair Queueing (CBFQ) K. T. Chan, B. Bensaou and D.H.K. Tsang Department of Electrical & Electronic Engineering Hong Kong University of Science & Technology Clear Water Bay, Kowloon, Hong Kong E-mail:feeking, eebben, eetsangg@ee.ust.hk Fax: +852 2358 1485 Indexing terms: Fair queueing, Bandwidth scheduling, Delay bound, Packetswitched networks. Abstract: A simple rate-based scheduling algorithm for packet-switched networks (e.g. Internet) is proposed. By using simple counters to keep track of the credits accumulated by each trac stream, the algorithm decides which stream to serve next based on the bandwidth share allocated to each trac stream and the sizes of the head of line (HOL) packets of the dierent streams. Our proposed CBFQ algorithm achieves the same fairness and delay bounds as the alternative approaches based on virtual time, while avoiding the implementation problems inherent in these methods. Introduction: To support both real-time and non real-time applications, the 1
This requires the network to provide in each multiplexer enough buers to avoid packet loss and to use the necessary scheduling algorithms to meet the packet delay requirements. To achieve this latter issue, fair queueing scheduling algorithms proves very ecient. In this spirit, many algorithms such as self clocked fair queueing (SCFQ) [1] have been proposed. Mostly all the algorithms are based on the idea of associating to each arriving packet a virtual time stamp. The smaller the time stamp, the higher is the priority of the corresponding packet. They proved very ecient in guaranteeing the fairness among the trac streams. However, the inherent complexity of the virtual time approach makes the practical implementation very dicult and expensive. Moreover, since the virtual clock is the reference clock to all the streams, it cannot be reset until all the streams are idle and the system is empty, which in fact seldom happens and thus may lead to numerical overow problems. In the following, we propose an algorithm which uses simple counters to keep track of the credits accumulated by each trac stream (or QoS class). Based on the values of the counters, the sizes of the head-of-line (HOL) packets of the dierent streams, and the share of bandwidth allocated to the dierent trac streams, the algorithm decides which packet is to be sent next. Network node model: The network node we consider is shown in Figure 1. A transmission link of speed C is shared among J independent streams (which can represent either individual sources or aggregate streams of sources having the same QoS requirements). Each stream is associated with a dedicated buer (note that this can be achieved in a shared buer by implementing linked lists). 2
S i, i = 1; ; J. To ensure stability, we assume P i S i C. Besides, to keep track of the transmission credits earned by each stream, the CBFQ algorithm associates a counter K i to trac stream i, i = 1; ; J. When the transmission link becomes available, based on the values the counters, the share of bandwidth of each stream, and the HOL packet sizes L i of the active streams, the CBFQ algorithm decides which packet is to be transmitted next. CBFQ algorithm: In the following, we present the general CBFQ algorithm. This algorithm is appropriate to either variable packet size networks (e.g. Internet) or xed packet size networks (e.g. ATM). To take account of the advantages provided by the xed packet size in ATM networks, a simplied version of the CBFQ algorithm for ATM networks has been proposed in [2]. 1. Initialize: At the beginning of operation, set all the counters to zero: K l = 0; l = 1; ; J 2. Begin: Let J = fj1; ; j k g and jj j = k such that Queues j1; ; j k are currently backlogged; 3. Let L jn be the size of the HOL packet of Queue j n 2 J ; 4. Sort the backlogged queues according to: L j1? K j1 S j1 L j 2? K j2 S j2 L jk? K jk S j k 3
lows: K jn? K jn + L j 1? K j1 S j1 S jn ; 8 j n 2 J nfj1g K j1? 0 6. End (Goto 2 to serve another packet). Intuitively, in Step 4, our algorithm serves rst the stream that needs the shortest time to earn enough credits to transmit its HOL packet. This time interval \decit" is (L j1? K j1 )=S j1 and is the shortest by virtue of the order in Step 4. Accordingly, in Step 5, the other streams earn an amount of credits proportional to their bandwidth share during this time interval, i.e. S jn (L j1? K j1 )=S j1. Note that, when the equality holds on the left side of the priority order in Step 4, the counters are incremented only once. Fairness guarantee: Let J (t1; t2) denote the set of queues that are continuously backlogged during (t1; t2). Dene W i (t1; t2) and MAX i, i = 1; :::; J, as the amount of trac transmitted from queue i during (t1; t2) and the maximum packet size of stream i respectively. We can prove the following theorem. Theorem 1 8l; l 0 2 J (t1; t2), W l(t1; t2)? W l0(t1; t2) S l S l MAX l 0 S l + MAXl0 : S l 0 Proof: First, we can prove by induction that 0 K l MAX l, at any time t. Second, if we let A l (t1; t2) be the amount of credit earned by stream l during (t1; t2), we can show that W l (t1; t2) A l (t1; t2) + K l (t1)? K l (t2). Finally, by 4
comes straightforward. 2 End-to-end delay bound guarantee: Denote by d n l the end-to-end delay experienced by the nth packet from stream l. Let I be the number of nodes on the path of ow l, and C i, i = 1; ; I be the server capacity at node i. Dene N i as the set of streams served by node i. Let MAX l be the maximum packet size from stream l, and MAX n l be the maximum packet size from stream l up to packet n (i.e. MAX n l = max k2f1;:::;ng Lk l, where L k l is the length of the k th packet from stream l). Theorem 2 For stream l which is constrained by a ( l ; l )-Leaky Bucket, if the scheduling algorithm at each server on the path of the ow belongs to CBFQ, then the end-to-end delay bound for packet n of stream l is given by d n l l + (I? 1)MAX n l l + IX i=1 X m2ninflg MAX m C i + X I?1 i ; i=1 where i is the propagation delay between nodes i and i + 1. Proof: By using the hints given in the proof of Theorem 1 with the framework provided in [3], this delay bound can be proved easily. 2 Complexity of CBFQ: It is easy to prove that after serving a packet, the order of the terms in Step 4 of the algorithm above does not change except for the queue that has just been served. In this case the sorting is not a full sort but just an insertion of an element (either the queue that has just been served, or a queue that just became active) in an already sorted list. Besides, since the 5
allel making the complexity of Step 5 equal to O(1). With these remarks and all the other operations being O(1), the complexity of the algorithm becomes the same as the complexity of a search algorithm: O(log(J)). By comparison to the alternative approaches, this constitutes a major improvement towards practical implementations. In addition, since the values of the counters are bounded, numerical overow problems would not occur in our algorithm. Conclusion: A new scheduling algorithm CBFQ for packet-switched networks has been proposed. Based on a set of counters that keep track of the credits earned by each trac stream, CBFQ decides which stream is to be served next. The CBFQ algorithm achieves the same fairness and delay bounds as the alternative algorithms such as SCFQ while requiring less computational overhead or hardware for practical implementation. References [1] S. J. Golestani. A self-clocked fair queueing scheme for broadband applications. In Proceedings of the IEEE INFOCOM, pages 636{646, 1994. [2] D. H. K. Tsang, B. Bensaou, and K. T. Chan. Credit-based fair queueing for ATM networks. IEE Electronics Letters, 32(25):2306{2307, December 1996. [3] P. Goyal, S.S. Lam, and H.M. Vin. Determining end-to-end delay bounds in heterogeneous networks. In Proc. 5th Int. Workshop on Network and 6
April 1995. FIFO 1 S 1 FIFO 2. FIFO J S 2 S J C bits/s Figure 1: Network node model 7