QoS Token Bucket & Shaper Rate Calculator

Dimension single-rate (srTCM RFC 2697) and two-rate (trTCM RFC 2698) traffic policers, calculate Committed Burst Size (CBS) and Excess Burst Size (EBS), evaluate shaping queue delay, and generate production router CLI configurations.

Token Bucket Dimensioning & Queue Sizing Engine
RFC 2697 / RFC 2698 Standards Compliant
Carrier QoS Profile Presets
ms
Committed Burst Size (CBS / Bc)
250,000 Bytes
244.14 KB | 2,000,000 bits (Tc = 10.0 ms)
Excess Burst Size (EBS / Be)
500,000 Bytes
Max Wire Burst: 2.50 ms @ Line Rate
Maximum Shaping Buffer Latency
10.0 ms
Traffic Shaping: Packets Buffered
Token Bucket Mechanics & Replenishment Flow Architecture Token Inflow: 200.00 Mbps
CBS Full
Committed Bucket (C)
CBS: 250,000 Bytes
CIR Inflow: 200 Mbps
Overflow spillway to EBS
Packet Drain @ Line Rate
EBS Half
Excess Bucket (E)
EBS: 500,000 Bytes
Advanced Dual-Rate trTCM, Shaper Buffer Depth & Router CLI Generation [-] Collapse Advanced Options
Bytes
MTU Starvation Check
PASS
CBS > 166× MTU Frame
Total Shaper Buffer Allocated
244.1 KB
250,000 Bytes allocated memory
Carrier SLA Jitter Status
SLA Compliant
Tc = 10.0 ms (≤ 10 ms Standard)
Automated Multi-Vendor QoS CLI Configuration Production-ready rate limiter syntax
policy-map SHAPE-EGRESS
 class class-default
  shape average 200000000 2000000 2000000
QoS Configuration Within Carrier SLA Boundaries
The configured token replenishment interval (Tc = 10.0 ms) and Committed Burst Size (CBS = 250,000 Bytes) provide ideal TCP throughput pacing without inducing packet starvation or excessive shaping jitter.
Real-Time Mathematical Derivation Chain
Port Speed = 1.00 Gbps (1,000,000,000 bps) | Target Rate CIR = 200.0 Mbps (200,000,000 bps) | Interval Tc = 10.0 ms (0.010 s) | Committed Burst Size CBS = (CIR × Tc) / 8 = (200,000,000 × 0.010) / 8 = 2,000,000 bits / 8 = 250,000 Bytes (244.14 KB) | Excess Burst Size EBS = 2 × CBS = 500,000 Bytes | MTU Check: CBS (250,000 B) > MTU (1500 B) → Satisfies minimum burst constraint | Burst Transmission Time @ 1G Line Rate = (250,000 × 8) / (1,000,000,000 - 200,000,000) = 2,000,000 / 800,000,000 = 0.0025 s = 2.50 ms | Maximum Shaper Queue Delay = (250,000 × 8) / 200,000,000 = 10.0 ms

Engineering Theory & Carrier QoS Standards

1. Traffic Policing vs. Traffic Shaping: The Architectural Divide

In carrier transport networks and enterprise WAN boundaries, rate-limiting is essential to enforce contracted Service Level Agreements (SLAs) and prevent upstream access traffic from oversubscribing downstream links. Rate limiting is executed via two fundamentally different mechanisms:

  • Traffic Policing (Rate Limiting): A traffic policer measures incoming or outgoing packet arrival rates against configured thresholds (CIR/PIR). Packets that arrive when sufficient tokens reside in the bucket are marked as conforming and forwarded immediately. When a burst exceeds token depth, excess packets are immediately dropped or remarked to a lower QoS priority (e.g., dropping DSCP from EF or AF41 down to Best Effort). Policing introduces zero additional queuing latency or jitter. However, because TCP interprets dropped segments as severe congestion, policing causes aggressive TCP sliding window collapse, frequently cutting effective throughput to a fraction of the contracted CIR.
  • Traffic Shaping (Rate Smoothing): Rather than discarding non-conforming packets, a traffic shaper holds excess traffic in an egress queue (typically Class-Based Weighted Fair Queuing, CBWFQ, or a dedicated FIFO buffer). Packets are then clocked out onto the physical wire at a smooth, steady rate equal to the CIR. While shaping preserves TCP window scalability and eliminates packet drops, it introduces queuing latency and packet jitter that can degrade interactive traffic like VoIP and real-time video if buffers are misconfigured.

2. Single-Rate (srTCM RFC 2697) vs. Two-Rate (trTCM RFC 2698) Metering

To classify traffic into differentiated forwarding tiers, the IETF standardized two formal three-color token bucket models:

  • Single-Rate Three-Color Marker (srTCM - RFC 2697): Employs a single token generator that replenishes tokens at the Committed Information Rate (CIR). It meters traffic into three colors using two token buckets: the Committed Bucket (C) with size CBS, and the Excess Bucket (E) with size EBS. Tokens fill bucket C first; only when bucket C is full do excess tokens spill over into bucket E. When a packet of size B arrives:
    • If B ≤ C, the packet is Green (conforming), and B tokens are decremented from C.
    • If B > C but B ≤ E, the packet is Yellow (exceeding), and B tokens are decremented from E.
    • If B > E, the packet is Red (violating), and no tokens are decremented.
  • Two-Rate Three-Color Marker (trTCM - RFC 2698): Designed for scenarios where a customer is permitted to burst up to an absolute ceiling known as the Peak Information Rate (PIR). Employs two independent token generators running at different rates: PIR replenishes the Peak Bucket (P, size PBS), while CIR replenishes the Committed Bucket (C, size CBS). When packet of size B arrives:
    • If B > P, the packet is Red.
    • If B ≤ P but B > C, the packet is Yellow, and B tokens are deducted from P.
    • If B ≤ C, the packet is Green, and B tokens are deducted from both C and P.

3. The Mathematics of Token Replenishment & Time Interval (Tc)

The operation of a token bucket is governed by the time interval (Tc) over which tokens are added:

CBS = CIR × Tc  ↔  Tc = CBS / CIR

Choosing the correct value of Tc requires balancing hardware constraints and traffic dynamics:

  • Too Small (Tc < 4 ms): On network silicon with coarse timer ticks (e.g., 10 ms hardware clocks), the bucket cannot refill fast enough. Furthermore, if the calculated CBS is smaller than the path MTU (e.g., 1500 Bytes), a single full-sized Ethernet frame will fail to find enough tokens upon arrival, resulting in catastrophic packet drop rates ("policer starvation").
  • Too Large (Tc > 50 ms to 125 ms): While legacy routers traditionally defaulted to Tc = 125 ms (1/8 of a second), this allows senders to dump immense bursts at full physical interface wire-speed. A 1 Gbps port configured with a 125 ms Tc allows an unbroken 125 Mb burst before policing engages, overwhelming downstream switch buffers and inducing severe packet loss and jitter for concurrent flows.
  • The Carrier Standard: Modern telecommunications operators and cloud interconnect providers standardize on Tc = 10 ms (0.010 seconds), achieving optimal balance between smooth packet transmission and low-latency absorption.

4. Buffer Sizing in Shapers: Avoiding Bufferbloat vs. Preventing Packet Drops

A traffic shaper requires buffer memory to temporarily hold packets during bursts. The required memory footprint is mathematically expressed as:

Buffer_Bytes ≥ Burst_Volume - (CIR × Burst_Duration)

However, allocating excessively large queues creates the phenomenon known as bufferbloat. When a shaping queue holds several megabytes of data, TCP senders do not experience packet loss, prompting them to continuously expand their congestion windows until the entire buffer is full. Packets remain queued for hundreds of milliseconds, turning an otherwise fast fiber connection into a high-latency link. For real-time applications, shapers should be paired with Active Queue Management (AQM) algorithms like FQ-CoDel or PIE to drop or ECN-mark packets before latency thresholds are exceeded.

Leased Line Profile Port Line Rate Committed Rate (CIR) Interval (Tc) CBS (Bytes) EBS / PBS (Bytes) Max Shaping Delay
VoIP SIP Trunk 100 Mbps FastE 2.0 Mbps 10 ms 2,500 B 5,000 B 10.0 ms
Branch SD-WAN Uplink 100 Mbps FastE 20.0 Mbps 10 ms 25,000 B 50,000 B 10.0 ms
Enterprise Leased Line 1.0 Gbps GigE 50.0 Mbps 10 ms 62,500 B 125,000 B 10.0 ms
Enterprise Leased Line 1.0 Gbps GigE 100.0 Mbps 10 ms 125,000 B 250,000 B 10.0 ms
Metro Ethernet Access 1.0 Gbps GigE 200.0 Mbps 10 ms 250,000 B 500,000 B 10.0 ms
Metro Ethernet Access 1.0 Gbps GigE 500.0 Mbps 10 ms 625,000 B 1,250,000 B 10.0 ms
Cloud Direct Interconnect 10.0 Gbps 10GE 1.0 Gbps 10 ms 1,250,000 B 2,500,000 B 10.0 ms
Cloud Direct Interconnect 10.0 Gbps 10GE 2.0 Gbps 10 ms 2,500,000 B 5,000,000 B 10.0 ms
Data Center DCI Core 10.0 Gbps 10GE 5.0 Gbps 5 ms 3,125,000 B 6,250,000 B 5.0 ms
Carrier Peering Fabric 100.0 Gbps 100GE 20.0 Gbps 5 ms 12,500,000 B 25,000,000 B 5.0 ms