Course contents

Unit 8: Management and basic policiesLesson 8.6 (6 of 6 in this unit)52 of 62 in the Cisco SD-WAN course

QoS concepts and queueing

Classes and DSCP marking, queues and scheduling, policing and shaping, and why a WAN Edge shapes to the circuit speed.

Intermediate · 12 min read

You'll learn to explain marking, queueing, policing and shaping, say why a WAN Edge shapes to the circuit speed, and read a queue counter to see whether a class is being dropped.

Technical definition

Quality of service (QoS) is the set of tools that decide which traffic waits, which goes first and which is dropped when a link is full. It does not create bandwidth. It decides who gets the bandwidth that exists. On a WAN Edge the main tools are classification and marking, queueing and scheduling, policing and shaping.

What QoS solves

A branch has a 100 Mbps internet circuit. A video backup starts and fills it. Voice calls on the same circuit begin to break up, because voice packets now wait in the same line as backup packets or are dropped. QoS is how the router is told that voice goes first and the backup can wait. The router needs three things to do this: a way to tell the traffic apart, a way to treat each kind differently, and a limit that matches the real speed of the circuit.

Diagram
The QoS pipeline
The QoS pipeline

Classify, mark, queue, shape.

  1. Classifywhich traffic
  2. Markset DSCP
  3. Queuewhich classwaits where
  4. Shapeto circuitspeed
Each stage depends on the one before it.
Diagram
Five tools, five questions
Five tools, five questions

Classification answers which traffic this is. Marking writes the answer into the packet. Queueing answers who waits where. Policing answers whether a class stays inside a rate by dropping the excess. Shaping answers whether the whole interface stays at the circuit speed by delaying the excess.

QoS on the edge
  • Classifywhich trafficis this?
  • Markwrite DSCPinto the packet
  • Queuewho waits,who is first
  • Policecut a classto a rate
  • Shapehold the linkto circuit speed
Most QoS faults come from using the right tool at the wrong place, or from leaving one of the five out.

Classify and mark

Classification picks out traffic by address, port, protocol or application. Marking then writes a class into the packet so that later devices can act on it without repeating the work. In IP, the marking is the Differentiated Services Code Point (DSCP) in the IP header. Common values are 46 (EF) for voice, 34 (AF41) for interactive video, 26 (AF31) for business data, 0 for best effort and 8 (CS1) for scavenger traffic that may be dropped first. Mark as close to the source as can be trusted.

Diagram
A simple class plan
A simple class plan
ClassDSCPQueue treatmentExample
Voice46 (EF)Strict priority, small shareVoice calls
Interactive video34 (AF41)Guaranteed shareMeetings
Business data26 (AF31)Guaranteed shareERP, databases
Default0RemainderGeneral web
Scavenger8 (CS1)Lowest, dropped firstBackups, updates
Values and names are common practice, not a rule. Use your organisation's plan.
Diagram
Trust the mark, or set it again
Trust the mark, or set it again

A source that is managed and trusted, such as a voice gateway, can keep the marking it set. A source that is not trusted, such as a guest network, has its marking reset at the first edge by matching on address and port.

Trusted sourceKeep the DSCP it setmanaged voice gateway
Untrusted sourceRe-mark at the first edgematch on address and port
Marking only helps when the device that acts on it can believe it.

Queue and schedule

Each class goes into its own queue. A scheduler picks which queue is served next. A priority queue is served ahead of the others, which suits voice but would starve everything else if it had no limit, so it is given a small cap. Other queues share what is left according to weights. When a queue is full, the next packet that arrives for it is dropped. In Cisco SD-WAN, localized policy maps forwarding classes to a limited number of queues on the WAN Edge, and the number and defaults depend on the platform and release.

Diagram
Classes, queues, scheduler and a shaped link
Classes, queues, scheduler and a shaped link
Classes, queues, scheduler and a shaped linkThree traffic classes go into three queues. A scheduler serves the voice queue first, shares the rest between the other queues, and sends the result into a link that is shaped to the circuit speed, which is lower than the interface speed. When the circuit is full, the default queue fills first and drops first.Voice, EFPriority queueBusiness, AF31Queue 2Default, best effortQueue 3Schedulerserves in turnShaped linke.g. 100 MbpsPort speed is higher than circuit speed, so shape to the circuit.

On small screens, swipe sideways or focus the diagram and use the arrow keys.

Queueing decides who waits when the link is full. Shaping makes the router treat the circuit speed, not the port speed, as the limit, so the queues work where the congestion really is.

Policing and shaping

Policing and shaping both enforce a rate. A policer drops or re-marks traffic that exceeds the rate, and so adds no delay but gives drops. A shaper holds excess packets in a buffer and sends them out later at the configured rate, which adds some delay and avoids drops. Use shaping on a WAN interface to match the circuit, and policing to limit a class, such as guest traffic.

Diagram
Where the queue forms
Where the queue forms

Without a shaper the router sends at the speed of its fast port and the provider's device drops the excess without knowing the classes. With a shaper set to the circuit speed, the queue builds on the router, which knows which class to protect.

No shaperqueue forms at theprovider, class blind
Shaper at circuit speedqueue forms on therouter, class aware
A queue has to form somewhere. Shaping decides that it forms on the device that knows your priorities.
Diagram
Policer and shaper
Policer and shaper

Same rate, different effect on excess traffic.

PolicerExcess is droppedor re-marked at once
ShaperExcess is bufferedand sent later
Shaping smooths traffic, policing cuts it.
  • Shape to the circuit speed that you pay for, not to the interface speed.
  • Leave a little headroom, because IPsec adds overhead that is not counted in the user's traffic.
  • Remember that queues only work in the direction they are applied: outbound on the WAN interface. Traffic coming from the provider is not queued by your router.

Encapsulation overhead and the real rate

Rates in a class plan are usually written from the user's point of view, but the circuit carries the encapsulated packets. Every packet gains the IPsec headers, so small packets grow by a large fraction. The table assumes 70 bytes of added overhead per packet and 50 packets per second per call (a packet every 20 ms). The real overhead depends on the cipher, on NAT traversal and on the release.

Diagram
One voice call with and without encapsulation (assumed 70 bytes)
One voice call with and without encapsulation (assumed 70 bytes)
CodecPacket beforePacket afterRate beforeRate afterGrowth
G.711 (160 byte payload)200 bytes270 bytes80 kbps108 kbps35 %
G.729 (20 byte payload)60 bytes130 bytes24 kbps52 kbps117 %
Computed from the packet sizes above. For 100 calls, G.711 grows from 8.0 to 10.8 Mbps and G.729 from 2.4 to 5.2 Mbps. Size a priority cap and a shaper from the encapsulated rate.

The growth matters most when a priority cap is sized. A cap holds a fixed number of kilobits per second, so the number of calls it can carry depends on the rate on the wire, not the rate the phone sends.

Diagram
How many calls a priority cap holds (computed)
How many calls a priority cap holds (computed)
Codec and capCalls if sized from the user rateCalls that fit on the wireOverestimate
G.711, cap 33 percent (31,350 kbps)391 calls290 calls101 calls, 35 percent
G.729, cap 33 percent (31,350 kbps)1,306 calls602 calls704 calls, 117 percent
G.711, cap 20 percent (19,000 kbps)237 calls175 calls62 calls, 35 percent
G.729, cap 20 percent (19,000 kbps)791 calls365 calls426 calls, 117 percent
Assumes the 95,000 kbps shaper from the worked case, caps of 33 and 20 percent of it (assumed shares, not a recommendation) and the 70 bytes of overhead above. The percentage is the growth in the call rate, so it stays the same whatever the cap; the number of calls that fit is what changes.

Reading a queue counter

The practical check is whether a class is being dropped. The output below is an example of a policy-map counter on a WAN interface. The exact layout depends on the platform and release.

Example output written for this lesson, simplified; real output has more fields and a different layout
BR-01#show policy-map interface GigabitEthernet1 output
Class-map: VOICE (priority)
  packets 482113  dropped 0
Class-map: BUSINESS
  packets 904551  dropped 12
Class-map: class-default
  packets 3320871  dropped 41872
Voice is not dropped. Business data lost 12 packets, which is minor. The default class lost many packets, which is expected when the circuit is full. If voice shows drops, its priority cap or the shaping rate is wrong. If nothing is ever dropped while users complain, congestion may be on the provider side, which this router cannot queue.
Diagram
What the counters say
What the counters say

Drops in the priority class mean its cap or the shaping rate is wrong. Drops only in the default class mean the queue forms on the router and is doing its job. No drops anywhere while users complain mean the queue is forming somewhere else, such as at the provider.

  1. Drops in VOICEPriority cap or shaping rate is wrongCheck against the encapsulated rate
  2. Drops only in class-defaultThe queue forms on the routerThe plan is working
  3. No drops, users complainThe queue forms somewhere elseCheck the shaper and the provider
Where the drops land shows whether the router or the provider is holding the queue.

A worked case: voice breaks up and nothing is dropped

BR-01 has a 1 Gbps port on a 100 Mbps internet circuit. Every afternoon a backup starts and voice calls break up for twenty minutes. The branch policy marks voice as DSCP 46 and the queue plan is in place, so Priya reads the counters on the WAN interface during a bad period.

Example output written for this lesson, simplified; real output has more fields and a different layout
BR-01#show policy-map interface GigabitEthernet1 output
Class-map: VOICE (priority)
  packets 120331  dropped 0
Class-map: BUSINESS
  packets 301402  dropped 0
Class-map: class-default
  packets 1840277  dropped 0
Nothing is dropped in any class, yet calls are breaking up. A router that is queueing correctly would show drops in the default class while the backup fills the link. Zero everywhere means the queue did not form on this router, so the excess is being discarded somewhere else.
Diagram
Evidence from the case
Evidence from the case

Voice breaks up during the backup, while the router counters show no drops in any class. The circuit is sold at 100 megabits and the router port runs at 1 gigabit, with no shaper. The provider's device is dropping the excess without knowing which packets are voice. A shaper below the circuit speed moves the queue to the router.

  1. SymptomCalls break up during the backupEvery afternoon for about twenty minutes
  2. CountersZero drops in every classThe router queue did not form
  3. Cause1 Gbps port on a 100 Mbps circuit, no shaperThe provider drops the excess blindly
  4. FixShape a little below the circuit speedRe-read counters and provider utilisation
Silence on the router was the clue. The router did not see a full link, so its priorities did not apply.
Diagram
The change
The change
SettingBeforeAfter
Shaping rate on the WAN interfaceNone95,000 kbps
Priority queue cap for voiceUnchangedUnchanged, checked against the encapsulated rate
The setting is called a shaping rate in the interface feature, and the name can differ between releases. Start a little below the circuit rate, then tune from the counters.
Example output written for this lesson, simplified; real output has more fields and a different layout
BR-01#show policy-map interface GigabitEthernet1 output
Class-map: VOICE (priority)
  packets 119870  dropped 0
Class-map: BUSINESS
  packets 298114  dropped 0
Class-map: class-default
  packets 1795022  dropped 38211
During the next backup the drops appear in class-default, where they belong, while voice and business traffic lose nothing. The queue now forms on the router, so the scheduler protects the classes the plan names. Users report stable calls.
Diagram
Symptoms and the first check
Symptoms and the first check
SymptomFirst checkLikely cause
Voice breaks up, no drops on the routerIs a shaping rate set below the circuit speed?The queue forms at the provider, not on the router
Voice shows drops on the routerThe priority cap against the encapsulated call rateA cap sized from the unencapsulated rate
Every class drops about equallyMarking and the class mapsTraffic is not matched, so it lands in the default class
Marking is correct but the provider ignores itThe provider's service termsThe circuit does not honour DSCP
Read the counters before changing the policy. Where the drops are, or are not, shows which tool is missing.

Learn more: Application-Aware Routing IntroductionForwarding, MTU and Tunnel Encapsulation

Test yourself

Predict · scenario 1

A branch has a 1 Gbps port and a 100 Mbps circuit. Voice breaks up during a backup, but the router shows no queue drops. What is the likely cause?

Predict · scenario 2

A shaper is set at 95 Mbps on a 100 Mbps circuit. During a backup the default class shows drops and voice shows none. Is that a fault?

Predict · scenario 3

A G.729 call sends 20 byte payloads every 20 ms. Adding 70 bytes of encapsulation to each packet, by how much does its rate on the wire grow?

Predict · scenario 4

Voice is dropped on the WAN Edge during busy periods, but the priority cap was sized from the unencapsulated call rate. What should be checked?

Predict · scenario 5

Which tool delays excess traffic instead of dropping it at once?

Predict · scenario 6

Why is the priority queue given a cap?

Predict · scenario 7

A voice cap of 33 percent of a 95,000 kbps shaper (31,350 kbps) was sized from the user rate of G.711 calls, 80 kbps each. With 70 bytes of encapsulation added, how many calls does the cap hold?

Predict · scenario 8

The counters show drops in VOICE (priority) and none in class-default. Which reading fits?

Predict · scenario 9

A guest network sends traffic that carries its own DSCP 46 marks toward the WAN Edge. What is the sensible handling?

FAQ

Does QoS make a link faster?
No. It only changes the order in which packets leave and which ones are dropped when the link is busy. On a link that is not full, QoS changes nothing you can see.
Why shape instead of just using the interface speed?
A router often has a 1 Gbps interface connected to a circuit that is sold at 100 Mbps. The router sees a fast link, so queues do not build on the router. The provider's device drops the excess instead, and it does not know your priorities. Shaping to the circuit speed moves the queue onto the router.
Does marking survive the overlay?
On typical IPsec tunnels the DSCP value of the inner packet is copied to the outer header, so the underlay can still see it. Whether a provider honours it is a matter of the service you bought. Check your release and your circuit.