ON THIS PAGE
Example: Configuring CoS Non-Strict Priority Scheduling
On supported platforms, you can configure non-strict priority scheduling to avoid starvation of lower priority queues.
This example shows how to assign non-strict priority scheduling to CoS queues.
Requirements
Before you begin, determine the shaping rate, schedulers, and forwarding classes for the CoS traffic. See shaping-rate (CoS Interfaces), Example: Configuring Class-of-Service Schedulers on a Security Device, and Example: Assigning Forwarding Classes to Output Queues.
Overview
Traffic shaping bandwidth allocation is based on the egress (outgoing) interface that the packet traverses. If you have several traffic streams with CoS prioritized, all traffic streams across the network are sent with more bandwidth than the bandwidth on the egress interface. This can sometimes result in higher-priority queues getting all of the bandwidth and lower priority queues not getting any bandwidth, and thus being starved.
This example demonstrates how the non-strict priority feature can resolve the starvation of strict priority scheduling problem. For this scenario, you initialize two traffic streams (50 Mbps each) with CoS classifiers configured. Interface ge-0/0/1 is configured for ingress traffic, and ge-0/0/2 is configured for egress traffic with shaping enabled at 50 million. For traffic stream Q2, you set the queue priority as high and the shaping rate at 10%. For the other traffic stream Q1, you set the queue priority as low and the shaping rate at 10%. See Figure 1.
Since CoS is strict priority scheduling, please keep in mind that higher priority queues can starve lower priority queues.
Configuration
Procedure
CLI Quick Configuration
To quickly configure this example, copy the
following commands, paste them into a text file, remove any line breaks,
change any details necessary to match your network configuration,
copy and paste the commands into the CLI at the [edit]
hierarchy
level, and then enter commit
from the configuration mode.
set class-of-service interfaces ge-0/0/2 unit 0 shaping-rate 50m set interfaces ge-0/0/2 per-unit-scheduler set class-of-service interfaces ge-0/0/1 unit 0 classifiers dscp dscp_custom set class-of-service classifiers dscp dscp_custom forwarding-class HIGH loss-priority low code-points 100011 set class-of-service classifiers dscp dscp_custom forwarding-class LOW loss-priority low code-points 100100 set class-of-service forwarding-classes queue 1 HIGH set class-of-service forwarding-classes queue 0 LOW set class-of-service scheduler-maps sched forwarding-class HIGH scheduler Q1 set class-of-service scheduler-maps sched forwarding-class LOW scheduler Q2 set class-of-service schedulers Q2 transmit-rate percent 10 set class-of-service schedulers Q2 priority high set class-of-service schedulers Q1 transmit-rate percent 10 set class-of-service schedulers Q1 priority low set-class-of-service non-strict-priority-scheduling
Step-by-Step Procedure
The following example requires you to navigate various levels in the configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in Configuration Mode in the Junos OS CLI User Guide.
To configure non-strict priority scheduling:
Configure shaping rate of 50 Mbps on the egress interface.
[edit] user@host# set class-of-service interfaces ge-0/0/2 unit 0 shaping-rate 50m set interfaces ge-0/0/2 per-unit-scheduler
Configure classifiers on the ingress interface.
[edit] user@host# set class-of-service interfaces ge-0/0/1 unit 0 classifiers dscp dscp_custom
Define the DSCP value to be assigned to the forwarding class.
[edit] user@host# set class-of-service classifiers dscp dscp_custom forwarding-class HIGH loss-priority low code-points 100011 user@host# set class-of-service classifiers dscp dscp_custom forwarding-class LOW loss-priority low code-points 100100
Define the forwarding class to a queue number.
[edit] user@host# set class-of-service forwarding-classes queue 1 HIGH user@host# set class-of-service forwarding-classes queue 0 LOW
Map the forwarding classes to a scheduler to control prioritized queueing.
[edit] user@host# set class-of-service scheduler-maps sched forwarding-class HIGH scheduler Q1 user@host# set class-of-service scheduler-maps sched forwarding-class LOW scheduler Q2
Define the schedulers with priority and transmit rates. The example uses the same ratio for transmit rate but defines different priorities.
[edit] user@host# set class-of-service schedulers Q2 transmit-rate percent 10 user@host# set class-of-service schedulers Q2 priority high user@host# set class-of-service schedulers Q1 transmit-rate percent 10 user@host# set class-of-service schedulers Q1 priority low
Configure the new non-strict-priority-scheduling option.
[edit] user@host# set-class-of-service non-strict-priority-scheduling
Results
From configuration mode, confirm your configuration
by entering the show interfaces queue
command. If the output
does not display the intended configuration, repeat the configuration
instructions in this example to correct it.
user@host> show interface queue ge-0/0/2 Queue: 0, Forwarding classes: LOW Queued: Packets : 18085500 8571 pps Bytes : 18013158000 68297136 bps Transmitted: Packets : 3800910 2030 pps Bytes : 3785706360 16178104 bps Tail-dropped packets : 14284525 6534 pps Queue: 1, Forwarding classes: HIGH Queued: Packets : 18085556 8541 pps Bytes : 18013213776 68062256 bps Transmitted: Packets : 11432620 6107 pps Bytes : 11386889520 48660808 bps Tail-dropped packets : 6652859 2436 pps
You will notice that the LOW priority queue got some traffic.
Traffic on the low priority queue is still less than the high priority queue, as the non-priority scheduling option still works to control traffic..
If you are done configuring the device, enter commit
from configuration mode.