No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

Fat AP and Cloud AP V200R008C00 CLI-based Configuration Guide

Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
Traffic Policing and Traffic Shaping

Traffic Policing and Traffic Shaping

If traffic sent by users is not limited, continuous burst data from numerous users may aggravate network congestion. To efficiently use limited network resources and better serve more users, traffic sent by users must be limited.

Traffic policing and traffic shaping limit traffic and resource usage by monitoring the traffic rate. Before implementing traffic policing and traffic shaping, assess whether the traffic exceeds the rate limit. Then traffic policies are implemented based on the assessment result. Generally, token buckets are used to assess traffic.

Differences Between Traffic Policing and Traffic Shaping

The differences between traffic policing and traffic shaping are as follows:

  • Traffic policing directly discards the packets whose rate exceeds the rate limit. Traffic shaping, however, buffers the packets whose rate is greater than the traffic shaping rate. When there are sufficient tokens in the token bucket, the device forwards buffered packets at an even rate.
  • Traffic shaping increases the delay, whereas traffic policing does not.
Table 27-1  Differences between traffic policing and traffic shaping

Type

Advantage

Disadvantage

Traffic shaping

Discards less packets.

Increases the delay and jitter. More buffer resources are required to buffer packets.

Traffic policing

Supports the re-marking action. No extra buffer is needed.

Discards more packets. Packets may be retransmitted.

Figure 27-1 shows the differences between traffic shaping and traffic policing.

Figure 27-1  Differences between traffic policing and traffic shaping

Traffic Metering and Token Bucket Mechanism

Overview

Traffic metering is the prerequisite for implementing traffic policing, traffic shaping, and interface-based rate limiting to provide better service for more users with limited network resources. Network devices determine whether the incoming traffic rate exceeds the limit and take measures based on the metering result. Generally, the token bucket mechanism is used to measure traffic.

A token bucket is a container that can store a certain number of tokens. The system places tokens into a token bucket at the configured rate. If the token bucket is full, excess tokens overflow and the number of tokens in the bucket can no longer increase. The system determines whether there are enough tokens in the bucket for packet forwarding. If so, the traffic rate conforms to the rate limit. Otherwise, the traffic rate exceeds or violates the rate limit.

RFC standards define the following token bucket algorithms:
  • The single rate three color marker (srTCM) algorithm determines traffic bursts based on packet lengths.
  • The two rate three color marker (trTCM) algorithm determines traffic bursts based on packet rates.

The token bucket algorithms mark packets red, yellow, or green based on traffic metering results.

Single-Rate-Two-Bucket Mechanism

The single-rate-two-bucket mechanism uses the srTCM algorithm defined in RFC 2697 to measure traffic and marks packets green, yellow, or red based on the metering result.

As shown in Figure 27-2 buckets C and E contain Tc and Te tokens respectively. The single-rate-two-bucket mechanism uses three parameters:
  • Committed information rate (CIR): indicates the rate at which tokens are put into bucket C, that is, the average traffic rate that bucket C allows.
  • Committed burst size (CBS): indicates the capacity of bucket C, that is, the maximum volume of burst traffic that bucket C allows.
  • Excess burst size (EBS): indicates the capacity of bucket E, that is, the maximum volume of excess burst traffic that bucket E allows.
The system places tokens into bucket C at the CIR:
  • If Tc is less than the CBS, Tc increases.
  • If Tc is equal to the CBS and Te is less than the EBS, Te increases.
  • If Tc is equal to the CBS and Te is equal to the EBS, Tc and Te do not increase.
B indicates the size of an arriving packet:
  • If B is less than or equal to Tc, the packet is marked green, and Tc decreases by B.
  • If B is greater than Tc and less than or equal to Te, the packet is marked yellow and Te decreases by B.
  • If B is greater than Te, the packet is marked red, and Tc and Te remain unchanged.

The single-rate-two-bucket mechanism allows burst traffic. When the traffic rate is lower than the CIR, packets are marked green. When the burst traffic volume is greater than the CBS and lower than the EBS, packets are marked yellow. When the burst traffic volume is greater than the EBS, packets are marked red.

Figure 27-2  Single-rate-two-bucket mechanism

This example uses the CIR of 1 Mbit/s and the CBS and EBS both of 2000 bytes. Buckets C and E are initially full of tokens. In single-rate-two-bucket mode, the token buckets process packets as follows:

NOTE:

Here, 1 Mbit/s is calculated by 1x106bit/s.

  • If the first packet arriving at the interface is 1500 bytes long, the packet is marked green because the number of tokens in both buckets P and C is greater than the packet length. The number of tokens in bucket C then decreases by 1500 bytes, with 500 bytes remaining. The number of tokens in bucket E remains unchanged.
  • Assume that the second packet arriving at the interface after a delay of 1 ms is 1500 bytes long. Additional 125-byte tokens are put into bucket C (CIR x time period = 1 Mbit/s x 1 ms = 1000 bits = 125 bytes). Bucket C now has 625-byte tokens, which are not enough for the 1500-byte second packet. Bucket E has 2000-byte tokens, which are enough for the second packet. Therefore, the second packet is marked yellow, and the number of tokens in bucket E decreases by 1500 bytes, with 500 bytes remaining. The number of tokens in bucket C remains unchanged.
  • Assume that the third packet arriving at the interface after a delay of 1 ms is 1000 bytes long. Additional 125-byte tokens are put into bucket C. Bucket C now has 750-byte tokens, which are not enough for the 1000-byte third packet. Tokens in bucket E are insufficient, so the third packet is marked red. The numbers of tokens in buckets C and E remain unchanged.
  • Assume that the fourth packet arriving at the interface after a delay of 20 ms is 1500 bytes long. Additional 2500-byte tokens are put into bucket C (CIR x time period = 1 Mbit/s x 20 ms = 20000 bits = 2500 bytes). Bucket C now has 3250-byte tokens. The excess 1250-byte tokens over the CBS (2000 bytes) are put into bucket E, so bucket E has 1750-byte tokens. The packet is marked yellow because the number of tokens in bucket C is greater than the packet length. The number of tokens in bucket C decreases by 1500 bytes, with 500 bytes remaining. The number of tokens in bucket E remains unchanged.

Table 27-2 describes the packet processing.

Table 27-2  Packet processing in single-rate-two-bucket mode
No. Time (ms) Packet Length (Bytes) Delay (ms) Token Addition (Bytes) Number of Tokens Before Packet Processing (Bytes) Number of Tokens After Packet Processing (Bytes) Marking
Bucket C Bucket E Bucket C Bucket E
- - - - - 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
Two-Rate-Two-Bucket Mechanism

The two-rate-two-bucket mechanism uses the trTCM algorithm defined in RFC 2698 to measure traffic and marks packets green, yellow, or red based on the metering result.

As shown in Figure 27-3, buckets P and C contain Tp and Tc tokens respectively. Two-rate-two-bucket mechanism uses four parameters:
  • Peak information rate (PIR): indicates the rate at which tokens are put into bucket P, that is, the maximum traffic rate that bucket P allows. The PIR is greater than the CIR.
  • CIR: indicates the rate at which tokens are put into bucket C, that is, the average traffic rate that bucket C allows.
  • Peak burst size (PBS): indicates the capacity of bucket P, that is, the maximum volume of burst traffic that bucket P allows.
  • CBS: indicates the capacity of bucket C, that is, the maximum volume of burst traffic that bucket C allows.
The system places tokens into bucket P at the PIR and places tokens into bucket C at the CIR:
  • If Tp is less than the PBS, Tp increases. If Tp is greater than or equal to the PBS, Tp remains unchanged.
  • If Tc is less than the CBS, Tc increases. If Tc is greater than or equal to the CBS, Tp remains unchanged.
B indicates the size of an arriving packet:
  • If B is greater than Tp, the packet is marked red.
  • If B is greater than Tc and less than or equal to Tp, the packet is marked yellow and Tp decreases by B.
  • If B is less than or equal to Tc, the packet is marked green, and Tp and Tc decrease by B.

The two-rate-two-bucket mechanism allows burst traffic rates. When the traffic rate is lower than the CIR, packets are marked green. When the traffic rate is higher than the CIR and less than the PIR, packets are marked yellow. When the traffic rate is higher than the PIR, packets are marked red.

Figure 27-3  Two-rate-two-bucket mechanism

This example uses the CIR of 1 Mbit/s, the PIR of 2 Mbit/s, the CBS of 2000 bytes, and the PBS of 3000 bytes. Buckets C and P are initially full of tokens. In two-rate-two-bucket mode, the token buckets process packets as follows:

NOTE:

Here, 1 Mbit/s is calculated by 1x106bit/s.

  • If the first packet arriving at the interface is 1500 bytes long, the packet is marked green because the numbers of tokens in both buckets P and C are greater than the packet length. Then the numbers of tokens in both buckets P and C decrease by 1500 bytes, with 500 and 1500 bytes remaining in bucket C and bucket P respectively.
  • Assume that the second packet arriving at the interface after a delay of 1 ms is 1800 bytes long. Additional 250-byte tokens are put into bucket P (PIR x time period = 2 Mbit/s x 1 ms = 2000 bits = 250 bytes). Bucket P now has 1750-byte tokens, and is smaller than the packet length. Additional 125-byte tokens are put into bucket C (CIR x time period = 1 Mbit/s x 1 ms = 1000 bits = 125 bytes). Bucket C now has 625-byte tokens. Therefore, the second packet is marked red, and the numbers of tokens in buckets P and C remain unchanged.
  • Assume that the third packet arriving at the interface after a delay of 1 ms is 1000 bytes long. Additional 250-byte tokens are put into bucket P. Bucket P now has 2000-byte tokens, and is larger than the packet length. Additional 125-byte tokens are put into bucket C. Bucket C now has 750-byte tokens, and is still smaller than the packet length. The packet is marked yellow. The number of tokens in bucket P decreases by 1000 bytes, with 1000 bytes remaining. The number of tokens in bucket C remains unchanged.
  • Assume that the fourth packet arriving at the interface after a delay of 20 ms is 1500 bytes long. Additional 5000-byte tokens are put into bucket P (PIR x time period = 2 Mbit/s x 20 ms = 40000 bits = 5000 bytes), but excess tokens over the PBS (3000 bytes) are dropped. Bucket P now has 3000-byte tokens, and is larger than the packet length. Additional 2500-byte tokens are put into bucket C (CIR x time period = 1 Mbit/s x 20 ms = 20000 bits = 2500 bytes), but excess tokens over the CBS (2000 bytes) are dropped. Bucket C then has 2000-byte tokens, which are enough for the 1500-byte fourth packet. Therefore, the fourth packet is marked green. The number of tokens in bucket P decreases by 1500 bytes, with 1500 bytes remaining. The number of tokens in bucket C decreases by 1500 bytes, with 500 bytes remaining.

Table 27-3 describes the packet processing.

Table 27-3  Packet processing in two-rate-two-bucket mode
No. Time (ms) Packet Length (Bytes) Delay (ms) Token Addition (Bytes) Number of Tokens Before Packet Processing (Bytes) Number of Tokens After Packet Processing (Bytes) Marking
Bucket C Bucket P Bucket C Bucket P Bucket C Bucket P
- - - - - - 2000 3000 2000 3000 -
1 0 1500 0 0 0 2000 3000 500 1500 Green
2 1 1800 1 125 250 625 1750 625 1750 Red
3 2 1000 1 125 250 750 2000 750 1000 Yellow
4 22 1500 20 2500 5000 2000 3000 500 1500 Green
Difference and Application of Two Token Bucket Modes

Table 27-4 describes the difference and relationship of two token bucket modes.

Table 27-4  Difference and relationship of two token bucket modes
Difference Single-Rate-Two-Bucket Two-Rate-Two-Bucket
Parameters CIR, CBS, and EBS CIR, CBS, PIR, and PBS
Mode in which tokens are placed When bucket C is full, tokens are put into bucket E. When buckets C and E are not full, tokens are put into bucket C only. Tokens are put into bucket C at the CIR and tokens are put into bucket P at the PIR. Buckets C and P are independent. Excess tokens are dropped when tokens in buckets C and P are full.
Whether traffic burst is allowed Traffic burst is allowed. Tokens in bucket C are first used. When tokens in bucket C are insufficient, tokens in bucket E are used. Traffic burst is allowed. When buckets C and P have sufficient tokens, tokens in both buckets C and P are used. When tokens in bucket C are insufficient, tokens in bucket P are used only.
Marking result Green, yellow, or red Green, yellow, or red
Relationship

In single-rate-two-bucket mode, if the EBS is 0, the effect is the same as that in single-rate-single-bucket mode.

In two-rate-two-bucket mode, if the PIR is equal to the CIR, the effect is the same as that in single-rate-single-bucket mode.

Table 27-5 describes the functions and scenarios of two token bucket modes.

Table 27-5  Functions and scenarios of two token bucket modes
Token Bucket Mode Function Usage Scenario
Single-rate-two-bucket Limits bandwidth, allows certain traffic burst, and distinguishes burst and normal services. Reserves bandwidth for important services or burst traffic (for example, email data).
Two-rate-two-bucket Limits bandwidth, allocates bandwidth, and determines whether the bandwidth is less than the CIR or is in the range of the CIR and PIR. Is recommended for important services because it better monitors burst traffic and guides traffic analysis.

Traffic Policing

Traffic policing discards excess traffic to limit the traffic within a specified range and to protect network resources as well as the enterprise benefits.

Implementation of Traffic Policing
Figure 27-4  Traffic policing components

As shown in Figure 27-4, traffic policing involves the following components:

  • Meter: measures the network traffic using the token bucket mechanism and sends the measurement result to the marker.

  • Marker: colors packets in green, yellow, or red based on the measurement result received from the meter.

  • Action: performs actions based on packet coloring results received from the marker. The following actions are defined:

    • Pass: forwards the packets that meet network requirements.

    • Remark + pass: changes the local priorities of packets and forwards them.

    • Discard: drops the packets that do not meet network requirements.

    By default, green and yellow packets are forwarded, and red packets are discarded.

If the rate of a type of traffic exceeds the threshold, the device reduces the packet priority and then forwards the packets or directly discards the packets based on traffic policing configuration. By default, the packets are discarded.

Translation
Download
Updated: 2019-01-11

Document ID: EDOC1000176006

Views: 118507

Downloads: 309

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Share
Previous Next