CN-121984922-A - Traffic shaping scheduling method and device and electronic equipment
Abstract
The invention provides a traffic shaping and scheduling method, a traffic shaping and scheduling device and electronic equipment, wherein under the condition that a data packet is stored in a target queue and the target queue meets a packet discharging condition, a first-order data packet in the target queue is sent to the rear end; and adjusting the residual scheduling weight of the target queue and the number of tokens in the token bucket according to the packet length of the outgoing data packet. The scheduler manages the same data queue based on the number of tokens and the remaining scheduling weights, and the shaping queue of the token queue and the scheduling queue corresponding to the weights do not need to be set separately, so that hardware redundancy is avoided, resources are saved, and cost and data transmission delay are reduced.
Inventors
- Request for anonymity
- Request for anonymity
- Request for anonymity
- Request for anonymity
- Request for anonymity
Assignees
- 成都星拓微电子科技股份有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260407
Claims (10)
- 1. A traffic shaping scheduling method, the method comprising: Under the condition that a data packet exists in a target queue and the target queue meets a packet discharging condition, the first-order data packet in the target queue is sent to the rear end, wherein the target queue is a data queue currently pointed by a scheduling pointer, the packet discharging condition is that the residual scheduling weight of the target queue is greater than 0, and the number of tokens in a token bucket of the target queue is greater than 0; and adjusting the residual scheduling weight of the target queue and the number of tokens in the token bucket according to the packet length of the outgoing data packet.
- 2. The traffic shaping scheduling method of claim 1, wherein the method comprises: And under the condition that the target queue is allowed to carry out bandwidth borrowing, if the residual scheduling weight of the target queue is smaller than or equal to 0 and the residual total bandwidth of the scheduler is larger than a preset borrowable threshold, increasing the residual scheduling weight of the target queue, and adjusting the number of tokens in a token bucket of the target queue according to the increasing amplitude of the residual scheduling weight.
- 3. The traffic shaping and scheduling method as set forth in claim 1, wherein the target queue is provided with a committed bandwidth token bucket and a bursty bandwidth token bucket, an initial number of bursty bandwidth tokens in the bursty bandwidth token bucket is greater than or equal to an initial number of committed bandwidth tokens in the committed bandwidth token bucket, and the sending the first-order packet in the target queue to the back end includes: When the number of the promised bandwidth tokens in the promised bandwidth token bucket is larger than 0, adding a first type mark to the first-order data packet; when the number of the promised bandwidth tokens in the promised bandwidth token bucket is smaller than or equal to 0 and the bursty bandwidth tokens in the bursty bandwidth token bucket are larger than 0, adding a second type mark to the first-order data packet; and sending the data packet added with the first type mark or the second type mark to the back end.
- 4. The traffic shaping and scheduling method according to claim 1, wherein said adjusting the remaining scheduling weight of the target queue and the number of tokens in the token bucket according to the packet length of the outgoing packet comprises: Determining equivalent weight and equivalent token number according to the packet length of the outgoing data packet; Subtracting the equivalent weight on the basis of the current residual scheduling weight of the target queue to obtain the adjusted residual scheduling weight of the target queue; subtracting the equivalent token number from the token bucket of the target queue to obtain the adjusted token number in the token bucket of the target queue.
- 5. The traffic shaping scheduling method as set forth in claim 2, wherein said increasing the remaining scheduling weight of the target queue comprises: determining the increasing amplitude of the residual scheduling weight according to the residual total bandwidth and the initial scheduling weight duty ratio of the target queue, wherein the initial scheduling weight duty ratio is the duty ratio of the initial scheduling weight of the target queue in the sum of the initial scheduling weights of all the queues; and up-regulating the residual scheduling weight of the target queue according to the increment amplitude.
- 6. The traffic shaping scheduling method according to claim 2, wherein in case a target queue is allowed to borrow bandwidth, if a remaining scheduling weight of the target queue is less than or equal to 0, but a remaining total bandwidth of a scheduler is less than or equal to a preset borrowable threshold, or if the target queue is not allowed to borrow bandwidth, and the remaining scheduling weight of the target queue is less than 0; The method further comprises the steps of: adding a pause scheduling flag to the target queue; And when all the data queues carry a pause scheduling mark or the residual total bandwidth of the scheduler is 0, restoring the residual total bandwidth of the scheduler to the initial total bandwidth, restoring the residual scheduling weight of each data queue to the corresponding initial scheduling weight, and supplementing the number of tokens in the token bucket of each data queue to the corresponding initial token number.
- 7. The traffic shaping scheduling method of claim 1, wherein the method further comprises: after the remaining total bandwidth of the scheduler is initialized, starting timing by using a first timer; And when the timing of the first timer reaches the set target duration, restoring the residual total bandwidth of the scheduler to the initial total bandwidth, restoring the residual scheduling weight of each data queue to the corresponding initial scheduling weight, and supplementing the number of tokens in the token bucket of each data queue to the corresponding initial token number.
- 8. A traffic shaping scheduler, the traffic shaping scheduler comprising: The first processing unit is used for sending the first-order data packet in the target queue to the rear end under the condition that the data packet exists in the target queue and the target queue meets the packet-out condition, wherein the target queue is the data queue pointed at by the scheduling pointer currently, the packet-out condition is that the residual scheduling weight of the target queue is greater than 0, and the number of tokens in the token bucket of the target queue is greater than 0; and the second processing unit is used for adjusting the residual scheduling weight of the target queue and the number of tokens in the token bucket according to the packet length of the outgoing data packet.
- 9. An electronic device comprising a scheduler and a plurality of data queues, the scheduler being coupled to the plurality of data queues, the scheduler being configured to perform the method of any of claims 1-7.
- 10. The electronic device of claim 9, wherein the electronic device is further provided with a register for recording a remaining scheduling weight for each queue.
Description
Traffic shaping scheduling method and device and electronic equipment Technical Field The present invention relates to the field of communications, and in particular, to a traffic shaping and scheduling method, apparatus, and electronic device. Background With the rapid growth of cloud computing, video streaming media and internet of things services, network equipment is required to meet the requirements of high bandwidth utilization and low delay transmission in a high-concurrency and multi-service mixed environment. The traditional network flow control method generally needs to set a flow shaping queue and a weight scheduling queue separately, and adopts a weight scheduling algorithm and a token bucket algorithm to respectively perform flow scheduling and shaping so as to realize bandwidth allocation and burst control between services with different priorities. In the method, a plurality of queues are needed to participate, so that the problems of hardware redundancy, resource waste, high transmission delay and the like exist. Disclosure of Invention The invention aims to provide a traffic shaping and scheduling method, a traffic shaping and scheduling device and electronic equipment so as to solve the problems. In order to achieve the above object, the technical scheme adopted by the embodiment of the invention is as follows: In a first aspect, an embodiment of the present invention provides a traffic shaping and scheduling method, where the method includes: Under the condition that a data packet exists in a target queue and the target queue meets a packet discharging condition, the first-order data packet in the target queue is sent to the rear end, wherein the target queue is a data queue currently pointed by a scheduling pointer, the packet discharging condition is that the residual scheduling weight of the target queue is greater than 0, and the number of tokens in a token bucket of the target queue is greater than 0; and adjusting the residual scheduling weight of the target queue and the number of tokens in the token bucket according to the packet length of the outgoing data packet. The scheduler manages the same data queue based on the number of tokens and the remaining scheduling weights, and the shaping queue of the token queue and the scheduling queue corresponding to the weights do not need to be set separately, so that hardware redundancy is avoided, resources are saved, and cost and data transmission delay are reduced. And under the condition that the target queue is allowed to carry out bandwidth borrowing, if the residual scheduling weight of the target queue is smaller than or equal to 0 and the residual total bandwidth of the scheduler is larger than a preset borrowable threshold, increasing the residual scheduling weight of the target queue, and adjusting the number of tokens in a token bucket of the target queue according to the increasing amplitude of the residual scheduling weight. Under the condition that the target queue is allowed to carry out bandwidth borrowing, if the residual scheduling weight of the target queue is smaller than or equal to 0 and the residual total bandwidth of the scheduler is larger than a preset borrowable threshold value, the residual scheduling weight of the target queue is increased, the number of tokens in a token bucket of the target queue is adjusted according to the increasing amplitude of the residual scheduling weight, and the bandwidth borrowing is carried out, so that the packet sending is continuously scheduled, and the bandwidth is fully utilized. Optionally, the target queue is provided with a committed bandwidth token bucket and a bursty bandwidth token bucket, the initial number of bursty bandwidth tokens in the bursty bandwidth token bucket is greater than or equal to the initial number of committed bandwidth tokens in the committed bandwidth token bucket, and the sending the first-order data packet in the target queue to the back end includes: When the number of the promised bandwidth tokens in the promised bandwidth token bucket is larger than 0, adding a first type mark to the first-order data packet; when the number of the promised bandwidth tokens in the promised bandwidth token bucket is smaller than or equal to 0 and the bursty bandwidth tokens in the bursty bandwidth token bucket are larger than 0, adding a second type mark to the first-order data packet; and sending the data packet added with the first type mark or the second type mark to the back end. Different marks are added according to token distribution in a token bucket, so that a subsequent processing link is convenient for processing the packet according to the marks. Optionally, the adjusting the remaining scheduling weight of the target queue and the number of tokens in the token bucket according to the packet length of the outgoing data packet includes: Determining equivalent weight and equivalent token number according to the packet length of the outgoing data packet;