In traffic policing, committed access rate (CAR) is used to control traffic. CAR uses token buckets to measure traffic and determines whether a packet is conforming to the specification.
CAR has the following two functions:
Rate limit: Only packets allocated enough tokens are allowed to pass so that the traffic rate is restricted.
Traffic classification: Packets are marked internal priorities, such as the scheduling precedence and drop precedence, based on the measurement performed by token buckets.
When a packet arrives, the device matches the packet against matching rules. If the packet matches a rule, the router uses token buckets to meter the traffic rate.
The router marks the packet red, yellow, or green based on the metering result. Red indicates that the traffic rate exceeds the specifications. Yellow indicates that the traffic rate exceeds the specifications but is within an allowed range. Green indicates that the traffic rate is conforming to the specifications.
The device drops packets marked red, re-marks and forwards packets marked yellow, and forwards packets marked green.
NetEngine 8000 Fs conform to relevant standards to implement CAR. CAR allows tokens to be added to a token bucket when a packet arrives. The number of tokens that are required is obtained using the following format: Number of required tokens = Committed information rate (CIR) x Period between the current time and the most recent time tokens are added. After tokens are put into a token bucket, the system determines whether the number of tokens is enough for the packet.
CAR supports srTCM with single bucket, srTCM with two buckets, and trTCM. This section provides examples of the three marking methods in Color-Blind mode. The implementation in Color-Aware mode is similar to that in Color-Blind mode.
SrTCM with Single Bucket
This example uses the CIR 1 Mbit/s, the committed burst size (CBS) 2000 bytes, and the excess burst size (EBS) 0. The EBS 0 indicates that only bucket C is used. Bucket C is initially full of tokens.
The following table illustrates this process:
No. |
Time |
Packet Length |
Delay |
Token Addition |
Tokens in Bucket C Before Packet Processing |
Tokens in Bucket C After Packet Processing |
Marking |
---|---|---|---|---|---|---|---|
- |
- |
- |
- |
- |
2000 |
2000 |
- |
1 |
0 |
1500 |
0 |
0 |
2000 |
500 |
Green |
2 |
1 |
1500 |
1 |
125 |
625 |
625 |
Red |
3 |
2 |
1000 |
1 |
125 |
750 |
750 |
Red |
4 |
22 |
1500 |
20 |
2500 |
2000 |
500 |
Green |
SrTCM with Two Buckets
This example uses the CIR 1 Mbit/s and the CBS and EBS both 2000 bytes. Buckets C and E are initially full of tokens.
The following table illustrates this process:
No. |
Time |
Packet Length |
Delay |
Token Addition |
Tokens in Bucket C Before Packet Processing |
Tokens in Bucket E Before Packet Processing |
Tokens in Bucket C After Packet Processing |
Tokens in Bucket E After Packet Processing |
Marking |
---|---|---|---|---|---|---|---|---|---|
- |
- |
- |
- |
- |
2000 |
2000 |
2000 |
2000 |
- |
1 |
0 |
1500 |
0 |
0 |
2000 |
2000 |
500 |
2000 |
Green |
2 |
1 |
1500 |
1 |
125 |
625 |
2000 |
625 |
500 |
Yellow |
3 |
2 |
1000 |
1 |
125 |
750 |
500 |
750 |
500 |
Red |
4 |
22 |
1500 |
20 |
2500 |
2000 |
1750 |
500 |
1750 |
Green |
TrTCM
This example uses the CIR 1 Mbit/s, the PIR 2 Mbit/s, and the CBS and PBS both 2000 bytes. Buckets C and P are initially full of tokens.
The following table illustrates this process:
No. |
Time |
Packet Length |
Delay (Bucket C) |
Delay (Bucket P) |
Token Addition (Bucket C) |
Token Addition (Bucket P) |
Tokens in Bucket C Before Packet Processing |
Tokens in Bucket P Before Packet Processing |
Tokens in Bucket C After Packet Processing |
Tokens in Bucket P After Packet Processing |
Marking |
---|---|---|---|---|---|---|---|---|---|---|---|
- |
- |
- |
- |
- |
- |
- |
2000 |
2000 |
2000 |
2000 |
- |
1 |
0 |
1500 |
0 |
0 |
0 |
0 |
2000 |
2000 |
500 |
500 |
Green |
2 |
1 |
1500 |
1 |
1 |
125 |
250 |
625 |
750 |
625 |
750 |
Red |
3 |
2 |
1000 |
1 |
1 |
125 |
250 |
750 |
1000 |
750 |
0 |
Yellow |
4 |
22 |
1500 |
20 |
20 |
2500 |
5000 |
2000 |
2000 |
500 |
500 |
Green |
The srTCM focuses on the traffic burst size and has a simple token-adding method and packet processing mechanism. The trTCM focuses on the traffic burst rate and has a complex token-adding method and packet processing mechanism.
The srTCM and trTCM have their own advantages and disadvantages. They vary from each other in performance, such as the packet loss rate, burst traffic processing capability, hybrid packet forwarding capability, data forwarding smoothing capability. The three markers fit for traffic with different features as follows:
To control the traffic rate, use srTCM with single bucket.
To control the traffic rate and distinguish traffic marked differently and process them differently, use srTCM with two buckets. Note that traffic marked yellow must be processed differently from traffic marked green. Otherwise, the implementation outcome of srTCM with two buckets is the same as that of the srTCM with single bucket.
To control the traffic rate and check whether the traffic rate exceeds the CIR or PIR, use trTCM. Note that traffic marked yellow must be processed differently from traffic marked green. Otherwise, the implementation outcome of trTCM is the same as that of srTCM with single bucket.
The CIR is the key to determine the volume of traffic allowed to pass through a network. The larger the CIR is, the higher the rate at which tokens are generated. The more the tokens allocated to packets, the greater the volume of traffic allowed to pass through. The CBS is also an important parameter. A larger CBS results in more accumulated tokens in bucket C and a greater volume of traffic allowed to pass through.
The Bucket depth (CBS, EBS or PBS) is set based on actual rate limit requirements. In principle, the bucket depth is calculated based on the following conditions:
Condition 1 is easy to meet. Condition 2 is difficult to operate, and the following formula is introduced:
Bucket depth (bytes) = Bandwidth (kbit/s) x RTT (ms)/8 (RTT refers to round trip time and is generally set to 1500 ms.)
The following formulas are used for NetEngine 8000 Fs:
CAR calculates the bandwidth of packets based on the entire packet. For example, CAR counts the length of the frame header and CRC field but not the preamble, inter frame gap, or SFD of an Ethernet frame in the bandwidth. The following figure illustrates a complete Ethernet frame (bytes):
After CAR is performed, the Inter frame gap, Preamble, and SFD fields are not involved in the bandwidth calculation.