Weighted fair queueing (WFQ) is a data packet scheduling algorithm used by network schedulers. WFQ is both a packet based implementation of the generalized processor sharing policy (GPS), and a natural generalization of fair queuing (FQ): whereas FQ shares the link's capacity in equal subparts, WFQ allows to specify, for each flow, which fraction of the capacity will be given.
Contents
Weighted fair queuing (WFQ) is also known as Packet-by-Packet GPS (PGPS or P-GPS) since it approximates generalized processor sharing "to within one packet transmission time, regardless of the arrival patterns."
Parametrisation and fairness
Like other GPS-like scheduling algorithms, the choice of the weights is left to the network administrator.
By regulating the WFQ weights dynamically, WFQ can be utilized for controlling the quality of service, for example to achieve guaranteed data rate.
As presented for fair queueing, there is no unique definition on what is "fair".
Proportional fairness can be achieved by setting the weights to
Algorithm
In WFQ, a scheduler handling N flows is configured with one weight
Like all fair-queuing schedulers, each flow is protected from the others, and it can be proved that if a data flow is leaky bucket constrained, an end-to-end delay bound can be guaranteed.
The algorithm of WFQ is very similar to the one of FQ. For each packet, a virtual theoretical departure date will be computed, defined as the departure date if the scheduler was a perfect GPS scheduler. Then, each time the output link is idle, the packet with the smallest date is selected for emission.
The pseudo code can be obtained simply from the one of FQ by replacing the computation of the virtual departure time by
packet.virFinish= virStart + packet.size / Riwith
WFQ as a GPS approximation
WFQ, under the name PGPS, has been designed as "an excellent approximation to GPS", and it has been proved that it approximates GPS "to within one packet transmission time, regardless of the arrival patterns."
Since WFQ implementation is similar to fair queuing, it has the same O(log(n)) complexity, where n is the number of flows. This complexity comes from the need to select the queue with the smallest virtual finish time each time a packet is sent.
After WFQ, several other implementations of GPS have been defined.
History
The introduction of parameters to share the bandwidth in an arbitrary way in mentioned at the end of as a possible extension to FQ. The term weighted first appears in.