A fine-grained sliding window network measurement method based on a P4 switch
By employing a fine-grained sliding window network measurement method on P4 switches, the problems of high accuracy and memory efficiency in network measurement under resource-constrained conditions are solved, achieving efficient frequency estimation and network performance improvement.
Patent Information
- Application Number
- CN202510483843.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-17
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2045-04-17
AI Technical Summary
Achieving high accuracy and memory efficiency in network measurements on resource-constrained P4 switches presents challenges, especially due to the limited number of pipeline stages in the PISA architecture, the lack of support for complex arithmetic operations in register operations, and the trade-off between memory usage and measurement accuracy caused by the scarcity of TCAM and SRAM resources.
A fine-grained sliding window network measurement method based on P4 switches is adopted. The time block and time slot of the data packet are obtained through hash operation. The packet header is combined to determine whether it is a query packet. If so, update or query operation is performed. Frequency estimation is implemented in the data plane. The advantages of programmable hardware switches are utilized to achieve line-speed processing.
While saving memory, it improves time granularity and query accuracy, achieving nanosecond-level latency and Tbps-level high throughput, thereby improving resource utilization and network performance, and adapting to network applications with different time sensitivities.
Smart Images

Figure CN120342904B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of network measurement technology, and particularly relates to a fine-grained sliding window network measurement method based on a P4 switch. Background Technology
[0002] Network measurement is a crucial process in computer networking, ensuring the healthy operation of network infrastructure and efficient traffic management. Through network measurement, important information such as the frequency of different network flows can be obtained, providing fundamental support for subsequent operations such as traffic engineering, Quality of Service (QoS) assessment, and anomaly detection. Traffic frequency statistics are a vital basic function in network measurement; however, with the increasing scale and complexity of networks, traditional network devices face challenges in processing massive traffic data due to limited computing power and memory resources. A common solution is to use a probabilistic data structure called a sketch, which uses hash mapping and counters to achieve flow characteristic statistics. Furthermore, considering that data packets in network data flows naturally possess temporal characteristics and that the dynamic network environment has high time sensitivity requirements, it is also necessary to combine the sketch with a sliding window model to form a sliding window sketch to reflect the temporal evolution of traffic characteristics.
[0003] The sliding window model provides time-aware capabilities for traffic characteristic analysis by dynamically updating data within the (time) window. Existing sliding window sketches include both software implementations entirely on the server side and implementations on the data plane (hardware switches). Implementing network measurements on the data plane is significant, as it avoids the overhead of transmitting large amounts of traffic data to a server for processing, allowing measurement tasks to be performed directly on the network forwarding path. Especially with the advent of programmable data planes (such as Intel Tofino ASICs), their line-speed processing and programmability have brought new opportunities for network measurements deployed on the data plane. P4 switches, as part of the programmable data plane, possess flexible programmability, enabling the implementation of algorithms designed for specific network measurement tasks such as frequency estimation. They also fully leverage hardware acceleration to provide efficient packet processing capabilities, thereby achieving more accurate and resource-efficient network measurements, reducing transmission latency, and improving network performance.
[0004] However, achieving efficient network measurement, especially on resource-constrained network devices (such as Intel TofinoASIC with only 10Mb of memory per stage), faces numerous challenges. First, the limited number of stages in its PISA (Protocol-Independent Switch Architecture) pipeline makes deploying fine-grained sliding window sketches highly challenging. Second, the RegisterAction operation in the P4 switch's registers does not support complex arithmetic operations (such as multiplication and division), nor does it support complex arithmetic operations in the ingress or egress control blocks. This forces developers to implement or approximate complex calculations using basic arithmetic operations. Furthermore, due to the scarcity of TCAM and SRAM resources, even using memory-efficient sketch data structures still requires a trade-off between memory usage and measurement accuracy. Therefore, despite the flexible programming capabilities of P4 programmable hardware switches, achieving high-accuracy and memory-efficient network measurement on resource-constrained P4 switches has become a key research challenge, urgently requiring an innovative solution. Summary of the Invention
[0005] To address the aforementioned technical problems, this invention proposes a fine-grained sliding window network measurement method based on a P4 switch, which can improve time granularity and query accuracy while saving memory.
[0006] This invention provides a fine-grained sliding window network measurement method based on a P4 switch, comprising:
[0007] Acquire data packets, perform a hash operation on the data packets, and obtain the time block and time slot of the current data packets based on the entry time of the data packets;
[0008] Clear one column of buckets in the next time block of the current data packet's time block;
[0009] Based on the header of the current data packet, determine whether the current data packet is a query packet, and obtain the determination result;
[0010] Based on the judgment result, combined with the cleared time block and time slot, an update or query operation is performed, and the current data packet is forwarded to the corresponding port.
[0011] Optionally, performing a hash operation on the data packet includes:
[0012] Select the number of hash functions based on the number of rows in the sketch used to implement the time block;
[0013] Extract the flow identifier of the data packet, input the flow identifier into the hash function respectively, and obtain the array index of the corresponding row. The array index is used to locate the position of the update or query triggered by the current data packet.
[0014] Optionally, obtaining the time block and time slot of the current data packet based on the data packet entry time includes:
[0015] The time block and time slot of the current data packet are calculated based on the entry time and the time length of each time block and time slot.
[0016] Optionally, based on the judgment result, combined with the cleared time block and time slot, performing an update or query operation and forwarding the current data packet to the corresponding port includes:
[0017] If it is a query packet, calculate the query start time block and time slot, obtain the query result, append the query result to the packet header and forward it to the corresponding port;
[0018] If it is not a query packet, then perform an update operation and forward the current data packet to the corresponding port.
[0019] Optionally, calculate the query start time block and time slot, and obtain the query results including:
[0020] The query start time block and time slot are calculated by combining the time lengths of the time block and time slot;
[0021] Determine whether the starting time block is the latest time block, and obtain a second determination result;
[0022] Based on the second judgment result, the query result is obtained.
[0023] Optionally, obtaining the query result based on the second determination result includes:
[0024] If the starting time block is the latest time block, then calculate the frequency of the time slot from the starting time slot to the previous time slot of the current time slot within the starting time block, and obtain the first query result;
[0025] If the starting time block is not the latest time block, the frequency from the starting time slot to the end of the time block is calculated within the starting time block. Then, the time blocks between the starting time block and the current time block are queried using the query method of the CM sketch to obtain the second query result.
[0026] The query result is obtained based on the first query result and the second query result.
[0027] Optionally, performing an update operation, forwarding the current data packet to the corresponding port, includes:
[0028] If the current data packet is not in a new time slot, the counter value of the bucket hashed in AuxCM will be incremented by 1 respectively;
[0029] If the current data packet is in a new time slot, then based on the minimum count value ctr min and minimum slot value min Update the ratio and frequency information in the corresponding time block and time slot, and reset the bucket hashed in AuxCM;
[0030] After completing the above operations, the current data packet is forwarded to the corresponding port.
[0031] Optionally, based on the minimum count value ctr min and minimum slot value min Updating the ratio and frequency information in the corresponding time blocks and time slots includes:
[0032] Get slot min The corresponding time block blk slot and slot min The corresponding bkt slot Time slots within spec ;
[0033] According to the time block blk slot and time slot spec Update the ratio bkt.r[slot] spec ];
[0034] For slot spec Update the ratio stored in each time slot bkt.r[s] and update the frequency information bkt.freq.
[0035] Compared with the prior art, the present invention has the following advantages and technical effects:
[0036] (1) Frequency estimation based on sliding window is implemented entirely in the data plane: This invention is implemented entirely in the data plane, avoiding the limitations of traditional technical solutions that rely on complex operations in the control plane. Furthermore, this invention uses a sliding window model for frequency estimation, which aligns with the inherent time-sensitivity of network data streams and meets the timeliness requirements of most applications. In addition, this invention leverages the ASIC chip on a programmable hardware switch to achieve line-speed processing, thereby realizing nanosecond-level latency and Tbps-level high throughput.
[0037] (2) Low memory consumption: The time blocks used in this invention are time blocks with relatively long coverage times, while the memory occupied by the ratio is extremely low (usually a few bits). Therefore, this invention can be efficiently deployed on memory-constrained hardware switches. Since this invention only occupies very little memory, other programs can also be deployed on the same hardware switch, improving resource utilization and saving costs.
[0038] (3) Fine granularity and high accuracy: This invention uses a ratio mechanism to logically divide time blocks. When a time block is divided into several smaller time slots, the time granularity is finer, which in turn makes the query more accurate. This effectively improves service quality and user experience.
[0039] (4) Flexible time block size adjustment: Network administrators can freely define the size of the time block before starting the program, and thus adjust the size of the time window to suit network applications with different time sensitivities. This enhances the manageability and adaptability of the system.
[0040] (5) Based on the low memory usage of large time blocks, this invention significantly improves time granularity and query accuracy by introducing a ratio mechanism, and overcomes the memory and computational limitations on P4 switches. It can be efficiently implemented on the data plane, improving network performance and service quality. Attached Figure Description
[0041] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0042] Figure 1 This is a flowchart of a fine-grained sliding window network measurement method based on a P4 switch according to an embodiment of the present invention;
[0043] Figure 2 This is a schematic diagram of the data structure of a frequency estimation embodiment of the present invention;
[0044] Figure 3 This is a flowchart of the pipeline processing of a P4 programmable hardware switch in a frequency estimation embodiment of the present invention. Detailed Implementation
[0045] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0046] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0047] This embodiment proposes a fine-grained sliding window network measurement method based on a P4 switch, such as... Figure 1 As shown, the specific steps include:
[0048] Retrieve data packets, perform hash operations on the data packets, and obtain the time block and time slot of the current data packet based on the entry time of the data packet;
[0049] Clear one column of buckets in the next time block of the current data packet's time block;
[0050] Determine whether the current data packet is a query packet by combining the packet header, and obtain the determination result;
[0051] Based on the judgment result, combined with the cleared time block and time slot, perform update or query operations, and forward the current data packet to the corresponding port.
[0052] Specifically, when a data packet arrives, a hash operation is performed and its corresponding time block and time slot are calculated based on its entry time.
[0053] Clear one column of buckets in the next time block of its own time block, and the next column to be cleared should be the column after the current column;
[0054] The packet header determines whether the current packet is a query packet. If so, the frequency within the corresponding time slot is calculated using the ratio in the query start time block. In other time blocks, the ratio is not calculated; the query is performed using the standard CM sketch query method. Finally, the result is compared with the CTR. min The results are summed to obtain the query result; if not, it is determined whether the data packet is in a new time slot compared to the previous data packet. If so, the frequency in the previous time slot needs to be quantified into a ratio and stored in the corresponding time block. If not, the counter in the corresponding bucket of AuxCM is incremented by 1.
[0055] More specifically, clear one column of buckets in the next time block of the time block to which the data packet belongs, and the next column to be cleared should be the column following the current column, including:
[0056] Set up a global variable to record which column is cleared to zero, and increment the global variable by 1 after clearing it.
[0057] Furthermore, hashing the data packets includes:
[0058] Select the number of hash functions based on the number of rows in the sketch used to implement the time block;
[0059] Extract the flow identifier of the data packet, input the flow identifier into the hash function, and obtain the array index of the corresponding row. The array index is used to locate the position of the update or query triggered by the current data packet.
[0060] Furthermore, based on the packet entry time, obtaining the time block and time slot of the current packet includes:
[0061] The time block and time slot of the current data packet are calculated based on the entry time and the duration of each time block and time slot.
[0062] Furthermore, based on the judgment result, combined with the cleared time block and time slot, an update or query operation is performed, and the current data packet is forwarded to the corresponding port, including:
[0063] If it is a query packet, calculate the query start time block and time slot, obtain the query results, append the query results to the packet header and forward it to the corresponding port;
[0064] If it is not a query packet, then perform an update operation and forward the current packet to the corresponding port.
[0065] Furthermore, the query start time block and time slot are calculated to obtain the query results, including:
[0066] Calculate the query start time block and time slot by combining the time lengths of the time block and time slot;
[0067] Determine if the starting time block is the latest time block, and obtain the second determination result;
[0068] Based on the second judgment result, obtain the query results.
[0069] Furthermore, based on the second judgment result, the query results obtained include:
[0070] If the starting time block is the latest time block, then calculate the frequency of the time slot from the starting time slot to the previous time slot within the starting time block, and obtain the first query result;
[0071] If the starting time block is not the latest time block, calculate the frequency from the starting time slot to the end of the time block within the starting time block, and then use the query method of CM sketch to query the time blocks between the starting time block and the current time block to obtain the second query result;
[0072] Based on the first and second query results, obtain the query results.
[0073] Further, performing an update operation, forwarding the current data packet to the corresponding port, includes:
[0074] If the current data packet is not in a new time slot, the counter value of the bucket hashed in AuxCM will be incremented by 1 respectively;
[0075] If the current data packet is in a new time slot, then it is based on the minimum count value ctr. min and minimum slot value min Update the ratio and frequency information in the corresponding time block and time slot, and reset the bucket hashed in AuxCM;
[0076] After completing the above operations, forward the current data packet to the corresponding port.
[0077] Furthermore, according to CTR min and slot min Updating the ratio and frequency information in the corresponding time blocks and time slots includes:
[0078] Get slot min The corresponding time block blk slot and slot min The corresponding blk slot Time slots within spec ;
[0079] According to time block blk slot and time slot spec Update the ratio bkt.r[slot] spec ];
[0080] For slot spec Update the ratio stored in each time slot bkt.r[s] and update the frequency information bkt.freq.
[0081] Specifically, calculating the frequency within the corresponding time slot using the ratio in the query start time block includes:
[0082] Find the bucket bkt containing the minimum frequency value tgt And calculate bkt tgt .freq·qratSum / ratSum.
[0083] Specifically, quantifying the frequency in the previous time slot into a ratio and storing it in the corresponding time block includes:
[0084] Find the previous time slot, specifically located in time block blk. slot slot spec At the location, calculate In addition, for slots earlier than the specified time block spec For time slots s, it is necessary to iterate through them and update their corresponding ratios, calculated as follows:
[0085] The following is a detailed description of this embodiment with reference to the accompanying drawings:
[0086] The data structure in this embodiment is as follows: Figure 2 As shown, this data structure comprises n+1 time blocks to form a time window, with each time block implemented using a CM sketch. Each CM sketch's buckets are divided into two parts: frequency and several ratios. Furthermore, when each packet arrives, if the frequency portion of the time block's CM sketch is incremented by 1 directly without using an additional data structure, it's impossible to know the frequency within each time slot of that time block. Therefore, an additional auxiliary CM sketch, AuxCM, is needed to record which time slot the previous packet in the current stream appeared in and how much frequency it accumulated in that time slot.
[0087] The following is combined with Figure 1 , Figure 3 The technical solution proposed in this embodiment will be described in detail, and the specific measurement steps are as follows:
[0088] Initially, all sketches have a bucket value of 0.
[0089] Step 1: When a data packet arrives, perform a hash operation and calculate its time block and time slot based on its entry time.
[0090] Specifically, in this embodiment, both the CM sketch and AuxCM of the time block can be viewed as two-dimensional arrays with three rows allocated. Therefore, three suitable (independent, computationally efficient) hash functions should be selected before the program starts. For each data packet, each hash function takes a stream identifier (e.g., a 5-tuple: source IP address, destination IP address, source port number, destination port number, protocol) as input and outputs the array index corresponding to each row of the data packet. In this embodiment, a total of three array indices are stored.
[0091] Next, on the Intel Tofino hardware switch, a timestamp, denoted as t, is recorded when a data packet enters the Ingress Parser. ing This timestamp is used to calculate the time block and time slot to which it belongs. Specifically, given a time block covering a time length of T and a time slot covering a time length of slotT, the time block to which the data packet belongs is blk. pkt =t ing >>log2T, the time slot it belongs to is slot. pkt =t ing>>log2slotT. It can be seen that the time blocks and time slots calculated in this way are monotonically increasing. However, since this embodiment does not perform memory allocation or reclamation during program runtime, the calculated time blocks and time slots need to be mapped to [0,N-1] and [0,m-1] respectively, where N is the number of time blocks required to fill the time window, and m is the number of time slots contained in each time block. Because slot... pkt It inherently contains blk pkt This data (because T = m·slot T), therefore, for this embodiment, only the slot... pkt Mapping is then possible. Therefore, the actual time slot to which this data packet belongs within a time block is the slot. blk =slot pkt mod m.
[0092] Step 2: Clear one column of the bucket in the next time block of the time block to which the data packet belongs, and the next column to be cleared should be the column after the current column.
[0093] Since there is no method for batch zeroing registers on the data plane, the next time block of the current time block is cleared gradually. This approach effectively clears outdated information (the next time block of the current time block is the oldest time block) while reusing the oldest time block, thus avoiding dynamic memory management during runtime.
[0094] Specifically, assuming a CM sketch for a time block has C columns, a global variable `colNo` needs to be maintained, initially set to 0. Each time the switch receives a packet and calculates its corresponding time block `blk`... pkt Afterwards, regarding blk pkt In the +1 time block, the column C of colNomod is cleared to zero. Then, colNo is incremented by 1.
[0095] Step 3: Determine if the current data packet is a query packet. There are two possibilities:
[0096] a. The packet header information conforms to the query packet-specific header set by the user. Users can configure header content to distinguish query packets from other network packets, for example, by setting a Type value that does not conform to any Ethernet II standard. In this case, a query operation should be triggered.
[0097] b. The header information of the data packet does not meet the user-defined header specific to the query packet. In this case, an update operation should be triggered.
[0098] First, let's explain the update operation. Generally, the update operation mainly includes three algorithms: FetchAux (retrieving the CTR from AuxCM)...min and slot min RstAux (resets the bucket hashed in AuxCM), and BlkUpdate (based on ctr...) min and slot min Update in the corresponding time block).
[0099] The FetchAux algorithm first finds the smallest slot value among the three buckets corresponding to the three array indices in AuxCM (see reference). Figure 2 The structure of each bucket in the Auxiliary CM sketch; this value is the slot. min Next, for all slot values in the three buckets, match the slot... min For buckets with equal values, find the smallest counter value; this value is the CTR. min .
[0100] The RstAux algorithm identifies all slot values less than or equal to the specified slot value in the three buckets corresponding to the three array indices in AuxCM. min Set the slot value of the bucket to slot. pkt And set the counter value to 1.
[0101] The BlkUpdate algorithm is a crucial algorithm in this invention involving ratios. When the current data packet is in a different (i.e., subsequent) time slot than the previous data packet belonging to the same flow, this algorithm should be invoked to update the ratio in the corresponding time block. Before invoking this algorithm, the FetchAux algorithm needs to be called first to obtain the slot. min and CTR min slot min Its function is to locate the time block and time slot that should be updated, ctr min The record is in the slot min The frequency accumulated within the time slot of this time slot.
[0102] The BlkUpdate algorithm first determines the slot min Calculate which specific time block and time slot this time slot belongs to. The specific time block is: blk slot =(slot) min >>log2m)mod N, where the specific time slot is slot spec =slot min -blk slot ·m.
[0103] Next, this embodiment will describe the time block blk. slotHow should one bucket `bkt` be updated? The other buckets follow the same method. Let `bkt.freq` be the frequency in the bucket, and `bkt.r[·]` be the ratio in the bucket. First, update... In the formula, b represents the number of bits for a ratio. Next, since new data is introduced into this time block, the slots within the time block... spec The previous time slots should also be updated. Specifically, for each slot... spec The previous time slot 's' has been updated to:
[0104] Finally, CTR min Adding the original bkt.freq to get the updated bkt.freq, i.e., bkt.freq = bkt.freq + ctr min .
[0105] The complete process of the update algorithm, i.e., step 3.b, is as follows: First, the FetchAux algorithm is called to obtain the ctr from AuxCM. min and slot min If slot min =slot pkt If the hash value is positive, the counter value of each bucket hashed in AuxCM is incremented by 1; otherwise, the BlkUpdate algorithm is called, based on the ctr. min and slot min Update the ratio and frequency information in the corresponding time block and time slot, and call the RstAux algorithm to reset the buckets hashed in AuxCM.
[0106] The query operation is explained below. First, the desired query stream ID and the desired query duration are read from the packet header. Based on the entry time of the query packet and the desired query duration, the start time of the query can be obtained by subtracting them, thus obtaining the start time block and time slot of the query. Specifically, let t be the desired query duration carried in the packet header. len The starting time slot for the query is: slot sp =(t ing -t len >> log2slotT, starting time block: blk sp =slot sp >>log2m. In addition, slots also need to be... sp Mapped to [0, m-1], the calculation is: slot spb =slot sp -m·blk sp .
[0107] The next step is to read data from the buckets hashed from the start time block and perform calculations. Note that the hash calculation at this point should not use the stream ID of the query packet itself as the hash input, but rather the stream ID to be queried carried in the query packet, and use the hash output as the index. First, find the bucket with the smallest frequency value among the three buckets corresponding to the three indices in the start time block, and denote this bucket as bkt. tgt Accumulate bkt tgt From slot spb The ratios of the time slots up to and including m-1 are denoted as qratSum. The summation is bkt. tgt The ratios of the time slots from 0 to m-1 (inclusive) are denoted as ratSum. Then, the frequency that should be added to the final result in the initial time block is bkt. tgt .freq·qratSum / ratSum.
[0108] It's important to note that the algorithm described above addresses the case where the starting time block and the current time block are not the same. If the starting time block and the current time block are the same, qratSum should be calculated from the slot. spb to slot blk The sum of the ratios of these time slots, approximately -1 (inclusive), should be ratSum, ranging from 0 to slot. blk The sum of the ratios of these time slots, including -1 (around 1).
[0109] Furthermore, due to the limitations of P4 switches, the formula bkt tgt .freq·qratSum / ratSum cannot be calculated accurately. The division implemented in this embodiment relies on the binary form of the divisor. The division is estimated by observing which positions in the binary form of the divisor are 1 to determine how to perform right shifts and additions. For example, The binary form of is (0.001001001...)2, then It can be estimated as needed. This expression can be easily computed using a series of right shifts and additions. Obviously, this introduces a certain truncation error.
[0110] Next, if the starting time block and the current time block are not in the same time block, for the time blocks in between, the query method of ordinary CM sketch is used, focusing only on the frequency value, obtaining several minimum frequency values, and accumulating them into the final result.
[0111] Finally, the FetchAux algorithm is called to obtain the CTR. min Add it to the final result to complete the query.
[0112] The complete query algorithm flow, i.e., step 3.a, firstly calculates the starting time block and time slot based on the query information carried in the packet header. Within the starting time block, a ratio mechanism is used to calculate the frequency of results that should be added to the final result. In the time blocks between the starting and current time blocks, only the frequency values in the buckets are considered, and the results are obtained using the standard CM sketch query method and added to the final result. Finally, the FetchAux algorithm is called to obtain the ctr. min Add it to the final result to complete the query.
[0113] Step 4: Forward the data packet to the corresponding port.
[0114] The above are merely preferred embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A fine-grained sliding window network measurement method based on a P4 switch, the method being applied to a P4 switch, characterized in that, include: Acquire data packets, perform a hash operation on the data packets, and obtain the time block and time slot of the current data packets based on the entry time of the data packets; Multiple time blocks are used to form a sliding window. Each time block is implemented using a CM sketch and contains multiple time slots. Clearing a column of buckets in the next time block of the current data packet's time block includes: whenever the P4 switch receives a data packet and calculates its time block, clearing the mod C-th column of buckets in the next time block, where a CM sketch of the time block has C columns; Based on the header of the current data packet, determine whether the current data packet is a query packet, and obtain the determination result; Based on the judgment result, combined with the cleared time block and time slot, perform an update or query operation, and forward the current data packet to the corresponding port, including: If it is a query packet, calculate the query start time, then obtain the corresponding start time block and time slot, get the query result, append the query result to the packet header and forward it to the corresponding port; If it is not a query packet, then perform an update operation and forward the current data packet to the corresponding port.
2. The fine-grained sliding window network measurement method based on a P4 switch according to claim 1, characterized in that, The hash operation on the data packet includes: Select the number of hash functions based on the number of rows in the CM sketch used to implement the time block; Extract the flow identifier of the data packet, input the flow identifier into the hash function respectively, and obtain the array index of the corresponding row. The array index is used to locate the position of the update or query triggered by the current data packet.
3. The fine-grained sliding window network measurement method based on a P4 switch according to claim 1, characterized in that, Based on the data packet entry time, obtaining the time block and time slot of the current data packet includes: The time block and time slot of the current data packet are calculated based on the entry time and the time length of each time block and time slot.
4. The fine-grained sliding window network measurement method based on a P4 switch according to claim 1, characterized in that, Calculate the query start time block and time slot, and obtain the query results including: The query start time block and time slot are calculated by combining the time lengths of the time block and time slot; Determine whether the starting time block is the latest time block, and obtain a second determination result; Based on the second judgment result, the query result is obtained.
5. The fine-grained sliding window network measurement method based on a P4 switch according to claim 4, characterized in that, Based on the second judgment result, obtaining the query result includes: If the starting time block is the latest time block, then calculate the frequency of the time slot from the starting time slot to the previous time slot of the current time slot within the starting time block, and obtain the first query result; If the starting time block is not the latest time block, the frequency from the starting time slot to the end of the time block is calculated within the starting time block. Then, the time blocks between the starting time block and the current time block are queried using the query method of the CM sketch to obtain the second query result. The query result is obtained based on the first query result and the second query result.
6. The fine-grained sliding window network measurement method based on a P4 switch according to claim 1, characterized in that, Performing an update operation, forwarding the current data packet to the corresponding port, includes: If the current data packet is not in a new time slot, then the bucket hashed in the auxiliary CM sketch will be... The values increment by 1 respectively; If the current data packet is in a new time slot, then based on the minimum count value... and minimum slot value Update the ratio and frequency information in the corresponding time block and time slot, and reset the buckets hashed in the auxiliary CM sketch; After completing the above operations, the current data packet is forwarded to the corresponding port.
7. A fine-grained sliding window network measurement method based on a P4 switch according to claim 6, characterized in that, Based on the minimum count value and minimum slot value Updating the ratio and frequency information in the corresponding time blocks and time slots includes: Get Corresponding time block and Corresponding Internal time slot ; According to the time block and time slot Update ratio ; for Each time slot before Update the stored ratios and frequency information. , where s is the time slot.
Citation Information
Patent Citations
Sketch based data center network flow analysis method
CN103647670A
Network measurement method and apparatus
WO2021254474A1