This article describes how queue buffer-size values are calculated on QX-based cards in MX Series routers.
Note: After queue buffer-size values are calculated, they are rounded to the nearest greater-than tail-drop-rule value, whereas policer burst-size values are calculated as max (queue buffer-size value, 2 * IFL MTU).
Alternative Reference: KB34860 - Example: Queue-depth calculation on Next-Generation-XQ-based cards [juniper.net]
Note: The following is enforced when using QX-based cards.
While configuring delay buffers, keep in mind that for guaranteed-high priority, the minimum buffer-size will be 30 milliseconds and for guaranteed-medium priority, the minimum buffer-size will be 60 milliseconds.
For strict-high priority, the shaping rate of the queue will be used to calculate the minimum buffer size and for high/medium priorities, the transmit rate of the queue will be used to calculate the minimum buffer size.
If the configured values are less than the minimum values, then the configured values are ignored and the minimum value is used.
When the scheduler transmit rate is in absolute form
queue g-rate = scheduler transmit-rate queue buffer-size = scheduler tx-rate * scheduler buffer-size QX min queue buffer-size = scheduler tx-rate * 30ms
Example
set class-of-service schedulers VOIP-NC-10M transmit-rate 2m set class-of-service schedulers VOIP-NC-10M buffer-size temporal 3k set class-of-service schedulers VOIP-NC-10M priority high set class-of-service traffic-control-profiles TCP-TEST-GR scheduler-map SCHEDULER-8115K set class-of-service traffic-control-profiles TCP-TEST-GR shaping-rate 10m set class-of-service traffic-control-profiles TCP-TEST-GR guaranteed-rate 100k set class-of-service interfaces ge-5/0/1 unit 100 output-traffic-control-profile TCP-TEST-GR queue g-rate = 2m queue buffer-size = 2m * 0.003 = 6000 bits QX minimum buffer-size = 2m * 0.03 = 60000 bits = 7500 bytes
On QX, queue buffer-size = max (queue buffer-size, QX min queue buffer-size) = max (6000 bits, 60000 bits) = 60000 bits.
labroot@jtac-mx480-r2046# run show interfaces queue ge-5/0/1.100 Queue: 1, Forwarding classes: VoIP Queue-depth bytes : Average : 0 Current : 0 Peak : 0 Maximum : 8192 NPC5(jtac-mx480-r2046 vty)# show qxchip 0 tail-rule 191 0 0 Tail drop rule configuration : 191 ref_count : 0 Drop Engine 0 : Tail drop rule ram address : 00002fc0 threshold : 4096 bytes shift : 5 mantissa : 128 Drop Engine 1 : Tail drop rule ram address : 00002fc0 threshold : 4096 bytes shift : 5 mantissa : 128 NPC5(jtac-mx480-r2046 vty)# show qxchip 0 tail-rule 192 0 0 Tail drop rule configuration : 192 ref_count : 1 Drop Engine 0 : Tail drop rule ram address : 00003000 threshold : 8192 bytes shift : 6 mantissa : 128 Drop Engine 1 : Tail drop rule ram address : 00003000 threshold : 8192 bytes shift : 6 mantissa : 128
As you can see in the above output, the calculated buffer-size is in between tail-drop-rule 191 and 192, and as per design, the queue will point to a tail-drop rule with a higher value, that is, 8192 bytes.
When the scheduler transmit rate is in % form
queue g-rate = TCP g-rate * scheduler tx-rate percent queue buffer-size = TCP g-rate * scheduler tx-rate percent * scheduler buffer-size QX min queue buffer-size = scheduler tx-rate * scheduler tx-rate percent * 30ms
set class-of-service schedulers VOIP-NC-10M transmit-rate percent 50 set class-of-service schedulers VOIP-NC-10M buffer-size temporal 3k set class-of-service schedulers VOIP-NC-10M priority high set class-of-service traffic-control-profiles TCP-TEST-GR scheduler-map SCHEDULER-8115K set class-of-service traffic-control-profiles TCP-TEST-GR shaping-rate 10m set class-of-service traffic-control-profiles TCP-TEST-GR guaranteed-rate 6m set class-of-service interfaces ge-5/0/1 unit 100 output-traffic-control-profile TCP-TEST-GR queue g-rate = 6m * 0.5 = 3.5m queue buffer-size = 6m * 0.5 * 0.003 = 9000 bits QX minimum buffer-size = 100k * 0.5 * 0.03 = 900000 bit = 11250 bytes
In this case, on QX, queue buffer-size = max (queue buffer-size, QX min queue buffer-size) = max (9000 bits, 90000 bits) = 90000 bits.
labroot@jtac-mx480-r2046# run show interfaces queue ge-5/0/1.100 Queue: 1, Forwarding classes: VoIP Queue-depth bytes : Average : 0 Current : 0 Peak : 0 Maximum : 16384 NPC5(jtac-mx480-r2046 vty)# show qxchip 0 tail-rule 192 0 0 Tail drop rule configuration : 192 ref_count : 0 Drop Engine 0 : Tail drop rule ram address : 00003000 threshold : 8192 bytes shift : 6 mantissa : 128 Drop Engine 1 : Tail drop rule ram address : 00003000 threshold : 8192 bytes shift : 6 mantissa : 128 NPC5(jtac-mx480-r2046 vty)# show qxchip 0 tail-rule 193 0 0 Tail drop rule configuration : 193 ref_count : 1 Drop Engine 0 : Tail drop rule ram address : 00003040 threshold : 16384 bytes shift : 7 mantissa : 128 Drop Engine 1 : Tail drop rule ram address : 00003040 threshold : 16384 bytes shift : 7 mantissa : 128
As you can see in the above output, the calculated buffer-size is in between tail-drop-rule 192 and 193, and as per design, the queue will point to a tail-drop rule with a higher value, that is, 16384 bytes.
When the scheduler transmit rate is absolute
policer bandwidth = scheduler tx-rate queue g-rate = scheduler tx-rate queue buffer-size = scheduler tx-rate * queue buffer-size QX minimum queue buffer-size = scheduler tx-rate * 30ms
set class-of-service schedulers VOIP-NC-10M transmit-rate 4m set class-of-service schedulers VOIP-NC-10M transmit-rate rate-limit set class-of-service schedulers VOIP-NC-10M buffer-size temporal 3k set class-of-service schedulers VOIP-NC-10M priority high set class-of-service traffic-control-profiles TCP-TEST-GR scheduler-map SCHEDULER-8115K set class-of-service traffic-control-profiles TCP-TEST-GR shaping-rate 10m set class-of-service traffic-control-profiles TCP-TEST-GR guaranteed-rate 6m set class-of-service interfaces ge-5/0/1 unit 100 output-traffic-control-profile TCP-TEST-GR policer bandwidth = 4m queue g-rate = 4m queue buffer-size = 4m * 0.003 = 12000 bits QX minimum buffer-size = 4m * 0.03 = 120000 bits = 15000 bytes
In this case, on QX, queue buffer-size = max (queue buffer-size, QX min queue buffer-size) = max(12000 bits, 120000 bits) = 120000 bits.
As you can see in the above output, the calculated buffer-size is in between tail-drop-rule 192 and 193, and the queue points to a tail-drop rule with a higher value, that is, 16384 bytes.
policer bandwidth = TCP shaping-rate * scheduler tx-rate percent queue g-rate = TCP shaping-rate * scheduler tx-rate percent queue buffer-size = TCP g-rate * scheduler tx-rate percent * scheduler buffer-size QX minimum queue buffer-size = TCP g-rate * 30ms
set class-of-service schedulers VOIP-NC-10M transmit-rate percent 50 set class-of-service schedulers VOIP-NC-10M transmit-rate rate-limit set class-of-service schedulers VOIP-NC-10M buffer-size temporal 3k set class-of-service schedulers VOIP-NC-10M priority high set class-of-service traffic-control-profiles TCP-TEST-GR scheduler-map SCHEDULER-8115K set class-of-service traffic-control-profiles TCP-TEST-GR shaping-rate 10m set class-of-service traffic-control-profiles TCP-TEST-GR guaranteed-rate 6m set class-of-service interfaces ge-5/0/1 unit 100 output-traffic-control-profile TCP-TEST-GR policer bandwidth = 10m * 0.5 = 5m queue g-rate = 10m * 0.5 = 5m queue buffer-size = 6m * 0.5 * 0.03 = 9000 bits QX minimum buffer-size = 5m * 0.03 = 150000 bits = 18750 bytes
In this case, on QX, queue buffer-size = max (queue buffer-size, QX min queue buffer-size) = max(9000 bits, 150000 bits) = 150000 bits.
labroot@jtac-mx480-r2046# run show interfaces queue ge-5/0/1.100 Queue-depth bytes : Average : 0 Current : 0 Peak : 0 Maximum : 24576 NPC5(jtac-mx480-r2046 vty)# show qxchip 0 tail-rule 193 0 0 Tail drop rule configuration : 193 ref_count : 0 Drop Engine 0 : Tail drop rule ram address : 00003040 threshold : 16384 bytes shift : 7 mantissa : 128 Drop Engine 1 : Tail drop rule ram address : 00003040 threshold : 16384 bytes shift : 7 mantissa : 128 NPC5(jtac-mx480-r2046 vty)# show qxchip 0 tail-rule 194 0 0 Tail drop rule configuration : 194 ref_count : 1 Drop Engine 0 : Tail drop rule ram address : 00003080 threshold : 24576 bytes shift : 7 mantissa : 192 Drop Engine 1 : Tail drop rule ram address : 00003080 threshold : 24576 bytes shift : 7 mantissa : 192
As you can see in the above output, the calculated buffer-size is in between tail-drop-rule 193 and 194, and the queue points to a tail-drop rule with a higher value, that is, 24576 bytes.