↓ Skip to main content
  1. Network Articles/
  2. MPLS Articles/

MPLS QoS Rate Control and Queuing (policer / shaper / priority)

Table of Contents

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 EXP (renamed TC by RFC 5462) and the three egress PE modes are covered in MPLS QoS (EXP and Uniform / Pipe / Short-Pipe).

Policer and shaper

Itempolicershaper
Excess trafficdropped (or re-marked)queued and sent later
How it showsas lossas latency
IOS XR syntaxpolice rate <value>shape average <value>
Directionsinput and outputoutput 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.

CommandBehaviour
priority level 1served 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.

Lab setup

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

STEPChangeWhat it shows
7police rate 100 kbps on the ingress PE inputexcess is dropped and shows as loss
8two-level shape average 200 kbps on the core-side outputnothing is dropped and latency grows
9parent shape plus child priority / bandwidth remainingonly the priority class keeps low latency
10remove all QoS configurationeverything 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.

STEP 7 PE1 show policy-map interface GigabitEthernet0/0/0/0 input (excerpt)
Class class-default
  Classification statistics          (packets/bytes)     (rate - kbps)
    Matched             :                 498/706164               33
    Transmitted         : N/A
    Total Dropped       :                 166/235388               11
  Policing statistics                (packets/bytes)     (rate - kbps)
    Policed(conform)    :                 332/470776               22
    Policed(exceed)     :                 166/235388               11

Matched is 498, conform 332 and exceed 166, matching the ping result of 334/500 (66 percent); two packets were still in flight when the counters were read. RTT was 9/15/71 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 (15 ms in STEP 7, where the policer was applied).

STEP 8 PE1 show policy-map interface GigabitEthernet0/0/0/1 output (excerpt)
Class class-default
  Classification statistics          (packets/bytes)     (rate - kbps)
    Matched             :                 468/667368               201
    Transmitted         :                 468/667368               201
    Total Dropped       :                   0/0                    0

  Policy PE1-CORE-SHAPE-CHILD Class class-default
    Classification statistics          (packets/bytes)     (rate - kbps)
      Matched             :                 468/667368               201
      Transmitted         :                 468/667368               201
      Total Dropped       :                   0/0                    0
    Queueing statistics
      Queue ID                             : 32
      High watermark                       : N/A
      Inst-queue-len                       : N/A
      Avg-queue-len                        : N/A
      Taildropped(packets/bytes)           : 0/0
      Queue(conform)      :                 468/667368               201

Total 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: EXP 5 gets priority level 1 and police rate 100 kbps, EXP 4 gets bandwidth remaining percent 20, and the rest goes to class-default. CE1 sent 1000 packets each of DSCP 46 (EXP 5), DSCP 34 (EXP 4) and DSCP 0, four seconds apart.

LoadDSCPEXPClassResultRTT min/avg/max
ToS 18446 (EF)5priority668/10006/10/87 ms
ToS 13634 (AF41)4bandwidth remaining 20%1000/10008/71/144 ms
ToS 000class-default1000/10008/71/134 ms
STEP 9 PE1 show policy-map interface GigabitEthernet0/0/0/1 output (excerpt)
Class class-default
  Classification statistics          (packets/bytes)     (rate - kbps)
    Matched             :                2995/4270870              31
    Transmitted         :                2664/3798864              21
    Total Dropped       :                 331/472006               10

  Policy PE1-CORE-QUEUE-CHILD Class TC5
    Classification statistics          (packets/bytes)     (rate - kbps)
      Matched             :                 995/1418870              31
      Transmitted         :                 664/946864               21
      Total Dropped       :                 331/472006               10
    Policing statistics                (packets/bytes)     (rate - kbps)
      Policed(conform)    :                 664/946864               21
      Policed(exceed)     :                 331/472006               10
      Policed(violate)    :                   0/0                    0
      Policed and dropped :                 331/472006
      Policed and dropped(parent policer)  : N/A
    Queueing statistics
      Queue ID                             : 40
      High watermark                       : N/A
      Inst-queue-len                       : N/A
      Avg-queue-len                        : N/A
      Taildropped(packets/bytes)           : 0/0
      Queue(conform)      :                 664/946864               21
      RED random drops(packets/bytes)      : 0/0


  Policy PE1-CORE-QUEUE-CHILD Class TC4
    Classification statistics          (packets/bytes)     (rate - kbps)
      Matched             :                1000/1426000              0
      Transmitted         :                1000/1426000              0
      Total Dropped       :                   0/0                    0
    Queueing statistics
      Queue ID                             : 41
      High watermark                       : N/A
      Inst-queue-len                       : N/A
      Avg-queue-len                        : N/A
      Taildropped(packets/bytes)           : 0/0
      Queue(conform)      :                1000/1426000              0
      RED random drops(packets/bytes)      : 0/0


  Policy PE1-CORE-QUEUE-CHILD Class class-default
    Classification statistics          (packets/bytes)     (rate - kbps)
      Matched             :                1000/1426000              0
      Transmitted         :                1000/1426000              0

Only 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 dscp class matched nothing on the core-side output, where labels are present. Classify on EXP there, or copy the value into a qos-group on input and use it on output
  • Always cap a priority class with police. 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.

FileContent
..._clear.txtcounters cleared before the collection (QoS, interface, MPLS forwarding)
..._ping.txtping / traceroute run after the clear
..._load_tos<value>.txtthe load sent from CE1 (1400 bytes at 10 ms intervals)
..._pmap-before.txt / ..._pmap-after.txtshow policy-map interface taken just before and just after the load
..._show.txtshow version / show interface / show ospf database / show policy-map interface / show mpls forwarding and others (70 commands per PE / P)
..._log.txtshow logging limited to that STEP. The clears also appear there as STEP<N>-CLEAR:
..._run.txtshow running-config at that STEP
..._trace.txtshow mpls ldp trace peer (PE1 / P1 / PE2)
..._commit.cfgthe configuration actually committed in that STEP (only for routers that changed)

The show policy-map interface in ..._show.txt and the one in ..._pmap-after.txt show different numbers. The former only counts the few dozen ping packets of that STEP, sent after the counters were cleared; the latter counts the load (500 or 1000 packets). The policy-map output quoted in the text comes from ..._pmap-after.txt.

STEP 7: policer on the ingress PE input

Routerclearpingshowsyslogrunning-configtraceconfig committedpolicy-map before loadpolicy-map after load
CE1clearpingshowlogrun————
PE1clearpingshowlogruntracecommitbeforeafter
P1clearpingshowlogruntrace———
PE2clearpingshowlogruntracecommit——
CE2clearpingshowlogrun————

STEP 8: two-level shaper on the core-side output

Routerclearpingshowsyslogrunning-configtraceconfig committedpolicy-map before loadpolicy-map after load
CE1clearpingshowlogrun————
PE1clearpingshowlogruntracecommitbeforeafter
P1clearpingshowlogruntrace———
PE2clearpingshowlogruntrace———
CE2clearpingshowlogrun————

STEP 9: parent shaper with child classes

Routerclearpingshowsyslogrunning-configtraceconfig committedpolicy-map before loadpolicy-map after load
CE1clearpingshowlogrun————
PE1clearpingshowlogruntracecommitbeforeafter
P1clearpingshowlogruntrace———
PE2clearpingshowlogruntrace———
CE2clearpingshowlogrun————

STEP 10: remove all QoS configuration (final state)

Routerclearpingshowsyslogrunning-configtraceconfig committed
CE1clearpingshowlogrun——
PE1clearpingshowlogruntracecommit
P1clearpingshowlogruntrace—
PE2clearpingshowlogruntrace—
CE2clearpingshowlogrun——

Loads sent from CE1 (ping ... size 1400 interval 10). The policy-map counters right after each load are the policy-map after load column above.

STEPToSResultFile
70334/500、RTT 9/15/71 msload
80500/500、RTT 18/56/132 msload
901000/1000、RTT 8/71/134 msload
91361000/1000、RTT 8/71/144 msload
9184668/1000、RTT 6/10/87 msload

Packet captures were taken per STEP on all four links.

STEPCE1-PE1PE1-P1P1-PE2PE2-CE2
7pcappcappcappcap
8pcappcappcappcap
9pcappcappcappcap
10pcappcappcappcap

References

ReferenceContent
RFC 3270MPLS Support of Differentiated Services: mapping EXP to PHBs
Test environmentXRv9000 26.1.1 (PE1 / P1 / PE2), XRd 26.1.1 (CE1 / CE2), Cisco Modeling Labs

Related articles