Queuing and Scheduling
The queuing and scheduling processes provides a robust framework for managing network traffic, ensuring that data flows smoothly and efficiently across the network. Traffic queuing, traffic scheduling, traffic shaping, congestion avoidance, and congestion management services are used to achieve this as mentioned in the following sections.
Traffic Queuing
Traffic queuing involves ordering packets for both input and output data. Devices can support multiple queues to control packet sequencing in different traffic classes. This is crucial for managing how data flows through a network, ensuring that packets are processed in an orderly manner.
Traffic Scheduling
Traffic scheduling is the methodical output of packets at a desired frequency to accomplish a consistent flow of traffic. You can apply traffic scheduling to different traffic classes to weight the traffic by priority.
Modifying Class Maps
![]() Note |
The provided system-defined queuing class maps cannot be modified. |
-
Default Behavior: By default, all network traffic is grouped into a single category called qos-group 0 . This means that without any specific configuration, all traffic is treated the same way.
-
System-Defined Classes: These are predefined categories that manage how different types of traffic are handled. They cannot be changed directly.
-
Policy Handling:
-
You can create a type queuing policy which allows you to configure particular que group. For more information see Configure Type Queuing Policies.
-
When you assign traffic to a different qos-group using a Type QoS policy, you might need to adjust these system-defined policies further to meet specific needs, such as reallocating bandwidth.
-
For information about configuring policy maps and class maps, see the Using Modular QoS CLI chapter.
Traffic Shaping
Traffic shaping is a technique that is used to control the flow of traffic leaving an interface to ensure it matches the speed of the remote target interface and adheres to contracted policies. This process helps eliminate bottlenecks caused by data-rate mismatches by regulating and smoothing packet flow. Key aspects include:
-
Maximum Traffic Rate: Imposes a limit on the traffic rate for each port's egress queue, buffering packets that exceed this threshold to minimize packet loss.
-
Comparison to Traffic Policing: Traffic shaping buffers packets instead of dropping them, thereby improving TCP traffic behavior.
-
Bandwidth Control: Allows control over available bandwidth, ensuring traffic conforms to the shaper rates and avoids excess egress traffic for the particular target interface.
-
Queue Length Thresholds: Configured using Weighted Random Early Detection (WRED) to manage queue lengths effectively.
Congestion Avoidance
You can use the following methods to proactively avoid traffic congestion on the device:
-
Apply WRED to TCP or non-TCP traffic.
-
Apply tail drop to TCP or non-TCP traffic.
Congestion Management
Congestion Management uses the following methods to maintain network performance by preventing congestion when queues exceed their thresholds.
-
Explicit Congestion Notification
-
Approximate Fair Drop
-
Weighted Random Early Detection
For information about configuring congestion management, see the Configuring WRED on Egress Queues section.
Explicit Congestion Notification
Explicit Congestion Notification (ECN) is an extension to WRED that marks packets instead of dropping them when the average queue length exceeds a specific threshold value. This helps in signaling congestion to routers and end hosts, prompting them to slow down packet transmission.
Approximate Fair Drop
Approximate Fair Drop (AFD) is an Active Queue Management (AQM) algorithm that acts on long lived large flows (elephant flows) in case of congestion, and does not impact short flows (mice flows).
When congestion occurs, the AFD algorithm maintains the queue occupancy at the configured queue desired value by probabilistically dropping packets from the large flows and not impacting short flows.
ECN can be enabled with AFD on a particular class of traffic to mark the congestion state instead of dropping the packets.
![]() Note |
The AFD algorithm is applicable only on the flows that are qualified as elephant flows. Mice flows are protected and are not subject to AFD dropping. |
AFD User Profiles
Three user profiles are provided with AFD:
-
Mesh (Aggressive)
AFD and ETRAP timers are set to be aggressive, so that the queue depth does not grow much and is kept close to the queue-desired value.
-
Burst (Default)
AFD and ETRAP timers are neither aggressive nor conservative, so that the queue depth could be observed to be hovering near the queue-desired value.
-
Ultra-burst (Conservative)
AFD and ETRAP timers are set to be conservative, so that more bursts are absorbed and fluctuations for queue depth can be observed around the queue-desired value.
These profiles set the ETrap and AFD timers to pre-configured values for different traffic profiles such as, very bursty or not-so bursty traffic. For more configuration flexibility, the ETrap period set by the profile can be overridden by configuring the ETrap age-period with the hardware qos etrap command. However, the AFD timer cannot be changed.
The following is an example of configuring the ETrap age-period:
switch(config)# hardware qos etrap age-period 50 usec
The following are examples of configuring the AFD user profiles:
-
Mesh (Aggressive with ETrap age-period: 20 µsec and AFD period: 10 µsec)
switch(config)# hardware qos afd profile mesh
-
Burst (Default with ETrap age-period: 50 µsec and AFD period: 25 µsec)
switch(config)# hardware qos afd profile burst
-
Ultra-burst (Conservative with ETrap age-period: 100 µsec and AFD period: 50 µsec)
switch(config)# hardware qos afd profile ultra-burst
Elephant Flow
When the number of bytes received in a flow exceeds the number of bytes specified by the ETrap byte-count-threshold, the flow is considered an elephant flow or large flow.
For a flow to continue to be an elephant flow, the configured bw_threshold number of bytes has to be received in the configured timer period. Otherwise, the flow is evicted from the ETrap hash table.
The ingress rate of every elephant flow is calculated and forwarded to egress for the AFD algorithm to consume.
Elephant Trap
The Elephant Trap (ETrap) identifies and hashes flows and forwards the arrival rate per flow to AFD for drop probability computation. It helps in distinguishing between large and short flows, ensuring that only large flows are subject to AFD dropping.
ETrap Parameters
ETrap has the following parameters that can be configured:
-
Byte-count
Byte-count Is used to identify elephant flows. When number of bytes received in a flow exceeds the number of bytes specified by the byte-count-threshold, the flow is considered an elephant flow. (Default byte-count is ~ 1 MB.)
-
Age-period and Bandwidth-threshold
Age-period and Bandwidth-threshold are used together to track the activeness of an elephant flow.
When the average bandwidth during the age-period time is lower than the configured bandwidth-threshold, an elephant flow is considered inactive and is timed-out and removed from the elephant flow table. (Default age-period is 50 µsec. Default bandwidth-threshold is 500 bytes.
Example:
switch (config)# hardware qos etrap age-period 50 usec
switch (config)# hardware qos etrap bandwidth-threshold 500 bytes
switch (config)# hardware qos etrap byte-count 1048555
Weighted Random Early Detection
Weighted Random Early Detection is another AQM algorithm that computes a random drop probability and drops packets indiscriminately across all flows in a traffic class. It cannot be used simultaneously with AFD, as both serve similar purposes but with different methodologies.
Comparison of WRED and AFD
Feature | WRED | AFD |
---|---|---|
Algorithm Type | Active Queue Management | Active Queue Management |
Drop Mechanism/Congestion Management | Computes a random drop probability and drops packets indiscriminately across all flows in a class of traffic | Computes drop probability based on the arrival rate of incoming flows, compares it with the computed fair rate, and drops packets from large flows without impacting short flows |
Priority Handling | Considers packet priority (CoS, DSCP/traffic class, or IP precedence value) to maintain higher-priority flows | Focuses on fairness by distinguishing between long-lived elephant flows and short-lived mice flows, exempting mice flows from dropping |
![]() Note |
AFD and WRED cannot be applied at the same time. Only one can be used in a system. |