Traffic scheduling method and device, electronic equipment and storage medium

By using programmable chips for traffic scheduling in network communication, and dynamically determining the forwarding port based on traffic exceeding the limit status and cost information, the problem of extending response time in burst traffic is solved by traditional methods, and fast and accurate traffic scheduling and network stability are achieved.

CN119676160APending Publication Date: 2025-03-21RUIJIE NETWORKS CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311224350.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-21
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

Traditional traffic scheduling methods have a long response time in burst traffic, resulting in network blockage, slow response speed and even loss of packets.

Method used

The programmable chip obtains and parses the pending messages, and determines the target forwarding port of the to-forwarding message based on the traffic exceeding status of the initial forwarding port associated with the destination IP address, as well as the traffic exceeding status and cost information of each candidate forwarding port, and updates the traffic exceeding status of the target forwarding port based on the traffic consumed to-forwarding messages.

Benefits of technology

It realizes fast-responsive traffic scheduling, avoids network blockage and slow response speed, and ensures timely forwarding of packets and precise traffic control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119676160A_ABST
    Figure CN119676160A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of network communication, in particular to a traffic scheduling method and device, electronic equipment and a storage medium, and aims to improve the accuracy of traffic scheduling. The method comprises the steps that a programmable chip obtains and analyzes a message to be processed, field information of the message to be processed is obtained, and the field information at least comprises a message type and a destination IP address; and when the message type represents that the to-be-processed message is a to-be-forwarded message, determining a target forwarding port of the to-be-forwarded message based on a traffic overrun state of an initial forwarding port associated with the destination IP address and respective traffic overrun states and cost information of the candidate forwarding ports, the candidate forwarding ports are the other output ports, except the initial forwarding port, in the pre-configured output ports; and updating the traffic overrun state of the target forwarding port based on the traffic consumed for forwarding the to-be-forwarded message, and forwarding the to-be-forwarded message to the next node device through the target forwarding port.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network communication technology, and in particular to a traffic scheduling method, device, electronic device and storage medium. Background Art

[0002] With the rapid development of computer technology and network communication technology, business requests in the network are becoming more and more frequent. At the same time, message forwarding is becoming more and more frequent, and the traffic generated is also increasing significantly. In order to improve the stability of the system, traffic scheduling is required.

[0003] In traditional technology, when scheduling traffic, the central processing unit (CPU) usually obtains the total traffic value of each port at a regular interval. If the total traffic value is greater than a preset traffic threshold, the traffic information of each port is cleared, and the scheduling priority of each port is re-sorted according to the corresponding allocation weight of each port contained in a preset equal-cost multi-path routing (ECMP) table.

[0004] However, when burst traffic arrives, the traffic allocated to the ports with high allocation weights will exceed the port upper limit. Since the CPU also needs to process a large number of other tasks, the CPU scheduling response time is long, which will cause the traffic of the ports with high allocation weights to be unable to be scheduled in time and exceed the port upper limit, causing network congestion, slow response speed, and even packet loss.

[0005] In view of this, it is necessary to propose a new traffic scheduling method to address the above problems. Summary of the invention

[0006] The embodiments of the present application provide a traffic scheduling method, device, electronic device and storage medium to improve the accuracy of traffic scheduling.

[0007] The specific technical solutions provided by the embodiments of this application are as follows:

[0008] In a first aspect, a traffic scheduling method is provided, comprising:

[0009] Acquire and parse the message to be processed, and obtain field information of the message to be processed, where the field information at least includes: message type and destination IP address;

[0010] When the message type indicates that the message to be processed is a message to be forwarded, based on the traffic overlimit state of the initial forwarding port associated with the destination IP address and the traffic overlimit state and cost information of each candidate forwarding port, the target forwarding port of the message to be forwarded is determined, wherein each candidate forwarding port is: each of the pre-configured egress ports except the initial forwarding port;

[0011] Based on the traffic consumed by forwarding the message to be forwarded, the traffic excess status of the target forwarding port is updated, and the message to be forwarded is forwarded to the next node device through the target forwarding port.

[0012] In a second aspect, a flow scheduling device is provided, comprising:

[0013] The acquisition module is used to acquire and parse the message to be processed, and obtain the field information of the message to be processed, where the field information at least includes: the message type and the destination IP address;

[0014] The first processing module is used to determine the target forwarding port of the message to be forwarded based on the flow limit excess state of the initial forwarding port associated with the destination IP address and the flow limit excess state and cost information of each candidate forwarding port when the message type characterizes that the message to be processed is a message to be forwarded, wherein each candidate forwarding port is: each of the pre-configured egress ports except the initial forwarding port;

[0015] The second processing module is used to update the traffic limit excess state of the target forwarding port based on the traffic consumed by forwarding the message to be forwarded, and forward the message to be forwarded to the next node device through the target forwarding port.

[0016] Optionally, when determining the target forwarding port of the message to be forwarded based on the traffic overlimit status of the initial forwarding port associated with the destination IP address information, and the traffic overlimit status and cost information of each candidate forwarding port, the first processing module is further used to:

[0017] Based on the destination IP address, query the message forwarding table to obtain the initial forwarding port of the message to be forwarded;

[0018] Determine the flow limit excess state of the initial forwarding port based on the current bit value of the bit associated with the initial forwarding port in the current bitmap, the current bitmap recording the current flow limit excess state of each outbound port;

[0019] When the flow rate over-limit state of the initial forwarding port is over-limit, determining the target forwarding port based on the flow rate over-limit state and cost information of each candidate forwarding port;

[0020] When the traffic over-limit status of the initial forwarding port is not exceeded, the initial forwarding port is used as the target forwarding port.

[0021] Optionally, when determining the target forwarding port based on the flow excess status and cost information of each candidate forwarding port, the first processing module is further configured to:

[0022] Based on the flow exceeding limit status of each candidate forwarding port, select each non-exceeding forwarding port from each candidate forwarding port;

[0023] Based on the cost information of each non-exceeding forwarding port, a target forwarding port that meets the preset cost condition is screened out from the non-exceeding forwarding ports.

[0024] Optionally, when updating the traffic limit excess state of the target forwarding port based on the traffic consumed by forwarding the message to be forwarded, the second processing module is further used to:

[0025] Based on the current number of tokens in the token bucket corresponding to the target forwarding port and the message length of the message to be forwarded, determine the number of remaining tokens in the token bucket, wherein when the target forwarding port forwards the message to be forwarded, the number of tokens consumed by the token bucket is equal to the message length;

[0026] If the number of remaining tokens is less than the preset over-limit token threshold, a scheduling loopback message is generated, and based on the scheduling loopback message, the traffic over-limit state of the target forwarding port is updated to over-limit, and the message header of the scheduling loopback message at least includes: the traffic over-limit state of the target forwarding port is over-limit;

[0027] If the number of remaining tokens is not less than the over-limit token threshold, the traffic over-limit status of the target forwarding port is not updated.

[0028] Optionally, after acquiring and parsing the message to be processed and obtaining field information of the message to be processed, the device further includes an updating module, and the updating module is used to:

[0029] When the message type indicates that the message to be processed is a scheduling loopback message, extracting the traffic over-limit state of the over-limit port carried in the scheduling loopback message;

[0030] The bit associated with the over-limit port in the current bitmap is set to a preset first bit value to obtain an updated bitmap, wherein the first bit value indicates that the flow over-limit state of the over-limit port is over-limit;

[0031] The scheduling loopback message is discarded.

[0032] Optionally, after acquiring and parsing the message to be processed and obtaining field information of the message to be processed, the device further includes a refresh module, and the refresh module is used to:

[0033] When the message type indicates that the message to be processed is a scheduling refresh message, the bit associated with each egress port in the current bitmap is set to a preset second bit value, wherein the scheduling refresh message is generated by the programmable chip according to a preset time interval, and the second bit value indicates that the flow over-limit state of the corresponding egress port is not exceeded;

[0034] For each of the outbound ports, the following operations are performed respectively: if the current number of tokens in the token bucket corresponding to the outbound port is less than the preset refresh token threshold, the number of added tokens corresponding to the outbound port is obtained, and tokens equal to the number of added tokens are added to the token bucket corresponding to the outbound port;

[0035] The scheduling refresh message is discarded.

[0036] According to a third aspect, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any one of the methods described in the first aspect are implemented.

[0037] According to a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method described in any one of the first aspects are implemented.

[0038] In a fifth aspect, a computer program product is provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device performs the steps of any one of the methods described in the first aspect above.

[0039] In an embodiment of the present application, a programmable chip acquires and parses a message to be processed, obtains field information of the message to be processed, and then when the message type of the message to be processed indicates that the message to be processed is a message to be forwarded, the target forwarding port of the message to be forwarded is determined based on the traffic excess status of the initial forwarding port associated with the destination IP address of the message to be forwarded, and the traffic excess status and cost information of each candidate forwarding port. Finally, based on the traffic required to forward the message to be forwarded, the traffic excess status of the target forwarding port is updated, and the message to be forwarded is forwarded to the next node device through the target forwarding port.

[0040] In this way, by using the programmable chip to schedule traffic, the programmable chip's hardware characteristics of fast response can be used to schedule traffic in a timely manner, avoiding problems such as long response time, network congestion, slow response speed, and even packet loss. In addition, based on the traffic overlimit status of the initial forwarding port, and the traffic overlimit status and cost information of each candidate forwarding port, the target forwarding port of the message to be forwarded is determined, and the target forwarding port whose outflow does not exceed the upper limit can be selected, and the traffic is accurately controlled not to exceed the limit, and the message to be forwarded is successfully forwarded. Based on the traffic consumed by forwarding the message to be forwarded, the traffic overlimit status of the target forwarding port is updated in a timely manner, and the traffic overlimit status of each outflow port is accurately monitored to improve the accuracy of traffic scheduling. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 A schematic diagram of an application scenario in an embodiment of the present application;

[0042] Figure 2 This is a schematic diagram of a first flow chart of a traffic scheduling method in an embodiment of the present application;

[0043] Figure 3 This is a schematic diagram of a first process for determining a target forwarding port in an embodiment of the present application;

[0044] Figure 4 A schematic diagram of a flow-limit-exceeding state of an initial forwarding port in an embodiment of the present application;

[0045] Figure 5 A second flow chart of determining a target forwarding port in an embodiment of the present application;

[0046] Figure 6 A schematic diagram of determining a target forwarding port in an embodiment of the present application;

[0047] Figure 7 A schematic diagram of a flow chart for updating the traffic overlimit status of a target forwarding port in an embodiment of the present application;

[0048] Figure 8 A schematic diagram of a process for updating the current bitmap in an embodiment of the present application;

[0049] Fig. 9 A schematic diagram of updating the current bitmap in an embodiment of the present application;

[0050] Fig.10 A schematic diagram of a process for refreshing each token bucket in an embodiment of the present application;

[0051] Fig.11 A schematic diagram of cleaning the current bitmap in an embodiment of the present application;

[0052] Fig.12 This is a second flow chart of a traffic scheduling method in an embodiment of the present application;

[0053] Fig.13 This is a schematic diagram of the structure of the flow scheduling device in the embodiment of the present application;

[0054] Fig.14 Schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0055] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0056] Some of the terms used in the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.

[0057] Programmable chip: Programmable chip has the characteristics of supporting programmability and good flexibility. Programmable chip supports programming objects to customize message forwarding rules and forwarding behaviors. The programmable chip can be a programmable switching chip and a field programmable gate array (FPGA), etc., and the embodiments of the present application are not limited to this.

[0058] Token Bucket: It is a traffic measurement mechanism used to evaluate whether the traffic rate exceeds the specified value. The token bucket here refers to the internal storage pool of the network device, and the token refers to the virtual information packet that fills the token bucket at a given rate. The token bucket can be regarded as a container for storing tokens. A certain capacity is pre-set, and a certain number of tokens are added to the token bucket at regular intervals until the token bucket is filled.

[0059] Messages to be forwarded: refers to user messages, which are messages that require layer-3 routing.

[0060] Scheduling loopback message: It is generated by custom coding inside the programmable chip, with a custom type of header, and is used to update the traffic over-limit status of the egress port to over-limit.

[0061] Scheduling refresh message: sent by the timed packet sending function of the programmable chip, with a specific header, used to update the traffic over-limit status of each egress port to within the limit and add tokens to the token bucket.

[0062] The following is a brief introduction to the design concept of the embodiment of the present application:

[0063] At present, with the rapid development of computer technology and network communication technology, business requests in the network are becoming more and more frequent. At the same time, message forwarding is becoming more and more frequent, and the traffic generated is also increasing significantly. In order to improve the stability of the system, traffic scheduling is required.

[0064] In traditional technology, when scheduling traffic, the central processing unit (CPU) usually obtains the total traffic value of each port at a regular interval. If the total traffic value is greater than a preset traffic threshold, the traffic information of each port is cleared, and the scheduling priority of each port is re-sorted according to the corresponding allocation weight of each port contained in the preset ECMP table.

[0065] However, when burst traffic arrives, the traffic allocated to ports with high allocation weights will exceed the port upper limit. Since the CPU needs to process a large number of other tasks and the sampling rate is low, the CPU scheduling response time is long, which will cause the traffic of ports with high allocation weights to be unable to be scheduled in time and exceed the port upper limit, causing network congestion, slow response speed, and even packet loss, resulting in inaccurate traffic scheduling.

[0066] In view of this, in the embodiments of the present application, a traffic scheduling method, device, electronic device and storage medium are proposed. The programmable chip obtains and parses the message to be processed, obtains the field information of the message to be processed, and then when the message type of the message to be processed indicates that the message to be processed is a message to be forwarded, the target forwarding port of the message to be forwarded is determined based on the traffic overlimit status of the initial forwarding port associated with the destination IP address of the message to be forwarded, and the traffic overlimit status and cost information of each candidate forwarding port, wherein each candidate forwarding port is: the remaining output ports except the initial forwarding port among the pre-configured output ports, and finally based on the traffic consumed by forwarding the message to be forwarded, the traffic overlimit status of the target forwarding port is updated, and the message to be forwarded is forwarded to the next node device through the target forwarding port.

[0067] In this way, by using the programmable chip to schedule traffic, the hardware characteristics of the programmable chip that responds quickly can be used to schedule traffic in a timely manner, avoiding problems such as long response time, network congestion, slow response speed, and even packet loss caused by the long response time. In addition, based on the traffic overlimit status of the initial forwarding port, and the traffic overlimit status and cost information of each candidate forwarding port, the target forwarding port of the message to be forwarded is determined, and the target forwarding port whose outflow does not exceed the upper limit can be selected, and the traffic is accurately controlled not to exceed the limit, and the message to be forwarded is successfully forwarded. Based on the traffic consumed by forwarding the message to be forwarded, the traffic overlimit status of the target forwarding port is updated, and the traffic overlimit status of each outflow port is accurately monitored to improve the accuracy of traffic scheduling.

[0068] The preferred implementation modes of the present application are described in detail below with reference to the accompanying drawings.

[0069] like Figure 1As shown, it is a schematic diagram of the application scenario of an embodiment of the present application. The application scenario diagram includes a programmable switch 110, a previous node device 120, and a next node device 130. The programmable switch 110 is connected to the previous node device 120 and the next node device 130 through a communication link. When the programmable switch 110 receives a message to be forwarded sent by the previous node device 120, it selects the target forwarding port of the message to be forwarded according to the traffic excess status of the initial forwarding port associated with the destination IP address of the message to be forwarded, and the traffic excess status and cost information of each candidate forwarding port, and forwards the message to be forwarded to the next node device 130 through the target forwarding port. Among them, a programmable chip is used in the programmable switch.

[0070] Based on the above embodiments, see Figure 2 FIG. 1 is a schematic diagram of a first flow chart of a traffic scheduling method in an embodiment of the present application, which specifically includes:

[0071] Step 20: Obtain and parse the message to be processed to obtain field information of the message to be processed.

[0072] The field information includes at least: message type and destination IP address.

[0073] In an embodiment of the present application, a message to be processed is obtained, the message to be processed includes a message header and message data, the message header of the message to be processed is parsed, and field information of the message to be processed is extracted.

[0074] Among them, the message header includes at least a source media access control (MAC) address field, a destination MAC address field, an Ethernet type field, a virtual local area network (VLAN) field, a source Internet Protocol (IP) address field, a destination IP address field and a protocol field, etc., which are not limited in the embodiments of the present application.

[0075] Step 21: When the message type indicates that the message to be processed is a message to be forwarded, the target forwarding port of the message to be forwarded is determined based on the traffic overlimit status of the initial forwarding port associated with the destination IP address and the traffic overlimit status and cost information of each candidate forwarding port.

[0076] The candidate forwarding ports are: the remaining egress ports among the pre-configured egress ports except the initial forwarding port.

[0077] In the embodiment of the present application, the message type of the message to be processed is identified according to the Ethernet type field of the message to be processed, and the message to be processed is processed using a processing method corresponding to the message type.

[0078] Among them, the message types of the messages to be processed include at least: messages to be forwarded, scheduling loopback messages and scheduling refresh messages, etc., which are not limited in the embodiments of the present application.

[0079] For example, assuming that the Ethernet type field of the message to be processed is 0x0800, the message type of the message to be processed is a message to be forwarded.

[0080] For another example, assuming that the Ethernet type field of the message to be processed is 0xFF01, the message type of the message to be processed is a scheduling loopback message.

[0081] For another example, assuming that the Ethernet type field of the message to be processed is 0x9001, the message type of the message to be processed is a scheduling refresh message.

[0082] The processing of the messages to be processed can be divided into the following three situations.

[0083] The first case: the message to be processed is a message to be forwarded.

[0084] In an embodiment of the present application, a target forwarding port for a message to be forwarded is determined based on the traffic excess status of an initial forwarding port associated with a destination IP address, and the traffic excess status and cost information of each candidate forwarding port.

[0085] Specifically, when determining the target forwarding port of the message to be forwarded, perform the following operations: Figure 3 As shown, it is a first flow chart of determining the target forwarding port in the embodiment of the present application. Figure 3 , and explain in detail the specific operations performed:

[0086] Step 210: Based on the destination IP address, query the message forwarding table to obtain the initial forwarding port of the message to be forwarded.

[0087] In the embodiment of the present application, after obtaining the field information of the message to be forwarded, the message forwarding table is queried according to the destination IP address to obtain the initial forwarding port of the message to be forwarded.

[0088] The message forwarding table records the forwarding port corresponding to each destination IP address.

[0089] For example, assuming that the destination IP address is 192.168.1.1, and the forwarding port corresponding to the destination IP address 192.168.1.1 in the message forwarding table is egress port 3, then the initial forwarding port of the message to be forwarded is determined to be egress port 3.

[0090] Step 211: Determine the flow limit excess state of the initial forwarding port based on the current bit value of the bit associated with the initial forwarding port in the current bitmap.

[0091] The current bitmap records the current flow rate over-limit status of each outbound port.

[0092] In an embodiment of the present application, the current bit map is read from the register. If the current bit value of the bit associated with the initial forwarding port in the current bit map is the first bit value, the flow over-limit state of the initial forwarding port is determined to be over-limit. If the current bit value of the bit associated with the initial forwarding port in the current bit map is the second bit value, the flow over-limit state of the initial forwarding port is determined to be not over-limit.

[0093] Among them, the first bit value indicates that the flow exceeding limit state of the egress port is exceeded, and the second bit value indicates that the flow exceeding limit state of the egress port is not exceeded. The first bit value can be 1, and the second bit value can be 0. This is not limited in the embodiments of the present application.

[0094] For example, see Figure 4 As shown, it is a schematic diagram of the traffic over-limit state of the initial forwarding port in an embodiment of the present application. Assuming that the initial forwarding port is egress port 3, the first bit value is 1, the second bit value is 0, and the current bit value of the bit associated with egress port 3 in the current bit map is 1, then the traffic over-limit state of the initial forwarding port is determined to be over-limit.

[0095] For another example, assuming that the initial forwarding port is egress port 2, the first bit value is 1, the second bit value is 0, and the current bit value of the bit associated with egress port 2 in the current bitmap is 0, then the traffic overlimit status of the initial forwarding port is determined to be not exceeded.

[0096] Step 212: Determine whether the traffic over-limit status of the initial forwarding port is over-limit, if so, execute step 213, otherwise, execute step 214.

[0097] Step 213: Determine the target forwarding port based on the flow excess status and cost information of each candidate forwarding port.

[0098] In an embodiment of the present application, it is determined whether the traffic over-limit status of the initial forwarding port is over-limit. When the traffic over-limit status of the initial forwarding port is over-limit, the target forwarding port is determined based on the traffic over-limit status and cost information of each candidate forwarding port.

[0099] Specifically, when executing step 213, the following operations are performed: Figure 5 As shown, it is a second flow chart of determining the target forwarding port in the embodiment of the present application. Figure 5, and explain in detail the specific operations performed:

[0100] Step 2130: Based on the flow rate exceeding status of each candidate forwarding port, select each non-exceeding forwarding port from each candidate forwarding port.

[0101] In the embodiment of the present application, the current bit value of the bit associated with each candidate forwarding port in the current bit map determines the flow excess state of each candidate forwarding port, and selects each non-exceeding forwarding port from each candidate forwarding port.

[0102] For example, see Figure 6 As shown, it is a schematic diagram for determining the target forwarding port in an embodiment of the present application, assuming that the first bit value is 1 and the second bit value is 0, the candidate forwarding ports include: egress port 1, egress port 2 and egress port 4, and the current bit values ​​corresponding to the candidate forwarding ports are 1, 0, and 0, respectively. Then, the flow excess state of egress port 1 is exceeded, the flow excess state of egress port 2 is not exceeded, and the flow excess state of egress port 4 is not exceeded. The non-exceeded forwarding ports include: egress port 2 and egress port 4.

[0103] Step 2131: Based on the cost information of each non-exceeding forwarding port, a target forwarding port that meets a preset cost condition is selected from each non-exceeding forwarding port.

[0104] In the embodiment of the present application, after obtaining each non-exceeding forwarding port, based on the respective cost information of each non-exceeding forwarding port, a target forwarding port that meets the preset cost condition is screened out from each non-exceeding forwarding port.

[0105] Among them, the cost information can be the cost price of the egress port, or it can be the level of the egress port cost price. The level of the cost price is obtained based on the cost price of the egress port. The preset cost condition can be that the cost information is less than a preset cost threshold, or it can be the smallest cost information among all the cost information. This is not limited in the embodiments of the present application.

[0106] For example, Figure 6 As shown, assuming that the preset cost condition is the minimum cost information among all the cost information, the non-exceeded forwarding ports include: egress port 2 and egress port 4, the cost information of egress port 2 is 1, and the cost information of egress port 4 is 2, then the target forwarding port that meets the preset cost condition is egress port 2.

[0107] Step 214: Use the initial forwarding port as the target forwarding port.

[0108] In the embodiment of the present application, it is determined whether the flow over-limit status of the initial forwarding port is over-limit. When the flow over-limit status of the initial forwarding port is not over-limit, the initial forwarding port is used as the target forwarding port.

[0109] For example, assuming that the initial forwarding port is egress port 2, and the flow limit exceeding state of the initial forwarding port is not exceeded, egress port 2 is directly used as the target forwarding port.

[0110] Step 22: Based on the traffic consumed by forwarding the message to be forwarded, the traffic limit excess status of the target forwarding port is updated, and the message to be forwarded is forwarded to the next node device through the target forwarding port.

[0111] The traffic consumption required for forwarding the message to be forwarded is represented by the number of tokens consumed in the token bucket corresponding to the target forwarding port.

[0112] Specifically, when updating the traffic limit status of the target forwarding port based on the traffic consumed by forwarding the message to be forwarded, the following operations are performed: Figure 7 As shown, it is a schematic diagram of the flow chart of updating the flow limit state of the target forwarding port in the embodiment of the present application. Figure 7 , and explain in detail the specific operations performed:

[0113] Step 220: Determine the number of remaining tokens in the token bucket based on the current number of tokens in the token bucket corresponding to the target forwarding port and the message length of the message to be forwarded.

[0114] When the target forwarding port forwards the message to be forwarded, the number of tokens consumed by the token bucket is equal to the message length.

[0115] In an embodiment of the present application, the difference between the current number of tokens in the token bucket corresponding to the target forwarding port and the message length of the message to be forwarded is calculated to obtain the remaining number of tokens in the token bucket corresponding to the target forwarding port.

[0116] For example, assuming that the current number of tokens in the token bucket corresponding to the target forwarding port is 10000, and the message length of the message to be forwarded is 1000, the remaining number of tokens in the token bucket is 10000-1000=9000.

[0117] Step 221: Determine whether the number of remaining tokens is less than a preset over-limit token threshold. If so, execute step 222; otherwise, execute step 223.

[0118] Among them, the preset over-limit token threshold can be: the maximum value of the message lengths of each message to be forwarded, which is not limited in the embodiments of the present application.

[0119] Step 222: Generate a scheduling loopback message, and based on the scheduling loopback message, update the traffic over-limit state of the target forwarding port to over-limit.

[0120] The message header of the scheduling loopback message at least includes: the flow limit exceeding state of the target forwarding port is exceeding the limit.

[0121] In addition, it is worth noting that the payload of the scheduling loopback message is controlled within 64 bytes, so that the scheduling loopback message can be sent to the message receiving end of the programmable chip through the reachable information path inside the programmable chip.

[0122] In an embodiment of the present application, it is determined whether the number of remaining tokens is less than a preset over-limit token threshold. When the number of remaining tokens is less than the preset over-limit token threshold, a scheduling loopback message is generated, and the traffic over-limit status of the target forwarding port is added as over-limit in the message header of the scheduling loopback message. Based on the scheduling loopback message, the traffic over-limit status of the target forwarding port is updated as over-limit.

[0123] For example, assuming that the preset over-limit token threshold is 3000 and the remaining number of tokens is 2000, the remaining number of tokens 2000 is less than the preset over-limit token threshold 3000, a scheduling loopback message is generated, and the traffic over-limit status of the target forwarding port is added as over-limit in the message header of the scheduling loopback message.

[0124] Specifically, bitmap information may be added to the custom message header to indicate that the flow rate over-limit state of the target forwarding port is over-limit.

[0125] For example, 32 bits of a custom header are used to carry bitmap information, and the bitmap information is defined as shown in Table 1:

[0126] Table 1

[0127]

[0128] For example, assuming that the outbound ports include: port 1, port 2, port 3 and port 4, the target forwarding port is port 1, and the number of remaining tokens in the token bucket corresponding to port 1 is less than the preset over-limit token threshold, a scheduling loopback message is generated, and 0b1000 is added to the message header of the scheduling loopback message, indicating that the traffic over-limit status of port 1 is over-limit.

[0129] Step 223: Do not update the traffic limit excess status of the target forwarding port.

[0130] In an embodiment of the present application, it is determined whether the number of remaining tokens is less than the preset over-limit token threshold. When the number of remaining tokens is not less than the over-limit token threshold, the traffic over-limit status of the target forwarding port is not updated, and the traffic over-limit status of the target forwarding port is not exceeded.

[0131] For example, assuming that the preset over-limit token threshold is 3000 and the number of remaining tokens is 4000, the number of remaining tokens 4000 is greater than the preset over-limit token threshold 3000, and the traffic over-limit status of the target forwarding port is not updated.

[0132] In this way, by monitoring the number of remaining tokens, the flow exceeding limit status of all egress ports can be accurately measured and saved, and the flow of the egress ports can be accurately controlled not to exceed the flow upper limit.

[0133] The second case: the message to be processed is a scheduling loopback message.

[0134] Specifically, when the message to be processed is a scheduling loopback message, the following operations are performed: Figure 8 As shown, it is a schematic diagram of the process of updating the current bitmap in the embodiment of the present application. Figure 8 , and explain in detail the specific operations performed:

[0135] Step 80: extract the traffic excess status of the excess port carried in the scheduling loopback message.

[0136] In the embodiment of the present application, after receiving the scheduling loopback message, the flow exceeding limit status of the exceeding limit port carried in the message header of the scheduling loopback message is extracted.

[0137] For example, a scheduling loopback message 1 is received, and information carried in a message header of the scheduling loopback message 1 is that the flow limit exceeding state of the egress port 1 is exceeded.

[0138] Step 81: Set the bit associated with the over-limit port in the current bitmap to a preset first bit value to obtain an updated bitmap.

[0139] The first bit value indicates that the flow rate exceeding state of the exceeding port is exceeding the limit.

[0140] In the embodiment of the present application, after the flow exceeding status of the exceeding port is obtained, the bit associated with the exceeding port in the current bit map in the register is set to a preset first bit value to obtain an updated update bit map.

[0141] For example, see Fig. 9 As shown, it is a schematic diagram of updating the current bit map in an embodiment of the present application. Assuming that the first bit value is 1, the output ports include port 1, port 2, port 3 and port 4, the out-of-limit port is output port 1, and the current bit value of the bit associated with port 1 in the current bit map is 0, then the current bit value of the bit associated with port 1 is set to 1 to obtain an updated bit map.

[0142] In addition, it is worth noting that in one embodiment of the present application, after receiving the scheduling loopback message, all other message processing processes are skipped, no logic table is queried, and other functions are prevented from modifying the scheduling loopback message. The current bit map is directly updated through the traffic excess status of the excess port.

[0143] Step 82: discard the scheduling loopback message.

[0144] In the embodiment of the present application, after obtaining the updated bitmap, the scheduling loopback message is discarded.

[0145] In this way, by scheduling loopback messages, the programmable chip can automatically update the current bit map without calling other devices, thereby improving the efficiency of traffic scheduling and reducing the complexity of traffic scheduling.

[0146] The third case: the message to be processed is a scheduling refresh message.

[0147] Specifically, when the message to be processed is a scheduling refresh message, the following operations are performed: Fig.10 As shown, it is a schematic diagram of the process of refreshing each token bucket in the embodiment of the present application. Fig.10 , and explain in detail the specific operations performed:

[0148] Step 1001: setting the bit associated with each outbound port in the current bitmap to a preset second bit value.

[0149] The scheduling refresh message is generated by the programmable chip at a preset time interval, and the second bit value indicates that the flow rate over-limit state of the corresponding output port is not over-limited.

[0150] In addition, it is worth mentioning that the preset time interval represents the interval at which a token is added.

[0151] In the embodiment of the present application, the data of the bits respectively associated with each output port in the current bit map are cleared, that is, the bits respectively associated with each output port in the current bit map are set to the preset second bit value.

[0152] For example, see Fig.11 As shown, it is a schematic diagram of cleaning the current bit map in an embodiment of the present application. Assuming that the second bit value is 0, the output ports include port 1, port 2, port 3 and port 4, and the bit values ​​of the bits associated with each output port in the current bit map are 1, 0, 1, and 0, respectively. Then, the bit value of the bit associated with output port 1 in the current bit map is set to 0, and the bit value of the bit associated with output port 3 in the current bit map is set to 0. After cleaning, the bit values ​​of the bits associated with each output port in the current bit map are: 0, 0, 0, and 0, respectively.

[0153] Step 1002: For each of the egress ports, perform the following operations: if the current number of tokens in the token bucket corresponding to the egress port is less than the preset refresh token threshold, obtain the number of added tokens corresponding to the egress port, and add tokens equal to the number of added tokens to the token bucket corresponding to the egress port.

[0154] The number of added tokens corresponding to the egress port may be determined based on the flow upper limit of the egress port and a preset time interval.

[0155] In the embodiment of the present application, for each of the output ports, the following operations are performed respectively: determine whether the current number of tokens in the token bucket corresponding to the output port is less than the preset refresh token threshold, if the current number of tokens in the token bucket corresponding to the output port is less than the preset refresh token threshold, then calculate the product of the flow upper limit and the time interval of the output port, determine the number of tokens to be added corresponding to the output port, and add tokens equal to the number of tokens to be added to the token bucket corresponding to the output port. If the current number of tokens in the token bucket corresponding to the output port is not less than the preset refresh token threshold, then do not add tokens to the token bucket corresponding to the output port.

[0156] For example, assuming that the preset refresh token threshold is 10 megabytes, the current number of tokens in the token bucket corresponding to port 2 is 1 megabyte, the traffic upper limit of port 2 is 10G, and the time interval for sending scheduling refresh messages is 0.001 seconds, then the current number of tokens in the token bucket corresponding to port 2 is less than the preset refresh token threshold, and the number of added tokens corresponding to port 2 is 10G*0.001=10 megabytes. 10 megabytes of tokens are added to the token bucket corresponding to the port.

[0157] Step 1003: discard the scheduling refresh message.

[0158] In the embodiment of the present application, after refreshing the token buckets corresponding to each egress port, the scheduling refresh message is discarded.

[0159] In this way, by scheduling refresh messages, tokens can be periodically added to the token buckets corresponding to the respective egress ports, and the flow excess data in the current bitmap can be cleared at the same time, so that the flow excess state of each egress port is not exceeded.

[0160] Based on the above embodiments, see Fig.12 FIG. 1 is a second flow chart of a traffic scheduling method in an embodiment of the present application, which specifically includes:

[0161] Step 1201: Acquire and parse the message to be processed to obtain field information of the message to be processed;

[0162] Step 1202: Determine whether the message to be processed is a message to be forwarded. If so, execute step 1203; otherwise, execute step 1206.

[0163] Step 1203: Determine the target forwarding port for the message to be forwarded based on the traffic overlimit status of the initial forwarding port associated with the destination IP address, and the traffic overlimit status and cost information of each candidate forwarding port.

[0164] Step 1204: based on the traffic consumed by forwarding the message to be forwarded, updating the traffic limit excess status of the target forwarding port;

[0165] Step 1205: Forward the message to be forwarded to the next node device through the target forwarding port.

[0166] Step 1206: Determine whether the message to be processed is a scheduling loop message, if so, execute step 1207, otherwise, execute step 1209.

[0167] Step 1207: extract the traffic excess status of the excess port carried in the scheduling loopback message, and set the bit associated with the excess port in the current bitmap to a preset first bit value to obtain an updated bitmap.

[0168] Step 1208: discard the scheduling loopback message.

[0169] Step 1209: Set the bit associated with each outbound port in the current bitmap to a preset second bit value.

[0170] Step 1210: For each of the egress ports, perform the following operations: if the current number of tokens in the token bucket corresponding to the egress port is less than the preset refresh token threshold, obtain the number of added tokens corresponding to the egress port, and add tokens equal to the number of added tokens to the token bucket corresponding to the egress port.

[0171] Step 1211: discard the scheduling refresh message.

[0172] Based on the same inventive concept, a flow scheduling device is also provided in the embodiment of the present application, see Fig.13 As shown, it is a schematic diagram of the structure of the flow scheduling device in an embodiment of the present application, which specifically includes:

[0173] The acquisition module 1301 is used to acquire and parse the message to be processed, and obtain field information of the message to be processed, where the field information at least includes: message type and destination IP address;

[0174] The first processing module 1302 is used to determine the target forwarding port of the message to be forwarded based on the traffic overlimit state of the initial forwarding port associated with the destination IP address and the traffic overlimit state and cost information of each candidate forwarding port when the message type characterizes that the message to be processed is a message to be forwarded, wherein each candidate forwarding port is: each of the pre-configured egress ports except the initial forwarding port;

[0175] The second processing module 1303 is used to update the traffic limit excess state of the target forwarding port based on the traffic consumed by forwarding the message to be forwarded, and forward the message to be forwarded to the next node device through the target forwarding port.

[0176] Optionally, when determining the target forwarding port of the message to be forwarded based on the traffic overlimit status of the initial forwarding port associated with the destination IP address information, and the traffic overlimit status and cost information of each candidate forwarding port, the first processing module 1302 is further used to:

[0177] Based on the destination IP address, query the message forwarding table to obtain the initial forwarding port of the message to be forwarded;

[0178] Determine the flow limit excess state of the initial forwarding port based on the current bit value of the bit associated with the initial forwarding port in the current bitmap, the current bitmap recording the current flow limit excess state of each outbound port;

[0179] When the flow rate over-limit state of the initial forwarding port is over-limit, determining the target forwarding port based on the flow rate over-limit state and cost information of each candidate forwarding port;

[0180] When the traffic over-limit status of the initial forwarding port is not exceeded, the initial forwarding port is used as the target forwarding port.

[0181] Optionally, when determining the target forwarding port based on the flow excess status and cost information of each candidate forwarding port, the first processing module 1302 is further configured to:

[0182] Based on the flow exceeding limit status of each candidate forwarding port, select each non-exceeding forwarding port from each candidate forwarding port;

[0183] Based on the cost information of each non-exceeding forwarding port, a target forwarding port that meets the preset cost condition is screened out from the non-exceeding forwarding ports.

[0184] Optionally, when updating the traffic limit excess state of the target forwarding port based on the traffic consumed by forwarding the message to be forwarded, the second processing module 1303 is further used to:

[0185] Based on the current number of tokens in the token bucket corresponding to the target forwarding port and the message length of the message to be forwarded, determine the number of remaining tokens in the token bucket, wherein when the target forwarding port forwards the message to be forwarded, the number of tokens consumed by the token bucket is equal to the message length;

[0186] If the number of remaining tokens is less than the preset over-limit token threshold, a scheduling loopback message is generated, and based on the scheduling loopback message, the traffic over-limit state of the target forwarding port is updated to over-limit, and the message header of the scheduling loopback message at least includes: the traffic over-limit state of the target forwarding port is over-limit;

[0187] If the number of remaining tokens is not less than the over-limit token threshold, the traffic over-limit status of the target forwarding port is not updated.

[0188] Optionally, after acquiring and parsing the message to be processed and obtaining field information of the message to be processed, the apparatus further includes an updating module 1304, and the updating module 1304 is used to:

[0189] When the message type indicates that the message to be processed is a scheduling loopback message, extracting the traffic over-limit state of the over-limit port carried in the scheduling loopback message;

[0190] The bit associated with the over-limit port in the current bitmap is set to a preset first bit value to obtain an updated bitmap, wherein the first bit value indicates that the flow over-limit state of the over-limit port is over-limit;

[0191] The scheduling loopback message is discarded.

[0192] Optionally, after acquiring and parsing the message to be processed and obtaining field information of the message to be processed, the device further includes a refreshing module 1305, and the refreshing module 1305 is used to:

[0193] When the message type indicates that the message to be processed is a scheduling refresh message, the bit associated with each egress port in the current bitmap is set to a preset second bit value, wherein the scheduling refresh message is generated by the programmable chip according to a preset time interval, and the second bit value indicates that the flow over-limit state of the corresponding egress port is not exceeded;

[0194] For each of the outbound ports, the following operations are performed respectively: if the current number of tokens in the token bucket corresponding to the outbound port is less than the preset refresh token threshold, the number of added tokens corresponding to the outbound port is obtained, and tokens equal to the number of added tokens are added to the token bucket corresponding to the outbound port;

[0195] The scheduling refresh message is discarded.

[0196] Based on the above embodiments, see Fig.14 Shown is a schematic diagram of the structure of an electronic device in an embodiment of the present application.

[0197] An embodiment of the present application provides an electronic device, which may include a processor 1410 (Center Processing Unit, CPU), a memory 1420, an input device 1430 and an output device 1440, etc. The input device 1430 may include a keyboard, a mouse, a touch screen, etc., and the output device 1440 may include a display device, such as a liquid crystal display (Liquid Crystal Display, LCD), a cathode ray tube (Cathode Ray Tube, CRT), etc.

[0198] The memory 1420 may include a read-only memory (ROM) and a random access memory (RAM), and provides the processor 1410 with program instructions and data stored in the memory 1420. In the embodiment of the present application, the memory 1420 may be used to store the program of any traffic scheduling method in the embodiment of the present application.

[0199] The processor 1410 calls the program instructions stored in the memory 1420, and the processor 1410 is used to execute any traffic scheduling method in the embodiments of the present application according to the obtained program instructions.

[0200] Based on the above embodiments, in an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the traffic scheduling method in any of the above method embodiments is implemented.

[0201] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0202] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0203] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0204] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0205] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A traffic scheduling method, characterized in that: Applied to programmable chips, including: Acquire and parse the message to be processed, and obtain field information of the message to be processed, wherein the field information at least includes: message type and destination IP address; When the message type indicates that the message to be processed is a message to be forwarded, based on the traffic overlimit state of the initial forwarding port associated with the destination IP address, and the traffic overlimit state and cost information of each candidate forwarding port, determine the target forwarding port of the message to be forwarded, wherein the candidate forwarding ports are: the remaining egress ports among the pre-configured egress ports except the initial forwarding port; Based on the traffic consumed by forwarding the message to be forwarded, the traffic excess state of the target forwarding port is updated, and the message to be forwarded is forwarded to the next node device through the target forwarding port.

2. The method according to claim 1, characterized in that The determining the target forwarding port of the message to be forwarded based on the traffic overlimit status of the initial forwarding port associated with the destination IP address information, and the traffic overlimit status and cost information of each candidate forwarding port, comprises: Based on the destination IP address, query the message forwarding table to obtain the initial forwarding port of the message to be forwarded; Determining a flow rate over-limit state of the initial forwarding port based on a current bit value of a bit associated with the initial forwarding port in a current bitmap, wherein the current bitmap records the flow rate over-limit state of each of the current outbound ports; When the flow rate over-limit state of the initial forwarding port is over-limit, determining the target forwarding port based on the flow rate over-limit state and cost information of each candidate forwarding port; When the flow over-limit state of the initial forwarding port is not exceeded, the initial forwarding port is used as the target forwarding port.

3. The method according to claim 2, characterized in that The determining the target forwarding port based on the flow excess status and cost information of each candidate forwarding port includes: Based on the flow rate exceeding status of each candidate forwarding port, select each non-exceeding forwarding port from the candidate forwarding ports; Based on the cost information of each of the non-exceeding forwarding ports, a target forwarding port that meets a preset cost condition is screened out from the non-exceeding forwarding ports.

4. The method according to any one of claims 1 to 3, characterized in that: The updating of the traffic limit excess state of the target forwarding port based on the traffic consumed by forwarding the message to be forwarded includes: Determine the number of remaining tokens in the token bucket based on the current number of tokens in the token bucket corresponding to the target forwarding port and the message length of the message to be forwarded, wherein when the message to be forwarded is forwarded at the target forwarding port, the number of tokens consumed by the token bucket is equal to the message length; If the number of remaining tokens is less than the preset over-limit token threshold, a scheduling loopback message is generated, and based on the scheduling loopback message, the flow over-limit state of the target forwarding port is updated to over-limit, and the message header of the scheduling loopback message at least includes: the flow over-limit state of the target forwarding port is over-limit; If the number of remaining tokens is not less than the excess token threshold, the traffic excess state of the target forwarding port is not updated.

5. The method according to claim 1, characterized in that After obtaining and parsing the message to be processed and obtaining the field information of the message to be processed, the method further includes: When the message type indicates that the message to be processed is a scheduling loopback message, extracting the traffic overlimit state of the overlimit port carried in the scheduling loopback message; The bit associated with the over-limit port in the current bitmap is set to a preset first bit value to obtain an updated bitmap, wherein the first bit value indicates that the flow over-limit state of the over-limit port is over-limit; The scheduling loopback message is discarded.

6. The method according to claim 1, characterized in that After obtaining and parsing the message to be processed and obtaining the field information of the message to be processed, the method further includes: When the message type indicates that the message to be processed is a scheduling refresh message, the bit associated with each of the output ports in the current bitmap is set to a preset second bit value, wherein the scheduling refresh message is generated by the programmable chip according to a preset time interval, and the second bit value indicates that the flow over-limit state of the corresponding output port is not over-limited; For each of the egress ports, the following operations are performed respectively: if the current number of tokens in the token bucket corresponding to the egress port is less than a preset refresh token threshold, the number of added tokens corresponding to the egress port is obtained, and tokens equal to the number of added tokens are added to the token bucket corresponding to the egress port; The scheduling refresh message is discarded.

7. A flow scheduling device, characterized in that: include: An acquisition module is used to acquire and parse the message to be processed, and obtain field information of the message to be processed, wherein the field information at least includes: a message type and a destination IP address; A first processing module, configured to determine a target forwarding port of the message to be forwarded based on a flow rate overlimit state of an initial forwarding port associated with the destination IP address and respective flow rate overlimit states and cost information of each candidate forwarding port when the message type indicates that the message to be processed is a message to be forwarded, wherein the candidate forwarding ports are: the remaining egress ports among the pre-configured egress ports except the initial forwarding port; The second processing module is used to update the traffic limit excess state of the target forwarding port based on the traffic consumed by forwarding the message to be forwarded, and forward the message to be forwarded to the next node device through the target forwarding port.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, characterized in that The method comprises a computer program stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device executes the steps of the method according to any one of claims 1 to 6.

Citation Information

Cited By

  • Network traffic control method and device, chip, network interface card, computer equipment, readable storage medium and program product

    CN120321189A