Showing posts with label Tools. Show all posts
Showing posts with label Tools. Show all posts

Hardware Queuing: 1PxQyT



To scale QoS functionality to campus speeds (like Gigabit Ethernet or 10 Gigabit Ethernet), Catalyst switches must perform QoS operations, including queuing, within hardware. For the most part, classification, marking, and policing policies (and syntax) are consistent in both Cisco IOS Software and Catalyst hardware; however, queuing and dropping are significantly different when implemented in hardware. Hardware queuing across Catalyst switches is implemented in a model that can be expressed as1PxQyT, where
  • 1P represents the support of a strict-priority hardware queue (which is usually disabled by default)
  • xQ represents x number of nonpriority hardware queues (including the default, Best-Effort queue)
  • yT represents y number of drop-thresholds per nonpriority hardware queue
For example, a Catalyst 6500 48-port 10/100/1000 RJ-45 Module (WS-X6748-GE-TX) has a 1P3Q8T queuing structure, meaning that it has
  • One strict priority hardware queue (which, incidentally, on this linecard is Queue 4)
  • Three additional nonpriority hardware queues, each with eight configurable Weighted Random Early Detect (WRED) drop thresholds per queue
Traffic assigned to the strict-priority hardware queue is treated with an Expedited Forwarding Per-Hop Behavior (EF PHB). That being said, it bears noting that on some platforms, there is no explicit limit on the amount of traffic that can be assigned to the PQ, and as such the potential to starve nonpriority queues exists. However, this potential for starvation can be effectively addressed by explicitly configuring input policers that limit (on a per-port basis) the amount of traffic that can be assigned to the priority queue (PQ). Incidentally, this is the recommended approach defined in RFC 3246 (Section 3).
Traffic assigned to a nonpriority queue will be provided with bandwidth guarantees, subject to the PQ being either fully-serviced or bounded with input policers.
For most platforms, there are typically multiple, configurable drop-thresholds per nonpriority queue. These are provided to allow for selective dropping policies (discussed in more detail in the next section) and to accommodate intraqueue QoS, which is more important in hardware queuing structures (where the number of queues is few and fixed) than in software queuing structures (where generally-speaking there are more queues available than needed). For example, if a campus network administrator had 12 classes of traffic to provision, yet had to work within a 1P3Q8T queuing structure, he could configure the drop thresholds to provide intraqueue QoS inline with his overall service-level objectives. In other words, he is not constrained to only provision four classes of traffic because that is the total number of queues his hardware supports.
To better understand the operation of a Catalyst hardware queuing, consider a simple example where the hardware supports a 1P2Q2T queuing structure, meaning one strict priority queue, two nonpriority queues each with two configurable drop-thresholds per nonpriority queue. In this example, bandwidth to these queues can be allocated so that Q1 (the default queue) is allocated 85 percent, Q2 (the network control queue) is allocated 10 percent, and Q3 (the priority queue) is allocated 5 percent.
Additionally, consider the use of Weighted Tail Drop (WTD) as the dropping algorithm. In this example, a drop threshold has been configured at 40 percent of Q1’s depth (Q1T1), and another drop threshold has been configured at 40 percent of Q2’s depth (Q2T1). Each queue also has a nonconfigurable drop threshold that corresponds to the tail of the queue (Q1T2 and Q2T2, respectively).
With these queues and thresholds thus provisioned, traffic can be assigned to these queues and thresholds based on CoS values; specifically CoS 5 (representing VoIP) is assigned to Q3, CoS 7 (representing network control protocols, such as Spanning Tree) is mapped to Q2T2, CoS 6 (representing internetworking protocols, such as routing protocols) is mapped to Q2T1, CoS values 2-4 (representing video and data applications) are mapped to Q1T2, and CoS values 0 and 1 are mapped to Q1T1.
Figure 1 illustrates this 1P2Q2T hardware queuing example, with WTD.

 
Figure 1: 1P2Q2T hardware queuing with WTD example
As shown in Figure 1, packets marked CoS 5 are assigned to the strict priority queue (Q3) and are serviced ahead of all other traffic. Additionally, packets with CoS values 0 through 4 are assigned on a first-come, first-serve basis to Q1 until Q1T1 is reached. At this point, the queuing algorithm no longer buffers packets marked with CoS values 0 and 1, but drops these; therefore, the remainder of Q1 is exclusively reserved for packets marked to CoS values 2 to 4 (representing higher-priority traffic). Similarly, packets with CoS values 6 and 7 are assigned to Q2, but packets marked CoS 6 are dropped if Q2T1 is exceeded.
Additionally, on some platforms and linecards, queuing is possible not only on egress, but also on ingress. This is because some platforms and linecards are engineered based on oversubscriptions ratios. This engineering approach is often taken as most campus links have average utilization rates far below link capacity and, therefore, can be more economically provisioned for with architectures based on oversubscription.
For example, the Cisco Catalyst 3750G is a fixed-configuration switch that supports up to 48 10/100/1000 ports, plus 4 Small Form-Factor Pluggable (SFP) ports for either GE or 10GE uplinks, representing a (minimum) total input capacity of (48 Gbps + 4 Gbps) 52 Gbps. The backplane of the 3750G is a dual 16 Gbps counter-rotating ring, with a total capacity of 32 Gbps. Thus, this 3750G architecture is engineered with a minimum oversubscription ratio of 52:32 or 13:8 or 1.625:1. However, when 10GE SFP uplinks are used or when (up to 9) 3750G switches are stacked (through Cisco Stackwise technology) into one logical grouping sharing the same dual-ring backplane, the oversubscription ratio becomes much higher. Thus, to protect real-time and critical traffic from being potentially dropped during extreme scenarios, when input rates exceed ring capacity, ingress queuing can be enabled on this platform through a 1P1Q3T queuing structure.
Remember that hardware queuing is (as the name implies) hardware-specific; therefore, there is considerable disparity in ingress and egress queuing structures and feature support across Catalyst switches platforms. For example, hardware egress queuing structures include the following:
  • 1P3Q3T (Catalyst 2960 and 3560 or 3750)
  • 1P3Q1T (Catalyst 4500 or 4900) and 1P7Q1T, (Catalyst 4500-E or 4900M)
  • 1P2Q1T, 1P2Q2T, 1P3Q1T, 1P3Q8T, 1P7Q4T, and 1P7Q8T (Catalyst 6500, module-dependent)
Note 
Some older Cisco Catalyst 6500 linecards also support 2Q2T, but these linecards are considered legacy and not recommended for IP Telephony and TelePresence deployments. For the full matrix of Catalyst 6500 queuing structures by module, refer to http://tinyurl.com/bgjkr5.
Additionally, some switches support CoS-to-Queue mappings only (like the Catalyst 6500), others support either CoS- or DSCP-to-Queue mappings (like the Catalyst 2960, 3560 and 3750, and 4500 and 4900). Similarly, when it comes to dropping algorithms, some platforms support CoS-based WRED (Catalyst 6500), others support CoS- or DSCP-based Weighted-Tail Drop (WTD) (Catalyst 2960 and 3560 and 3750), or even platform-specific dropping algorithms, such as Dynamic Buffer Limiting (DBL) (Catalyst 4500 and 4900).
Long story short—network administrators need to be thoroughly familiar with the mapping, queuing, and dropping features of their Catalyst switches and linecard platforms to properly provision QoS policies within the campus.

Low-Latency Queuing (LLQ)


LLQ

Low-Latency Queuing (LLQ) is essentially CBWFQ combined with a strict priority queue. Traffic assigned to the strict priority queue, using the priority command, is completely serviced before all other CBWFQ queues are serviced. LLQ bandwidth, like CBWFQ bandwidth, can be assigned either in absolute kbps or as a percentage of the link’s bandwidth (using the priority percent command).
Note 
The original name for the LLQ algorithm was Priority-Queue-Class-Based Weighted-Fair Queuing (PQ-CBWFQ). Although this name was technically more descriptive, it was obviously clumsy from a marketing perspective, hence, the algorithm was renamed LLQ.
To better understand how LLQ works, Example 1 adds a strict priority queue, to support VoIP
Example 1: LLQ/CBWFQ Policy Example

Router(config)# policy-map LLQ
Router(config-pmap)# class VOICE
Router(config-pmap-c)# priority 100
Router(config-pmap-c)# class CALL-SIGNALING
Router(config-pmap-c)# bandwidth percent 5
Router(config-pmap-c)# class TRANSACTIONAL-DATA
Router(config-pmap-c)# bandwidth percent 20
Router(config-pmap-c)# class BULK-DATA
Router(config-pmap-c)# bandwidth percent 10
Router(config-pmap-c)# class class-default
Router(config-pmap-c)# fair-queue

Next, look at Figure 1 to see what has changed in the underlying queuing mechanisms when LLQ has been combined with CBWFQ.

 
Figure 1: LQ and CBWF Q mechanisms
Note 
For the sake of simplicity, some Layer 2 subsystems (including Link Fragmentation and Interleaving) have been omitted from Figure 1 because these mechanisms simply aren’t relevant at the link speeds required by TelePresence.
In Figure 1, you see a router interface that has been configured with a 5-class LLQ/CBWFQ policy, with voice assigned to a 100-kbps LLQ, and additional three explicit CBWFQs defined for Call-Signaling, Transactional Data, and Bulk Data respectively, and a default queue that has a Fair-Queuing pre-sorter assigned to it. However, an underlying mechanism that might not be obvious from the configuration, but is shown in the illustration, is an implicit policer attached to the LLQ.
The threat posed by any strict priority-scheduling algorithm is that it can completely starve lower-priority traffic. To prevent this, the LLQ mechanism has a built-in policer. This policer (like the queuing algorithm itself) engages only when the LLQ-enabled interface is experiencing congestion. Therefore, it is important to provision the priority classes properly. In this example, if more than 100 kbps of voice traffic was offered to the interface, and the interface was congested, the excess voice traffic would be discarded by theimplicit policer. However, traffic that is admitted by the policer gains access to the strict priority queue and is handed off to the Tx-Ring ahead of all other CBWFQ traffic.
Now, consider the case of servicing not just voice with strict-priority LLQ, but also real-time interactive-video (which, for these two following examples, is abbreviated simply asvideo).
Two options exist to the network administrator. The first is to admit both voice and video to the same LLQ. Thus the second LLQ example policy becomes what is shown in Example 2.
Example 2: Aggregate LLQ for Voice and Video Policy Example

Router(config)# class-map match-any REALTIME
Router(config-cmap)# match dscp ef
Router(config-cmap)# ! Matches VoIP on DSCP EF (per RFC4594)
Router(config-cmap)# match dscp cs4
Router(config-cmap)# ! Matches Realtime-Interactive Video on CS4 (per RFC4594)
Router(config-cmap)#
Router(config-cmap)# policy-map LLQ2
Router(config-pmap)# class REALTIME
Router(config-pmap-c)# priority 500
Router(config-pmap-c)# ! Combined LLQ for VoIP and Video
Router(config-pmap-c)# class CALL-SIGNALING
Router(config-pmap-c)# bandwidth percent 5
Router(config-pmap-c)# class TRANSACTIONAL-DATA
Router(config-pmap-c)# bandwidth percent 20
Router(config-pmap-c)# class BULK-DATA
Router(config-pmap-c)# bandwidth percent 10
Router(config-pmap-c)# class class-default
Router(config-pmap-c)# fair-queue

Figure 2 illustrates the corresponding IOS mechanisms for this second LLQ example.

 
Figure 2: Aggregate LLQ for voice and video policy mechanisms
In Figure 2, you can see that not only has the LLQ been expanded in size (to 500 kbps), but also the implicit policer (for the combined VoIP and TelePresence class) has been increased to 500 kbps. Such a policy can continue to protect voice from data and video from data. However, this policy does potentially allow video to interfere with voice. This is because traffic offered to the LLQ class is serviced on a first-come, first-serve basis. Therefore, should video traffic suddenly burst, it is possible (even likely) that voice traffic would be dropped.
At this point, you can realize another benefit of the implicit policer for the LLQ—not only does this mechanism protect nonreal-time queues from bandwidth-starvation, but also it allows for Time-Division Multiplexing (TDM) of the LLQ. TDM of the LLQ allows for the configuration and servicing of multiple LLQs, while abstracting the fact that there is only a single LLQ “under-the-hood,” so to speak. Pertinent to the example, by configuring two LLQs, not only are voice and video protected from data applications, but also voice and video are protected from interfering with each other.
Example 3 provides the final policy example to cover this point, wherein a dual-LLQ design is used, one each for voice and video.
Example 3: Dual-LLQ for Voice and Video Policy Example

Router(config)# class-map match-all VOICE
Router(config-cmap)# match dscp ef
Router(config-cmap)# ! Matches VoIP on DSCP EF (per RFC4594)
Router(config-cmap)# class-map match-all VIDEO
Router(config-cmap)# match dscp cs4
Router(config-cmap)# ! Matches Realtime-Interactive Video on CS4 (per RFC4594)
Router(config-cmap)# !
Router(config-cmap)# policy-map LLQ3
Router(config-pmap)# class VOICE
Router(config-pmap-c)# priority 100
Router(config-pmap-c)# ! Provisions 100 kbps of LLQ for VoIP
Router(config-pmap-c)# class VIDEO
Router(config-pmap-c)# priority 400
Router(config-pmap-c)# ! Provisions 400 kbps of LLQ for Realtime-Interactive Video
Router(config-pmap-c)# class CALL-SIGNALING
Router(config-pmap-c)# bandwidth percent 5
Router(config-pmap-c)# class TRANSACTIONAL-DATA
Router(config-pmap-c)# bandwidth percent 20
Router(config-pmap-c)# class BULK-DATA
Router(config-pmap-c)# bandwidth percent 10
Router(config-pmap-c)# class class-default
Router(config-pmap-c)# fair-queue

Figure 3 illustrates the corresponding IOS mechanisms for this third LLQ example.

 
Figure 3: Dual-LLQ for vice and video policy mechanisms
In Figure 3, you see that two separate implicit policers have been provisioned, one each for the VoIP class (to 100 kbps) and another for the Video class (to 400 kbps), yetthere remains only a single strict-priority queue, which is provisioned to the sum of all LLQ classes, in this case to 500 kbps (100 kbps + 400 kbps). Traffic offered to either LLQ class is serviced on a first-come, first-serve basis until the implicit policer for each specific class has been invoked. For example, if the video class attempts to burst beyond its 400 kbps rate, it will be dropped.
Therefore, when considering designs to support real-time applications, such as VoIP and TelePresence (an Interactive-Video application, as defined in RFC 4594), a dual-LLQ design can provide the best levels of service for VoIP and TelePresence, while preventing these from interfering with each other.

Class-Based Weighted-Fair Queuing (CBWFQ)


CBWFQ

Class-Based Weighted-Fair Queuing (CBWFQ) is a queuing algorithm that combines the capability to guarantee bandwidth with the capability to dynamically ensure fairness to other flows within a class of traffic.
CBWFQ allows for the creation of up to 64 classes of traffic, each with its own reserved queue. Each queue is serviced in a weighted-round-robin (WRR) fashion based on the bandwidth assigned to each class. Bandwidth might be assigned to a class in terms of absolute kbps (with the bandwidth command), as a percentage of a link’s bandwidth (with the bandwidth percent command), or as a percentage of bandwidth remaining, after the strict-priority Low-Latency Queue has been serviced (with the bandwidth remaining command).
To better understand how CBWFQ works, Example 1 begins by constructing a simple CBWFQ policy.
Example 1: CBWFQ Policy Example

Router(config)# policy-map CBWFQ
Router(config-pmap)# class NETWORK-CONTROL
Router(config-pmap-c)# bandwidth percent 5
Router(config-pmap-c)# class TRANSACTIONAL-DATA
Router(config-pmap-c)# bandwidth percent 20
Router(config-pmap-c)# class BULK-DATA
Router(config-pmap-c)# bandwidth percent 10
Router(config-pmap-c)# class class-default
Router(config-pmap-c)# fair-queue

Next, look at the underlying CBWFQ mechanisms that correspond with this policy, as illustrated in Figure 1.

 
Figure 1: Class-Based Weighted-Fair Queuing mechanisms
In Figure 1, you see a router interface that has been configured with a 4-class CBWFQ policy, with an explicit CBWFQ defined for Network Control, Transactional Data, and Bulk Data, respectively, and the default CBWFQ queue, which has a Fair-Queuing (FQ) pre-sorter assigned to it.
Note 
CBWFQ is a bit of a misnomer because the pre-sorter that can be applied to certain CBWFQs, such as class-default, is not actually a Weighted-Fair Queuing (WFQ) pre-sorter, but rather a Fair-Queuing (FQ) pre-sorter, and as such, it ignores any IP Precedence values when calculating bandwidth allocation traffic flows. To be more technically accurate, this queuing algorithm would be better named Class-Based Fair-Queuing or CBFQ.
Another underlying queuing mechanism is a final (FIFO) output buffer called the Tx-Ring, which serves the purpose of always having packets ready to be placed onto the wire so that link utilization can be driven to 100 percent. The Tx-Ring also serves to indicate congestion to IOS. Specifically, when the Tx-Ring fills to capacity, the interface is known to be congested, and a signal is sent to engage any LLQ/CBWFQ policies that have been configured on the interface.
CBWFQ works in the following manner:
  1. Packets are classified according to the class maps and assigned to either explicitly defined CBWFQs or to the default queue. If the packets are assigned to the default queue and fair-queuing has been enabled on the default class with the fair-queue subcommand, packets receive a proportionately equal share of the available bandwidth for the default queue. For example, if there is 100 kbps assigned to the default queue and there are 10 IP flows that are contenting for the default queue, each flow is assigned an equal share (10 kbps) of bandwidth by the FQ pre-sorter.
  2. Next, the CBWFQ scheduler dequeues the packets from each CBWFQ in a weighted-round-robin (WRR) manner that reflects the proportionate bandwidth allocations per-class.
  3. These packets are then enqueued into the Tx-Ring.
  4. Finally, the packets exit the Tx-Ring in a FIFO manner as they are transmitted across the physical interface media.
CBWFQ is a highly efficient queuing algorithm for data applications but lacks the capability to provide strict-priority servicing to real-time applications, such as voice or interactive video. This is because it provides a bandwidth guarantee but not a latency/jitter guarantee. Therefore, to service such real-time applications, a strict-priority queue was added to the CBWFQ algorithm, and the resulting algorithm was named Low-Latency Queuing.

Shaping Tools | Network Quality of Service



Shapers operate in a manner similar to policers in that they invoke token bucket algorithms to meter traffic. However, the principle difference between a policer and a shaper is that where a policer re-marks or drops traffic as a policy action, a shaper merely delays traffic. Even though TelePresence is a real-time application, you might encounter scenarios, such as subline rate access scenarios, which require shaping policies to be included within a comprehensive TelePresence QoS policy. Figure 1 illustrates generic traffic shaping.

 
Figure 1: Generic traffic shaping effect on traffic flow
Shapers are particularly useful when traffic must conform to a specific rate of traffic to meet a service-level agreement (SLA) or to guarantee that traffic offered to a service provider is within a contracted rate. Additionally, shapers have long been associated with Non-Broadcast Multiple-Access (NBMA) WAN topologies, such as ATM and Frame Relay, where potential speed-mismatches exist. However, shapers are becoming increasingly popular on newer Layer 3 WAN access circuits, such as Ethernet-based handoffs, to conform to subline access rates.
Shapers, like policers, use token bucket algorithms. On most platforms, by default, IOS shapers set the Bc to equal CIR/8, which yields an interval (Tc) of 125 ms. Although this interval value might be adequate for data applications, it introduces unnecessary interpacket delays for real-time networks. Consider the example shown in Figure 2.
 
Figure 2: Shaping behavior with default Bc values
A shaper uses the CIR, Bc, and Be to smooth a traffic stream to a specified rate. It achieves the given CIR by taking the line speed of the interface and dividing it into equal length timeslots (Intervals, or Tc) and then sends a smaller portion (Bc) of the traffic during each timeslot. The timeslot size is governed by the Bc parameter (Tc = Bc / CIR). In Figure 2, a line rate of 128 kbps is shaped to 64 kbps. The Bc, by default, is one eighth of the CIR (or eight kbps). Each second is divided into eight timeslots of 125 ms each, and the shaped rate of 64,000 bps is divided into eight bursts of 8000 bps each (Bc). Each burst will take 62.5 ms to transmit (at a 128 kbps line rate). So the shaper transmits information for the first 62.5ms of each 125 ms timeslot and is silent for the remaining 62.5 ms of the timeslot. Over the span of a second, this achieves the average rate of CIR.
Additionally, you can use the Be value to determine the peak Rate of sending, which is calculated as follows:
Peak Rate = CIR (1 + Be / Bc)
Peak-rate shaping allows the router to burst higher than average-rate shaping. However, when peak-rate shaping is enabled, any traffic exceeding the CIR can be dropped if the network becomes congested.
A router interface might be configured to shape using average rates, through the shape average policy-action command, or to a peak rate, through the shape peak policy-action command. The configuration for a basic Class-Based Shaping policy to shape to an average rate of 5 Mbps is as follows:
Router(config)# policy-map CB-SHAPING-5MBPS
Router(config-pmap)# class class-default
Router(config-pmap-c)# shape average 5000000
Because shaping involves buffering, various queuing techniques might be activated when the shaping buffer has been filled to capacity.