P4-based early flow type identification and traffic scheduling method, system and device
By adopting an early flow type identification and traffic scheduling method based on P4, the problems of fixed network device functions and response latency in SAGINs are solved, and microsecond-level response and adaptive scheduling of traffic are achieved, ensuring network efficiency, fairness and high throughput.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-29
- Publication Date
- 2026-03-31
AI Technical Summary
Existing network equipment, due to its use of fixed-function hardware and static scheduling strategies, is unable to adapt to the rapidly changing network conditions and service requirements in SAGINs (Space-Air-Ground Integrated Networks), leading to network congestion and performance degradation.
An early flow type identification and traffic scheduling method based on P4 is adopted. By extracting quintuples, compressed packet length feature values and sliding windows for multi-stage dynamic priority decision-making, combined with a hierarchical virtual time scheduling model, microsecond-level response and adaptive scheduling of traffic are achieved.
It enables rapid response to instantaneous traffic changes, ensures low-latency processing of high-priority traffic, avoids starvation of low-priority traffic, and maintains high network throughput and fairness.
Smart Images

Figure CN121418908B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer network communication technology and is applicable to application scenarios with high requirements for traffic dynamics and heterogeneity. Specifically, it relates to an early flow type identification and traffic scheduling method, system, and device based on P4. Background Technology
[0002] With the gradual development of 6G, the sixth-generation mobile communication technology, building a globally covered and seamless communication network has gradually become the core development goal. To achieve this goal, existing technologies have proposed a Space-Air-Ground Integrated Network (SAGINs). This network organically integrates high, medium, and low orbit satellite networks, aerial platforms such as drones, maritime platforms, and terrestrial cellular networks, aiming to provide connectivity services to any corner of the world.
[0003] However, due to its inherent characteristics, such as the drastic dynamic changes in topology caused by the high-speed movement of satellites and the flexible deployment of drones, the huge propagation latency and heterogeneous bandwidth characteristics of satellite-to-ground and inter-satellite links, as well as the diverse and even conflicting demands on network performance from emerging services such as remote control, holographic communication, and massive Internet of Things, this network architecture constitutes an extremely complex network environment. In such an environment, ensuring key service quality indicators such as ultra-low latency, fast flow completion time, and high throughput has become the core challenge of network design.
[0004] Because traditional network devices still use fixed-function hardware and static scheduling strategies, such as Strict Priority (SP) or Weighted Round Robin (WRR), their service logic is rigid and difficult to adapt to the rapidly changing network conditions and service requirements in SAGINs. These mechanisms cannot respond to changes in link quality or sudden traffic on a microsecond-level time scale, resulting in network congestion, performance degradation, and a serious impact on user experience.
[0005] Therefore, the extreme dynamism of SAGINs places strict requirements on the programmability and adaptability of the network data plane.
[0006] To address these issues, this application proposes a method, system, and device for early flow type identification and traffic scheduling based on P4, which is a dynamic adaptive packet scheduling mechanism that can adapt to the highly dynamic environment of SAGINs, thus solving the aforementioned technical problems. Summary of the Invention
[0007] The main objective of this invention is to provide an early flow type identification and traffic scheduling method, system, and device based on P4 to solve the technical problems mentioned in the background art, such as fixed functions, large resource consumption, high response latency, or inability to balance priority and fairness. It seeks to achieve a delicate balance between "functional complexity" and "resource constraints" by completely embedding the core decision-making logic into a programmable data plane defined by languages such as P4, so as to achieve microsecond-level response to instantaneous traffic changes.
[0008] The present invention solves the above-mentioned technical problems by adopting the following technical solutions:
[0009] A method for early flow type identification and traffic scheduling based on P4, characterized by comprising:
[0010] Step S1. For data packets arriving at the programmable switch, extract the 5-tuple and perform bidirectional flow identification to determine its flow ID;
[0011] Synchronously compress the data packet length to obtain a compressed packet length feature value, and based on the packet counter associated with the flow ID and the sliding window storing historical compressed packet length feature values, perform a multi-stage dynamic priority decision process to determine a current priority for the data packet;
[0012] Step S2. Calculate a scheduling HVT Rank value based on the determined current priority, the virtual completion time of the previous data packet associated with the flow ID, and the compressed packet length feature value, and queue and schedule data packets according to the scheduling HVT Rank value.
[0013] Preferably, in step S1, before calculating the flow hash value, the five-tuple extracted from the data packet—source / destination IP address, source / destination port number, and protocol number—is normalized. For example, the smaller IP address is fixed as the source IP address, and the smaller port number is fixed as the source port, so that the traffic in the request and response directions obtains the same hash key, thereby determining its flow ID by calculating the flow hash value.
[0014] Preferably, in the process of compressing the data packet length in step S1: a range-based quantization mechanism is adopted, and the original length of the data packet is mapped to a predefined, shorter compressed packet length feature value through a set of matching action tables in P4 registers, so as to save data plane storage resources.
[0015] Preferably, the execution flow of the multi-stage dynamic priority decision-making process in step S1 includes:
[0016] Step S11. Initial default allocation phase: Before the sliding window is filled, a temporary default priority is assigned to the current data packet based on its compressed packet length characteristic value;
[0017] Step S12. Early classification stage: When the sliding window is filled for the first time, a basic priority is determined for the stream based on the pattern formed by the length feature values of all compressed packets in the window;
[0018] Step S13. Subsequent Hysteresis Adjustment Stage: After the early classification stage, hysteresis logic is adopted to dynamically adjust or maintain the priority of the current data packet based on the degree of deviation between the compressed packet length feature value of the current data packet and the historical feature value within the sliding window. This hysteresis logic mainly applies to the data stream that is currently in the middle priority, and its purpose is to adjust it only when the stream undergoes drastic feature changes, so as to avoid frequent oscillations caused by small fluctuations.
[0019] Preferably, the hysteresis logic in step S13 is as follows: First, read the compressed packet length feature values of the first three historical data packets stored in the sliding window and calculate their sum. Simultaneously, obtain the compressed packet length feature value of the currently arriving data packet and amplify its value by three times.
[0020] Then, a hysteresis comparison was performed:
[0021] A. Degradation judgment: If three times the current packet length feature value is greater than the sum of the feature values of the previous three packets and a preset hysteresis threshold, it indicates that the current packet size has increased significantly and the flow feature has changed abruptly. At this time, the priority of the flow is reduced.
[0022] B. Upgrade Judgment: If three times the current packet length feature value plus the preset hysteresis threshold is still less than the sum of the feature values of the previous three packets, it indicates that the current packet size has decreased significantly. In this case, the priority of the flow will be increased.
[0023] C. Maintain judgment: If neither of the above two conditions is met, it means that the change in flow characteristics is within the tolerance range, and the current priority remains unchanged.
[0024] Preferably, the hysteresis logic used in the subsequent hysteresis adjustment stage of step S13 is as follows: priority change is triggered only when the difference between the compressed packet length feature value of the current data packet and the average value of the historical feature values within the sliding window exceeds a preset adjustment threshold, so as to enhance the stability of priority allocation and avoid rapid priority changes.
[0025] Preferably, the calculation of the scheduling HVT Rank value in step S2 utilizes a hierarchical virtual time HVT model, and the specific steps include:
[0026] S21. Map the current priority determined in step S1 to two scheduling parameters: a preset virtual time baseline and a weight. The priority mapping process of S1 is achieved by predefining a set of strictly hierarchical baseline constants and weight constants in the data plane to ensure that traffic of different priorities is strictly isolated in the virtual time domain.
[0027] S22. Compare the virtual time baseline with the virtual completion time of the previous packet in this flow, and take the larger one as the virtual start time. ;
[0028] S23. Calculate the HVT Rank value using the following formula: , This is the length feature value of the compressed file.
[0029] S24. Write the calculated HVT Rank value back to the virtual completion time register as the new virtual completion time for the stream, thus achieving a state update to ensure the order of data packets within the same stream.
[0030] Preferably, during the queuing and scheduling process in step S2, an adaptive congestion awareness and mitigation mechanism is also set up for low-priority queues. This mechanism takes effect in the early classification stage and traffic scheduling, including:
[0031] In the data plane, the arrival rate of packets in one or more low-priority queues is monitored in real time through a set of P4 registers. When the rate exceeds a congestion rate threshold within a set time window, the queue is determined to be in a congested state.
[0032] In response to the congestion state, for new flows that should have been assigned low priority according to the early classification stage of step S1, the current priority of the low-priority flow that arrives is promoted to a second-lowest priority as the "effective priority" in step S1, so that it can enter the second-lowest priority queue during scheduling in S2, effectively alleviating the starvation problem of the lowest priority flow.
[0033] In another aspect, the present invention also discloses an early flow type identification and traffic scheduling system based on P4, for performing the steps of any of the methods described above, including:
[0034] The early flow type identification module is used to extract the five-tuple and perform bidirectional flow identification on all data packets arriving at the programmable P4 switch to determine the unique flow ID of the flow to which it belongs; compress the length of the data packets to obtain a compressed packet length feature value; and perform a multi-stage dynamic priority decision process based on the packet counter associated with the flow ID and a sliding window storing historical compressed packet length feature values to determine a basic priority and a current priority for the data packets.
[0035] The adaptive congestion awareness and flow scheduling module is used to monitor the packet arrival rate of low-priority queues in real time using data plane registers. When queue congestion is detected, the current priority of newly arriving low-priority flows is raised to the second lowest priority. The module also uses a hierarchical virtual time (HVT) scheduler to calculate a globally unique scheduling HVT Rank value by combining the current priority, the historical virtual completion time of the flow, the preset weight, and the compressed packet length feature value. This allows data packets to enter the hierarchical queue to wait for scheduling based on the HVT Rank value.
[0036] In another aspect, the present invention also discloses a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the method described above.
[0037] As can be seen from the above technical solutions, the present invention provides a method, system, and device for early flow type identification and traffic scheduling based on P4. Compared with the prior art, the present invention has the following advantages:
[0038] 1. This invention dynamically allocates and adjusts service priorities for each flow by performing online analysis of the limited packet length characteristics in the early stages of each flow's lifecycle, and achieves efficient and fair resource allocation by combining advanced scheduling algorithms.
[0039] 2. This invention utilizes data plane programmable technology, represented by the P4 language, which, through its three major characteristics of protocol independence, target independence, and field reconfigurability, endows network switching equipment with unprecedented flexibility, enabling the direct definition and implementation of complex message processing and forwarding logic in the data plane according to specific needs.
[0040] It should be understood that the descriptions in this section are not intended to identify key or essential features of embodiments of the invention, nor are they intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Of course, implementing any product of the invention does not necessarily require achieving all of the advantages described above simultaneously. Attached Figure Description
[0041] The accompanying drawings, which form part of this application, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an undue limitation of the invention. In the drawings:
[0042] Figure 1 This is a schematic diagram of the overall system architecture and data packet processing flow of the present invention;
[0043] Figure 2 This is a schematic view of a highly heterogeneous air-space-ground integrated network in the background technology of this invention;
[0044] Figure 3 This is a schematic diagram of the quintuple normalization process for bidirectional stream recognition in an embodiment of the present invention;
[0045] Figure 4 This is a schematic diagram of the sliding window mechanism implemented based on the P4 register in an embodiment of the present invention;
[0046] Figure 5 This is the state transition diagram of the low-priority queue congestion state mechanism in this embodiment of the invention;
[0047] Figure 6 This is a schematic diagram illustrating the logical layering of the three scheduling models in this embodiment of the invention;
[0048] Figure 7 This is a topology diagram used in the embodiments of the present invention;
[0049] Figure 8 This is a performance comparison chart of average flow completion time for each priority flow type in this embodiment of the invention.
[0050] Figure 9 This is a comparison chart of the average end-to-end latency performance of each priority traffic type in this embodiment of the invention.
[0051] Figure 10 This is a comparison chart of the total throughput performance of the system in this embodiment of the invention;
[0052] Figure 11 This is a comparison chart of the impact of parameters on the performance of flow completion time in the embodiments of the present invention;
[0053] Figure 12 This is a comparison chart showing the impact of parameters on end-to-end latency performance in embodiments of the present invention. Detailed Implementation
[0054] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0055] For details in the embodiments, please refer to Figures 1 to 12 .
[0056] like Figure 1 As shown in the embodiments of the present invention. Figure 1As shown, the scheduling intelligence of this method is fully embedded in the data plane pipeline of the P4 switch. This method achieves rapid, efficient, and self-contained service priority differentiation and dynamic adjustment by online sensing and analysis of early behavioral characteristics of the data flow. Finally, combined with a hierarchical virtual time scheduling model, it enables refined service quality assurance for different business needs.
[0057] The specific processing flow of this method is divided into two aspects according to function: traffic type identification and traffic scheduling, including:
[0058] L1. Perform early flow type identification: For all packets arriving at the programmable P4 switch, extract the 5-tuple and perform bidirectional flow identification to determine the unique flow ID of the flow to which it belongs; compress the length of the packets to obtain a compressed packet length feature value; based on the packet counter associated with the flow ID and the sliding window storing historical compressed packet length feature values, perform a multi-stage dynamic priority decision process to determine a base priority and a current priority for the packets.
[0059] At this point, the specific operation process for early stream type identification includes:
[0060] L11. Performs precise bidirectional stream identification and packet length compression.
[0061] L111. Bidirectional Flow Identification: To ensure that the forward and reverse traffic of a single business interaction is identified as a single flow, the system normalizes the source / destination IP address, source / destination port number, and protocol number of the data packet's five-tuple information before calculating the hash value. Specifically, the system always uses the IP address and port number with the smaller value as the source address and source port in the normalized five-tuple, thus ensuring that round-trip traffic always generates a stable and unique flow ID. This identification process borrows the idea of cuckoo hashing, calculating two candidate hash indices for the flow to effectively reduce hash collisions.
[0062] L112. Packet Length Compression: Due to the extremely limited on-chip storage resources in the data plane, this invention employs a range-mapping-based quantization mechanism to compress packet lengths. Through the matching action table in P4, the complete length range of Ethernet packets is efficiently mapped into several fixed, shorter feature values, greatly saving storage resources.
[0063] L12. Perform multi-stage dynamic priority decision-making. This mechanism is coupled with the stream's lifecycle, utilizing a sliding window of size four implemented in the P4 register to store historical compressed packet length features, and dividing the decision-making process into three consecutive stages:
[0064] L121. Initial Default Allocation Phase: For the first 3 packets of a new flow, the system lacks sufficient historical information at this time. Therefore, based on heuristic observation, a temporary default priority is assigned to each packet according to the compressed packet length of the current single packet: packets with a compressed packet length of less than or equal to 2 are given temporary high priority, otherwise they are given temporary medium priority.
[0065] L122. Early Flow Classification Phase: When the fourth packet of a flow arrives, the sliding window is full. The system reads the length characteristics of all four compressed packets within the window and matches them with a set of predefined typical traffic patterns designed to capture different application types, such as the "control flow" pattern of consecutive small packets, the "interactive application" pattern of alternating large and small packets, and the "burst" pattern of consecutive large packets, thereby determining a more accurate and stable basic priority for the flow.
[0066] L123. Subsequent Hysteresis Adjustment Phase: For the fifth and subsequent packets in a flow, the system employs a priority hysteresis adjustment algorithm. To adapt to changes in flow behavior while avoiding drastic priority oscillations, this algorithm uses hysteresis logic. It determines whether the flow's behavior pattern has undergone a significant and sustained change by comparing the compressed packet length of the newly arriving packet with the average size of historical packets within the sliding window. Priority changes are triggered only when the difference between the new packet size and the historical average exceeds a preset adjustment threshold; otherwise, the priority remains unchanged, achieving stable dynamic adaptive scheduling throughout the entire process.
[0067] L2. Adaptive congestion awareness and flow scheduling: The data plane register is used to monitor the packet arrival rate of the low-priority queue in real time. When the queue is congested, the current priority of newly arriving low-priority flows is raised to the second lowest priority. A hierarchical virtual time (HVT) scheduler is used to calculate a globally unique scheduling HVT Rank value by combining the current priority, the historical virtual completion time of the flow, the preset weight, and the compressed packet length feature value. Data packets enter the hierarchical queue to wait for scheduling according to the HVT Rank value.
[0068] The specific operational procedures for implementing adaptive congestion awareness and traffic scheduling at this time include:
[0069] L21. The scheduling ranking value HVT Rank is calculated using the hierarchical virtual time (HVT) scheduler.
[0070] L211. To achieve a unified approach of differential service, inter-flow fairness, and intra-flow ordering, this method calculates a globally unique scheduling HVT Rank value for each packet, which represents the virtual completion time of the packet.
[0071] The calculation of the L212. HVT Rank value integrates four key factors: First, it maps the current effective priority of the data packet to a huge virtual time baseline and a weight value to macroscopically isolate virtual time domains of different priorities; second, it obtains the virtual completion time of the previous data packet in the flow to which the data packet belongs to ensure the first-in-first-out order of data packets within the same flow; and finally, it combines the compressed packet length feature value of the data packet for calculation.
[0072] The calculated HVT Rank value of L212 ensures that high-priority packets receive a smaller rank value and are scheduled first, and the packets are then sent to the appropriate hierarchical queue according to this value.
[0073] L22. Design and implement an adaptive congestion sensing and mitigation mechanism.
[0074] L221. Congestion Awareness: This mechanism monitors the packet arrival rate of low-priority queues in real time via registers within the P4 data plane. The system periodically checks the number of packets arriving at a specific priority queue within that time window every 5 milliseconds. When this rate consistently exceeds a preset congestion rate threshold, the queue is determined to be in a congested state.
[0075] L222. Congestion Mitigation: Once congestion is detected, the system will trigger mitigation measures. For newly arriving flows that should have been classified as the lowest priority in the S12 "Early Flow Classification Phase", the decision module will proactively raise their effective priority to a higher, second-lower level, thereby reducing the traffic entering the congestion queue from the source.
[0076] L223. Starvation Mitigation: In addition, the HVT scheduling model incorporates anti-starvation logic. When calculating the HVT Rank value, the system checks if a flow's "previous packet virtual completion time" is significantly behind its priority's corresponding "virtual time baseline." This indicates that the flow has not been scheduled for a long time, and the system will forcibly pull its scheduling starting point back to the current virtual time baseline. This effectively provides the flow with another opportunity to re-engage in scheduling contention, thus effectively avoiding the indefinite "starvation" problem in traditional strict priority (SP) scheduling.
[0077] Based on the above operational process, the specific implementation steps in the specific embodiment are as follows:
[0078] Step L1 Traffic Type Identification:
[0079] L1.1: When a data packet enters the programmable switch, it first enters the flow identification and data packet length feature extraction section. One of the core functions of this section is to achieve accurate bidirectional flow identification, and the identification process is as follows: Figure 3As shown. To address the issue that traditional 5-tuple hashing methods might identify forward and reverse traffic from a single business interaction as two independent flows, this method normalizes the 5-tuple information of the data packet—source / destination IP address, source / destination port number, and protocol number—before calculating the hash value. Specifically, the system always uses the smaller IP address and port number as the source address and source port in the normalized 5-tuple, ensuring that a stable and unique "normalized 5-tuple" is always generated in both directions of a single interaction session. Subsequently, the system uses this normalized 5-tuple to calculate the unique signature of the flow and two different hash indices. Borrowing the idea of cuckoo hashing, it searches or inserts data at two candidate positions in the flow table, effectively reducing the probability of hash collisions and improving the utilization of flow table resources.
[0080] L1.2: After determining flow attribution, the module performs lightweight processing on the packet length characteristics. Since on-chip storage resources in the data plane are extremely valuable, directly storing the original packet length would severely limit the number of flows the system can track. Therefore, this invention employs a range-mapping-based quantization mechanism to compress packet length. This mechanism divides the full length range of Ethernet packets—64 to 1514 bytes—into several non-uniform intervals, mapping each interval to a fixed-length, shorter feature value. This non-linear partitioning strategy fully considers that the length differences of small-sized packets are more critical for flow type determination, while subtle differences between large-sized packets are insignificant. This mapping process is efficiently implemented in P4 through a matching action table, improving storage efficiency several times over without introducing additional processing latency.
[0081] L1.3: Packets enter the multi-stage dynamic priority decision module. This module divides the processing of a flow into three consecutive stages based on its lifecycle. For the first three packets of a new flow, the system uses an initial default allocation strategy. Due to the lack of historical information at this time, the system assigns a temporary default priority based on a common heuristic observation—that initial packets for latency-sensitive applications are usually smaller. For example, smaller packets are given a temporary high priority, and larger packets are given a temporary medium priority to provide initial quality of service differentiation.
[0082] L1.4: When the fourth packet of a flow arrives, the system triggers a one-time early flow classification. At this time, a sliding window, implemented by hardware registers, used to store the compressed packet length characteristics of the four most recent packets, is filled. The sliding window mechanism is as follows: Figure 4As shown, the system reads four feature values within the window and matches them against a set of predefined rules designed to capture typical traffic patterns for different application types. For example, a continuous small packet pattern might be identified as a control flow and given the highest priority, while an alternating pattern of large and small packets might be identified as an interactive application flow. Alongside classification, the system also introduces a tiered congestion protection mechanism that monitors the congestion status of each egress queue in real time. If a flow's intended queue is congested, the system promotes it to a less loaded, suboptimal queue. Therefore, the system records two priorities for flows: a "raw priority" reflecting its inherent behavior and an "effective priority" that considers the real-time network state; the latter is used for current actual scheduling.
[0083] L1.5: For the fifth and subsequent packets in a flow, the system employs a priority hysteresis adjustment algorithm. To adapt to changes in flow behavior while avoiding drastic priority oscillations, this algorithm adds a certain degree of "inertia" to priority changes. It determines whether the flow's behavior pattern has undergone a significant and sustained change by comparing the size of the newly arriving packet with the average size of historical packets within the sliding window. Priority downgrading or upgrading is only triggered when the new packet size is significantly larger or smaller than the historical average; otherwise, the priority remains unchanged, thus achieving stable dynamic adaptive scheduling throughout the entire process.
[0084] Step L2 traffic scheduling:
[0085] SL.1: Data packets enter the hierarchical virtual time scheduling and congestion mitigation module. Figure 5 This diagram illustrates the state transition mechanism of the congestion mitigation module. To achieve a unified approach of differential service, inter-flow fairness, and intra-flow ordering, this method calculates a globally unique scheduling HVT Rank value for each data packet, representing the virtual completion time of the packet. The calculation of the HVT Rank value integrates four key factors: a large virtual time baseline determined by the current effective priority of the data packet, used to macroscopically isolate virtual time domains of different priorities; the virtual completion time of the previous data packet in the flow to which the data packet belongs, to ensure the first-in, first-out order of data packets within the same flow; a weight determined by the current priority, used to determine the degree of "penalty" of the data packet length on virtual time; and the length feature value of the compressed data packet. The HVT Rank value calculated by this model will serve as the most important basis for data packet enqueueing and scheduling. To intuitively illustrate how the weight determines the degree of "penalty" of the data packet length on virtual time, we use a data packet with a compressed packet length feature value of 5 as an example for comparison:
[0086] If the packet belongs to the highest priority (Class 0), with a corresponding weight of 10, then the virtual time increment generated by the packet is 50. This means that it is only shifted backward a small amount on the scheduling timeline and can be processed quickly.
[0087] If the data packet belongs to a low priority (Class 3), its corresponding weight is as high as 10000, then the virtual time increment generated by a data packet of the same size becomes 50000.
[0088] This means that in a low-priority queue, sending a data packet of the same size will result in a longer virtual completion time. This mechanism forces large packets in a low-priority flow to 'give way,' thereby achieving short-flow priority within the same priority level while ensuring extremely low latency for high-priority services globally.
[0089] L2.2: A lightweight congestion awareness and mitigation mechanism for low-priority queues. This mechanism continuously monitors the packet arrival rate of the lowest-priority queue within the data plane. When this rate consistently exceeds a preset threshold over a period of time, the queue is considered congested. Upon detection of congestion, the system triggers mitigation measures: for newly arriving flows that should have been classified as lowest priority, the decision module proactively elevates their effective priority to a higher level, reducing traffic entering the congestion queue at its source; simultaneously, for existing flows already waiting in the queue, HVT's Rank calculation logic forcibly pulls their virtual timeline back to near the current baseline, effectively providing them with a second chance to re-engage in scheduling contention, thus avoiding indefinite starvation.
[0090] Furthermore, based on the above operational results, a comprehensive test and evaluation of the performance of its operational process is required. The test verification and result analysis are as follows:
[0091] A simulation platform was built, and the results were compared with two classic baseline scheduling algorithms—strict priority (SP) and first-in, first-out (FIFO). The scheduling logic of the three models is as follows: Figure 6 As shown.
[0092] The experimental environment was set up on an Ubuntu 20.04.6 LTS operating system. A dumbbell-shaped network topology containing two hosts (H1, H2) and a core switch (SW) was constructed using the Mininet network emulator, as follows: Figure 7As shown. The core switch is a BMv2 software programmable switch with a v1model architecture, loaded with the P4 program designed in this invention. The link bandwidth between the host and the switch is set to 80 Mbps to simulate a bandwidth-limited congestion bottleneck. The control plane communicates with the switch through the P4Runtime interface, responsible for issuing the initial forwarding table rules at the start of the experiment and collecting and processing performance statistics through the controller script after the experiment.
[0093] The traffic settings in the experiment were designed to simulate typical congestion in a 6G integrated terrestrial-satellite network, where high-priority critical services and high-bandwidth background data flows compete for resources on limited links. To ensure the realism of the traffic, the service type ratio and traffic characteristics were based on publicly available real-world network datasets, and a "continuous pressure" congestion scenario was designed. The traffic generator first generates continuous background traffic at a rate of 40 Mbps, initially classified as the lowest priority in the scheduler; subsequently, a mixed short-flow "attack traffic" consisting of high-priority and second-highest-priority traffic with a total rate of up to 60 Mbps is injected. This brings the total traffic rate entering the switch to 100 Mbps, exceeding the bottleneck link bandwidth of 80 Mbps, thus causing continuous and severe congestion in the switch's internal queues. This provides a basis for evaluating and comparing the performance of different scheduling algorithms under extreme competitive conditions. The evaluation metrics mainly include average flow completion time (FCT), average end-to-end latency, and total network throughput.
[0094] Based on the test results, it can be seen that the early flow type identification and traffic scheduling method and system based on P4 proposed in this invention exhibit significant advantages in all performance indicators. For example... Figure 8 and Figure 9 As shown, in terms of flow completion time and end-to-end latency, the performance of the mechanism of this invention is optimal for the highest priority Class 0 and Class 1 traffic, with FCT and latency significantly lower than SP and FIFO. This demonstrates that this invention, through early flow identification and HVT Rank value calculation, can quickly assign extremely high scheduling weights to packets of high-priority flows, allowing them to be processed with almost no queuing. For the lowest priority Class 3 traffic, a severe "starvation" phenomenon occurs under SP scheduling, with its FCT and latency increasing exponentially; in contrast, the performance of Class 3 traffic under the mechanism of this invention is far superior to SP, demonstrating good fairness. This is mainly due to the hierarchical virtual time mechanism ensuring that low-priority queues can also obtain service opportunities over time, and the proactive intervention of congestion adaptive detection and timeline reset mechanisms when queues are backlogged.
[0095] In terms of total network throughput, such as Figure 10As shown, the mechanism of this invention achieves 98.074 Mbps, which is very close to the theoretically optimal FIFO mechanism (99.937 Mbps) and significantly higher than the SP mechanism (87.275 Mbps). The SP mechanism, due to its strict preemption rules, may lead to link idleness at certain times, thus reducing overall utilization. In contrast, this invention, through its virtual time scheduling and anti-starvation design, ensures that the link can be effectively utilized as long as there are data packets in the queue, proving that this scheme achieves complex priority scheduling and fairness guarantees while almost without sacrificing overall network throughput performance.
[0096] like Figure 11 and Figure 12 As shown in the diagram, the congestion determination rate threshold for different priority P3 queues (representing the maximum number of data packets allowed to arrive at the queue within the system's set congestion monitoring time window) is used. When the actual number of arriving data packets exceeds this threshold, the system determines that the queue is congested and triggers the congestion mitigation mechanism. This is then combined with... Figure 11 and Figure 12 The sensitivity analysis of key parameters in the congestion mitigation module of this invention is as follows: The parameters exist within an optimal working range, within which the fairness of ensuring low-priority flows is most effectively balanced with avoiding excessive interference to medium-priority flows, verifying the effectiveness and robustness of the adaptive mechanism. In summary, the proposed solution demonstrates excellent performance in ensuring high-priority services, resolving low-priority starvation, and maintaining high network throughput, providing an effective solution for lightweight, fine-grained, and dynamically adaptive packet scheduling in a programmable data plane.
[0097] On the other hand, the present invention also discloses an early flow type identification and traffic scheduling system based on P4, used to perform the steps of the method in the above embodiment.
[0098] In summary, this invention provides core technical support for addressing the aforementioned challenges through data plane programmable technology, represented by the P4 language. P4, with its three key characteristics of protocol independence, target independence, and context-reconfigurability, endows network switching equipment with unprecedented flexibility, enabling users to directly define and implement complex packet processing and forwarding logic in the data plane according to specific needs. This makes it possible to deploy intelligent scheduling algorithms within switches that can sense flow characteristics and dynamically adjust service policies. Embedding the intelligence of scheduling decisions into the data plane ensures microsecond-level response to instantaneous traffic changes, which is crucial for meeting the stringent QoS requirements of SAGINs. Therefore, this invention focuses on utilizing the capabilities of the P4 programmable data plane to adapt to the highly dynamic environment of SAGINs, not only solving key QoS guarantee issues in SAGINs but also providing a new paradigm for intelligent and efficient resource management in future networks.
[0099] In another aspect, the present invention also discloses a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the method described above.
[0100] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the P4-based early flow type identification and traffic scheduling methods described above.
[0101] It is understood that the system provided in the embodiments of the present invention corresponds to the method provided in the embodiments of the present invention, and the explanation, examples and beneficial effects of the relevant content can be referred to the corresponding parts of the above methods.
[0102] This application also provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, communication interface, and memory communicate with each other via the communication bus.
[0103] Memory, used to store computer programs;
[0104] When the processor executes the program stored in memory, it implements the above-mentioned early flow type identification and flow scheduling method based on P4.
[0105] The communication bus mentioned in the above-mentioned electronic devices can be a standard bus for interconnecting peripheral components or an extended industrial standard structure bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc.
[0106] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0107] The memory may include random access memory or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0108] The processors mentioned above can be general-purpose processors, including central processing units, network processors, etc.; they can also be digital signal processors, application-specific integrated circuits, field-programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0109] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, an optical medium, or a semiconductor medium, etc.
[0110] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
[0111] Furthermore, it should be noted that if any directional indication (such as up, down, left, right, front, back, etc.) is involved in the embodiments of the present invention, the directional indication is only used to explain the relative positional relationship and movement of each component in a specific posture. If the specific posture changes, the directional indication will also change accordingly.
[0112] Furthermore, if the embodiments of this invention involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the meaning of "and / or" throughout the text includes three parallel solutions; for example, "A and / or B" includes solution A, solution B, or a solution where both A and B are satisfied simultaneously. Furthermore, in the embodiments of this invention, "multiple" refers to two or more. Moreover, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
Claims
1. A P4-based early flow type identification and traffic scheduling method, characterized in that, Comprising: Step S1. Extracting the five-tuple and performing bidirectional flow identification to determine the flow ID for the data packet arriving at the programmable switch; Synchronously compressing the data packet length to obtain a compressed packet length feature value, and based on the packet counter associated with the flow ID and the sliding window storing the historical compressed packet length feature values, performing a multi-stage dynamic priority decision process to determine a current priority for the data packet; Step S2. Calculating a scheduling HVT Rank value according to the determined current priority, the virtual completion time of the last data packet associated with the flow ID, and the compressed packet length feature value, and queuing and scheduling the data packet according to the scheduling HVT Rank value; The execution flow of the multi-stage dynamic priority decision process in step S1 includes: Step S11. Initial default allocation stage: before the sliding window is filled, a temporary default priority is assigned to the current data packet according to the compressed packet length feature value of the current data packet; Step S12. Early classification stage: when the sliding window is first filled, a base priority is determined for the flow according to the pattern formed by all compressed packet length feature values in the window; Step S13. Subsequent hysteresis adjustment stage: after the early classification stage, a hysteresis logic is used to dynamically adjust or maintain the priority of the current data packet according to the deviation of the compressed packet length feature value of the current data packet from the historical feature values in the sliding window; The hysteresis logic in step S13 is: first, read the compressed packet length feature values of the first three historical data packets stored in the sliding window and calculate their sum, at the same time, obtain the compressed packet length feature value of the newly arrived data packet and amplify its value by 3 times; Then perform hysteresis comparison: A. If 3 times the current packet length feature value is greater than the sum of the total of the first three historical packet feature values and a preset hysteresis threshold, it means that the size of the current data packet has significantly increased and the flow characteristics have changed, at this time the priority of the flow is reduced; B. If 3 times the current packet length feature value plus the preset hysteresis threshold is still less than the total of the first three historical packet feature values, it means that the size of the current data packet has significantly decreased, at this time the priority of the flow is increased; C. Otherwise, it means that the change of flow characteristics is within the tolerance range, and the current priority is maintained; The calculation of the scheduling HVT Rank value in step S2 uses a hierarchical virtual time HVT model, and the specific steps include: S21. mapping the current priority level determined in S1 to two scheduling parameters, a pre-set virtual time baseline and a weight ; S22. Compare the virtual time baseline and the virtual completion time of the previous data packet of the flow, and take the greater one as the virtual start time ; S23. Calculate the HVT Rank value, the calculation formula is: , is the compressed package length characteristic value; S24. Write the calculated HVT Rank value back to the virtual completion time register as the new virtual completion time of the flow, and finally realize state update to ensure the order of data packets within the same flow; In the queuing and scheduling process of step S2, a set of adaptive congestion awareness and mitigation mechanisms are also set for low priority queues, including: Monitoring the data packet arrival rate of one or more low priority queues in the data plane through a set of P4 registers, and when the rate exceeds a congestion rate threshold within a set time window, it is determined that the queue is in a congested state; In response to the congestion state, the current priority of a newly arrived low priority flow is increased to the next low priority for a new flow that should have been assigned a low priority according to the early classification stage of S1.
2. The P4-based early flow type recognition and traffic scheduling method of claim 1, wherein, The step S1 normalizes the quintuple of the data packet: source / destination IP address, source / destination port number and protocol number, determines the flow ID by calculating the flow hash value.
3. The P4-based early flow type recognition and traffic scheduling method of claim 1, wherein, In the step S1 of compressing the length of the data packet, a range mapping-based quantization mechanism is adopted, and through a matching action table in a set of P4 registers, the original length of the data packet is mapped to a predefined, shorter compressed packet length feature value, so as to save the data plane storage resource.
4. The P4-based early flow type recognition and traffic scheduling method of claim 1, wherein, The hysteresis logic adopted in the subsequent hysteresis adjustment stage of the step S13 is specifically: only when the difference between the compressed packet length feature value of the current data packet and the average value of the historical feature values in the sliding window exceeds the preset adjustment threshold, the change of the priority is triggered, so as to enhance the stability of the priority allocation and avoid the rapid change of the priority.
5. A P4-based early flow type identification and traffic scheduling system for performing the steps of the method of any one of claims 1-4, characterized in that, It comprises: an early flow type identification module for extracting the quintuple and performing bidirectional flow identification to determine the unique flow ID of the flow to which the data packet arriving at the programmable P4 switch belongs; compressing the length of the data packet to obtain a compressed packet length feature value; based on the packet counter associated with the flow ID and the sliding window storing the historical compressed packet length feature values, a multi-stage dynamic priority decision process is performed to determine a basic priority and a current priority for the data packet; an adaptive congestion awareness and traffic scheduling module for monitoring the packet arrival rate of the low priority queue in real time by using the data plane register, and when the queue is congested, the current priority of the newly arrived low priority flow is raised to the next low priority; and a hierarchical virtual time HVT scheduler is adopted, and the current priority, the historical virtual completion time of the flow, the preset weight and the compressed packet length feature value are integrated to calculate a globally unique scheduling HVT Rank value, so that the data packet enters the hierarchical queue according to the HVT Rank value for scheduling.
6. A computer device, comprising: It comprises a memory and a processor, the memory stores a computer program, and the computer program is executed by the processor, so that the processor executes the steps of the method according to any one of claims 1 to 4. It comprises a memory and a processor, the memory stores a computer program, and the computer program is executed by the processor, so that the processor executes the steps of the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Flow scheduling method and system based on dynamic priority
CN116489104A
Network traffic regulation and control system and method, and storage medium
CN120264358A