OcNOS-SP : Quality of Service Guide : Quality of Service Configuration Guide : Congestion Avoidance
Congestion Avoidance
Congestion avoidance techniques monitor network traffic loads in an effort to anticipate and avoid congestion at common network bottlenecks. Congestion avoidance is achieved through packet dropping. Among the more commonly used congestion avoidance mechanisms, Weighted Random Early Detection (WRED) is optimum for high-speed transit networks.
Qumran supports two types of congestion avoidance mechanisms.
Tail drop – this is the default congestion avoidance behaviour when WRED is not configured
WRED (Weighted Random Early Detection): This is applied only when configured
Tail Drop
Tail drop treats all traffic equally and does not differentiate between classes of service. Queues get filled during period of congestion. When the output queue is full and tail drop is in effect, packets are dropped until the congestion is eliminated and the queue is no longer full.
Configuring Packet Drop Priority Using Tail Drop
Qumran supports configuring color independent tail drop per queue, where the default queue-limit is 62914560 bytes (~62MB). The maximum queue limit (629145600) is not guaranteed in case of congestion because this is shared memory.
queue-limit <1-629145600> (packets | bytes | kbytes | mbytes | ms | us)
no queue-limit
Tail drop configurable parameters are listed below:
Threshold in bytes, kilobytes, megabytes, packets or millisecond format.
Ranges of different units are as follow:
Packets: min 9 – max 614400
Bytes: min 9416 – max 629145600
Kilo-bytes: min 9 – max 614400
Mega-bytes: max 600
Milliseconds: max 50
Microseconds: max50000
An example of configuring per-priority queue Tail Drop is shown below:
(config)#policy-map type queuing default pq-taildrop
(config-pmap-que-def)#class type queuing default q3
(config-pmap-c-que-def)#queue-limit 1 mbytes
(config-pmap-c-que-def)#exit
Queue Drop Counters Verification
Drop counters with drop reason can be verified globally by using the following command:
#show hardware-discard-counters
+------------------------------------------+---------------+--------------+
| Registers | Core 0 | Core 1 |
+------------------------------------------+---------------+--------------+
IQM_QUEUE_ENQ_DISCARDED_PACKET_COUNTER 1596100
Reason: VOQ_VOQ_MX_QSZ_STATUS Y
EGQ_PQP_DISCARD_UNICAST_PACKET_COUNTER 59807
Reason: SRC_EQUAL_DEST_INT Y
Weighted Random Early Discard (WRED)
Qumran assigns each port eight priority queues to buffer traffic level that exceeds the port's total bandwidth. When traffic congestion persists, packets are dropped randomly. As a result traffic of greater priority may be dropped instead of traffic with lower priority.
In order to protect higher priority traffic from being dropped in such a scenarios, Qumran supports monitoring traffic congestion and drop packets based on a Weighted Random Early Discard (WRED) algorithm. Early detection of traffic congestion helps in avoiding global synchronization.
This algorithm enables the system to calculate current average queue length and compares the value against the configured minimum and maximum threshold values. Configured weight is a factor of calculating average queue length. If the calculated average queue length is within the configured minimum threshold, then the packet is enqueued. If the queue length is more than the configured maximum threshold, the packet will be dropped. When the queue length increases above minimum threshold and is within the configured maximum threshold, decision to enqueue or drop the packet is taken based on the configured drop probability. Higher drop probability packets are dropped and lower drop probability packets are enqueued.
When the current average queue length is slightly above the minimum threshold, packet drop count will be lower and increases as the current queue length reaches towards maximum threshold. Drop probability configuration decides the fraction of packet drops when average queue length reaches maximum threshold.
This method allows the application to take protective measures and synchronize the lost sessions over a period of time and thus avoiding sudden surges of traffic. Configurable parameters should be effective enough to provide enough time for the application to take corrective measures. If the gap between minimum threshold and maximum threshold values is small, then the time required for average queue length to increase from minimum threshold to maximum threshold is less and the algorithm will be ineffective.
Figure 13-1 shows how weighted random early discard works.
Weighted random early discard flow algorithm
Configuring Packet Drop Probability Using WRED
Qumran device supports both color independent per-priority queue WRED configuration and per-color, per-priority queue WRED configuration. One of the options is configurable per queue based on the requirement.
WRED configurable parameters are listed below:
min_threshold: Minimal average queue size to apply WRED. Can be configured in bytes, kilobytes, megabytes, packets or millisecond format.
max_thershold: Maximum average queue size to apply WRED. Can be configured in bytes, kilobytes, megabytes, packets or millisecond format.
weight–factor of current size versus average size, in the calculation of new average size. Can be configured in range of 1 to 31 (optional).
drop probability–maximum WRED drop probability applied at maximum threshold. Can be configured in percentage (optional).
At lower weight, average queue size will increase at the rate of instantaneous queue size, hence more packets will be dropped by WRED before queuing.
In this case, yellow packets are dropped more than green packets. At higher weight, average queue size will increase very slowly in comparison to instantaneous queue size, hence fewer packets will be dropped by WRED and more number packets will be queued. As a result we will observe similar results to tail drop.
Note: Formula to calculate new queue size:
NEW_AVG = OLD_AVG + (NEW_AVG-OLD_AVG) / (2 ^gain)
Formula to calculate drop probability:
Drop Probability = (AVRG_Q_SIZE-PQAVRGMINTH)/(PQAVRGMAXTH-PQAVRGMINTH) * 100%
It is recommended to use a weight value between 1 to 3 to achieve proper WRED functionality.
An example of configuring per-priority queue WRED is shown below:
(config)#policy-map type queuing default pq-wred
(config-pmap-que-def)#class type queuing default q3
(config-pmap-c-que-def)#random-detect 30 mbytes 500 mbytes drop-probability 50
(config-pmap-c-que-def)#exit
Both the minimum and maximum threshold must be configured in the same format. Thresholds can be configured in the range of 1 kilobyte to 600 megabytes or 50 milliseconds for millisecond format. In the above configuration, priority queue q3 is configured with a minimum threshold of 30 megabytes and a maximum threshold of 500 megabytes and a drop probability of 50%.
random-detect (green|yellow|red|)(min-threshold|)<1-629145600>
(packets|bytes|bytes|mbytes|ms|us) (max-threshold|)<1-629145600>
(packets|bytes|kbytes|mbytes|ms|us)(drop-probability <1-100>|)
An example of configuring per-color, per-priority queue WRED is shown below:
(config)#policy-map type queuing default pq-c-wred
(config-pmap-que-def)#class type queuing default q3
(config-pmap-c-que-def)#random-detect yellow 30 mbytes 100 mbytes drop-probability 10
(config-pmap-c-que-def)#random-detect green 100 mbytes 300 mbytes drop-probability 10
(config-pmap-c-que-def)#random-detect weight 3
(config-pmap-c-que-def)#exit
Configuration allows minimum threshold, maximum threshold and drop probability to be configured differently for green packets and yellow packets. In the above configuration priority queue q3 will be configured with minimum threshold of 30 megabytes and maximum threshold of 100 megabytes for yellow with drop probability for 10% and minimum threshold of 100 mbps and max threshold of 300 mbps for green with drop probability of 10% for all colors along with a weight value of 3.
See Chapter 12, Configuring Egress Queues on Ports for details about queuing property configuration.
Queue drop counters verification
Drop counters with drop reason can be verified globally by using the following command:
#show hardware-discard-counters
+-------------------------------------------+--------------+--------------+
| Registers | Core 0 | Core 1 |
+-------------------------------------------+--------------+--------------+
IQM_QUEUE_ENQ_DISCARDED_PACKET_COUNTER 1596100
Reason: VOQ_WRED_STATUS Y
EGQ_PQP_DISCARD_UNICAST_PACKET_COUNTER 59807
Reason: SRC_EQUAL_DEST_INT Y