MPLS QoS Rate Control and Queuing (policer / shaper / priority)
There are two ways to hold traffic down in an MPLS network. A policer drops what exceeds the rate on the spot; a shaper buffers it and stretches out the time it takes to send. Dropping versus delaying shows up as a difference in loss and latency once real packets flow. Splitting classes into separate queues then keeps latency low for the traffic that matters. This article explains how to write both in IOS XR and measures loss and latency in an XRv9000 lab.
Label TC and the three egress PE modes are covered in MPLS QoS (Traffic Class and Uniform / Pipe / Short-Pipe).
Policer and shaper
| Item | policer | shaper |
|---|---|---|
| Excess traffic | dropped (or re-marked) | queued and sent later |
| How it shows | as loss | as latency |
| IOS XR syntax | police rate <value> |
shape average <value> |
| Directions | input and output | output only |
A policer counts conform and exceed separately and drops the excess by default. A shaper queues the excess instead, so nothing is dropped until the queue fills.
Splitting classes into queues
Shaping at the parent sets the overall ceiling, and classes in the child decide the priority within it.
| Command | Behaviour |
|---|---|
priority level 1 |
served before the other classes (priority queue) |
police rate <value> (with priority) |
caps the priority queue so it cannot take all the bandwidth |
bandwidth remaining percent <share> |
share of what the priority queue leaves behind |
On the core-side output the packets carry labels, so classes match on match mpls experimental topmost, not match dscp. The IP header sits inside the label stack, and a match dscp class built on the core-side output matched nothing in this lab.
Lab setup
Five routers: CE1 - PE1 - P1 - PE2 - CE2, with OSPF + LDP in the core and iBGP vpnv4 between the PEs. PE1, P1 and PE2 are XRv9000; CE1 and CE2 are XRd.
The load is a ping from CE1 to CE2 with 1400-byte packets at 10 ms intervals. Packets larger than 1500 bytes do not pass the segments that involve XRd, which is why that size is used.
Overview of the steps
| STEP | Change | What it shows |
|---|---|---|
| 7 | police rate 100 kbps on the ingress PE input |
excess is dropped and shows as loss |
| 8 | two-level shape average 200 kbps on the core-side output |
nothing is dropped and latency grows |
| 9 | parent shape plus child priority / bandwidth remaining |
only the priority class keeps low latency |
| 10 | remove all QoS configuration | everything returns to the original state |
Dropping with a policer (STEP 7)
police rate 100 kbps was applied to the customer-facing input of PE1 and 500 packets of 1400 bytes were sent. 334 got through and 166 were dropped.
Class class-default
Classification statistics (packets/bytes) (rate - kbps)
Matched : 500/709000 30
Transmitted : N/A
Total Dropped : 166/235388 10
Policed(conform) : 334/473612 20
Policed(exceed) : 166/235388 10Matched is 500, conform 334 and exceed 166, matching the ping result of 334/500 (66 percent). RTT was 7/14/47 ms, so the packets that did get through were not delayed.
Delaying with a shaper (STEP 8)
The policer was removed and a two-level shape average 200 kbps applied to the core-side output (the parent class-default does the shaping, and the child gives bandwidth remaining percent 100 to its own class-default). Under the same load all 500 packets got through, with an average RTT of 56 ms (about 13 ms before the change).
Class class-default
Classification statistics (packets/bytes) (rate - kbps)
Matched : 500/713000 114
Transmitted : 500/713000 114
Total Dropped : 0/0 0
Policy PE1-CORE-SHAPE-CHILD Class class-default
Classification statistics (packets/bytes) (rate - kbps)
Matched : 500/713000 114
Queue(conform) : 500/713000 114Total Dropped and Taildropped are both 0: everything was sent. A policer appears as loss, a shaper as latency.
Splitting classes into queues (STEP 9)
The core-side output became a parent shape average 300 kbps with a child policy: TC 5 gets priority level 1 and police rate 100 kbps, TC 4 gets bandwidth remaining percent 20, and the rest goes to class-default. CE1 sent 1000 packets each of DSCP 46 (TC 5), DSCP 34 (TC 4) and DSCP 0, four seconds apart.
| Load | DSCP | TC | Class | Result | RTT min/avg/max |
|---|---|---|---|---|---|
| ToS 184 | 46 (EF) | 5 | priority |
667/1000 | 6/9/75 ms |
| ToS 136 | 34 (AF41) | 4 | bandwidth remaining 20% |
1000/1000 | 7/70/167 ms |
| ToS 0 | 0 | 0 | class-default |
1000/1000 | 8/70/132 ms |
Class class-default
Classification statistics (packets/bytes) (rate - kbps)
Matched : 3000/4278000 31
Transmitted : 2667/3803142 21
Total Dropped : 333/474858 10
Policy PE1-CORE-QUEUE-CHILD Class TC5
Classification statistics (packets/bytes) (rate - kbps)
Matched : 1000/1426000 31
Transmitted : 667/951142 21
Policed(exceed) : 333/474858 10
Policy PE1-CORE-QUEUE-CHILD Class TC4
Classification statistics (packets/bytes) (rate - kbps)
Matched : 1000/1426000 0
Transmitted : 1000/1426000 0Only the class in the priority queue keeps the latency it had before the change. The other two wait in the parent shaper queue and average 70 ms. The police rate 100 kbps on the priority queue dropped 333 packets, which is why EF shows 667/1000. Without that cap the priority queue would starve the other classes.
Design notes
- A
match dscpclass matched nothing on the core-side output, where labels are present. Classify on TC there, or copy the value into aqos-groupon input and use it on output - Always cap a
priorityclass withpolice. Without it the other classes stop being served - A policer shows as loss and a shaper as latency. Putting delay-sensitive traffic behind a shaper degrades it even when nothing is dropped
Verification configs and show output
For every STEP the following files were collected per router. The verification config is the ..._run.txt file (the final state is the one from the last STEP). Counters are cleared, then the pings are sent, and only then is the show output taken, so the numbers in each STEP belong to that STEP alone.
| File | Content |
|---|---|
..._clear.txt |
counters cleared before the collection (QoS, interface, MPLS forwarding) |
..._ping.txt |
ping / traceroute run after the clear |
..._load_tos<value>.txt |
load results (1400 bytes at 10 ms intervals) |
..._pmap-after.txt |
show policy-map interface taken after the load |
..._show.txt |
show version / show interface / show policy-map interface / show mpls forwarding and others |
..._log.txt |
show logging limited to that STEP. The clears also appear there as STEP<N>-CLEAR: |
..._run.txt |
show running-config at that STEP |
..._commit.cfg |
the configuration actually committed in that STEP (only for routers that changed) |
STEP 7: policer on the ingress PE input
Load: load, counters after it: pmap.
| Router | clear | ping | show | syslog | running-config | committed |
|---|---|---|---|---|---|---|
| CE1 | clear | ping | show | log | run | — |
| PE1 | clear | ping | show | log | run | commit |
| P1 | clear | — | show | log | run | — |
| PE2 | clear | ping | show | log | run | commit |
| CE2 | clear | ping | show | log | run | — |
STEP 8: two-level shaper on the core-side output
Load: load, counters after it: pmap.
| Router | clear | ping | show | syslog | running-config | committed |
|---|---|---|---|---|---|---|
| CE1 | clear | ping | show | log | run | — |
| PE1 | clear | ping | show | log | run | commit |
| P1 | clear | — | show | log | run | — |
| PE2 | clear | ping | show | log | run | — |
| CE2 | clear | ping | show | log | run | — |
STEP 9: parent shaper with child classes
Load: EF / AF41 / ToS 0, counters after it: pmap.
| Router | clear | ping | show | syslog | running-config | committed |
|---|---|---|---|---|---|---|
| CE1 | clear | ping | show | log | run | — |
| PE1 | clear | ping | show | log | run | commit |
| P1 | clear | — | show | log | run | — |
| PE2 | clear | ping | show | log | run | — |
| CE2 | clear | ping | show | log | run | — |
STEP 10: remove all QoS configuration (final state)
| Router | clear | ping | show | syslog | running-config | committed |
|---|---|---|---|---|---|---|
| CE1 | clear | ping | show | log | run | — |
| PE1 | clear | ping | show | log | run | commit |
| P1 | clear | — | show | log | run | — |
| PE2 | clear | ping | show | log | run | — |
| CE2 | clear | ping | show | log | run | — |
Packet captures were taken per STEP on all four links.
| STEP | CE1-PE1 | PE1-P1 | P1-PE2 | PE2-CE2 |
|---|---|---|---|---|
| 7 | pcap | pcap | pcap | pcap |
| 8 | pcap | pcap | pcap | pcap |
| 9 | pcap | pcap | pcap | pcap |
| 10 | pcap | pcap | pcap | pcap |
References
| Reference | Content |
|---|---|
| RFC 3270 | MPLS Support of Differentiated Services: mapping TC to PHBs |
| Test environment | XRv9000 26.1.1 (PE1 / P1 / PE2), XRd 26.1.1 (CE1 / CE2), Cisco Modeling Labs |
Related articles
- What Is MPLS
- MPLS Labels and the Label Stack
- MPLS Label Operations (push / swap / pop) and PHP
- MPLS TTL Processing and MTU
- What Is LDP
- LDP Label Distribution Modes and Label Spaces
- LDP-IGP Synchronization and LDP Session Protection
- LDP Label Advertisement Control (Filtering)
- LDP Session Authentication (TCP MD5)
- MPLS OAM (LSP Ping and LSP Traceroute)
- What Is MPLS TE (RSVP-TE)
- MPLS TE CSPF and Path Constraints (Bandwidth, Affinity, TE Metric)
- Steering Traffic into MPLS TE Tunnels
- MPLS TE Fast Reroute (Link and Node Protection)
- MPLS TE Fast Reroute (Auto-Tunnel Backup and SRLG)
- MPLS QoS (Traffic Class and Uniform / Pipe / Short-Pipe)
- MPLS QoS Rate Control and Queuing (policer / shaper / priority)