Traffic Shaping
Traffic shaping adjusts the rate of outgoing traffic so that the outgoing traffic can be sent out at an even rate. Traffic shaping uses the buffer and token bucket to control traffic. When packets are sent at a high speed, traffic shaping buffers packets and then evenly sends these cached packets based on the token bucket.
When the rate of an interface on a downstream device is slower than that of an interface on an upstream device or burst traffic occurs, traffic congestion may occur on the downstream device interface. Traffic shaping can be configured on the interface of an upstream device so that outgoing traffic is sent at an even rate and congestion is avoided.
Traffic Shaping Process
The traffic shaping technology is used on an interface, a sub-interface, or in an interface queue, and can limit the rate of all the packets on an interface or the packets of a certain type passing through an interface.
Flow-based queue shaping using the single bucket at a single rate on an interface or sub-interface is used as an example. Figure 3-4 shows the traffic shaping process.
The traffic shaping process is described as follows:
- When packets arrive, the device classifies packets so that the packets enter different queues.
- If the queue that packets enter is not configured with traffic shaping, the packets of the queue are sent. Otherwise, proceed to the next step.
- The system places tokens into the bucket at the configured rate (CIR):
- If there are sufficient tokens in the bucket, the device sends packets directly and the number of tokens decreases.
- If there are insufficient tokens in the bucket, the device places packets into the buffer queue. If the buffer queue is full, packets are discarded.
- When there are packets in the buffer queue, the system extracts the packets from the queue and sends them periodically. Each time the system sends a packet, it compares the number of packets with the number of tokens till the tokens are insufficient to send packets or all the packets are sent.
After queue shaping is performed, the system needs to control the packets at the traffic shaping rate configured on an interface if traffic shaping is configured on the interface or sub-interface. The process is the same as the queue shaping process; however, you do not need to perform 1 and 2.
Adaptive Traffic Shaping
Traffic shaping solves the problem of packets discarded on the inbound interface of the downstream device when the rate of the inbound interface on the downstream device is smaller than the rate of the outbound interface on the upstream device. In some scenarios, the interface rate of the downstream device is variable, so the upstream device cannot determine the traffic shaping parameters. Configure an adaptive traffic profile and associate an NQA test instance with the adaptive traffic profile so that the device can dynamically adjust traffic shaping parameters based on the NQA result.
NQA test instance: measures the packet loss ratio on the inbound interface of the downstream device. The upstream device adjusts traffic shaping parameters based on the detected packet loss ratio.
Traffic shaping rate range: allowed by the outbound interface of the upstream device. The traffic shaping rate in this range is adjusted dynamically.
Traffic shaping rate adaptation step: step of the traffic shaping rate dynamically adjusted each time.
Packet loss ratio range: is allowed by the inbound interface of the downstream device. If the packet loss ratio detected by the NQA test instance is within the range, the upstream device does not adjust the traffic shaping rate. If the detected packet loss ratio is larger than the upper threshold for the packet loss ratio, the upstream device reduces its traffic shaping rate. If the detected packet loss ratio is smaller than the lower threshold for the packet loss ratio and congestion occurs on the upstream device, the upstream device increases its traffic shaping rate.
Interval at which the traffic shaping rate increases: interval at which the upstream device increases the traffic shaping rate when the packet loss ratio frequently changes below the lower threshold of the packet loss ratio. This parameter prevents frequent traffic shaping rate change.
When the NQA test instance detects a high packet loss ratio, to prevent packet loss, the upstream device immediately reduces the traffic shaping rate regardless of the interval.
Condition |
Action |
---|---|
The NQA test instance detects that the packet loss ratio is greater than the upper threshold in the adaptive traffic profile. |
Reduce the traffic shaping rate. |
|
Increase the traffic shaping rate. |
|
Retain the traffic shaping rate. |
The detected packet loss ratio is within the packet loss ratio range in the adaptive traffic profile. |
Retain the traffic shaping rate. |
NQA test fails. |
Retain the upper threshold for the traffic shaping rate in the adaptive traffic profile |
The adaptive traffic profile can be bound to an NQA test instance. The upstream device uses the upper threshold for the traffic shaping rate in the adaptive traffic profile if the adaptive traffic profile is not bound to the NQA test instance.