About QoS Scheduling
Definitions
In this section we define core "scheduling" terms.
- Packet Handle
- When a router is prepared to forward a packet, it places a packet handle, representing that packet, in one of the egress queues. This handle holds information like the length of the packet and the location of the packet in memory.
- Class Queues
-
When egress QoS is configured, a class queue is created for each class where we configure a queuing action. Similarly, we create an implicit class-default queue for any traffic not matching one of the explicitly-created queuing classes. If you configure a class with only non-queuing actions (e.g., a class with only marking configured), "matching" packets will be enqueued in the class-default queue.
- Schedule
-
You should view a schedule (scheduler) as the decision maker. By selecting the packet handle, the schedule chooses which packet should next exit and when to send it. In the diagram above the "oval" represents a single schedule that selects a packet from one of the class queues.
Note
An individual schedule is created for each interface.
- Schedule Entry
-
For a schedule to choose between queues it needs to know each queues' expected treatment. We store this type of information in a schedule entry. For example, by configuring a queuing command (e.g. bandwidth 10 Mbps ) you are setting the schedule entry.
The schedule entry also stores the internal state like the last time a packet was transmitted from that queue and the current packet handle, if any, from that queue.
Two types of schedule entries include the following: Priority Queues, and Bandwidth Queues.
How Schedule Entries are Programmed
In this section we provide a brief introduction to the parameters that are configured within a schedule entry. The actual commands will be covered in greater detail later in this chapter.
Firstly, a schedule entry is configured as either a priority entry or bandwidth entry ( priority queue or bandwidth queue).
In the descriptions that follow you will see that priority entries can be further divided into P1 entries or P2 entries. You configure a P1 entry (the default) with either the priority or priority level 1 command. Similarly, you use the priority level 2 command to configure a P2 entry.
A bandwidth entry has three distinct parameters: minimum rate (Min), maximum rate (Max) and excess weight (drawn as "Ex" in illustrations).
Note |
The scheduler for a ASR 1000 Series Aggregation Services Router is often described as a three-parameter scheduler. |
- The Min (minimum rate) entry allocates a minimum bvandwidth guaranteed amount of throughput to a queue. The Min entry is configured with the bandwidth command and is not set unless explicitly configured. IOS configuration checking attempts to ensure that a schedule will always have sufficient bandwidth to honor any configured Min rates. Servicing queues based on monitoring throughput vs. a preconfigured target rate is sometimes referred to as real time scheduling (refer to Scheduler's Representation of Time).
- The Max (maximum rate) entry establishes a ceiling on the amount of throughput a queue can receive. The Max entry is configured using the shape command and is not set unless explicitly configured. Understand that Max sets a ceiling on the throughput of a queue but does not in itself guarantee any throughput to that queue.
- The Ex (excess weight) entry mandates how queues will compete for any bandwidth available after Priority and Min guarantees have been met (excess bandwidth, or available bandwidth that is not guaranteed to, or not used by, priority and bandwidth guarantees). We configure Excess Weight with the bandwidth remaining command and unless explicitly configured, it defaults to 1. Excess bandwidth sharing is proportional to a queue's Excess Weight (sometimes referred to as virtual time scheduling, because no rates are configured and relative behavior alone is significant). For reflections on bandwidth sharing, see How Schedule Entries are Programmed.
The following diagram summarizes what is presented above (the commands to set each schedule entry).
Schedule Operation
How a schedule determines the packet sequence may be summarized as follows:
Note |
After each packet is forwarded, we return to step 1. |
-
If the P1 queue is not empty, send the P1 packets.
-
If the PI queue is empty but the P2 queue is not, send the P2 packets.
-
Provided all priority queues are empty, the schedule services any queues with a minimum bandwidth guarantee (Min) and continues to service such queues until the guarantees are met. To ensure fairness, the scheduler will pick between queues with minimum guarantees by selecting the eligible queue, a queue that has not exceeded the bandwidth guarantee and has been waiting longest.
-
What if priority queues are empty and all bandwidth guarantees have been satisfied? Any excess bandwidth is distributed between queues that still require service until either all bandwidth is exhausted or a given queue has reached a maximum configured bandwidth. The Ex configured in that queue's schedule entry, dictates the share each queue will receive of this excess bandwidth.
Schedule Operation: Without a Shaper
The following example illustrates how a schedule operates and how it determines the bandwidth each queue will receive for a given offered load.
Before diving into the example we need to introduce the concept of priority queue admission control. In the previous description of schedule operation you will notice an absence of rates regarding how the schedule deals with priority queues; the schedule simply selects the priority queue whenever it contains a packet.
To prevent a priority queue (class) from starving other queues of service, we can use a policer to limit the consumable bandwidth. Such a policer restricts the rate at which packets can be enqueued in that queue.
In the following example, we attach a policy to a 100 Mbps interface:
policy-map scheduling-example
class voice
priority level 1
police 20m
class video
priority level 2
police 10m
class mission-critical
bandwidth 20000
class class-default
Note |
Bandwidth is configured in Kbps. While police and shape commands support a postfix to specify the unit, the bandwidth command does not. |
The loads offered to each class are shown at the top of the figure: 30M, 5M, 50M, and 50M. We have applied policers (20M and 10M) to the priority queues.
30 Mbps is offered to the voice class, which first traverses a 20 Mbps policer, enqueuing 20 Mbps to the P1 queue. Because we always service this queue first, all 20 Mbps enqueued will be forwarded.
5 Mbps is offered to the video class (which all transits the 10 Mbps policer) and 5 Mbps is enqueued to the video queue. As 80 Mbps (100 Mbps - 20 Mbps) bandwidth is still available, all 5 Mbps will be forwarded.
After servicing priority queues, we advance to any queues with an explicit Min bandwidth guarantee. The mission-critical class has a Min of 20 Mbps so it will receive at least that amount of throughput.
The available excess bandwidth is 55Mbps (100 Mbps - 20 Mbps - 5 Mbps - 20 Mbps). Both the class-default and mission-critical classes have default excess weights of 1, so each receives an equal share of the available bandwidth, (55Mbps/2 =) 27.5 Mbps.
The mission-critical class will observe a total throughput of 47.5 Mbps (20 Mbps + 27.5 Mbps).
Schedule Operation: With a Shaper
Let's modify the configuration slightly - we will add a Max value (configure a shaper) to the mission-critical class:
policy-map scheduling-example
class voice
priority level 1
police 20m
class video
priority level 2
police 10m
class mission-critical
bandwidth 20000
shape average 30m
Note |
We excluded class-default in the policy definition - it is always there whether or not we explicitly define it. |
The loads offered to each class is exactly as before: 30M, 5M, 50M and 50M.
30 Mbps is offered to the voice class, which first passes through a 20 Mbps policer, enqueing 20 Mbps to the P1 queue. We always service this queue first, so all 20 Mbps enqueued will be forwarded.
5 Mbps is offered to the video class (which all passes through the 10 Mbps policer) and 5 Mbps is enqueued to the P2 queue. As 80 Mbps (100 Mbps - 20 Mbps) bandwidth is still available, all 5 Mbps will be forwarded.
After servicing priority queues, we advance to any queues with an explicit Min. The mission-critical class has a bandwidth guarantee of 20 Mbps so it will receive at least that amount of throughput.
The available excess bandwidth is 55 Mbps (100 - 20 - 5 - 20 Mbps). Both the class-default and mission-critical classes have default Ex's 1, so each receives an equal share of the available bandwidth. From the Excess bandwidth sharing "rule," where in bandwidth is proportional to a queue's Ex, each class receives a 27.5 Mbps share. (For more information on this "rule," refer to How Schedule Entries are Programmed.)
Based on the bandwidth guarantee and bandwidth sharing, the mission-critical queue would receive 47.5 Mbps (20 + 27.5 Mbps). However, the queue cannot use this much bandwidth because the Max configured shape rate is set to 30 Mbps (recall that Max is set to 0 in the previous example). Consequently, the queue uses 30 Mbps (out of the 47.5 Mbps received from bandwidth sharing) and the additional 17.5 Mbps of bandwidth returns to the excess pool.
As class-default is the only queue still requesting bandwidth, it has no competition and can consume this extra 17.5 Mbps, increasing its total throughput to 45 Mbps.
Note |
This example demonstrates how bandwidth is never wasted - scheduling will continue to sort through eligible queues and apportion bandwidth until one of the following applies:
|