Configuring Queuing and Scheduling

About Queuing and Scheduling

Traffic queuing is the ordering of packets and applies to both input and output of data. Device modules can support multiple queues, which you can use to control the sequencing of packets in different traffic classes. You can also set taildrop thresholds. The device drops packets only when the configured thresholds are exceeded.

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.

The queuing and scheduling processes allow you to control the bandwidth that is allocated to the traffic classes so that you achieve the desired trade-off between throughput and latency for your network.

Modifying Class Maps

System-defined queuing class maps are provided.


Note


The provided system-defined queuing class maps cannot be modified.


You can modify the QoS groups that are matched by system-defined queuing class maps. Each QoS group appears only once in the queues of the same type.

If you want to change the system-default queuing class maps, you must also change the queuing policies that are applied on the interfaces because any changes in the queuing class maps causes traffic disruptions and might also cause packet drops.


Caution


When you modify a system-defined queuing class map, the changes occur immediately and might disrupt traffic.



Note


The CoS-to-queue mapping is predetermined and cannot be changed.


For information about configuring class maps, see the Configuring Congestion Avoidance section.

Congestion Management

For egress packets, you can choose one of the following congestion management methods:

  • Specify a bandwidth that allocates a minimum data rate to a queue.

  • Impose a minimum and maximum data rate on a class of traffic so that excess packets are retained in a queue to shape the output rate.

  • Allocate all data for a class of traffic to a priority queue. The device distributes the remaining bandwidth among the other queues.

Traffic Shaping

Traffic shaping allows you to control the traffic going out of an interface in order to match its flow to the speed of the remote target interface and to ensure that the traffic conforms to policies contracted for it. You can shape traffic that adheres to a particular profile to meet downstream requirements. Traffic shaping eliminates bottlenecks in topologies with data-rate mismatches.

Traffic shaping regulates and smooths out the packet flow by imposing a maximum traffic rate for each port’s egress queue. Packets that exceed the threshold are placed in the queue and are transmitted later. Traffic shaping is similar to traffic policing, but the packets are not dropped. Because packets are buffered, traffic shaping minimizes packet loss (based on the queue length), which provides better traffic behavior for TCP traffic.

Using traffic shaping, you can control access to available bandwidth, ensure that traffic conforms to the policies established for it, and regulate the flow of traffic to avoid congestion that can occur when the egress traffic exceeds the access speed of its remote, target interface. For example, you can control access to the bandwidth when policy dictates that the rate of a given interface should not, on average, exceed a certain rate even though the access rate exceeds the speed.

Prerequisites for Queuing and Scheduling

Queuing and scheduling have the following prerequisites:

  • You must be familiar with using modular QoS CLI.

  • You are logged on to the device.

Guidelines and Limitations for Configuring Queuing and Scheduling

Queuing and scheduling have the following configuration guidelines and limitations:

  • Nexus 3600 Switches support only the eight (8) queue configuration in QoS policies. Fewer queues can be configured but are not supported.

  • Beginning with Cisco NX-OS Release 10.3(2)F, an error message is provided to check on 4Q mode policy configuration. Also, before upgrading to Release 10.3(2)F, if 4Q mode queuing policy is configured, ensure the configuration is removed in the system.

  • show commands with the internal keyword are not supported.

  • The device supports a system-level queuing policy, so all ports in the system are impacted when you configure the queuing policy.

  • A type queuing policy can be attached to the system or to individual interfaces for input or output traffic.

  • Changes are disruptive. The traffic passing through ports of the specified port type experience a brief period of traffic loss. All ports of the specified type are affected.

  • Performance can be impacted. If one or more ports of the specified type do not have a queuing policy applied that defines the behavior for the new queue, the traffic mapping to that queue might experience performance degradation.

  • Traffic shaping might increase the latency of packets due to queuing because it falls back to store-and-forward mode when packets are queued.

  • When configuring priorities for one class map queue, you need to configure the priority level for that queue. When configuring priorities for more than one class map queue, you need to configure the priorities for each of the queues.

  • The queue-limit configuration is applicable only in ingress queuing policy on Cisco Nexus 9500 switches with 9600-R/RX line cards.

  • The bandwidth percent configuration is applicable only in egress queuing policy on Cisco Nexus 9500 switches with 9600-R/RX line cards.

  • If granted buffer is not carved out using a custom input queuing policy for a specified group, only global shared buffers are used.

Order of Resolution

The queue-limit for a priority-group is resolved in the following order:

  • Interface ingress queuing policy (if applied and queue-limit configuration specified for that class).

  • System ingress queuing policy (if applied and queue-limit configuration specified for that class).

Configuring Queuing and Scheduling

Queuing and scheduling are configured by creating policy maps of type queuing that you apply to an egress interface. You can modify system-defined class maps, which are used in policy maps to define the classes of traffic to which you want to apply policies.

You can configure the congestion-avoidance features, which includes tail drop, in any queue.

You can configure one of the egress congestion management features, such as priority, traffic shaping, and bandwidth in output queues.

The system-defined policy map, default-out-policy, is attached to all ports to which you do not apply a queuing policy map. The default policy maps cannot be configured.

Configuring Type Queuing Policies

Type queuing policies for egress are used for scheduling the traffic of a specific system class. A type queuing policy is identified by its QoS group and can be attached to the system or to individual interfaces for input or output traffic.

SUMMARY STEPS

  1. configure terminal
  2. policy-map type queuing policy-name
  3. class type queuing class-name
  4. priority
  5. no priority
  6. shape {kbps | mbps | gbps} burst size min minimum bandwidth
  7. bandwidth percent percentage
  8. no bandwidth percent percentage

DETAILED STEPS

  Command or Action Purpose

Step 1

configure terminal

Enters global configuration mode.

Step 2

policy-map type queuing policy-name

Creates a named object that represents a set of policies that are to be applied to a set of traffic classes. Policy-map names can contain alphabetic, hyphen, or underscore characters, are case sensitive, and can be up to 40 characters.

Step 3

class type queuing class-name

Associates a class map with the policy map, and enters configuration mode for the specified system class.

Step 4

priority

Specifies that traffic in this class is mapped to a strict priority queue.

Step 5

no priority

(Optional) Removes the strict priority queuing from the traffic in this class.

Step 6

shape {kbps | mbps | gbps} burst size min minimum bandwidth

Specifies the burst size and minimum guaranteed bandwidth for this queue.

Step 7

bandwidth percent percentage

Assigns a weight to the class. The class will receive the assigned percentage of interface bandwidth if there are no strict-priority queues. If there are strict-priority queues, however, the strict-priority queues receive their share of the bandwidth first. The remaining bandwidth is shared in a weighted manner among the class configured with a bandwidth percent. For example, if strict-priority queues take 90 percent of the bandwidth, and you configure 75 percent for a class, the class will receive 75 percent of the remaining 10 percent of the bandwidth.

Note

 

Before you can successfully allocate bandwidth to the class, you must first reduce the default bandwidth configuration on class-default and class-fcoe.

Step 8

no bandwidth percent percentage

(Optional) Removes the bandwidth specification from this class.

Configuring Queue Limit Using Ingress Queuing Policy

There are situations where each port needs dedicated buffers. An ingress queuing policy can be used for this purpose.

SUMMARY STEPS

  1. configure terminal
  2. policy-map type queuing policy-map-name
  3. class type queuing c-in-q1

DETAILED STEPS

  Command or Action Purpose

Step 1

configure terminal

Enters global configuration mode.

Step 2

policy-map type queuing policy-map-name

Enters policy-map queuing class mode and identifies the policy map assigned to the type queuing policy map.

Step 3

class type queuing c-in-q1

Attaches the class map of type queuing and then enters policy-map class queuing mode. Class queuing names are listed in the System-Defined Type queuing Class Maps table.

Note

 

The qos-group associated with the class must be defined as a no-drop class in the network-qos policy applied in the system qos.

Configuring Congestion Management

You can configure only one of the following congestion management methods in a policy map:

  • The bandwidth command and the bandwidth remaining command are the same. Configuring either gives the same results.

  • Allocate a minimum data rate to a queue by using the bandwidth command or the bandwidth remaining command.

  • Allocate a minimum data rate to a queue by using the bandwidth command or the bandwidth remaining command.

  • Allocate all data for a class of traffic to a priority queue by using the priority command. You can use the bandwidth command or the bandwidth remaining command to distribute remaining traffic among the nonpriority queues. By default, the system evenly distributes the remaining bandwidth among the nonpriority queues.

  • Allocate a minimum and maximum data rate to a queue by using the shape command.

In addition to the congestion management feature that you choose, you can configure one of the following queue features in each class of a policy map:

  • Taildrop thresholds based on the queue size and the queue limit usage.

Configuring Tail Drop

You can configure tail drop by setting thresholds. The device drops any packets that exceed the thresholds. You can specify a threshold based on the queue size or buffer memory that is used by the queue.

SUMMARY STEPS

  1. configure terminal
  2. policy-map [type queuing] [match-first] [policy-map-name]
  3. class type queuing class-name
  4. queue-limit {queue-size [bytes | kbytes | mbytes] | dynamic value}
  5. (Optional) Repeat Steps 2 and 3 to assign tail drop thresholds for other queue classes.
  6. show policy-map [type queuing [policy-map-name | default-out-policy]]
  7. copy running-config startup-config

DETAILED STEPS

  Command or Action Purpose

Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#

Enters global configuration mode.

Step 2

policy-map [type queuing] [match-first] [policy-map-name]

Example:

switch(config)# policy-map type queuing egr-queuing-policy-1
switch(config-pmap-que)#

Configures the policy map of type queuing and then enters policy-map mode for the policy-map name you specify. Policy-map names can contain alphabetic, hyphen, or underscore characters, are case sensitive, and can be up to 40 characters.

Step 3

class type queuing class-name

Example:

switch(config-pmap-que)# class type queuing c-out-8q-q7
switch(config-pmap-c-que)#

Configures the class map of type queuing and then enters policy-map class queuing mode. Class queuing names are listed in the previous System-Defined Type queuing Class Maps table.

Step 4

queue-limit {queue-size [bytes | kbytes | mbytes] | dynamic value}

Example:

switch(config-pmap-c-que)# queue-limit 1000 mbytes

Assigns a tail drop threshold based on the queue size in bytes, kilobytes, or megabytes or allows the queue’s threshold size to be determined dynamically depending on the number of free cells available. The device drops packets that exceed the specified threshold.

The valid values for byte-based queue size are from 1 to 83886080. The valid values for dynamic queue size are from 0 to 10.

Step 5

(Optional) Repeat Steps 2 and 3 to assign tail drop thresholds for other queue classes.

Step 6

show policy-map [type queuing [policy-map-name | default-out-policy]]

Example:

switch(config-pmap-c-que)# show policy-map type queuing egr-queuing-policy-1

(Optional) Displays information about all configured policy maps, all policy maps of type queuing, a selected policy map of type queuing, or the default output queuing policy.

Step 7

copy running-config startup-config

Example:

switch(config)# copy running-config
startup-config

(Optional) Saves the running configuration to the startup configuration.

Configuring Bandwidth and Bandwidth Remaining

You can configure the bandwidth and bandwidth remaining on the egress queue to allocate a minimum percentage of the interface bandwidth to a queue.

SUMMARY STEPS

  1. configure terminal
  2. policy-map type queuing {[match-first] policy-map-name}
  3. class type queuingclass-name
  4. Assign a minimum rate of the interface bandwidth or assign the percentage of the bandwidth that remains:
    • Bandwidth percent:

      bandwidth {percent percent}
    • Bandwidth remaining percent:

      bandwidth remaining percent percent
  5. (Optional) Repeat Steps 3 and 4 to assign tail drop thresholds for other queue classes.
  6. exit
  7. show policy-map [type queuing [policy-map-name | default-out-policy]]
  8. copy running-config startup-config

DETAILED STEPS

  Command or Action Purpose

Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#

Enters global configuration mode.

Step 2

policy-map type queuing {[match-first] policy-map-name}

Example:

switch(config)# policy-map type queuing shape_queues
switch(config-pmap-que)#

Configures the policy map of type queuing and then enters policy-map mode for the policy-map name you specify. Policy-map names can contain alphabetic, hyphen, or underscore characters, are case sensitive, and can be up to 40 characters.

Step 3

class type queuingclass-name

Example:

switch(config-pmap-que)# class type queuing c-out-8q-q1
switch(config-pmap-c-que)#

Configures the class map of type queuing and then enters policy-map class queuing mode. Class queuing names are listed in the previous System-Defined Type queuing Class Maps table.

Step 4

Assign a minimum rate of the interface bandwidth or assign the percentage of the bandwidth that remains:

  • Bandwidth percent:

    bandwidth {percent percent}
  • Bandwidth remaining percent:

    bandwidth remaining percent percent

Example:

  • Bandwidth percent:

    switch(config-pmap-c-que)# bandwidth percent 25
  • Bandwidth remaining percent:

    switch(config-pmap-c-que)# bandwidth remaining percent 25
  • Bandwidth percent:

    Assigns a minimum rate of the interface bandwidth to an output queue as the percentage of the underlying interface link rate. The range is from 0 to 100.

    The example shows how to set the bandwidth to a minimum of 25 percent of the underlying link rate.

  • Bandwidth remaining percent:

    Assigns the percentage of the bandwidth that remains to this queue. The range is from 0 to 100.

    The example shows how to set the bandwidth for this queue to 25 percent of the remaining bandwidth.

Step 5

(Optional) Repeat Steps 3 and 4 to assign tail drop thresholds for other queue classes.

Step 6

exit

Example:

switch(config-cmap-que)# exit
switch(config)#

Exits policy-map queue mode and enters global configuration mode.

Step 7

show policy-map [type queuing [policy-map-name | default-out-policy]]

Example:

switch(config-pmap-c-que)# show policy-map type queuing shape_queues

(Optional) Displays information about all configured policy maps, all policy maps of type queuing, a selected policy map of type queuing, or the default output queuing policy.

Step 8

copy running-config startup-config

Example:

switch(config)# copy running-config
startup-config

(Optional) Saves the running configuration to the startup configuration.

Configuring Priority

If you do not specify the priority, the system-defined egress pq queues behave as normal queues.

You can configure only one level of priority on an egress priority queue. You use the system-defined priority queue class for the type of module to which you want to apply the policy map.

For the nonpriority queues, you can configure how much of the remaining bandwidth to assign to each queue. By default, the device evenly distributes the remaining bandwidth among the nonpriority queues.


Note


When a priority queue is configured, the other queues can only use the remaining bandwidth in the same policy map. A priority queue can be configured on any queue.


SUMMARY STEPS

  1. configure terminal
  2. policy-map type queuing {[match-first] policy-map-name}
  3. class type queuing class-name
  4. priority [level value]
  5. class type queuingclass-name
  6. bandwidth remaining percent percent
  7. (Optional) Repeat Steps 5 to 6 to assign the remaining bandwidth for the other nonpriority queues.
  8. exit
  9. show policy-map [type queuing [policy-map-name | default-out-policy]]
  10. copy running-config startup-config

DETAILED STEPS

  Command or Action Purpose

Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#

Enters global configuration mode.

Step 2

policy-map type queuing {[match-first] policy-map-name}

Example:

switch(config)# policy-map type queuing priority_queue1
switch(config-pmap-que)#

Configures the policy map of type queuing and then enters policy-map mode for the policy-map name you specify. Policy-map names can contain alphabetic, hyphen, or underscore characters, are case sensitive, and can be up to 40 characters.

Step 3

class type queuing class-name

Example:

switch(config-pmap-que)# class type queuing c-out-8q-q1
switch(config-pmap-c-que)#

Configures the class map of type queuing and then enters policy-map class queuing mode. Class queuing names are listed in the previous System-Defined Type queuing Class Maps table.

Step 4

priority [level value]

Example:

switch(config-pmap-c-que)# priority

Selects this queue as a priority queue. Only one priority level is supported.

Step 5

class type queuingclass-name

Example:

switch(config-pmap-que)# class type queuing c-out-q2
switch(config-pmap-c-que)#

(Optional) Configures the class map of type queuing and then enters policy-map class queuing mode. Class queuing names are listed in the previous System-Defined Type queuing Class Maps table.

Choose a nonpriority queue where you want to configure the remaining bandwidth. By default, the system evenly distributes the remaining bandwidth among the nonpriority queues.

Step 6

bandwidth remaining percent percent

Example:

switch(config-pmap-c-que)# bandwidth remaining percent 25

(Optional) Assigns the percent of the bandwidth that remains to this queue. The range is from 0 to 100.

Step 7

(Optional) Repeat Steps 5 to 6 to assign the remaining bandwidth for the other nonpriority queues.

Step 8

exit

Example:

switch(config-cmap-que)# exit
switch(config)#

Exits policy-map queue mode and enters global configuration mode.

Step 9

show policy-map [type queuing [policy-map-name | default-out-policy]]

Example:

switch(config)# show policy-map type queuing priority_queue1

(Optional) Displays information about all configured policy maps, all policy maps of type queuing, a selected policy map of type queuing, or the default output queuing policy.

Step 10

copy running-config startup-config

Example:

switch(config)# copy running-config
startup-config

(Optional) Saves the running configuration to the startup configuration.

Configuring Traffic Shaping

You can configure traffic shaping on an egress queue to impose a minimum and maximum rate on it.


Note


Configuring traffic shaping for a queue is independent of priority or bandwidth in the same policy map.


Before you begin

Configure random detection minimum and maximum thresholds for packets.

SUMMARY STEPS

  1. configure terminal
  2. policy-map type queuing {[match-first] policy-map-name}
  3. class type queuing class-name
  4. shape min value {bps | gbps | kbps | mbps | pps} max value {bps | gbps | kbps | mbps | pps}
  5. (Optional) Repeat Steps 3 and 4 to assign tail drop thresholds for other queue classes.
  6. show policy-map [type queuing [policy-map-name | default-out-policy]]
  7. copy running-config startup-config

DETAILED STEPS

  Command or Action Purpose

Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#

Enters global configuration mode.

Step 2

policy-map type queuing {[match-first] policy-map-name}

Example:

switch(config)# policy-map type queuing shape_queues
switch(config-pmap-que)#

Configures the policy map of type queuing and then enters policy-map mode for the policy-map name you specify. Policy-map names can contain alphabetic, hyphen, or underscore characters, are case sensitive, and can be up to 40 characters.

Step 3

class type queuing class-name

Example:

switch(config)# class type queuing c-out-q-default
switch(config-pmap-c-que)#

Configures the class map of type queuing and then enters policy-map class queuing mode. Class queuing names are listed in the previous System-Defined Type queuing Class Maps table.

Step 4

shape min value {bps | gbps | kbps | mbps | pps} max value {bps | gbps | kbps | mbps | pps}

Example:

switch(config-pmap-c-que)# shape min 10 bps max 100 bps

Assigns a minimum and maximum bit rate on an output queue. The default bit rate is in bits per second (bps).

The example shows how to shape traffic to a minimum rate of 10 bits per second (bps) and a maximum rate of 100 bps.

Step 5

(Optional) Repeat Steps 3 and 4 to assign tail drop thresholds for other queue classes.

Step 6

show policy-map [type queuing [policy-map-name | default-out-policy]]

Example:

switch(config)# show policy-map type queuing shape_queues

(Optional) Displays information about all configured policy maps, all policy maps of type queuing, a selected policy map of type queuing, or the default output queuing policy.

Step 7

copy running-config startup-config

Example:

switch(config)# copy running-config
startup-config

(Optional) Saves the running configuration to the startup configuration.

Applying a Queuing Policy on a System

You apply a queuing policy globally on a system.

SUMMARY STEPS

  1. configure terminal
  2. system qos
  3. service-policy type queuing output {policy-map-name | default-out-policy}

DETAILED STEPS

  Command or Action Purpose

Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#

Enters global configuration mode.

Step 2

system qos

Example:

switch (config)# system qos
switch (config-sys-qos)#

Enters system qos mode.

Step 3

service-policy type queuing output {policy-map-name | default-out-policy}

Example:

switch (config-sys-qos)# service-policy type queuing map1

Adds the policy map to the input or output packets of system.

Note

 

The output keyword specifies that this policy map should be applied to traffic transmitted from an interface.

Note

 

To restore the system to the default queuing service policy, use the no form of this command.

Verifying the Queuing and Scheduling Configuration

Use the following commands to verify the queuing and scheduling configuration:

Command

Purpose

show class-map [type queuing [class-name]]

Displays information about all configured class maps, all class maps of type queuing, or a selected class map of type queuing.

show policy-map [type queuing [policy-map-name | default-out-policy]]

Displays information about all configured policy maps, all policy maps of type queuing, a selected policy map of type queuing, or the default output queuing policy.

show policy-map system

Displays information about all configured policy maps on the system.

Configuration Examples for Queuing and Scheduling

In this section you can find examples of configuring queuing and scheduling.

Example: Configuring Traffic Shaping

The following example shows how to configure traffic shaping using 1000 packets per second (pps)::

configure terminal
  class-map type queuing match-any c-out-8q-q1
    match qos-group 1
  class-map type queuing match-any c-out-8q-q2
    match qos-group 1
policy-map type queuing pqu
  class type queuing c-out-8q-q3
    bandwidth percent 20
    shape min 100 mbps max 500 mbps
  class type queuing c-out-8q-q2
    bandwidth percent 30
    shape min 200 mbps max 1000 mbps
  class type queuing c-out-8q-q-default
    bandwidth percent 50
  class type queuing c-out-8q-q1
    bandwidth percent 0
  class type queuing c-out-8q-q4
    bandwidth percent 0
  class type queuing c-out-8q-q5
    bandwidth percent 0
  class type queuing c-out-8q-q6
    bandwidth percent 0
  class type queuing c-out-8q-q7
    bandwidth percent 0
system qos
  service-policy type queuing output pqu