A query method for large flow quintuples based on P4 programmable switch

By using hash functions and Bloom filters on the P4 programmable switch to process quintuples of network traffic, the problem of excessive resource consumption of terminal equipment is solved, and efficient monitoring of network traffic and performance improvement are achieved.

CN115967673BActive Publication Date: 2024-09-06SHENZHEN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211207305.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-30
Publication Date
2024-09-06
Estimated Expiration
2042-09-30

AI Technical Summary

Technical Problem

In the era of big data, the increase in network traffic has led to excessive consumption of terminal device resources. Traditional terminal-based statistical methods have placed a huge burden on the CPU, memory and storage, affecting performance.

Method used

Using a method based on P4 programmable switches, the quintuple of network traffic packets is mapped to the storage bucket through a hash function, changed according to the bucket count and threshold, and a Bloom filter is introduced to determine the large flow quintuple. Implement loopback and counting statistics of data packets, and finally access the data plane registers in real time through the control plane to output the results.

Benefits of technology

Effectively offload traffic monitoring to in-network switches, reduce terminal resource consumption, improve network performance, and achieve efficient and accurate network traffic measurement and decision-making.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115967673B
    Figure CN115967673B
Patent Text Reader

Abstract

The present invention relates to the technical field of network measurement, and in particular to a query method for a large flow quintuple based on a P4 programmable switch, which unloads a data summary of network flow measurement to a programmable switch in a network to give full play to switching node resources, realize network flow decision-making, and improve the overall network performance; firstly, a network flow data packet is filtered, and the filtering conditions include but are not limited to a network layer protocol and a transport layer protocol, and then the network flow data packet is hash-mapped to a storage bucket of each register in a sketch for processing, and a large flow data packet that meets the conditions is resubmitted, and after resubmission, a count is obtained in a corresponding storage bucket and the count and quintuple information are stored, and finally the quintuple information and flow size of the large flow are read through a control plane.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of network measurement, and in particular to a query method for large flow quintuples based on a P4 programmable switch. Background Art

[0002] Network administrators usually need network monitoring and other means to perform troubleshooting, traffic control, load balancing, etc. In the era of big data, network traffic is increasing, with global traffic increasing by 25%-35% in March 2020. This poses a huge challenge for terminals to process messages and obtain general statistical information, as this may lead to more terminal resource consumption and longer processing time.

[0003] Sketch is an algorithm based on probabilistic data structure, which can achieve network traffic measurement with minimal resource occupation and high accuracy. In network monitoring, the usual sketch approach is to take the source address, destination address, transport layer protocol, source port number, and destination port number of the network traffic data packet as a five-tuple as input, obtain the hash value through the hash function, and map it to a bucket in the array for counting. The traditional terminal-based statistical method consumes a lot of valuable resources such as the terminal's CPU, memory, and storage, which may cause irreversible wear and tear on the terminal performance over time. The P4-based programmable switch is very suitable for deploying this algorithm because the P4 language has the advantages of reconfigurability, protocol independence, and platform independence. The processing logic of the switch can be changed without replacing the hardware. As a forwarding node in the network, the switch has a huge advantage of high line speed, which is undoubtedly the best platform for P4 language deployment. Therefore, processing and counting messages at high line speed in a P4-based programmable switch can help terminal nodes save valuable time and resources. In summary, offloading traffic monitoring from terminals to programmable switches within the network is of great significance for efficient, accurate and fast network measurement. Summary of the invention

[0004] In order to solve the above technical problems, the present invention provides a large flow quintuple query method based on a P4 programmable switch, which is used to offload the data summary of network traffic measurement to a programmable switch in the network, so as to give full play to the switching node resources, realize the traffic decision in the network, and improve the overall performance of the network.

[0005] The present invention provides a query method for large flow quintuples based on a P4 programmable switch, including flow filtering: filtering the flow that does not meet the conditions through the parser of the programmable switch, the conditions including but not limited to the network layer protocol and the transport layer protocol, thereby measuring the flow that meets the conditions, and the resubmitted message requires additional metadata parsing.

[0006] The present invention provides a query method for large flow quintuples based on a P4 programmable switch, which changes the bucket information: each data packet is represented as p, and a 32-bit hash value h(p) is obtained and then sliced ​​into 16-bit hash values ​​h(p) 1 、h(p) 2 、h(p) 3 Used to determine the bucket number mapped to different arrays. Each bucket B has two pieces of information: the current stored traffic five-tuple hash value B.id and the count B.value, and both are initialized to 0. When a data packet arrives at a bucket, the bucket information is changed according to the following four different situations:

[0007] (1) If the hash value B.id stored in the bucket is the hash value h(p) of the current data packet, and the bucket count is greater than or equal to a predefined threshold TH, then the bucket count is increased by 1, and the return value is 1 to indicate that the traffic to which the current data packet belongs is a large flow;

[0008] (2) The hash value B.id stored in the bucket is the hash value h(p) of the current data packet, but the bucket count is less than the predefined threshold TH, then the bucket count is increased by 1 and the return value is 0;

[0009] (3) If the hash value B.id stored in the bucket is not the hash value h(p) of the current data packet, and the bucket count is greater than or equal to a predefined threshold TH, the bucket count is reduced by 1 and the return value is 0;

[0010] (4) If the hash value B.id stored in the bucket is not the hash value h(p) of the current data packet, and the bucket count is less than the predefined threshold TH, the bucket count is reduced by 1, the hash value B.ID stored in the bucket is changed to the hash value h(e) of the current data packet, and the return value is 0.

[0011] A query method for a large flow quintuple based on a P4 programmable switch of the present invention further includes resubmission: among the return values ​​of buckets in different arrays, as long as one is 1 according to the situation, a loopback operation is performed on the data packet, and the data packet is resubmitted to the parser;

[0012] After resubmission, the bucket count can be extracted, and the bucket with a return value of 1 is used as the count of the five-tuple to which the data packet belongs recorded in the bucket. The count of the bucket with a return value of 0 is regarded as 0, and the counts obtained from multiple buckets are compared to obtain the maximum value as the final count of the five-tuple.

[0013] A query method for a large flow quintuple based on a P4 programmable switch of the present invention also includes introducing a Bloom filter to determine whether a large flow quintuple is recorded for the first time; if the quintuple is determined as a large flow for the first time, the order in which the flow is determined as a large flow is given, and the quintuple information of the flow is recorded, which are the source IP address, the destination IP address, the transport layer protocol, the source port number, and the destination port number; if it is not recorded for the first time, the order in which it is determined as a large flow is read;

[0014] The final count obtained for each data packet of the large flow is judged in the counting registers of the corresponding order, and the larger one is taken as the value stored in the register.

[0015] The present invention provides a query method for large flow quintuples based on a P4 programmable switch, which also includes real-time access to storage information of a data plane register through a control plane, and real-time return of output results, so that a network administrator can obtain intuitive large flow information, thereby facilitating the network administrator to perform the next step of operation. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 is a flow chart of the implementation of the present invention;

[0017] Figure 2 is a schematic diagram of the bucket processing algorithm of the present invention;

[0018] Figure 3 is a process flow chart of the parser of the present invention;

[0019] Figure 4 is a schematic diagram of a large flow information collector of the present invention;

[0020] Figure 5 It is a schematic diagram of the control plane analysis result of the present invention. DETAILED DESCRIPTION

[0021] In order to make the technical content of the present invention clearer, specific examples will be given in detail below and explained with the help of drawings. It should be understood that the specific examples described here are only used to explain the present invention and are not used to limit the present invention.

[0022] Figure 1 The flowchart of the query method of the large flow quintuple based on the P4 programmable switch of the present invention comprises the following steps:

[0023] (1) Traffic filtering: Before a data packet is processed by the programmable switch pipeline, it needs to pass through a parser to extract the header field. Filtering conditions are set in the parser, including but not limited to limiting the network layer protocol to IPv4 and IPv6, and limiting the transport layer protocol to TCP and UDP, etc. Data packets that do not meet the filtering conditions are discarded.

[0024] (2) Change bucket information: Represent each data packet as p. After obtaining the 32-bit hash value h(p) through the hash function based on the five-tuple information of the data packet, slice it into h(p)1=h(p)[31:16], h(p)2=h(p)[23:8], h(p)3=h(p)[15:0] to determine the number of storage buckets mapped to different arrays. Each bucket B has two parts of information: the current stored traffic five-tuple hash value B.id and the count B.value, and both are initialized to 0. When a data packet arrives at a bucket, the bucket information is changed according to the following four different situations:

[0025] (a) If the hash value B.id stored in the bucket is the hash value h(p) of the current data packet, and the bucket count is greater than or equal to a predefined threshold TH, then the bucket count is increased by 1, and the return value is 1 to indicate that the traffic to which the current data packet belongs is a large flow;

[0026] (b) The hash value B.id stored in the bucket is the hash value h(p) of the current data packet, but the bucket count is less than the predefined threshold TH, then the bucket count is increased by 1 and the return value is 0;

[0027] (c) If the hash value B.id stored in the bucket is not the hash value h(p) of the current data packet, and the bucket count is greater than or equal to a predefined threshold TH, the bucket count is reduced by 1 and the return value is 0;

[0028] (d) If the hash value B.id stored in the bucket is not the hash value h(p) of the current data packet, and the bucket count is less than the predefined threshold TH, the bucket count is reduced by 1, the key B.id stored in the bucket is changed to the hash value h(p) of the current data packet, and the return value is 0.

[0029] (3) Resubmission: Since the network traffic distribution has the characteristics of fewer elephant flows and more mouse flows, hash collisions are inevitable, so the key values ​​assigned to buckets in different arrays are different. Therefore, among the return values ​​of buckets in different arrays, if one is 1, the data packet is looped back, that is, the data packet is resubmitted to the parser.

[0030] (4) Reading bucket counts: After resubmission, the bucket counts can be extracted. The bucket with a return value of 1 is used as the count of the five-tuple to which the data packet belongs. The bucket with a return value of 0 is regarded as 0. The counts obtained from multiple buckets are compared, and the maximum value is obtained as the final count of the five-tuple.

[0031] (5) Writing data: A Bloom filter is introduced to determine whether a large flow is recorded for the first time. If it is determined to be a large flow for the first time, the order in which the flow is determined to be a large flow is given, and the five-tuple information of the flow is recorded, which are the source IP address, destination IP address, transport layer protocol, source port number, and destination port number. The final count of each incoming data packet of the large flow is judged in the register of the corresponding order, and the larger one is taken as the value stored in the register.

[0032] (6) Management data: The control plane can access the storage information of the data plane register in real time and return the output results in real time, so that the network administrator can obtain intuitive information such as large flow quintuples, large flow counts and traffic bases, thereby facilitating the network administrator to perform the next step of operations such as access control lists and forwarding path management.

[0033] Figure 2 This is a schematic diagram of the bucket processing algorithm of the present invention. After each data packet p is extracted by the parser, it will be sent to the pipeline for the next step of processing. First, the hash function takes the five-tuple of the data packet as input, and can obtain a 32-bit hash value h(p) representing a five-tuple, and obtains the numbers of the buckets mapped in different arrays by slicing, which are h(p) and 1 =h(p)[31:16]、h(p) 2 =h(p)[23:8],h(p) 3 =h(p)[15:0], which are then mapped to the corresponding buckets in each array.

[0034] In the P4 programmable switch, the storage bucket is implemented by a register. At present, there are many restrictions on the register, one of which is that in a register action, at most two comparison judgments are performed. The present invention proposes two judgment conditions for keys and values, namely, judging whether the hash value of the storage bucket key and the data packet is the same, and comparing the value of the storage bucket with a predefined threshold. Therefore, there are four different situations, and the next operation is determined according to the following four different situations:

[0035] (1) If the bucket key B.id is the same as the hash value h(p) of the currently processed data packet, and the current bucket value B.value is not less than a predefined threshold TH, the current data packet is identified as belonging to a large flow, and the bucket count is incremented by one. The return value is 1, which means that the current data packet is resubmitted to the parser;

[0036] (2) If the bucket key B.id is the same as the hash value h(p) of the currently processed data packet, and the current bucket value B.value is less than a predefined threshold TH, then it is not a large flow, and only the bucket count is increased by one. The return value is 0, which means that the current data packet is not resubmitted to the parser;

[0037] (3) If the key B.id of the bucket is different from the hash value h(p) of the currently processed data packet, and the value B.value of the current bucket is not less than a predefined threshold TH, it can be considered that a hash collision has occurred between the small flow and the large flow, so the bucket count is saturated and reduced by one. Here, saturation reduction is defined as: if the bucket count is greater than zero, the bucket count is reduced by one, otherwise no processing is performed;

[0038] (4) If the key B.id of the bucket is different from the hash value h(p) of the currently processed data packet, and the value of the current bucket is less than a predefined threshold TH, it can be considered that a hash collision has occurred between the small flows. Since the focus of the present invention is on large flows, the bucket count is saturated and reduced by one, and the bucket key is changed to the hash value of the current data packet.

[0039] Regarding case (1), resubmission is required because of another limitation of the P4 register, that is, each time a data packet passes through a register in the pipeline, a register action of the register is executed at most once. This results in the case where the data packet only passes through the pipeline once, and the count cannot be obtained after the bucket algorithm is completed, because the register action is performed twice on the same register. If the return value is set to the register count after the bucket algorithm is processed, it is impossible to tell whether a hash collision has occurred, so the logic implementation of reading the register count is placed after resubmission.

[0040] When a quintuple is accessed for the first time, the applicable situation is case (4), because the key and value of the bucket are both 0, and the probability that the quintuple is also 0 is 1 / (2^32), so it can be considered that the hash value of the quintuple must be different from the key of the bucket. For large flows, in the absence of hash collisions, the cost of changing the bucket key to its quintuple hash value is only one data packet, which can be ignored; for small flows, since the purpose of the present invention is to query large flows, hash collisions between small flows cause the bucket key to be changed, which is acceptable, even if this sacrifices the accuracy of small flow measurement.

[0041] If the return values ​​of the corresponding buckets of multiple arrays are all 0, the flow to which the data packet belongs is a small flow and no subsequent operation is performed on it. Otherwise, as long as the return value of one bucket is 1, it will be resubmitted to the parser for large flow statistics processing.

[0042] Figure 3 The parser is used to extract header fields of different layers in the message.

[0043] (1) Start parsing: First, determine whether the message is a resubmitted message based on the inherent metadata added to the data packet by the P4 programmable switch: If it is a resubmitted message, extract the information of which arrays need to output the bucket count, and then initialize the user-defined metadata; otherwise, directly initialize the user-defined metadata;

[0044] (2) Initializing user-defined metadata: The metadata contains information such as temporary variables required for processing messages in the pipeline. The user-defined metadata is initialized, that is, the user-defined metadata is assigned a value of 0;

[0045] (3) Parsing the data link layer header: Extract the Ethernet header into the header stack. The Ethernet header contains fields such as the source MAC address, the destination MAC address, and the type. The type field is used to determine how to parse the network layer protocol.

[0046] (4) Parse the network layer header: The network layer header contains information such as the source IP address, destination IP address, and transport layer protocol. Based on the results of the data link layer parsing, extract the IPv4 header or IPv6 header into the header stack. If it is an IPv4 header, determine how to parse the transport layer protocol based on its protocol field; if it is an IPv6 header, determine how to parse the transport layer protocol based on its next header field; otherwise, discard the packet;

[0047] (5) Parsing the transport layer header: The transport layer header contains information such as the source port and the destination port. According to the results of the network layer parsing, if it is a TCP header, the TCP header is extracted into the header stack; if it is a UDP header, the UDP header is extracted into the header stack; otherwise, all port information is set to zero. Parsing is completed.

[0048] Figure 4 After resubmission, the parser can extract key information, that is, which arrays correspond to the storage buckets that identify the data packet p as belonging to the large flow.

[0049] After re-entering the pipeline, for the bucket whose return value was 1 before resubmission, the obtained count is the current count of the bucket; and for the bucket whose return value was 0 before resubmission, the obtained count is 0. By comparing the counts of the corresponding buckets of different arrays, the maximum value p.max can be obtained.

[0050] Subsequently, the data packet passes through the Bloom filter, which is used to determine whether the large flow information collector has recorded the quintuple of a large flow data packet. In the P4 programmable switch, the Bloom filter is implemented by a register, the data type it stores is 1 bit, and the initial state is set to 0. If a quintuple accesses the Bloom filter for the first time, the inverse state value 1 of the current state 0 is output to indicate that the large flow quintuple is recorded for the first time, and the state of the Bloom filter is set to 1; when the large flow quintuple accesses the Bloom filter again, the inverse state value 0 of the current state 1 is output to indicate that the quintuple has been recorded, and the state of the Bloom filter is set to 1.

[0051] If a large flow quintuple is accessed for the first time, the order in which the quintuple is judged to be a large flow is recorded as the number for storing the large flow quintuple information. According to the number index, five registers are used to record the quintuple information respectively: source IP address, destination IP address, transport layer protocol, source port number, and destination port number. If it is not the first access, the order in which it is judged to be a large flow is read.

[0052] Finally, according to the number index, a register is used to store the maximum count value calculated for the quintuple, so as to update the count of the quintuple.

[0053] Figure 5 This is a schematic diagram of the control plane analysis results of the present invention. When the P4 programmable switch runs a program, all data packets passing through the switch will be processed by the program of the data plane. The network administrator can obtain data on the control plane at any time and output the measurement results of the large flow.

[0054] The table header indicates from left to right the order in which the large flow quintuple is determined to be a large flow, the source IP address of the large flow, the destination IP address of the large flow, the transport layer protocol of the large flow, the source port of the large flow, the destination port of the large flow, and the packet count of the large flow. Taking the first row of the data part as an example, the row indicates that the quintuple with source IP address 203.85.126.61, destination IP address 126.23.178.112, transport layer protocol UDP protocol, source port number 40000, and destination port number 56747 is the 32nd quintuple determined to be a large flow, and the packet count of the quintuple is 140.

[0055] By collecting data through the control plane, network administrators can collect information such as cardinality, number of heavy hitters, number of heavy flow packets (flow size), and top-k flows (top-k) ranked from most to least. Based on this information, they can make further decisions, such as modifying the access control list (ACL) and forwarding path.

Claims

1. A method for querying large flow quintuples based on a P4 programmable switch, characterized in that: Including traffic filtering: through the parser of the programmable switch, the traffic that does not meet the conditions is filtered. The conditions include but are not limited to the network layer protocol and the transport layer protocol, so as to measure the traffic that meets the conditions. The resubmitted message needs to be additionally parsed for metadata; It also includes changing the bucket information: each data packet is represented as p, and the 32-bit hash value h(p) is obtained and sliced ​​into 16-bit hash values ​​h(p)1, h(p)2, and h(p)3 to determine the bucket numbers mapped to different arrays. Each bucket B has two parts of information: the current stored traffic five-tuple hash value B.id and the count B.value, and both are initialized to 0. When a data packet arrives at a bucket, the bucket information is changed according to the following four different situations: (1) If the hash value B.id stored in the bucket is the hash value h(p) of the current data packet, and the bucket count is greater than or equal to a predefined threshold TH, then the bucket count is increased by 1, and the return value is 1 to indicate that the traffic to which the current data packet belongs is a large flow; (2) The hash value B.id stored in the bucket is the hash value h(p) of the current data packet, but the bucket count is less than the predefined threshold TH, then the bucket count is increased by 1 and the return value is 0; (3) If the hash value B.id stored in the bucket is not the hash value h(p) of the current data packet, and the bucket count is greater than or equal to a predefined threshold TH, the bucket count is reduced by 1 and the return value is 0; (4) If the hash value B.id stored in the bucket is not the hash value h(p) of the current data packet, and the bucket count is less than the predefined threshold TH, then the bucket count is reduced by 1, and the hash value B.ID stored in the bucket is changed to the hash value h(e) of the current data packet, and the return value is 0; It also includes resubmission: among the return values ​​of the buckets in different arrays, as long as one is 1, the data packet is looped back and resubmitted to the parser; After resubmission, the bucket count can be extracted, and the bucket with a return value of 1 is used as the count of the five-tuple to which the data packet belongs recorded in the bucket, and the count of the bucket with a return value of 0 is regarded as 0. The counts obtained from multiple buckets are compared, and the maximum value is obtained as the final count of the five-tuple; It also includes the introduction of a Bloom filter to determine whether a large flow quintuple is recorded for the first time; If the five-tuple is determined as a large flow for the first time, the order in which the flow is determined as a large flow is given, and the five-tuple information of the flow is recorded, which includes the source IP address, destination IP address, transport layer protocol, source port number, and destination port number; if it is not recorded for the first time, the order in which it is determined as a large flow is read; The final count obtained for each data packet of the large flow is judged in the counting registers of the corresponding order, and the larger one is taken as the value stored in the register.

2. A method for querying large flow quintuples based on a P4 programmable switch as claimed in claim 1, characterized in that: It also includes real-time access to the storage information of the data plane register through the control plane, and real-time return of output results, so that network administrators can obtain intuitive large flow information, making it easier for network administrators to perform the next step of operation.