A multi-service traffic grouping and scheduling method for a P4 switch
By combining the Sketch algorithm with the Bloom filter to optimize feature extraction, simplifying the decision tree, and using the AD-PIFO algorithm to dynamically adjust priorities, the problems of hardware resource limitations and insufficient dynamism in P4 switches are solved, and efficient multi-service traffic classification and group scheduling are achieved.
Patent Information
- Application Number
- CN202510131815.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-06
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2045-02-06
AI Technical Summary
Existing technologies in P4 switches suffer from limitations in hardware resources, high computational complexity, insufficient dynamism, and low feature extraction efficiency, making it difficult to meet the requirements for efficient classification and grouping scheduling of multi-service traffic.
A feature extraction method combining the Sketch algorithm and Bloom filters is adopted, which combines bitwise operations to simplify the decision tree and the AD-PIFO variable priority group scheduling algorithm to optimize feature storage and classification process and dynamically adjust data packet priority.
It improves the feature extraction efficiency and classification accuracy of P4 switches under multi-service traffic, dynamically adjusts priorities to adapt to network changes, and enhances network packet processing efficiency and service quality.
Smart Images

Figure CN119996310B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of network communication technology and traffic classification, and in particular to a multi-service traffic packet scheduling method based on a P4 switch. Background Technology
[0002] Protocol-independent processor (P4) technology provides an open language and architecture for programming network packet processors. The emergence of P4 technology has greatly improved the programmability of SDN, enabling packet-based scheduling within the network. However, current research on using P4 for traffic classification and packet scheduling still faces many challenges and exhibits significant shortcomings compared to related patented technologies.
[0003] Existing technologies employ traditional decision trees or deep learning models for traffic classification and scheduling. However, these models generally suffer from insufficient hardware adaptability, as they are not optimized for the resource limitations of P4 switches. P4 switches have limited resources, such as limited memory and computing resources. Traditional decision tree models may require a large amount of memory for construction and storage, and deep learning models have high computational complexity. Running these models on P4 switches severely impacts their performance, resulting in inefficient packet processing and failing to meet practical application requirements.
[0004] Meanwhile, existing technologies lack dynamism. Many scheduling algorithms lack a mechanism for dynamically adjusting priorities based on real-time network conditions. In real-world SDN networks, network conditions are complex and constantly changing; packet transmission latency, link load, and other factors can fluctuate at any time. However, existing technologies cannot dynamically adjust packet forwarding priorities based on these real-time network changes, making it difficult to adapt to dynamic network environments and the QoS requirements of diverse services. For example, when network congestion occurs, the priority of critical service packets cannot be increased in a timely manner, leading to a decline in service quality.
[0005] Furthermore, existing technologies are inefficient in feature extraction. Most methods do not combine Sketch with time threshold detection mechanisms, resulting in high hash collision rates. When processing large amounts of data packets, frequent hash collisions significantly reduce the accuracy and efficiency of feature extraction. For example, when using Bloom filters to store features, without optimized collision detection mechanisms, the false positive rate increases, affecting the accuracy of business flow classification and ultimately reducing the algorithm's performance in multi-classification scenarios.
[0006] Although P4 technology has brought new possibilities to network traffic scheduling, there are still two major problems in the research on using P4 for service flow classification and packet scheduling: First, the classification algorithm based on P4 is crude in terms of feature engineering, making it difficult to extract effective features in resource-constrained P4 switches, resulting in poor algorithm performance in multi-classification scenarios; Second, the scheduling algorithm based on P4 is insufficient in terms of dynamic adaptability, and cannot adaptively adjust the scheduling strategy according to the actual latency of data packets in the SDN network, making it difficult to adapt to dynamic network environments and diverse service QoS requirements.
[0007] To address the aforementioned challenges, this invention proposes a service packet scheduling method for P4 switches. It aims to improve network packet processing efficiency and Quality of Service (QoS) through refined feature extraction, service flow classification, and dynamic packet scheduling strategies, meeting the QoS requirements of different services and enhancing the overall performance and efficiency of the switch. This method optimizes the collision detection mechanism using feature extraction methods based on statistical intervals and Sketch, and designs the AD-PIFO packet scheduling method based on variable priority to dynamically adjust packet forwarding priorities, thus solving existing problems. Experiments have verified its advantages in high-priority traffic throughput, low latency, medium-to-low priority traffic throughput, stability, and practicality. Summary of the Invention
[0008] To address the above problems, this invention proposes a multi-service traffic packet scheduling method for P4 switches. It constructs a comprehensive implementation path encompassing feature extraction, service flow classification, and packet scheduling. In the feature extraction stage, service flows are identified based on the five-tuple in the packet header. Features are stored in registers using the Sketch algorithm, and after sufficient data is collected, they are input into the model for classification and labeling. During this process, Bloom filters and key feature selection are optimized. For service flow classification, a decision tree algorithm is selected based on P4 characteristics and simplified and optimized. Packet scheduling constructs an architecture including ranking calculation and packet scheduling modules, dynamically adjusting priorities based on latency information, and optimizing queue management using the AD-PIFO algorithm. This invention progressively advances from feature capture and classification decision to packet scheduling, effectively improving the performance of P4 switches.
[0009] To achieve the objectives of this invention, the technical solution is as follows:
[0010] (1) Based on the Sketch algorithm, feature extraction and storage are performed. The business flow is determined by the five-tuple in the header of the data packet, and the data packet features are stored in the register by the Bloom filter based on the Sketch algorithm. When the feature data reaches a certain amount, it is formed into a feature vector and input into the pre-trained machine learning model for classification.
[0011] The P4 switch boasts powerful programmability, enabling flexible packet processing. Feature extraction and storage based on the Sketch algorithm leverages the P4's programmability to efficiently extract and store packet features on the data plane, providing a data foundation for subsequent service flow classification. This aligns with the P4 switch's ability to customize packet processing logic to meet diverse needs.
[0012] (2) Business flow classification is based on decision trees. A decision tree node range compression method based on bit operations is used to adjust the decision tree node range, reduce the number of matching entries, and adapt to the data plane requirements of the P4 switch. The classification process is executed through the P4 matching-action pipeline to achieve business flow classification. Bit operations directly operate on binary bits, and the right shift operation plays a key role in this method.
[0013] The data plane of a P4 switch typically has limited resources, making it unsuitable for complex computations. A decision tree node range compression method based on bitwise operations can effectively reduce the number of matching entries, lower computational complexity, and is well-suited to the resource constraints of the P4 switch's data plane. Simultaneously, the P4's matching-action pipeline provides a natural implementation path for the execution of the decision tree classification process, enabling efficient completion of business flow classification tasks.
[0014] (3) Packet scheduling is based on variable priority. When a data packet enters the first P4 switch, a custom header is added to record the priority and cumulative queuing delay. A priority adjustment module is connected after the delay statistics module. The packet forwarding priority is corrected based on the state classification of the cumulative delay ratio. That is, the data packets are divided into idle state, normal state, and congested state according to the ratio of the cumulative queuing delay to the ideal queuing delay, and the priority is adjusted according to this state classification. At the same time, the dynamic boundary threshold update rule is followed, and the PIFO algorithm is used to select queues and adjust the sorting according to priority.
[0015] The P4 supports flexible customization and modification of packet headers, allowing custom headers to be added when packets enter the switch to record priority and accumulated queuing delay. Furthermore, the P4's programmability facilitates the implementation of priority adjustment modules and dynamic boundary threshold update rules. Combined with the PIFO algorithm, priorities can be dynamically adjusted and queues selected based on the real-time status of packets, fully demonstrating the flexibility and programmability of the P4 switch in packet scheduling.
[0016] In real-world applications, the volume and types of traffic involved in multi-service traffic vary widely. The volume of traffic can reach thousands or even higher. In large-scale network scenarios, such as metropolitan area networks (MANs) or large-scale data center networks, the volume of traffic can potentially extend to tens of thousands or even higher to meet the needs of numerous users and complex services. In terms of service types, it covers a variety of different characteristics. For example, real-time interactive services, such as VoIP; data transmission services, such as FTP; and multimedia services, including streaming video and streaming audio, all involve large data volumes. Furthermore, in real-world networks, there may also be traffic generated by IoT devices and traffic from various internal enterprise business systems.
[0017] As an improvement to the present invention, the specific method of step (1) is as follows:
[0018] (1.1) First, the service flow is determined using the five-tuple (source IP, destination IP, protocol number, source port number, and destination port number) in the packet header. Then, a hash function is used to perform a hash operation on the five-tuple to determine the service flow and update the traffic characteristics. During this process, the Sketch algorithm is introduced to efficiently calculate features. The Sketch algorithm uses multiple hash functions to map the key content of the data packet into a fixed-size Sketch structure, thereby generating a compact and efficient feature representation and completing feature extraction. The specific calculation process is as follows: In the feature extraction method based on a Bloom filter, the data packet timestamp t is first input. n Data packet length l, maximum data packet length l m Number of data packets (s), cumulative data packet length (l) s Time threshold t resold Data packet count threshold len t The five-tuple k and the bit array B are used. Three hash functions H1, H2, and H3 are used to calculate the mapping positions of k in the bit array B: h1 = B[H1(k)], h2 = B[H2(k)], and h3 = B[H3(k)]. If at least one of h1, h2, and h3 is 0, it is determined to be a new stream, the corresponding bit is set to 1, and the F_Initialize function is called to initialize the new stream. In this function, the timestamp t of the current data packet is... n The timestamp t of the first data packet in the stream is assigned. f and the timestamp t of the previous data packet l Assign the data packet length l to the data packet size sum register l. s Set the packet count register s to 1, and simultaneously assign the packet length l to the maximum packet length register l. m Finally, the initialized statistical values are returned. If h1, h2, and h3 are all non-zero, the subsequent calculations will be based on the difference in data packet timestamps and a preset time threshold t.resold The comparison results are processed accordingly (the relevant judgment logic is described later in the text, but is not fully presented here). When the number of data packets s reaches the preset data packet number threshold len... t At that time, the output stream characteristic F(t) n ,t l ,t f ,t i ).
[0019] (1.2) In the feature selection stage, the sum of packet lengths, the total time interval, and the maximum packet length of the flow segments within the statistical interval are selected as the set of features. These features are optimized through a balancing strategy while maintaining low complexity.
[0020] (1.3) Next, a Bloom filter is used to store these features. The Bloom filter consists of a bit array, a set of hash functions, and a query mechanism. To reduce the probability of hash collisions, a time threshold detection mechanism is introduced. First, the bit array is set to all 0s, representing an empty set, providing space for storing elements. Then, for the element to be stored, its position in the bit array is calculated using a hash function, and the corresponding position is set to 1. Because multiple hash functions are used, the probability of collisions and false positives is effectively reduced. When querying an element, the position is obtained through the hash function, and the bit value is checked. If all bits are 1, the element may exist (with a low false positive rate); if any bit is 0, the element definitely does not exist. This is the basis for the Bloom filter's fast existence determination.
[0021] (1.4) Finally, the business flow features are stored. For data packets in the business flow, their positions in the Sketch structure and Bloom filter are located using a hash function based on the 5-tuple, and the features are stored. For new flows, initialization is performed; for conflicting flows, the timestamp is compared with a threshold to determine whether to update or reset the register. When the preset packet count threshold is reached, features are extracted from the Sketch structure and Bloom filter to form a feature vector, which is then input into a pre-trained machine learning model for classification.
[0022] This approach integrates the temporal correlation of data packets and the dynamic changes in traffic, optimizing the collision detection mechanism of the Bloom filter based on the Sketch structure. The sketch-based method utilizes hashing techniques for coarse-grained classification of data packets to derive measurement estimates, meeting the needs of real-time measurement in high-speed environments while saving computational and space overhead. This not only ensures effective feature extraction but also improves the algorithm's adaptability and accuracy in resource-constrained environments. During hash table updates, collisions are determined by comparing the timestamp difference between the current and previous data packets, significantly reducing the probability of hash collisions.
[0023] As an improvement to the present invention, the specific method of step (2) is as follows:
[0024] Traffic classification is achieved on a P4 switch by simplifying the decision tree structure, avoiding the need to create matching items one by one for large numerical ranges. Bitwise operations are used to simplify the conditions, reducing hardware resource consumption without compromising classification performance.
[0025] The following processing is performed, taking the original decision tree branch condition processing as an example. For instance, processing the transition condition "<8192" from branch 1 to branch 2 requires a large number of entries in the matching table due to its large value, measured in microseconds. An innovative approach is to use bitwise operations to right-shift all decision conditions and feature values by 3 bits, reducing this condition to "[0,1024]", significantly reducing the size of the matching table. Rigorous experimental verification shows that this significantly reduces model implementation complexity, improves resource utilization efficiency and classification response speed, and enables the decision tree to run more robustly and efficiently in the P4 environment while ensuring relatively stable classification performance.1
[0026] By improving the decision tree structure, specifically by simplifying decision conditions through bitwise operations, the number of required matching terms is reduced. Experimental results show that this does not significantly affect the classifier's performance. This approach significantly reduces the complexity of implementing the decision tree model in the P4 switch while maintaining classifier performance.
[0027] As an improvement to the present invention, the specific method of step (3) is as follows:
[0028] (3.1) The ranking is calculated based on the cumulative queuing delay, which includes the following steps:
[0029] The ingress switch uses the 5-tuple as the basis for sessions on independent networks. When a new network session requests a custom header at the ingress switch, the controller queries the network topology to identify the expected transmission path and configures the flow table rules of the border switches.
[0030] For intermediate switches, data packets are categorized into idle, normal, and congested states based on the ratio of cumulative queuing delay to ideal queuing delay. The priority of data packets is determined by link load. When the ratio is less than 0.5, the packet is classified as idle and its priority is reduced by one level during the current switch's forwarding phase. When the ratio is between 0.5 and 1, the packet is classified as normal and no priority processing is applied. When the ratio is greater than 1, the packet is classified as congested and its priority is increased by one level.
[0031] Similar to intermediate switches, egress switches need to determine the transmission status of data packets and adjust their priorities. In addition, to ensure that data packets are forwarded normally in the external network, custom headers need to be removed.
[0032] (3.2) Based on AD-PIFO, packet scheduling is performed. When a data packet enters the forwarding stage of the switch, the priority of the data packet is determined by the information carried in the custom header. The algorithm starts from the highest priority FIFO queue, sequentially checks the boundary threshold of each queue and compares it with the priority of the data packet until the data packet meets the enqueue condition. The data packet is then pushed down. During the data packet push-down, the algorithm checks whether there is a reverse order. If there is a reverse order, the algorithm reduces the boundary threshold of the corresponding queue, lowers the priority upper limit, and ensures that high priority data packets are forwarded first.
[0033] This step designs an adjustable PIFO (AD-PIFO) algorithm, which uses PIFO blocks to assign priorities to data packets. Its queue division is based on priority criteria rather than flow boundaries. By dynamically adjusting boundary thresholds, data packets of different service types flow between multiple queues according to priority, improving network resource utilization efficiency. It can also detect reverse ordering during data packet pushdown and adjust queue thresholds accordingly, reducing the chance of low-priority data packets entering high-priority queues and ensuring priority forwarding of high-priority data packets.
[0034] A multi-service traffic packet scheduling method for P4 switches is proposed. The service is classified at the application level to solve the problems of coarse feature engineering and insufficient dynamic adjustability of existing P4 classification algorithms, thereby improving network packet processing efficiency and quality of service (QoS).
[0035] Compared with the prior art, the advantages of the present invention are as follows:
[0036] 1. Advantages of feature extraction and storage
[0037] (1) Innovative Combination and Optimization: This invention innovatively combines the Sketch algorithm with the Bloom filter and introduces a time threshold detection mechanism to optimize conflict detection. Compared to existing technologies that simply extract TCP flow packet features, this invention comprehensively considers the temporal correlation of packets and dynamic changes in traffic, enabling more efficient and accurate feature extraction and storage within resource-constrained P4 switches, adapting to complex network environments. For example, in multi-tenant scenarios in data center networks, it can accurately capture the features of different service flows, ensuring classification accuracy. Other documents do not employ similar optimized feature extraction and storage methods.
[0038] (2) Targeted and Balanced Feature Selection: This invention selects the sum of packet lengths, the overall time interval, and the maximum packet length of flow segments within a statistical interval as features, balancing low complexity and effectiveness, and optimizing the selection through a balanced strategy. Existing technologies mainly rely on network quintuples and service flow time limits and sizes for scheduling, with different focuses in feature selection. The feature selection of this invention is more targeted at traffic classification in a P4 switch environment, and can effectively support service flow classification and scheduling decisions.
[0039] 2. Advantages of Business Flow Classification
[0040] (1) Decision tree optimization for hardware adaptation: Considering the characteristics of the P4 switch's data plane, this invention simplifies the decision tree conditions through bitwise operations, reducing the number of matching entries and lowering hardware resource consumption while maintaining classification performance. For example, the decision tree branch condition "<8192" is optimized to "[0,1024]", improving resource utilization efficiency and classification response speed. While existing technologies also perform structural transformations on the decision tree, they do not offer similar optimizations for the resource limitations of specific hardware like the P4 switch.
[0041] (2) Superior Performance in Multi-Class Scenarios: This invention demonstrates outstanding performance in multi-class scenarios. Through improved feature extraction and decision tree optimization, it effectively distinguishes various service flows. Experiments show that it outperforms similar methods in terms of accuracy, precision, and recall. For example, compared with SMASH and IDEAFIX models, it shows significant advantages in handling complex network traffic classification. Existing technologies mainly focus on the application of CNN and LSTM-based classification models in QoS queue scheduling, and their relevance and performance in multi-class scenarios on P4 switches are inferior to this invention.
[0042] 3. Advantages of group scheduling
[0043] (1) Dynamic Priority Adjustment Mechanism: This invention designs a variable priority packet scheduling method (AD PIFO) based on accumulated queuing delay and ideal service queuing delay, which can dynamically adjust the forwarding priority according to the real-time status of data packets in the network. When network congestion or load changes, the priority of data packets can be adjusted in a timely manner to ensure the QoS requirements of high-priority services. In contrast, existing technologies mainly schedule based on service flow time limits and sizes, without fully incorporating real-time delay feedback of data packets during network transmission to adjust priorities;
[0044] (2) Efficient queue management and resource utilization: The AD PIFO algorithm divides queues based on priority criteria. By dynamically adjusting boundary thresholds, it enables data packets of different service types to flow reasonably among multiple queues, improving network resource utilization efficiency. Simultaneously, it can detect and handle reverse ordering during data packet pushdown, ensuring that high-priority data packets are forwarded first. This queue management method is more advantageous than traditional flow-based queue management strategies and other methods for which similar efficient queue management mechanisms are not explicitly described in other documents in terms of improving overall network performance and efficiency.
[0045] 4. Overall performance advantages
[0046] (1) Strong hardware adaptability: Specifically designed for P4 switches, it fully considers their resource limitations and operating modes, enabling efficient traffic classification and scheduling in a P4 switch environment. Compared with other studies that do not focus on P4 switches, it can better leverage the programmability advantages of P4 switches, improve their performance in complex network traffic processing, and meet the needs of fine-grained scheduling on a packet-by-packet basis in SDN networks.
[0047] (2) Stability and Practicality in Multiple Scenarios: It demonstrates stable and effective performance under various load conditions, with reasonable additional time overhead for data packet transmission. Through case studies of multi-tenant scenarios in data center networks and traffic management during different service periods in metropolitan area networks, it is verified that it can guarantee the quality of service for various services in complex and ever-changing network environments. Compared to other studies, the method of this invention has stronger adaptability and practicality in real-world network scenarios, providing a more reliable solution for network optimization. Attached Figure Description
[0048] Figure 1 This describes the service packet scheduling method in a P4 switch.
[0049] Figure 2 This is a schematic diagram of the Bloom filter processing flow.
[0050] Figure 3 This is an example of the original decision tree model.
[0051] Figure 4 To improve the decision tree model instance,
[0052] Figure 5 The overall architecture of the variable priority group scheduling method,
[0053] Figure 6 This outlines the specific process for ranking calculation based on cumulative queuing delay.
[0054] Figure 7 The specific algorithm flow for AD-PIFO. Detailed Implementation
[0055] To enhance understanding of the present invention, a detailed description of the invention is provided below in conjunction with the accompanying drawings.
[0056] Example: See Figure 1 — Figure 7 A multi-service traffic group scheduling method for P4 switches is proposed, which constructs an implementation path from feature extraction, service flow classification and group scheduling.
[0057] Business flow data packets first enter the data plane, where they are parsed using a five-tuple grouping method. Then, three features are selected: the sum of data packet lengths of flow segments within a statistical interval, the overall time interval, and the maximum data packet length. Feature engineering based on the sketch algorithm is performed in a Bloom filter to extract feature vectors. These vectors are then used to train a decision tree in the deployment classification model, with structural improvements. The extracted feature vectors are then used for classification in the improved decision tree-based business classification model, and priority is adjusted through latency calculation. Next, the data packets enter the packet scheduling module, where five-tuples are uploaded based on a custom header, business flow priority is determined, flow table rules are updated and distributed, and finally, boundary awareness, data packet pushdown, and boundary updates are performed sequentially to complete data packet forwarding.
[0058] The method includes the following steps:
[0059] (1) Based on the Sketch algorithm, feature extraction and storage are performed. The business flow is determined by the five-tuple in the header of the data packet, and the data packet features are stored in the register by the Bloom filter based on the Sketch algorithm. When the feature data reaches a certain amount, it is formed into a feature vector and input into the pre-trained machine learning model for classification.
[0060] The P4 switch boasts powerful programmability, enabling flexible packet processing. Feature extraction and storage based on the Sketch algorithm leverages the P4's programmability to efficiently extract and store packet features on the data plane, providing a data foundation for subsequent service flow classification. This aligns with the P4 switch's ability to customize packet processing logic to meet diverse needs.
[0061] (2) Business flow classification is based on decision trees. A decision tree node range compression method based on bit operations is used to adjust the decision tree node range, reduce the number of matching entries, and adapt to the data plane requirements of the P4 switch. The classification process is executed through the P4 matching-action pipeline to achieve business flow classification. Bit operations directly operate on binary bits, and the right shift operation plays a key role in this method.
[0062] The data plane of a P4 switch typically has limited resources, making it unsuitable for complex computations. A decision tree node range compression method based on bitwise operations can effectively reduce the number of matching entries, lower computational complexity, and is well-suited to the resource constraints of the P4 switch's data plane. Simultaneously, the P4's matching-action pipeline provides a natural implementation path for the execution of the decision tree classification process, enabling efficient completion of business flow classification tasks.
[0063] (3) Packet scheduling is based on variable priority. When a data packet enters the first P4 switch, a custom header is added to record the priority and cumulative queuing delay. A priority adjustment module is connected after the delay statistics module. The packet forwarding priority is corrected based on the state classification of the cumulative delay ratio. That is, the data packets are divided into idle state, normal state, and congested state according to the ratio of the cumulative queuing delay to the ideal queuing delay, and the priority is adjusted according to this state classification. At the same time, the dynamic boundary threshold update rule is followed, and the PIFO algorithm is used to select queues and adjust the sorting according to priority.
[0064] The P4 supports flexible customization and modification of packet headers, allowing custom headers to be added when packets enter the switch to record priority and accumulated queuing delay. Furthermore, the P4's programmability facilitates the implementation of priority adjustment modules and dynamic boundary threshold update rules. Combined with the PIFO algorithm, priorities can be dynamically adjusted and queues selected based on the real-time status of packets, fully demonstrating the flexibility and programmability of the P4 switch in packet scheduling.
[0065] The specific method for step (1) is as follows:
[0066] (1.1) First, the service flow is determined using the five-tuple (source IP, destination IP, protocol number, source port number, and destination port number) in the packet header. Then, a hash function is used to perform a hash operation on the five-tuple to determine the service flow and update the traffic characteristics. During this process, the Sketch algorithm is introduced to efficiently calculate features. The Sketch algorithm uses multiple hash functions to map the key content of the data packet into a fixed-size Sketch structure, thereby generating a compact and efficient feature representation and completing feature extraction. The specific calculation process is as follows: In the feature extraction method based on a Bloom filter, the data packet timestamp t is first input. n Data packet length l, maximum data packet length l m Number of data packets (s), cumulative data packet length (l) s Time threshold t resold Data packet count threshold len t The five-tuple k and the bit array B are used. Three hash functions H1, H2, and H3 are used to calculate the mapping positions of k in the bit array B: h1 = B[H1(k)], h2 = B[H2(k)], and h3 = B[H3(k)]. If at least one of h1, h2, and h3 is 0, it is determined to be a new stream, the corresponding bit is set to 1, and the F_Initialize function is called to initialize the new stream. In this function, the timestamp t of the current data packet is... n The timestamp t of the first data packet in the stream is assigned. f and the timestamp t of the previous data packet lAssign the data packet length l to the data packet size sum register l. s Set the packet count register s to 1, and simultaneously assign the packet length l to the maximum packet length register l. m Finally, the initialized statistical values are returned. If h1, h2, and h3 are all non-zero, the subsequent calculations will be based on the difference in data packet timestamps and a preset time threshold t. resold The comparison results are processed accordingly (the relevant judgment logic is described later in the text, but is not fully presented here). When the number of data packets s reaches the preset data packet number threshold len... t At that time, the output stream characteristic F(t) n ,t l ,t f ,t i ).
[0067] (1.2) In the feature selection stage, the sum of packet lengths, the total time interval, and the maximum packet length of the flow segments within the statistical interval are selected as the set of features. These features are optimized through a balancing strategy while maintaining low complexity.
[0068] (1.3) Next, a Bloom filter is used to store these features. The Bloom filter consists of a bit array, a set of hash functions, and a query mechanism. To reduce the probability of hash collisions, a time threshold detection mechanism is introduced. First, the bit array is set to all 0s, representing an empty set, providing space for storing elements. Then, for the element to be stored, its position in the bit array is calculated using a hash function, and the corresponding position is set to 1. Because multiple hash functions are used, the probability of collisions and false positives is effectively reduced. When querying an element, the position is obtained through the hash function, and the bit value is checked. If all bits are 1, the element may exist (with a low false positive rate); if any bit is 0, the element definitely does not exist. This is the basis for the Bloom filter's fast existence determination.
[0069] (1.4) Finally, the business flow features are stored. For data packets in the business flow, their positions in the Sketch structure and Bloom filter are located using a hash function based on the 5-tuple, and the features are stored. For new flows, initialization is performed; for conflicting flows, the timestamp is compared with a threshold to determine whether to update or reset the register. When the preset packet count threshold is reached, features are extracted from the Sketch structure and Bloom filter to form a feature vector, which is then input into a pre-trained machine learning model for classification.
[0070] This approach integrates the temporal correlation of data packets and the dynamic changes in traffic, optimizing the collision detection mechanism of the Bloom filter based on the Sketch structure. The sketch-based method utilizes hashing techniques for coarse-grained classification of data packets to derive measurement estimates, meeting the needs of real-time measurement in high-speed environments while saving computational and space overhead. This not only ensures effective feature extraction but also improves the algorithm's adaptability and accuracy in resource-constrained environments. During hash table updates, collisions are determined by comparing the timestamp difference between the current and previous data packets, significantly reducing the probability of hash collisions.
[0071] The specific method for step (2) is as follows:
[0072] Traffic classification is achieved on a P4 switch by simplifying the decision tree structure, avoiding the need to create matching items one by one for large numerical ranges. Bitwise operations are used to simplify the conditions, reducing hardware resource consumption without compromising classification performance.
[0073] The following processing is performed, taking the original decision tree branch condition processing as an example. For instance, processing the transition condition "<8192" from branch 1 to branch 2 requires a large number of entries in the matching table due to its large value, measured in microseconds. An innovative approach is to use bitwise operations to right-shift all decision conditions and feature values by 3 bits, reducing this condition to "[0,1024]", significantly reducing the size of the matching table. Rigorous experimental verification shows that this significantly reduces model implementation complexity, improves resource utilization efficiency and classification response speed, and enables the decision tree to run more robustly and efficiently in the P4 environment while ensuring relatively stable classification performance.1
[0074] By improving the decision tree structure, specifically by simplifying decision conditions through bitwise operations, the number of required matching terms is reduced. Experimental results show that this does not significantly affect the classifier's performance. This approach significantly reduces the complexity of implementing the decision tree model in the P4 switch while maintaining classifier performance.
[0075] The specific method for step (3) is as follows:
[0076] (3.1) The ranking is calculated based on the cumulative queuing delay, which includes the following steps:
[0077] The ingress switch uses the 5-tuple as the basis for sessions on independent networks. When a new network session requests a custom header at the ingress switch, the controller queries the network topology to identify the expected transmission path and configures the flow table rules of the border switches.
[0078] For intermediate switches, data packets are categorized into idle, normal, and congested states based on the ratio of cumulative queuing delay to ideal queuing delay. The priority of data packets is determined by link load. When the ratio is less than 0.5, the packet is classified as idle and its priority is reduced by one level during the current switch's forwarding phase. When the ratio is between 0.5 and 1, the packet is classified as normal and no priority processing is applied. When the ratio is greater than 1, the packet is classified as congested and its priority is increased by one level.
[0079] Similar to intermediate switches, egress switches need to determine the transmission status of data packets and adjust their priorities. In addition, to ensure that data packets are forwarded normally in the external network, custom headers need to be removed.
[0080] (3.2) Based on AD-PIFO, packet scheduling is performed. When a data packet enters the forwarding stage of the switch, the priority of the data packet is determined by the information carried in the custom header. The algorithm starts from the highest priority FIFO queue, sequentially checks the boundary threshold of each queue and compares it with the priority of the data packet until the data packet meets the enqueue condition. The data packet is then pushed down. During the data packet push-down, the algorithm checks whether there is a reverse order. If there is a reverse order, the algorithm reduces the boundary threshold of the corresponding queue, lowers the priority upper limit, and ensures that high priority data packets are forwarded first.
[0081] This step designs an adjustable PIFO (AD-PIFO) algorithm, which uses PIFO blocks to assign priorities to data packets. Its queue division is based on priority criteria rather than flow boundaries. By dynamically adjusting boundary thresholds, data packets of different service types flow between multiple queues according to priority, improving network resource utilization efficiency. It can also detect reverse ordering during data packet pushdown and adjust queue thresholds accordingly, reducing the chance of low-priority data packets entering high-priority queues and ensuring priority forwarding of high-priority data packets.
[0082] like Figure 1 The figure shows a method for multi-service traffic packet scheduling in a P4 switch.
[0083] In the data plane, the service flow is locked based on the five-tuple in the packet header. Features are stored in registers using the Sketch algorithm, and after sufficient data is collected, the model is input for classification and labeling. During this process, the Bloom filter and key feature selection are optimized. When classifying service flows, a decision tree algorithm is selected based on P4 characteristics and simplified and optimized. Simultaneously, a priority scheduling algorithm based on accumulated queuing delay is used for priority correction and delay calculation. The group scheduling module, through boundary awareness, packet pushdown, and boundary update, determines the architecture including ranking calculation and group scheduling modules. In the control plane, priorities are dynamically adjusted based on delay information, and queue management is optimized using the AD-PIFO algorithm. This invention advances sequentially from feature capture and classification decision to group scheduling, effectively improving the performance of P4 switches.
[0084] To better illustrate the service packet scheduling method for P4 switches, we first introduce the processing flow of the Bloom filter and its combined application with the Sketch algorithm. For example... Figure 2 As shown, the Bloom filter uses a predefined bit array to represent the elements in the set. During initialization, all bits are set to 0, indicating that the set is empty. Simultaneously, several hash functions required by the Sketch algorithm are also predefined; these hash functions are used to map the characteristics of data packets to the bit arrays of the Sketch structure and the Bloom filter.
[0085] When adding elements (i.e., packet features) to a Bloom filter, the packet's feature value is first calculated using the Sketch algorithm. The Sketch algorithm uses multiple hash functions to map key packet information (such as quintuples, packet length, etc.) into a fixed-size Sketch structure, generating a compact feature representation. This feature value, along with the original packet (or a portion of its features), is then used as input and mapped to specific positions in a bit array by one or more hash functions of the Bloom filter. Each hash function computes the input and sets the corresponding bit in the bit array to 1.
[0086] For query operations, the Sketch algorithm is first used to calculate the feature value of the data packet to be queried. Then, the Bloom filter uses a set of hash functions to calculate the hash value of this feature value and subsequently checks the bits at those positions in the bit array. If all the calculated bits at those positions are 1, the element (i.e., the feature of the data packet) may exist in the set; if any bit at any position is 0, then it can be determined that the element is not in the set.
[0087] During the hash table (i.e., the bit array of the Bloom filter) update process, if a hash collision occurs (i.e., multiple data packets' characteristics are mapped to the same bit through the hash function, resulting in all bits at these positions being 1), an additional judgment mechanism needs to be introduced. Specifically, a genuine collision can be determined by comparing the timestamp difference between the current data packet and the previous data packet. If the time interval is less than a preset threshold, it is considered to be data packets from the same service flow, and the hash table is updated (i.e., keeping the bits at these positions 1); if the time interval is greater than or equal to the threshold, it is considered to be the start of a new service flow, and the register needs to be reset (i.e., the bits at these positions are reset to 0), and the Sketch structure and Bloom filter need to be updated to reflect the new service flow characteristics.
[0088] To explain in detail the multi-service traffic packet scheduling method for P4 switches, this invention then introduces its improvement on the decision tree model. Applying machine learning to the data plane of a P4 switch faces resource constraints. While decision trees are suitable for this environment, the original decision tree... Figure 3 As shown, large values in some decision conditions can lead to a massive matching table for the P4 switch, as it requires creating a matching entry for each value within the range [0, 8192], increasing hardware implementation complexity and resource consumption. To address these issues, an improved decision tree structure is designed ( Figure 4 Dividing all decision conditions by 8 simplifies the condition judgment. Although the P4 switch does not support floating-point and multiplication and division operations, it can be achieved through bitwise operations. That is, all decision conditions and feature values are shifted right by 3 bits, so that the original judgment condition [0, 8192] is converted to [0, 1024], which greatly reduces the number of matching items, optimizes the balance between resource utilization and classification efficiency, and ensures efficient network operation and accurate traffic management.
[0089] To further illustrate the multi-service traffic packet scheduling method for P4 switches, the overall architecture of the variable priority packet scheduling method is finally introduced, based on... Figure 5 — Figure 7The variable priority packet scheduling method boasts a rigorous and efficient workflow, with its overall architecture relying on the collaborative operation of two core modules: ranking calculation and PIFO-based packet scheduling. When a packet arrives at a switch, the packet parsing submodule takes the lead, accurately extracting the five-tuple hash value and uploading it to the control plane. The control plane quickly updates the flow table rules according to preset rules and then distributes them to the data planes of each switch. At this point, the ingress switch assigns a custom header to the packet, recording its priority and accumulated queuing delay in detail, thus beginning the packet's transmission journey in the network. In the delay calculation submodule, the system continuously compares the accumulated queuing delay with the ideal queuing delay, and the results are seamlessly transmitted to the priority adjustment submodule, becoming the key basis for adjusting the packet forwarding priority. Once the packet enters the packet scheduling module, the priority adjustment submodule flexibly adjusts the priority based on the delay comparison results, while the packet forwarding submodule accurately selects queues and properly adjusts their order according to the PIFO algorithm. After the packet is properly encapsulated by the reverse parser, it is robustly forwarded. During the forwarding process, the custom header information is continuously and dynamically updated to reflect changes in the packet's state in real time. The egress switch bears a heavy responsibility. It not only accurately judges the data packet transmission status and adjusts the priority in a timely manner, but also decisively deletes the custom header when the data packet is about to enter the external network, ensuring that the data packet is transmitted smoothly in the external network environment.
[0090] The invention will now be described with reference to specific examples and accompanying drawings. The invention comprises the following steps:
[0091] (1) Based on the Sketch algorithm, feature extraction and storage are performed. The business flow is determined by the five-tuple in the header of the data packet, and the data packet features are stored in the register by the Bloom filter based on the Sketch algorithm. When the feature data reaches a certain amount, it is formed into a feature vector and input into the pre-trained machine learning model for classification.
[0092] The P4 switch boasts powerful programmability, enabling flexible packet processing. Feature extraction and storage based on the Sketch algorithm leverages the P4's programmability to efficiently extract and store packet features on the data plane, providing a data foundation for subsequent service flow classification. This aligns with the P4 switch's ability to customize packet processing logic to meet diverse needs.
[0093] (2) Business flow classification is based on decision trees. A decision tree node range compression method based on bit operations is used to adjust the decision tree node range, reduce the number of matching entries, and adapt to the data plane requirements of the P4 switch. The classification process is executed through the P4 matching-action pipeline to achieve business flow classification. Bit operations directly operate on binary bits, and the right shift operation plays a key role in this method.
[0094] The data plane of a P4 switch typically has limited resources, making it unsuitable for complex computations. A decision tree node range compression method based on bitwise operations can effectively reduce the number of matching entries, lower computational complexity, and is well-suited to the resource constraints of the P4 switch's data plane. Simultaneously, the P4's matching-action pipeline provides a natural implementation path for the execution of the decision tree classification process, enabling efficient completion of business flow classification tasks.
[0095] (3) Packet scheduling is based on variable priority. When a data packet enters the first P4 switch, a custom header is added to record the priority and cumulative queuing delay. A priority adjustment module is connected after the delay statistics module. The packet forwarding priority is corrected based on the state classification of the cumulative delay ratio. That is, the data packets are divided into idle state, normal state, and congested state according to the ratio of the cumulative queuing delay to the ideal queuing delay, and the priority is adjusted according to this state classification. At the same time, the dynamic boundary threshold update rule is followed, and the PIFO algorithm is used to select queues and adjust the sorting according to priority.
[0096] The P4 supports flexible customization and modification of packet headers, allowing custom headers to be added when packets enter the switch to record priority and accumulated queuing delay. Furthermore, the P4's programmability facilitates the implementation of priority adjustment modules and dynamic boundary threshold update rules. Combined with the PIFO algorithm, priorities can be dynamically adjusted and queues selected based on the real-time status of packets, fully demonstrating the flexibility and programmability of the P4 switch in packet scheduling.
[0097] To explain in detail the working steps of a multi-service traffic packet scheduling method for P4 switches, the following three use cases illustrate the different working modes of this method under different measures.
[0098] Specific Example 1: Traffic Scheduling in a Multi-Tenant Data Center Network Scenario
[0099] The data center network provides services to multiple tenants with diverse service types, including big data analytics (high priority), cloud computing services (medium priority), and general office applications (low priority). Network traffic load is constantly changing dynamically, with peak tenant service periods occurring intermittently. This places extremely high demands on the accuracy of network resource allocation and scheduling, while also requiring strict control over traffic interference between different tenant services.
[0100] During the feature extraction and classification phase, when big data analytics traffic is generated, the system uses the five-tuple in the packet header to lock the traffic flow and accumulates and stores features in registers using the Sketch algorithm. For example, in the data-intensive computing phase, a large number of data packets are transmitted in a short period of time. The system accurately extracts features such as a sharp increase in the total length of data packets, stable transmission time intervals, and a large maximum data packet length, forming feature vectors that are input into the decision tree model for classification. Bloom filters efficiently store features with low collision probability and, based on a time threshold detection mechanism, accurately handle the storage needs of frequently updated traffic features, ensuring accurate classification of big data traffic.
[0101] During the operation of cloud computing services, such as the virtual machine instance creation and data interaction phases, the system continuously tracks data packet characteristics. Based on five-tuple hash location feature storage and updates, a Bloom filter ensures the accuracy of feature queries. Through an optimized hash collision handling mechanism, it accurately distinguishes cloud computing traffic from other service traffic, providing a precise basis for subsequent scheduling.
[0102] After regular office application traffic occurs, the system operates according to the feature extraction process. Based on features such as the regularity of data packet arrival time intervals and the relatively stable data packet length, combined with the Bloom filter storage and query function, the system accurately determines the business type and priority, and effectively distinguishes different priority businesses in the feature extraction and classification stages.
[0103] During the scheduling phase, data packets enter the switch, and the AD-PIFO algorithm dominates the scheduling process. Big data analytics service data packets arrive at the ingress switch, where a custom header is assigned priority and accumulated queuing latency. The control plane updates and distributes flow tables based on network topology and service rules. In the latency statistics module, if the queuing latency of a data packet exceeds the ideal value, the algorithm increases its priority within the switch, prioritizing bandwidth resource allocation to ensure data analysis efficiency.
[0104] Cloud computing service data packets are scheduled based on priority. In the event of network congestion causing changes in queuing latency, the algorithm adjusts the priority according to the latency ratio. For example, if the queuing latency of a medium-priority cloud computing service packet is 1.2 times the ideal value, its priority is increased by one level; if it is less than 0.5 times, its priority is decreased by one level, ensuring a dynamic balance in service response performance and maintaining the overall stability of the data center's service quality.
[0105] Regular office application data packets are scheduled in a low-priority queue, and resource allocation is dynamically adjusted according to network load. When high- and medium-priority services have low load, their bandwidth share is appropriately increased; when high- and medium-priority services are busy, bandwidth is strictly limited to prevent interference with critical services and ensure the orderly and efficient operation of multi-tenant services in the data center.
[0106] Specific Example 2: Traffic Management for Different Service Periods in a Metropolitan Area Network
[0107] Metropolitan area networks (MANs) cover a wide area and offer a variety of services, including daytime business office services (high priority such as dedicated enterprise lines, medium priority such as ordinary enterprise office networks, and low priority such as street shop networks) and nighttime residential entertainment (high priority such as online games, medium priority such as high-definition videos, and low priority such as social media browsing). Network traffic exhibits a clear alternation between daytime and nighttime peak traffic periods, and is affected by regional activity patterns, resulting in uneven distribution of traffic load across different regions, requiring flexible allocation of network resources.
[0108] During daytime business hours, enterprise dedicated line traffic is high, and the system identifies business flows using a five-tuple approach. Taking high-frequency transaction data transmission from financial institutions as an example, these data packets are characterized by high frequency, small batches, and low latency. The system captures these characteristics using the Sketch algorithm. This algorithm maintains a compact data structure to approximately track the frequency of elements in the data stream, thereby capturing key statistical information of the data packets within a limited space. Specifically, the Sketch algorithm uses several hash functions to map the features of the data packets into a bit array, thus enabling rapid estimation of the distribution of data packet features with minimal storage cost. The application of this algorithm allows Bloom filters to accurately store and quickly query and classify data packets, ensuring that financial business data packets can be quickly identified and processed, achieving low-latency, highly reliable network transmission, and prioritizing the allocation and scheduling of network resources for critical business operations.
[0109] When traffic surges on a typical enterprise office network, the system extracts characteristics of data packets such as those from file sharing and email sending / receiving. Based on the moderate size and variable time intervals of these data packets, and combined with Bloom filters to optimize conflict handling, the system accurately categorizes business flows and schedules them in an orderly manner according to priority, thereby improving the overall efficiency of the office network and reducing the enterprise's network operating costs.
[0110] During nighttime entertainment hours and peak online gaming periods, the system focuses on data packet characteristics. For example, real-time battle games exhibit bursty data packet traffic and latency sensitivity. The Sketch algorithm efficiently extracts features, while the Bloom filter ensures feature accuracy, providing precise classification for the AD-PIFO algorithm. This ensures a low-latency experience for gamers and improves user satisfaction.
[0111] In high-definition video service traffic transmission, the system accurately classifies data packets based on their large length and stable transmission characteristics. Bloom filters facilitate feature storage and retrieval, providing a basis for scheduling, allocating bandwidth according to network load, ensuring smooth video playback, and improving the quality of entertainment services for residents.
[0112] When processing traffic for social media browsing, the system classifies data packets based on their fragmented nature and long time intervals, and uses a feature-based storage and query mechanism to allocate network resources rationally, ensuring a smooth online social experience for residents.
[0113] Regarding scheduling strategy adjustments, the AD-PIFO algorithm dynamically schedules traffic based on the alternating daytime and nighttime peak traffic patterns of the metropolitan area network. During peak business hours in the daytime, priority is given to ensuring bandwidth resources for enterprise leased lines and high-demand office services, raising the boundary threshold of high-priority service queues, and limiting the influx of low-priority service traffic. For example, enterprise leased line service packets are prioritized based on latency, and are forwarded preferentially during congestion to ensure the smooth operation of critical services such as financial transactions.
[0114] During peak nighttime entertainment hours, the algorithm optimizes the scheduling of high-priority services such as online games and high-definition video. When network congestion occurs, the algorithm prioritizes game services and reduces the bandwidth of low-priority video packets to ensure a smooth real-time gaming experience. Based on network load changes, the algorithm flexibly adjusts the thresholds and resource allocation ratios for each service queue, such as dynamically allocating resources according to user density and service needs in different regions, thereby improving metropolitan area network resource utilization and user experience.
[0115] Experiment 1: Evaluation of Business Flow Classification Method
[0116] Experimental objective:
[0117] A comprehensive evaluation of the traffic flow classification method for resource-constrained scenarios is conducted on traffic flow datasets extracted from real network environments. The performance of the proposed method is compared with other existing classification methods to demonstrate its advantages.
[0118] Experimental steps
[0119] 1. We selected the Bloom filter, which boasts the highest query efficiency in Sketch, as the feature storage structure. Furthermore, by considering the temporal correlation of data packets, we improved the conflict detection method to reduce the false positive rate. In this process, Sketch maintains a probabilistic data structure to capture and store key features of data packets at a low storage cost. A hash function maps these features into bit arrays. When the number of data packet features reaches a certain threshold, the information from these bit arrays is used to form a feature vector, which is then input into a pre-trained machine learning model for classification. This approach not only improves the efficiency of feature extraction but also enhances the model's accuracy in data packet classification. Compared to the SMASH and IDEAFIX models, our method demonstrates superior performance in both feature extraction and classification.
[0120] 2. A simple network topology was set up using a BMV2 virtual software switch and Mininet, including 2 virtual hosts, 1 P4 software switch and 1 central controller. All experiments were run on a high-performance server configured with CPU: Intel Core i9-13900KF@3GHz, memory: 64GB, etc.
[0121] 3. A dataset was constructed using a hybrid of ISCXVPN2016 and self-collected traffic. Data with insufficient traffic volume was excluded, and self-collected traffic was added to balance the sample. 70% of the data was used as the training set, and 30% as the test set, with a 50-fold cross-validation. KNN, SVM, ANN, and decision tree algorithms were evaluated to determine the optimal hyperparameters. The decision tree model was converted to P4 language for data plane classification, while the other algorithms were used for control plane classification. The performance of packet-by-packet and flow-by-flow classification models was tested, and the proposed method was compared with existing methods in terms of accuracy, precision, and recall. The performance loss of the decision tree model's shift operation was evaluated.
[0122] Experiment 2: Evaluation of the Group Scheduling Method
[0123] Experimental objective:
[0124] Verify whether the scheduling scheme based on cumulative queuing delay can provide differentiated services for data streams with different priorities. Compare the key performance indicators of existing priority scheduling schemes in different network environments. Test the performance of the AD-PIFO algorithm in a P4 switch and the impact of the number of logical queues and custom header time overhead.
[0125] Experimental steps:
[0126] 1. A priority adjustment algorithm based on cumulative queuing delay and a group scheduling algorithm based on AD-PIFO are proposed, with SP-PIFO, AIFO, and RIFO algorithms implemented on P4 as comparison objects. The network topology in section 4.1.1 is expanded to include 3 virtual hosts, 4 P4 software switches, and 1 central controller, all using the same server configuration.
[0127] 2. Using the traffic dataset from 4.1.2, we adjusted the packet sending rate using tcpreplay and tcprewrite, generated TCP traffic using the iperf tool and added identifiers to distinguish priorities, and randomly mixed equal amounts and sizes into a dataset. We set the experimental link bottleneck to 100Mbps, configured the service flow classification model, and divided the service flows into high, medium, and low priorities. The default forwarding priorities were 1, 4, and 7 for the experiment.
[0128] 3. In a congested network environment, measure the end-to-end latency and throughput of TCP streams generated by iperf under different algorithms. With a 10Mbps payload and the same TCP traffic, the ideal latency is approximately 2ms. Use "tcpdump -i eth0" and packet capture commands to analyze the pcap file and calculate latency and throughput.
[0129] 4. Using a specific dataset, measure the dynamic changes in throughput of intermediate switch s2 and the average transmission time of packets within switch s2 under different loads using the AD-PIFO algorithm at a transmission rate of 80Mbps and a data stream duration of 20 seconds, and compare the four algorithms.
[0130] 5. Evaluate the impact of the number of logical queues on the performance of the AD-PIFO algorithm using flow completion time as an indicator, and compare the performance of the AD-PIFO algorithm with those of 8 and 16 queue configurations. Send service traffic at a rate of 20Mbps for 30 seconds, and calculate the average processing time of the ingress, intermediate, and egress switches (based on the difference between the average packet transmission time and the time value of the P4 program metadata field) to evaluate the time overhead of the custom header.
[0131] It should be noted that the above embodiments are merely preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Equivalent substitutions or alternatives made based on the above technical solutions shall all fall within the scope of protection of the present invention.
Claims
1. A multi-service traffic packet scheduling method for P4 switches, characterized in that, The method includes the following steps: (1) Feature extraction and storage are performed based on the Sketch algorithm. The business flow is determined using the five-tuple in the packet header, and the packet features are stored in a register using a Bloom filter based on the Sketch algorithm and combined with a time threshold collision detection mechanism. A joint feature storage method of Sketch and Bloom filter is constructed. When the feature data reaches a certain amount, it is formed into a feature vector and input into a pre-trained decision tree for classification. (2) Business flow classification is performed based on decision tree. The decision tree node range compression method based on bit operation is used to adjust the decision tree node range, reduce the number of matching entries, and adapt to the data plane requirements of P4 switch. The classification process is executed through the matching-action pipeline of P4 to realize business flow classification. Bit operation directly operates on binary bits. (3) Based on variable priority, packet scheduling is performed. When a data packet enters the first P4 switch, a custom header is added to record the priority and cumulative queuing delay. The priority adjustment module is connected after the delay statistics module. The packet forwarding priority is corrected based on the state classification of the cumulative delay ratio. That is, the data packet is divided into idle state, normal state and congested state according to the ratio of the cumulative queuing delay and the ideal queuing delay. The priority is then adjusted according to this state classification. At the same time, the dynamic boundary threshold update rule is followed, and the PIFO algorithm is adopted to select the queue and adjust the sorting according to the priority.
2. The multi-service traffic packet scheduling method for P4 switches according to claim 1, characterized in that, The specific method for step (1) is as follows: (1.1) First, the service flow is determined using the five-tuple in the packet header, namely source IP, destination IP, protocol number, source port number, and destination port number. Then, the five-tuple is hashed using a hash function to determine the service flow and update the traffic characteristics. In this process, the Sketch algorithm is introduced to efficiently calculate features. The Sketch algorithm uses multiple hash functions to map the key content of the packet into a fixed-size Sketch structure, thereby generating a compact and efficient feature representation and completing the feature extraction. The specific calculation process is as follows: In the feature extraction method based on Bloom filters, the packet timestamp t is first input. n Data packet length l, maximum data packet length l m Number of data packets (s), cumulative data packet length (l) s Time threshold t resold Data packet count threshold len t Given a quintuple k and a bit array B, three hash functions H1, H2, and H3 are used to calculate the mapping positions of k in bit array B: h1 = B[H1(k)], h2 = B[H2(k)], and h3 = B[H3(k)]. If at least one of h1, h2, or h3 is 0, it is determined to be a new stream, the corresponding bit is set to 1, and the F_Initialize function is called to initialize the new stream. In this function, the timestamp t of the current data packet is set... n The timestamp t of the first data packet in the stream is assigned. f and the timestamp t of the previous data packet l Assign the data packet length l to the data packet size sum register l. s Set the packet count register s to 1, and simultaneously assign the packet length l to the maximum packet length register l. m Finally, the initialized statistical values are returned. If h1, h2, and h3 are all non-zero, the subsequent calculations will be based on the difference in data packet timestamps and the preset time threshold t. resold The comparison results are processed accordingly. When the number of data packets s reaches the preset data packet number threshold len... t At that time, the output stream characteristic F(t) n ,t l ,t f ,t i ), (1.2) In the feature selection stage, the sum of packet lengths, the total time interval, and the maximum packet length of the flow segments within the statistical interval are selected as features. These features are optimized through a balancing strategy while maintaining low complexity. (1.3) Next, a Bloom filter is used to store these features. The Bloom filter consists of a bit array, a set of hash functions, and a query mechanism. To reduce the probability of hash collisions, a time threshold detection mechanism is introduced. First, the bit array is set to all 0s to represent an empty set, providing space for storing elements. Then, for the element to be stored, its position in the bit array is calculated using a hash function, and the corresponding position is set to 1. Since multiple hash functions are used, the probability of collisions and misjudgments is effectively reduced. When querying an element, the position is obtained through the hash function, and the bit value is checked. If all bits are 1, the element may exist; if any bit is 0, the element definitely does not exist. This is the basis for the Bloom filter's fast existence judgment. (1.4) Finally, the storage of business flow features is completed. For data packets in the business flow, the position of the packet in the Sketch structure and Bloom filter is located by the hash function based on the 5-tuple, and the features are stored. For new flows, the bit initialization is performed. For conflict flows, the timestamp is compared with the threshold to determine whether to update or reset the register. When the preset packet number threshold is reached, the features are extracted from the Sketch structure and Bloom filter to form a feature vector, which is then input into the pre-trained decision tree model for classification.
3. The multi-service traffic packet scheduling method for P4 switches according to claim 1, characterized in that, The specific method for step (2) is as follows: Traffic classification is implemented on a P4 switch by simplifying the decision tree structure. By using a decision tree node range compression method based on bit operations, the creation of matching items for each large numerical range is avoided. Bit operations are used to simplify the conditions, reducing hardware resource consumption without compromising classification performance.
4. The multi-service traffic packet scheduling method for P4 switches according to claim 1, characterized in that, The specific method for step (3) is as follows: (3.1) The ranking is calculated based on the cumulative queuing delay, which includes the following steps: The ingress switch uses the 5-tuple as the basis for sessions on independent networks. When a new network session requests a custom header at the ingress switch, the controller queries the network topology to identify the expected transmission path and configures the flow table rules for the border switches. For intermediate switches, state classification based on cumulative delay ratio categorizes data packets into idle, normal, and congested states according to the ratio of cumulative queuing delay to ideal queuing delay. When the ratio is less than 0.5, the packet is classified as idle, and its priority is reduced by one level. When the ratio is between 0.5 and 1, the packet is classified as normal, and no priority processing is applied. When the ratio is greater than 1, the packet is classified as congested, and its priority is increased by one level. Simultaneously, following the dynamic boundary threshold update rules, the boundary thresholds for the above status classifications can be updated based on dynamic factors such as link load and queue status. The egress switch needs to determine the transmission status of data packets and adjust priorities based on the above rules. Furthermore, to ensure normal forwarding of data packets in the external network, custom headers need to be removed. (3.2) Based on AD-PIFO, packet scheduling is performed. When a data packet enters the forwarding stage of the switch, the priority of the data packet is determined by the information carried in the custom header. The algorithm starts from the highest priority FIFO queue, sequentially checks the boundary threshold of each queue and compares it with the priority of the data packet until the data packet meets the enqueue condition and pushes the data packet down. When the data packet is pushed down, it checks whether there is a reverse order phenomenon. If there is a reverse order, it follows the dynamic boundary threshold update rule and reduces the boundary threshold of the corresponding queue to lower the priority upper limit and ensure that high priority data packets are forwarded first. At the same time, the boundary threshold can be further dynamically adjusted according to the real-time network status to optimize the scheduling strategy.
Citation Information
Patent Citations
Network overpoint measurement method and device based on multi-stage filtering Sketch
CN118590290A
Industrial internet-oriented DDoS defense method
CN118827199A