Process of Traffic Policing
In traffic policing, the Committed Access Rate (CAR) is used to control traffic. Packets are first classified according to pre-defined matching rules. Packets that conform to the specified rate limit are forwarded directly, whereas packets that exceed the specified rate limit are dropped or have their priorities re-marked before being retransmitted.
The CAR technology uses token buckets (TBs) to control traffic.Figure 1 shows the process of traffic policing with CAR.
The tokens are put into the TB at the rate defined by users. The capacity of the TB is also defined by users. No more tokens can be added once the maximum capacity of the TB is reached.
When packets reach a device, the device classifies the packets according to the information such as the IP precedence, source address, or destination address. Packets that conform to the preset rule are processed by means of the TB.
If there are enough tokens in the bucket, packets are forwarded. At the same time, the number of tokens in the TB decreases based on the length of the packets. If the TB contains insufficient tokens or is empty, the packets that were not allocated enough tokens are either discarded or re-marked with the IP precedence, DSCP, or EXP values before being retransmitted. During this period of time, the number of tokens in the TB remains unchanged.
The preceding process shows that the CAR technology enables a router to control traffic as well as mark or re-mark packets.
The major function of CAR is controlling the traffic rate. With the CAR technology, a TB is used to measure the data traffic that flows through the interfaces on a router so that only the packets assigned with tokens go through the router during the specified time period. In this manner, the traffic rate is limited. CAR specifies the maximum traffic rates of both incoming packets and outgoing packets on an interface. In addition, the rate of certain types of traffic can be controlled based on information such as the IP address, port number, and priority. Traffic that does not conform to the preceding conditions is not limited in rate; such traffic is forwarded at the original rate.
CAR is mainly deployed at the network edge to ensure that the core device can process data normally.
Principle of the TB
The TB is used to measure the traffic rate. When data packets reach a device, the device fetches tokens from the TB for transmitting data packets. One token is required for one data packet. That is, there must be enough tokens in the TB. If tokens are insufficient, some of the data packets are discarded. It is similar to booking movie tickets. The maximum number of the audience allowed in is determined by the number of seats at the cinema. If any seats are unoccupied, the tickets are still available; if all seats are occupied, no tickets are available and the potential audience must wait for the next show. The principle of the TB is similar to this. The TB functions as a counter, as shown in the following figure.
There are tokens available for 8000 bytes in the TB. When a data packet of 5000 bytes reaches a device, the device applies for tokens to transmit the 5000–byte packet. The number of tokens in the TB is available for 8000 bytes, larger than that of the packet. Therefore, the packet is forwarded. Then, another data packet of 5000 bytes reaches the device within the time of TI, as shown in the following figure.
There are still tokens available for 3000 bytes in the TB. As the time of TI does not expire, no more token is placed into the TB. The packet, however, is 5000 bytes long. As a result, the remaining tokens are not enough for the data packet, so the data packet is discarded. Discarding the data packet does not consume any tokens. After the packet is discarded, tokens for 3000 bytes are left in the TB until the time of TI expires. Then, new tokens are to fill the TB.
Let us take a look at the adding of new tokens. Assume that the CBS is set to 8000 bytes in the above figure. The system places tokens for 8000 bytes into the TB next time. Since there are tokens for 3000 bytes left in the TB, only the tokens for 5000 bytes of the tokens for 8000 bytes are used to fill the TB, and the remaining tokens for 3000 bytes are discarded if no data packet applies for tokens for 3000 bytes. This is because there is no room for them in the TB.
Implementation of Traffic Policing
This section describes the implementation of traffic policing with a single TB and dual TBs.
-
Traffic policing with a single rate three color marker (srTCM)
-
Traffic policing with two rate three color marker (trTCM)
Parameters for srTCM
The following parameters are involved in srTCM:
- Committed Information Rate (CIR): the rate at which tokens are put into a token bucket. The CIR is expressed in kbps.
- Committed Burst Size (CBS): the committed volume of traffic that an interface allows to pass through, also the depth of a token bucket. The CBS is expressed in bytes. The CBS must be greater than or equal to the size of the largest possible packet in the stream. Note that sometimes a single packet can consume all the tokens in the token bucket. The larger the CBS is, the greater the traffic burst can be.
- Peak burst size (PBS): the maximum size of burst traffic before all traffic exceeds the CIR. The PBS is expressed in bytes.
A packet is marked green if it does not exceed the CBS, yellow if it exceeds the CBS but does not exceed the PBS, and red if it exceeds the PBS.
Method of Adding Tokens for srTCM
Both buckets C and P are initially full.
Rules for srTCM
Tc and Tp refer to the number of tokens in buckets C and P, respectively. The initial values of Tc and Tp are respectively the CBS and PBS.
In Color-Blind mode, the following rules apply when a packet of size B arrives at time t:
- When one token bucket is used:
- If Tc(t) – B ≥ 0, the packet is marked green, and Tc is decremented by B.
- If Tc(t) – B < 0, the packet is marked red, and Tc remains unchanged.
- When two token buckets are used:
- If Tc(t) – B ≥ 0, the packet is marked green, and Tc is decremented by B.
- If Tc(t) – B < 0 but Tp(t) – B ≥ 0, the packet is marked yellow, and Tp is decremented by B.
- If Tp(t) – B < 0, the packet is marked red, and neither Tc nor Tp is decremented.
In Color-Aware mode, the following rules apply when a packet of size B arrives at time t:
- When one token bucket is used:
- If the packet has been pre-colored as green and Tc(t) – B ≥ 0, the packet is re-marked green, and Tc is decremented by B.
- If the packet has been pre-colored as green and Tc(t) – B < 0, the packet is re-marked red, and Tc remains unchanged.
- If the packet has been pre-colored as yellow or red, the packet is re-marked red regardless of the packet length. The Tc value remains unchanged.
- When two token buckets are used:
- If the packet has been pre-colored as green and Tc(t) – B ≥ 0, the packet is re-marked green, and Tc is decremented by B.
- If the packet has been pre-colored as green and Tc(t) – B < 0 but Tp(t) – B ≥ 0, the packet is marked yellow, and Tp is decremented by B.
- If the packet has been pre-colored as yellow and Tp(t) – B ≥ 0, the packet is re-marked yellow, and Tp is decremented by B.
- If the packet has been pre-colored as yellow and Tp(t) – B < 0, the packet is re-marked red, and Tp remains unchanged.
- If the packet has been pre-colored as red, the packet is re-marked red regardless of the packet length. The Tc and Tp values remain unchanged.
Parameters for trTCM
trTCM covers the following parameters:
- CIR: the rate at which tokens are put into a token bucket. The CIR is expressed in kbps.
- CBS: the committed volume of traffic that an interface allows to pass through, also the depth of a token bucket. The CBS is expressed in bytes. The CBS must be greater than or equal to the size of the largest possible packet entering a device.
- PIR: the maximum rate at which an interface allows packets to pass and is expressed in kbps. The PIR must be greater than or equal to the CIR.
- PBS: the maximum volume of traffic that an interface allows to pass through in a traffic burst.
Method of Adding Tokens for trTCM
Tokens are put into buckets C and P at the rate of CIR and PIR, respectively. When one bucket is full of tokens, any subsequent tokens for the bucket are dropped, but tokens continue being put into the other bucket if it is not full.
Buckets C and P are initially full.
Rules for trTCM
The trTCM focuses on the traffic burst rate and checks whether the traffic rate is conforming to the specifications. Therefore, traffic is measured based on bucket P and then bucket C.
Tc and Tp refer to the numbers of tokens in buckets C and P, respectively. The initial values of Tc and Tp are respectively the CBS and PBS.
In Color-Blind mode, the following rules apply when a packet of size B arrives at time t:
- If Tp(t) – B < 0, the packet is marked red, and The Tc and Tp values remain unchanged.
- If Tp(t) – B ≥ 0 but Tc(t) – B < 0, the packet is marked yellow, and Tp is decremented by B.
- If Tc(t) – B ≥ 0, the packet is marked green and both Tp and Tc are decremented by B.
In Color-Aware mode, the following rules apply when a packet of size B arrives at time t:
- If the packet has been pre-colored as green, and Tp(t) – B < 0, the packet is re-marked red, and neither Tp nor Tc is decremented.
- If the packet has been pre-colored as green and Tp(t) – B ≥ 0 but Tc(t) – B < 0, the packet is re-marked yellow, and Tp is decremented by B, and Tc remains unchanged.
- If the packet has been pre-colored as green and Tc(t) – B ≥ 0, the packet is re-marked green, and both Tp and Tc are decremented by B.
- If the packet has been pre-colored as yellow and Tp(t) – B < 0, the packet is re-marked red, and neither Tp nor Tc is decremented.
- If the packet has been pre-colored as yellow and Tp(t) – B ≥ 0, the packet is re-marked yellow, and Tp is decremented by B and Tc remains unchanged.
- If the packet has been pre-colored as red, the packet is re-marked red regardless of what the packet length is. The Tp and Tc values remain unchanged.
(Visited 1,102 times, 1 visits today)