Switch priority flow control method and device, equipment and storage medium
By dynamically adjusting bandwidth and queue thresholds through real-time data analysis and historical prediction models, the problems of high latency and low bandwidth utilization of the PFC protocol in the SONiC system are solved, achieving efficient flow control, ensuring smooth flow of high-priority traffic and reasonable allocation of low-priority traffic, and improving network performance.
Patent Information
- Application Number
- CN202511346062.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-19
- Publication Date
- 2026-01-06
AI Technical Summary
The existing PFC protocol suffers from high latency and low bandwidth utilization in SONiC systems, making it unsuitable for dynamic environments and leading to network congestion and inefficient flow control.
By acquiring real-time data of traffic with different priorities, calculating traffic control parameters, dividing high and low priority bandwidth, predicting future load based on historical traffic sequences, dynamically adjusting queue thresholds and bandwidth allocation ratios, and combining port queue management and bandwidth allocation units, dynamic traffic control is achieved.
It enables real-time detection of queue congestion, ensuring stable bandwidth for high-priority traffic and on-demand allocation of low-priority traffic, thus preventing congestion, reducing latency, improving bandwidth utilization, and guaranteeing network service quality.
Smart Images

Figure CN121283984A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to a method, apparatus, device, and storage medium for priority flow control of a switch. Background Technology
[0002] Currently, in data centers and high-performance computing networks, switches primarily employ the Priority Flow Control (PFC) protocol to ensure flow control under network congestion. The PFC protocol controls the transmission rate of different priority flows, ensuring that high-priority data streams are transmitted in a timely manner and preventing network congestion.
[0003] However, when the existing PFC protocol is implemented in the SONiC (Software for Open Networking in the Cloud) system, it suffers from drawbacks such as high latency, low bandwidth utilization, and incompatibility with dynamic environments.
[0004] The above content is only used to help understand the technical solution of the present invention and does not represent an admission that the above content is prior art. Summary of the Invention
[0005] The main objective of this invention is to provide a method, apparatus, device, and storage medium for priority flow control of switches, aiming to solve the technical problems of high latency and low bandwidth utilization in switch flow control.
[0006] To achieve the above objectives, the present invention provides a switch priority flow control method, which includes the following steps:
[0007] Obtain real-time traffic data for traffic with different priorities;
[0008] Flow control parameters are calculated based on the real-time flow data to obtain the first control command;
[0009] Based on the first control instruction, high-priority bandwidth and low-priority bandwidth are divided to obtain the first allocation result;
[0010] Predicted load data is obtained by forecasting future load based on historical traffic sequences.
[0011] The queue threshold and bandwidth allocation ratio are updated based on the predicted load data and the first allocation result to obtain the second control instruction;
[0012] The second control command is sent to the port queue manager and the bandwidth allocation unit, so that the port queue manager controls the queue length according to the updated queue threshold, and the bandwidth allocation unit schedules traffic according to the updated bandwidth allocation ratio.
[0013] In one embodiment, the step of acquiring real-time traffic data for different priority traffic includes:
[0014] The current queue length of each priority queue is read at a preset sampling period to obtain the queue length data;
[0015] The transmission rate and latency of each priority traffic are calculated based on the queue length data;
[0016] The queue length data, the sending rate, and the delay are encapsulated to obtain real-time traffic data.
[0017] In one embodiment, the step of calculating flow control parameters based on the real-time flow data to obtain a first control command includes:
[0018] The first comparison result is obtained by comparing the length of the high-priority queue in the real-time traffic data with a preset high threshold.
[0019] The second comparison result is obtained by comparing the length of the low-priority queue in the real-time traffic data with a preset low threshold.
[0020] When the first comparison result indicates that the length of the high-priority queue exceeds the preset high threshold, a pause instruction to pause low-priority traffic is generated.
[0021] When the second comparison result indicates that the length of the low-priority queue is lower than the preset low threshold, a recovery instruction to restore low-priority traffic is generated.
[0022] The pause command or the resume command is used as the first control command.
[0023] In one embodiment, the step of dividing high-priority bandwidth and low-priority bandwidth based on the first control instruction to obtain a first allocation result includes:
[0024] The first control command is parsed to obtain the first target ratio required for high-priority traffic and the second target ratio required for low-priority traffic.
[0025] The remaining bandwidth of the link is obtained based on the current total link bandwidth and the reserved bandwidth.
[0026] The high-priority bandwidth is obtained by multiplying the remaining bandwidth of the link by the first target ratio.
[0027] The low-priority bandwidth is obtained by multiplying the remaining bandwidth of the link by the second target ratio.
[0028] The high-priority bandwidth and the low-priority bandwidth are written into the outgoing port scheduler to obtain the first allocation result.
[0029] In one embodiment, the step of predicting future load based on historical traffic sequences to obtain predicted load data includes:
[0030] Read the historical traffic sequence from the storage unit for a preset number of sampling periods;
[0031] The historical traffic sequence is normalized to obtain a normalized sequence;
[0032] The normalized sequence is input into the trained time series prediction model to obtain a sequence of predicted flow values for a preset number of sampling periods in the future.
[0033] The predicted load data is obtained by calculating the average value of the predicted flow value sequence.
[0034] In one embodiment, the step of updating the queue threshold and bandwidth allocation ratio based on the predicted load data and the first allocation result to obtain the second control instruction includes:
[0035] The predicted load data is compared with a preset load threshold to obtain the load comparison result;
[0036] When the load comparison result indicates that the predicted load data is greater than the preset load threshold, the current queue threshold of the low-priority queue is reduced by a first preset step size to obtain the updated queue threshold.
[0037] When the load comparison result indicates that the predicted load data is greater than the preset load threshold, the current proportion of high-priority bandwidth is increased by a second preset step size to obtain the updated bandwidth allocation proportion.
[0038] The updated queue threshold and the updated bandwidth allocation ratio are encapsulated to obtain the second control instruction.
[0039] In one embodiment, it further includes:
[0040] Get port load data for all ports;
[0041] The port load data is traversed to identify a first set of ports with loads higher than a preset high load threshold and a second set of ports with loads lower than a preset low load threshold.
[0042] Select low-priority traffic to be migrated from the first set of ports and determine the size of the traffic to be migrated;
[0043] Generate a traffic migration instruction carrying the migration traffic size and the target port identifier in the second port set;
[0044] The traffic migration instruction is sent to the routing decision unit, so that the routing decision unit updates the forwarding table entries based on the traffic migration instruction and directs the low-priority traffic to the target port.
[0045] Furthermore, to achieve the above objectives, the present invention also proposes a switch priority flow control device, the device comprising:
[0046] The data acquisition module is used to acquire real-time traffic data of different priority traffic flows;
[0047] The first calculation module is used to calculate traffic control parameters based on the real-time traffic data to obtain a first control command; and to divide high-priority bandwidth and low-priority bandwidth based on the first control command to obtain a first allocation result.
[0048] The second calculation module is used to predict future load based on historical traffic sequences to obtain predicted load data; and to update the queue threshold and bandwidth allocation ratio according to the predicted load data and the first allocation result to obtain a second control command.
[0049] The control module is used to send the second control command to the port queue manager and the bandwidth allocation unit, so that the port queue manager controls the queue length according to the updated queue threshold, and the bandwidth allocation unit schedules traffic according to the updated bandwidth allocation ratio.
[0050] Furthermore, to achieve the above objectives, the present invention also proposes a switch priority flow control device, the device comprising: a memory, a processor, and a switch priority flow control program stored in the memory and executable on the processor, the switch priority flow control program being configured to implement the steps of the switch priority flow control method as described above.
[0051] In addition, to achieve the above objectives, the present invention also proposes a storage medium storing a switch priority flow control program, wherein the switch priority flow control program, when executed by a processor, implements the steps of the switch priority flow control method as described above.
[0052] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the switch priority flow control method described above.
[0053] One or more technical solutions proposed in this application have at least the following technical effects:
[0054] Real-time traffic data enables the system to instantly perceive the congestion level of each priority queue; dynamic threshold and bandwidth allocation mechanisms ensure that high-priority traffic always receives stable bandwidth, while low-priority traffic is allocated elastically on demand; predictive models based on historical traffic sequences can adjust queue thresholds and bandwidth ratios before congestion occurs, achieving proactive prevention; the immediate issuance and execution of the second control command forms millisecond-level closed-loop control, avoiding the accumulated delays at each stage in traditional solutions. Therefore, high-priority services no longer wait due to sudden traffic surges, and low-priority services are not excessively discarded due to static policies, ensuring full utilization of overall link resources and guaranteeing network service quality. Attached Figure Description
[0055] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0056] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0057] Figure 1 This is a flowchart illustrating an embodiment of the switch priority flow control method of this application.
[0058] Figure 2 This is a flowchart illustrating Embodiment 2 of the switch priority flow control method of this application;
[0059] Figure 3 This is a schematic diagram of the module structure of the switch priority flow control device in an embodiment of this application;
[0060] Figure 4 This is a schematic diagram of the hardware operating environment involved in the switch priority flow control method in this application embodiment.
[0061] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0062] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0063] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0064] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device or switch priority flow control device capable of performing the above functions. The following description uses a switch priority flow control device as an example to illustrate this embodiment and the subsequent embodiments.
[0065] Based on this, embodiments of this application provide a switch priority flow control method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the switch priority flow control method of this application.
[0066] In this embodiment, the switch priority flow control method includes steps S10 to S60:
[0067] Step S10: Obtain real-time traffic data for traffic of different priorities;
[0068] It should be noted that different priority traffic refers to message flows that are divided into several levels according to the importance of the business, with each level corresponding to a queue; real-time traffic data is a set of quantitative information that represents the instantaneous state of the current network.
[0069] It is understood that this invention proposes a switch PFC protocol optimization method and its implementation process based on the SONiC system. Through the coordinated optimization of hardware and software, it solves the problems of high latency, low bandwidth utilization and static flow control strategy in the existing PFC protocol.
[0070] The design of the hardware modules directly affects the optimization effect of the PFC protocol, and mainly involves the following parts:
[0071] Traffic monitoring unit: This unit is responsible for collecting various traffic information in the network in real time, including indicators such as the transmission rate, queue length, and latency of traffic with different priorities. Through the collected data, the system can gain a comprehensive understanding of the network traffic status and provide a basis for subsequent traffic control.
[0072] Hardware sensors and monitoring units are used to connect to the switch network via high-speed interfaces.
[0073] The traffic monitoring unit periodically collects data and transmits it to the backend processing unit for further analysis.
[0074] PFC Control Unit: Based on feedback information from the traffic monitoring unit, the PFC control unit is responsible for calculating and formulating corresponding traffic control strategies, especially how to adjust the transmission rate of traffic with different priorities.
[0075] Based on real-time monitoring data, the system uses pre-defined rules and algorithms in the computer hardware to determine whether parameters in the PFC protocol (such as traffic priority and queue control strategies) need to be adjusted.
[0076] Using a caching mechanism reduces the delay in the propagation of control signals and improves real-time performance.
[0077] Dynamic bandwidth allocation module: This module dynamically adjusts the bandwidth allocation method according to the PFC control unit's strategy. It ensures sufficient bandwidth support for high-priority traffic while also allocating bandwidth to low-priority traffic, thereby improving overall bandwidth utilization.
[0078] The intelligent bandwidth allocation algorithm dynamically adjusts the bandwidth allocation for each switch node in the network.
[0079] Based on real-time traffic changes, bandwidth is automatically reallocated to optimize the transmission of high-priority traffic.
[0080] At the software level, the SONiC system optimizes traffic control through a traffic analysis and scheduling module, a PFC optimization algorithm module, and a load balancing mechanism.
[0081] Traffic Analysis and Scheduling Module: This module uses machine learning algorithms to analyze traffic trends in real time and predict potential future network load changes, adjusting traffic scheduling strategies in advance. Through machine learning, the system can identify potential traffic bottlenecks and make preventative adjustments.
[0082] Historical traffic data is collected and machine learning models (such as regression analysis and time series forecasting) are trained to predict future traffic.
[0083] Adjust traffic scheduling strategies, such as changing queue priorities and traffic buffering strategies.
[0084] The PFC optimization algorithm module optimizes the flow control strategy of the PFC protocol based on the prediction results of the flow analysis and scheduling module. The system can dynamically adjust the flow control threshold, priority strategy, and propagation timing of control signals in the PFC protocol to maximize traffic transmission efficiency.
[0085] Based on traffic prediction data, the parameters in the protocol are automatically adjusted (such as priority adjustment, queue length control, etc.).
[0086] By adjusting the PFC threshold, data packet loss can be reduced, and bandwidth utilization of low-priority traffic can be improved.
[0087] Load balancing mechanism: This mechanism monitors the traffic load of each switch in real time and automatically adjusts the distribution of link traffic to avoid network bottlenecks. Through intelligent load balancing technology, the system can dynamically adjust the load distribution of each node to ensure a uniform distribution of traffic in the network.
[0088] The system will automatically adjust the traffic load of the links based on the load of each switch, optimize network traffic distribution, and ensure no bottlenecks.
[0089] In one feasible implementation, step S10 includes steps A11 to A13:
[0090] A11: Read the current queue length of each priority queue at a preset sampling period to obtain the queue length data;
[0091] It should be noted that the preset sampling period means that the system triggers a reading action once at a fixed time interval to ensure data continuity.
[0092] Queue length refers to the number of packets temporarily stored but not yet forwarded in a priority queue, reflecting the instantaneous level of congestion.
[0093] Queue length data is a dataset that aggregates the lengths of queues of various priorities.
[0094] A12: Calculate the sending rate and latency of each priority traffic based on the queue length data;
[0095] It should be noted that the preset sampling period means that the system triggers a reading action once at a fixed time interval to ensure data continuity.
[0096] Queue length refers to the number of packets temporarily stored but not yet forwarded in a priority queue, reflecting the instantaneous level of congestion.
[0097] Queue length data is a dataset that aggregates the lengths of queues of various priorities.
[0098] A13: Encapsulate queue length data, sending rate, and latency to obtain real-time traffic data.
[0099] It should be noted that encapsulation involves packaging the queue length, sending rate, and latency information into a unified format to form real-time traffic data that can be directly identified by subsequent steps.
[0100] Step S20: Calculate the flow control parameters based on the real-time flow data to obtain the first control command;
[0101] It should be noted that the flow control parameters are the quantitative basis for determining when to pause or resume low-priority flow.
[0102] In one feasible implementation, step S20 includes steps A21 to A25:
[0103] A21: The first comparison result is obtained by comparing the length of the high-priority queue in the real-time traffic data with a preset high threshold;
[0104] It should be noted that the high-priority queue length is part of the real-time traffic data and is used to reflect the congestion status of high-priority services.
[0105] The preset high threshold is a reference value for the upper limit of queue length set to prevent high-priority services from being damaged.
[0106] The first comparison result is the conclusion of "exceeding the limit" or "not exceeding the limit" obtained after comparing the length of the high-priority queue with the preset high threshold.
[0107] A22: The second comparison result is obtained by comparing the length of the low-priority queue in the real-time traffic data with a preset low threshold;
[0108] It should be noted that the low-priority queue length is the queue length corresponding to low-priority services in the real-time traffic data.
[0109] The preset low threshold is a reference value for the lower limit of queue length set to prevent low-priority services from being suppressed for a long time.
[0110] The second comparison result is the conclusion of "lower than" or "not lower than" after comparing the length of the low-priority queue with the preset low threshold.
[0111] A23: When the first comparison result shows that the length of the high-priority queue exceeds a preset high threshold, a pause command is generated to pause the low-priority traffic.
[0112] It should be noted that the pause command is a control command that instructs the system to temporarily prevent low-priority traffic from entering the forwarding path.
[0113] A24: When the second comparison result shows that the length of the low-priority queue is lower than the preset low threshold, a recovery instruction to restore low-priority traffic is generated.
[0114] It should be noted that the recovery command is a control command that instructs the system to allow low-priority traffic to re-enter the forwarding path.
[0115] A25: Use the pause or resume command as the first control command.
[0116] It should be noted that the recovery command is a control command that instructs the system to allow low-priority traffic to re-enter the forwarding path.
[0117] Step S30: Based on the first control instruction, divide the high-priority bandwidth and low-priority bandwidth to obtain the first allocation result;
[0118] It should be noted that bandwidth refers to the maximum amount of data that a link can carry per unit of time.
[0119] In one feasible implementation, step S30 includes steps A31 to A35:
[0120] A31: Parse the first control command to obtain the first target ratio required for high-priority traffic and the second target ratio required for low-priority traffic;
[0121] It should be noted that parsing involves extracting the proportions required for high-priority services and low-priority services from the first control instruction.
[0122] The first target ratio is the proportion of remaining bandwidth on the link that high-priority services are expected to occupy.
[0123] The second target ratio is the proportion of remaining link bandwidth expected to be occupied by low-priority services.
[0124] A32: The remaining bandwidth of the link is obtained based on the current total bandwidth and the reserved bandwidth;
[0125] It should be noted that the total bandwidth of the link is the total transmission capacity that the physical link can provide.
[0126] Reserved bandwidth refers to the fixed bandwidth portion that is locked in advance to ensure critical business operations.
[0127] The remaining bandwidth of a link is the available bandwidth after deducting the reserved bandwidth from the total bandwidth of the link.
[0128] A33: Multiply the remaining bandwidth of the link by the proportion of the first target to obtain the high-priority bandwidth;
[0129] It should be noted that high-priority bandwidth refers to the dedicated bandwidth allocated from the remaining bandwidth of the link to high-priority services according to the proportion of the first target.
[0130] A34: Multiply the remaining bandwidth of the link by the proportion of the second target to obtain the low-priority bandwidth;
[0131] It should be noted that low-priority bandwidth refers to the available bandwidth allocated from the remaining bandwidth of the link to low-priority services according to the proportion of the second target.
[0132] A35: Write the high-priority bandwidth and low-priority bandwidth into the outgoing port scheduler to obtain the first allocation result.
[0133] It should be noted that the outgoing port scheduler is the functional entity responsible for implementing bandwidth allocation on physical ports based on the allocation results.
[0134] The first allocation result is the specific values of high-priority bandwidth and low-priority bandwidth, and their effective records in the scheduler.
[0135] Step S40: Predict future load based on historical traffic sequences to obtain predicted load data;
[0136] It should be noted that historical traffic sequences refer to datasets composed of traffic samples collected over a past period arranged in chronological order.
[0137] In one feasible implementation, step S40 includes steps A41 to A44:
[0138] A41: Read the historical traffic sequence from the storage unit for a preset number of sampling periods;
[0139] It should be noted that the storage unit is used to persistently store the physical or logical storage space of historical traffic sequences.
[0140] The preset sampling period is the length of the time window used by the system to form the historical flow sequence.
[0141] A42: Normalize the historical flow sequence to obtain a normalized sequence;
[0142] It should be noted that normalization is the process of mapping historical data with different dimensions or amplitudes to a unified numerical range.
[0143] The normalized sequence is the historical flow sequence after mapping.
[0144] A43: Input the normalized sequence into the trained time series prediction model to obtain the predicted flow value sequence for the next preset number of sampling periods;
[0145] It should be noted that a time series prediction model that has been trained is a mathematical model that has been pre-trained using historical data and has the ability to infer future traffic flow.
[0146] A44: Calculate the average value of the predicted flow rate sequence to obtain the predicted load data.
[0147] It should be noted that the average value is a single indicator obtained by averaging the predicted flow rate series, and is used to represent the overall load level in the future.
[0148] Predicted load data is a quantification of future load, presented as an average value.
[0149] Step S50: Update the queue threshold and bandwidth allocation ratio based on the predicted load data and the first allocation result to obtain the second control command;
[0150] It should be noted that updating refers to dynamically correcting existing parameters based on the prediction results.
[0151] In step S60, the second control command is sent to the port queue manager and the bandwidth allocation unit, so that the port queue manager controls the queue length according to the updated queue threshold and the bandwidth allocation unit schedules traffic according to the updated bandwidth allocation ratio.
[0152] It should be noted that the port queue manager is the functional entity responsible for deciding whether to enqueue or drop packets based on queue thresholds.
[0153] The bandwidth allocation unit is the functional entity responsible for scheduling traffic at the outgoing port according to the bandwidth ratio.
[0154] In practice, traffic monitoring involves hardware monitoring of network traffic to quickly detect the arrival of protocol packets.
[0155] PFC protocol processing involves the PFC control unit deciding whether to suspend low-priority traffic based on real-time traffic data to ensure that high-priority traffic (such as important protocols or real-time data) can continue uninterrupted.
[0156] Bandwidth allocation is the dynamic adjustment of bandwidth, allocating more bandwidth to high-priority traffic based on traffic type, while delaying the transmission of low-priority traffic.
[0157] Real-time optimization involves predicting traffic and adjusting bandwidth and priorities in advance to avoid congestion or bottlenecks.
[0158] This process ensures that high-priority traffic transmission remains unaffected when a large number of protocol messages arrive, while optimizing bandwidth usage. Suppose that in a data center switch, some protocol messages have high timeliness requirements (such as video conferencing data streams), while other low-priority traffic (such as file backups) has a higher tolerance for latency. In this case, through dynamic bandwidth allocation and adjustments by the PFC control unit, the bandwidth allocation ratio for video traffic can be set to 70%, while the ratio for low-priority traffic can be set to 30%. Simultaneously, through traffic prediction, the system can identify traffic fluctuations in advance and adjust the rate of priority traffic to ensure smooth transmission of high-priority traffic in the network.
[0159] In one feasible implementation, step S60 includes steps A51 to A55:
[0160] A51: Get port load data for all ports;
[0161] It should be noted that port load data refers to the instantaneous or periodic average traffic intensity of each physical output port of the switch at a certain moment, usually presented in the form of packet count or byte rate.
[0162] In the specific implementation, the system periodically reads the "port byte count register" through an internal counter, divides the cumulative byte difference of each port by the sampling period, obtains the load value of that port, and finally forms a port load data table.
[0163] A52: Traverse port load data to identify a first set of ports with loads higher than a preset high load threshold and a second set of ports with loads lower than a preset low load threshold;
[0164] In the specific implementation, the system sequentially scans the port load data table, adds the port numbers with load values greater than the high threshold to the first port set, and adds the port numbers with load values less than the low threshold to the second port set.
[0165] A53: Select the low-priority traffic to be migrated from the first port set and determine the size of the traffic to be migrated;
[0166] In the specific implementation, the system reads the statistical information of a certain port queue in the first port set, identifies the lowest priority queue, calculates the number of packets that queue is expected to generate in the next sampling period, and uses this as the migration traffic size.
[0167] A54: Generates a traffic migration command carrying the size of the migrated traffic and the identifier of the target port in the second port set;
[0168] In the specific implementation, the system fills the above fields according to the internal message format to form a traffic migration instruction, and sends it to the routing decision unit through the management bus.
[0169] A55: Sends a traffic migration instruction to the routing decision unit so that the routing decision unit updates the forwarding table entries based on the traffic migration instruction and directs low-priority traffic to the target port.
[0170] In the specific implementation, after receiving the traffic migration instruction, the routing decision unit deletes the original entry for the low-priority traffic corresponding to the source port, adds a new forwarding rule pointing to the target port, and then the subsequent low-priority packets are redirected to the target port, thus completing load balancing.
[0171] This embodiment provides a switch priority traffic control method. Real-time traffic data enables the system to instantly perceive the congestion level of each priority queue. A dynamic threshold and bandwidth allocation mechanism ensures that high-priority traffic always receives stable bandwidth, while low-priority traffic is flexibly allocated as needed. A prediction model based on historical traffic sequences can adjust queue thresholds and bandwidth ratios before congestion occurs, achieving proactive prevention. The immediate issuance and execution of the second control command forms a millisecond-level closed-loop control, avoiding the accumulated delays in each stage of traditional solutions. Therefore, high-priority services no longer wait due to sudden traffic surges, and low-priority services are not excessively discarded due to static policies, ensuring full utilization of overall link resources and guaranteeing network service quality.
[0172] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in the first embodiment described above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 2 Step S50 includes steps S501 to S504:
[0173] Step S501: Compare the predicted load data with the preset load threshold to obtain the load comparison result;
[0174] It should be noted that the predicted load data is a quantitative estimate of the overall network traffic volume in the future period by the model;
[0175] The preset load threshold is a warning level pre-set by the system. Through numerical comparison, the system obtains two discrete conclusions: "above" or "not above," which are the load comparison results.
[0176] Step S502: When the load comparison result indicates that the predicted load data is greater than the preset load threshold, the current queue threshold of the low priority queue is reduced by a first preset step size to obtain the updated queue threshold.
[0177] It should be noted that the current queue threshold refers to the maximum allowed queuing depth for low-priority queues.
[0178] The first preset step size is the reduction range set by the system for gradual adjustment. Lowering this threshold makes it easier for low-priority packets to be dropped or deferred, freeing up cache resources.
[0179] Step S503: When the load comparison result indicates that the predicted load data is greater than the preset load threshold, the current proportion of high-priority bandwidth is increased by a second preset step size to obtain the updated bandwidth allocation proportion.
[0180] It should be noted that the current ratio refers to the proportion of high-priority traffic in the remaining bandwidth of the link;
[0181] The second preset step size is the increment range. Increasing this ratio will give high-priority messages more opportunities to be sent.
[0182] Step S504: Encapsulate the updated queue threshold and the updated bandwidth allocation ratio to obtain the second control instruction.
[0183] It should be noted that encapsulation refers to packaging the two adjustment results into an internal control message of a uniform format so that subsequent modules can execute it all at once.
[0184] This embodiment provides a switch priority traffic control method. By reducing the depth of low-priority queues in advance and simultaneously increasing the share of high-priority bandwidth, the system can complete resource allocation before high load arrives, significantly reducing the latency of high-priority services and improving the overall link utilization.
[0185] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the switch priority flow control method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.
[0186] This application also provides a switch priority flow control device, please refer to... Figure 3 The switch priority flow control device includes:
[0187] The data acquisition module 10 is used to acquire real-time traffic data of different priority traffic.
[0188] The first calculation module 20 is used to calculate the flow control parameters based on real-time flow data to obtain the first control command; and to divide the high-priority bandwidth and low-priority bandwidth based on the first control command to obtain the first allocation result.
[0189] The second calculation module 30 is used to predict future load based on historical traffic sequences to obtain predicted load data; and to update the queue threshold and bandwidth allocation ratio according to the predicted load data and the first allocation result to obtain the second control command.
[0190] The control module 40 is used to send the second control command to the port queue manager and the bandwidth allocation unit, so that the port queue manager controls the queue length according to the updated queue threshold and the bandwidth allocation unit schedules traffic according to the updated bandwidth allocation ratio.
[0191] The switch priority flow control device provided in this application, employing the switch priority flow control method in the above embodiments, can solve the technical problems of high latency and low bandwidth utilization in switch flow control. Compared with the prior art, the beneficial effects of the switch priority flow control device provided in this application are the same as those of the switch priority flow control method provided in the above embodiments, and other technical features in the switch priority flow control device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0192] In one embodiment, the data acquisition module 10 is further configured to read the current queue length of each priority queue at a preset sampling period to obtain queue length data;
[0193] Calculate the sending rate and latency for each priority traffic based on the queue length data;
[0194] The queue length data, sending rate, and latency are encapsulated to obtain real-time traffic data.
[0195] In one embodiment, the first calculation module 20 is further configured to compare the length of the high-priority queue in the real-time traffic data with a preset high threshold to obtain a first comparison result;
[0196] The second comparison result is obtained by comparing the length of the low-priority queue in the real-time traffic data with a preset low threshold.
[0197] When the first comparison result shows that the length of the high-priority queue exceeds a preset high threshold, a pause command is generated to pause the low-priority traffic.
[0198] When the second comparison result shows that the length of the low-priority queue is lower than a preset low threshold, a recovery instruction to restore low-priority traffic is generated.
[0199] The pause or resume command is used as the first control command.
[0200] In one embodiment, the first calculation module 20 is further configured to parse the first control command to obtain a first target ratio required for high-priority traffic and a second target ratio required for low-priority traffic;
[0201] The remaining bandwidth of the link is obtained based on the current total link bandwidth and the reserved bandwidth.
[0202] Multiply the remaining bandwidth of the link by the proportion of the first target to obtain the high-priority bandwidth;
[0203] Multiply the remaining bandwidth of the link by the proportion of the second target to obtain the low-priority bandwidth;
[0204] The high-priority bandwidth and low-priority bandwidth are written to the outgoing port scheduler to obtain the first allocation result.
[0205] In one embodiment, the second calculation module 30 is further configured to read historical traffic sequences from the storage unit for a preset number of sampling periods;
[0206] The historical traffic sequence is normalized to obtain a normalized sequence;
[0207] Inputting the normalized sequence into the trained time series prediction model yields a sequence of predicted flow values for a preset number of sampling periods in the future.
[0208] The predicted load data is obtained by calculating the average of the predicted flow value sequence.
[0209] In one embodiment, the second calculation module 30 is further configured to compare the predicted load data with a preset load threshold to obtain a load comparison result;
[0210] When the load comparison result indicates that the predicted load data is greater than the preset load threshold, the current queue threshold of the low priority queue is reduced by the first preset step size to obtain the updated queue threshold.
[0211] When the load comparison result indicates that the predicted load data is greater than the preset load threshold, the current proportion of high-priority bandwidth is increased by a second preset step size to obtain the updated bandwidth allocation proportion.
[0212] The updated queue threshold and the updated bandwidth allocation ratio are encapsulated to obtain the second control instruction.
[0213] In one embodiment, the control module 40 is further configured to acquire port load data for all ports;
[0214] Iterate through port load data to identify a first set of ports with loads above a preset high load threshold and a second set of ports with loads below a preset low load threshold.
[0215] Select low-priority traffic to be migrated from the first set of ports and determine the size of the traffic to be migrated;
[0216] Generate a traffic migration command that carries the size of the migrated traffic and the identifier of the target port in the second port set;
[0217] The traffic migration command is sent to the routing decision unit so that the routing decision unit updates the forwarding table entries based on the traffic migration command and directs low-priority traffic to the target port.
[0218] This application provides a switch priority flow control device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the switch priority flow control method in Embodiment 1 above.
[0219] The following is for reference. Figure 4 This document illustrates a structural diagram of a switch priority flow control device suitable for implementing embodiments of this application. The switch priority flow control device in this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 4The switch priority flow control device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0220] like Figure 4 As shown, the switch priority flow control device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to a program stored in ROM (Read Only Memory) 1002 or a program loaded from storage device 1003 into RAM (Random Access Memory) 1004. RAM 1004 also stores various programs and data required for the operation of the switch priority flow control device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via bus 1005. Input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to I / O interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows the switch priority flow control device to communicate wirelessly or wiredly with other devices to exchange data. While the figure shows switch priority flow control devices with various systems, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.
[0221] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0222] The switch priority flow control device provided in this application, employing the switch priority flow control method described in the above embodiments, can solve the technical problems of high latency and low bandwidth utilization in switch flow control. Compared with the prior art, the beneficial effects of the switch priority flow control device provided in this application are the same as those of the switch priority flow control method provided in the above embodiments, and other technical features of this switch priority flow control device are the same as those disclosed in the previous embodiment method, and will not be repeated here.
[0223] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0224] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0225] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the switch priority flow control method in the above embodiments.
[0226] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, RAM (Random Access Memory), ROM (Read Only Memory), EPROM (Erasable Programmable Read Only Memory or Flash Memory), optical fibers, CD-ROM (CD-Read Only Memory), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0227] The aforementioned computer-readable storage medium may be included in the switch priority flow control device; or it may exist independently and not be assembled into the switch priority flow control device.
[0228] The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by the switch priority flow control device, the switch priority flow control device causes the following: it acquires real-time flow data of different priority flows; calculates flow control parameters based on the real-time flow data to obtain a first control instruction; it divides high-priority bandwidth and low-priority bandwidth based on the first control instruction to obtain a first allocation result; it predicts future load based on historical flow sequences to obtain predicted load data; it updates the queue threshold and bandwidth allocation ratio based on the predicted load data and the first allocation result to obtain a second control instruction; and it sends the second control instruction to the port queue manager and the bandwidth allocation unit, so that the port queue manager controls the queue length according to the updated queue threshold and the bandwidth allocation unit schedules traffic according to the updated bandwidth allocation ratio.
[0229] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including LAN (Local Area Network) or WAN (Wide Area Network)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0230] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0231] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0232] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described switch priority flow control method, which can solve the technical problems of high latency and low bandwidth utilization in switch flow control. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the switch priority flow control method provided in the above embodiments, and will not be repeated here.
[0233] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the switch priority flow control method described above.
[0234] The computer program product provided in this application can solve the technical problems of high latency and low bandwidth utilization in switch flow control. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the switch priority flow control method provided in the above embodiments, and will not be repeated here.
[0235] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.
Claims
1. A method for switch priority flow control, the method comprising: The method comprises: obtaining real-time traffic data of different priority traffics; calculating a traffic control parameter according to the real-time traffic data to obtain a first control instruction; dividing high-priority bandwidth and low-priority bandwidth based on the first control instruction to obtain a first allocation result; predicting future load based on a historical traffic sequence to obtain predicted load data; updating a queue threshold and a bandwidth allocation ratio according to the predicted load data and the first allocation result to obtain a second control instruction; issuing the second control instruction to a port queue manager and a bandwidth allocation unit, so that the port queue manager controls the queue length according to the updated queue threshold, and the bandwidth allocation unit schedules traffic according to the updated bandwidth allocation ratio.
2. The method of claim 1, wherein, The step of obtaining real-time traffic data of different priority traffics comprises: reading the current queue length of each priority queue at a preset sampling period to obtain queue length data; calculating the sending rate and delay of each priority traffic according to the queue length data; encapsulating the queue length data, the sending rate and the delay to obtain real-time traffic data.
3. The method of claim 1, wherein, The step of calculating a traffic control parameter according to the real-time traffic data to obtain a first control instruction comprises: comparing the high-priority queue length in the real-time traffic data with a preset high threshold to obtain a first comparison result; comparing the low-priority queue length in the real-time traffic data with a preset low threshold to obtain a second comparison result; generating a pause instruction for pausing low-priority traffic when the first comparison result is that the high-priority queue length exceeds the preset high threshold; generating a resume instruction for resuming low-priority traffic when the second comparison result is that the low-priority queue length is lower than the preset low threshold; taking the pause instruction or the resume instruction as the first control instruction.
4. The method of claim 1, wherein, The step of dividing high-priority bandwidth and low-priority bandwidth based on the first control instruction to obtain a first allocation result comprises: analyzing the first control instruction to obtain a first target ratio required by high-priority traffic and a second target ratio required by low-priority traffic; obtaining link residual bandwidth based on the current total bandwidth of the link and the reserved bandwidth; multiplying the link residual bandwidth by the first target ratio to obtain high-priority bandwidth; multiplying the link residual bandwidth by the second target ratio to obtain low-priority bandwidth; writing the high-priority bandwidth and the low-priority bandwidth into an egress port scheduler to obtain a first allocation result.
5. The method of claim 1, wherein, The step of predicting future load based on a historical traffic sequence to obtain predicted load data comprises: reading a historical traffic sequence of a past preset number of sampling periods from a storage unit; performing normalization processing on the historical traffic sequence to obtain a normalized sequence; inputting the normalized sequence into a trained time series prediction model to obtain a predicted traffic value sequence of a future preset number of sampling periods; calculating the average of the predicted traffic value sequence to obtain predicted load data.
6. The method of claim 1, wherein, The step of updating a queue threshold and a bandwidth allocation ratio according to the predicted load data and the first allocation result to obtain a second control instruction comprises: The predicted load data is compared with a preset load threshold to obtain a load comparison result; When the load comparison result indicates that the predicted load data is greater than the preset load threshold, a current queue threshold of a low-priority queue is reduced by a first preset step to obtain an updated queue threshold; When the load comparison result indicates that the predicted load data is greater than the preset load threshold, a current proportion of a high-priority bandwidth is increased by a second preset step to obtain an updated bandwidth allocation proportion; The updated queue threshold and the updated bandwidth allocation proportion are encapsulated to obtain a second control instruction.
7. The method of claim 1, wherein, Further comprising: Obtaining port load data of all ports; Traversing the port load data to identify a first port set with load higher than a preset high load threshold and a second port set with load lower than a preset low load threshold; Selecting low-priority traffic to be migrated from the first port set and determining a migration traffic size; Generating a traffic migration instruction carrying the migration traffic size and a target port identifier in the second port set; Sending the traffic migration instruction to a routing decision unit to enable the routing decision unit to update a forwarding table entry and direct the low-priority traffic to the target port based on the traffic migration instruction.
8. A switch priority flow control apparatus, characterized by, The device comprises: A data acquisition module for acquiring real-time traffic data of different priority traffic; A first calculation module for calculating traffic control parameters based on the real-time traffic data to obtain a first control instruction, and dividing a high-priority bandwidth and a low-priority bandwidth based on the first control instruction to obtain a first allocation result; A second calculation module for predicting future load based on a historical traffic sequence to obtain predicted load data, and updating a queue threshold and a bandwidth allocation proportion based on the predicted load data and the first allocation result to obtain a second control instruction; A control module for issuing the second control instruction to a port queue manager and a bandwidth allocation unit to enable the port queue manager to control queue length based on the updated queue threshold, and enable the bandwidth allocation unit to schedule traffic based on the updated bandwidth allocation proportion.
9. A switch priority flow control device, characterized by, The device comprises a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the switch priority traffic control method according to any one of claims 1 to 7.
10. A storage medium, characterized by The storage medium is a computer-readable storage medium, and the storage medium stores a computer program, which is executed by a processor to implement the steps of the switch priority traffic control method according to any one of claims 1 to 7.