Sunday 30 March 2008

Congestion Management and Queuing - WFQ

WFQ (Weighted Fair Queuing) - Default queuing mechanism on serial interfaces less than E1 speed, it is used by modern queuing methods CBWFQ and LLQ. WFQ is a flow based queuing method, flows are assigned to FIFO queues.

Flows are identified by the following features:
-Src/Dst IP address
-Protocol number
-ToS
-Src/Dst TCP/UDP port number

When recieving a packet it's hash value is calculated, all packets in a flow will have the same hash value. The hash is calculated on the fields above. After the packet has had it's hash calculated if it is a new flow it is assigned a new queue, if it is part of an existing flow it is assigned to the same queue as the rest of the packets.

If a queue size is larger than congestive disgard threshold then it may be dropped. The priority of a packet or flow will influence the sequencing number. Higher priority packets are assigned a smaller sequence number so will be given preferential treatment. If all flows have the same priority interface bandwith is devided equally.

The number of queues is equal to the number of active flows, by default this is a maximum of 256 queues. When flows exceed the maximum configured value they are added to existing queues.



WFQ has a hold policy that covers every queue, when the hold threshold is exceeded any new packets are dropped, this is called 'aggressive dropping'. Aggressive dropping does have one exception, if the destination queue is empty then the packet will be accepted.

Every queue has a Congestion Discard Threshold (CDT), if the hold queue is not full but the CDT is reached then the packet will be dropped. This is called 'early dropping', the only exception is if a packet has a higher sequence number then that will be dropped instead.

WFQ is enabled using 'fair-queue' command on interface, 'fair-queue cdt_value' can be used to configure CDT. 'hold-queue max_limit out' can be used to set the hold queue limit.

No comments: