P4 switch-based fine-grained sliding window network measurement method
By adopting the fine-grained sliding window network measurement method on the P4 switch, the high accuracy and memory efficient network measurement problems under resource constraints are solved, and efficient frequency estimation and network performance improvement on the data plane are achieved.
Patent Information
- Application Number
- CN202510483843.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-17
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2045-04-17
AI Technical Summary
There are challenges in achieving high accuracy and memory-efficient network measurements on resource-constrained P4 switches, especially due to the limited number of pipeline stages in the PISA architecture, limited register operation complexity and scarcity of TCAM/SRAM resources.
The fine-grained sliding window network measurement method based on P4 switch is adopted to obtain the time block and time slot of the data packet through hashing operations, and the packet header is used to determine whether it is a query packet, perform update or query operations, and implement frequency estimation on the data plane, and use the ASIC chip of the programmable hardware switch for linear speed processing.
It realizes efficient frequency estimation on the data plane, reduces memory consumption, improves time granularity and query accuracy, adapts to network applications with different time sensitivity, and improves network performance and service quality.
Smart Images

Figure CN120342904A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of network measurement, and particularly relates to a fine-grained sliding window network measurement method based on a P4 switch. Background Art
[0002] Network measurement is a key process in the field of computer networks to ensure 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, which provides basic support for subsequent operations such as traffic engineering, quality of service (QoS) evaluation, and anomaly detection. In network measurement, traffic frequency statistics is an important basic function. However, with the growth of network scale and complexity, traditional network devices face challenges in processing massive traffic data due to limited computing power and memory resources. A commonly used solution is to adopt a probabilistic data structure called sketch, which realizes flow feature statistics through hash mapping and counters. At the same time, considering that the data packets in network data streams naturally carry the characteristics of time and the dynamic network environment has a high demand for time sensitivity, it is also necessary to additionally consider combining the sketch with the sliding window model to form a sliding window sketch to reflect the temporal evolution law of traffic characteristics.
[0003] The sliding window model provides temporal awareness for traffic feature analysis by dynamically updating the data within the (time) window. In existing sliding window sketches, some are fully implemented at the software level on the server side, while others are implemented on the data plane (hardware switch). Implementing network measurement on the data plane is of great significance. It can avoid the overhead of transmitting a large amount of traffic data to the server for processing and directly execute measurement tasks on the network forwarding path. Especially with the emergence of programmable data planes (such as Intel Tofino ASIC), their characteristics of line speed processing and programmability bring new opportunities for implementing network measurement deployed on the data plane. As part of the programmable data plane, the P4 switch has flexible programmability, can implement algorithms designed for specific network measurement tasks such as frequency estimation, and at the same time make full use of the advantages of hardware acceleration to provide efficient packet processing capabilities, thereby realizing more accurate and resource-efficient network measurement, reducing transmission latency, and improving network performance.
[0004] However, achieving efficient network measurement, especially on resource-constrained network devices (e.g., each stage of the Intel Tofino ASIC has only 10 Mb of memory), also faces many challenges. First, due to the limited number of stages in the pipeline of its PISA (Protocol-Independent Switch Architecture), it is highly challenging to deploy a sliding window sketch with extremely fine granularity on it; second, the RegisterAction operation of the registers in the P4 switch 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, which forces developers to use basic arithmetic operations to implement or approximate the results of complex operations themselves; in addition, limited by the scarcity of TCAM and SRAM resources, even when using a memory-efficient sketch data structure, a trade-off still needs to be made between memory occupancy and measurement accuracy. Therefore, although P4 programmable hardware switches have flexible programming capabilities, how to achieve high-accuracy and memory-efficient network measurement on resource-constrained P4 switches has become a key problem in current research and urgently requires an innovative solution. Summary of the Invention
[0005] To solve the above technical problems, the present invention proposes a fine-grained sliding window network measurement method based on a P4 switch, which can improve the time granularity and query accuracy while saving memory.
[0006] The present invention provides a fine-grained sliding window network measurement method based on a P4 switch, including:
[0007] Obtain a data packet, perform a hash operation on the data packet, and obtain the time block and time slot of the current data packet according to the ingress time of the data packet;
[0008] Clear a column of buckets in the next time block of the time block of the current data packet;
[0009] Combine the packet header of the current data packet to determine whether the current data packet is a query packet, and obtain the determination result;
[0010] According to the determination result, combine the cleared time block and time slot to perform an update or query operation, and forward the current data packet to the corresponding port.
[0011] Optionally, performing a hash operation on the data packet includes:
[0012] Select a number of hash functions equal to the number of rows of the sketch used to implement the time block;
[0013] Extract the flow identifier of the data packet, input the flow identifier into a hash function respectively, and obtain the array subscript of the corresponding row, where the array subscript is used to locate the position where the update or query triggered by the current data packet is performed.
[0014] Optionally, obtaining the time block and time slot of the current data packet according to the entry time of the data packet includes:
[0015] Calculate the time block and time slot of the current data packet according to the entry time in combination with the time lengths of each time block and time slot.
[0016] Optionally, according to the judgment result, in combination 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:
[0017] If it is a query packet, calculate the query start time block and time slot, obtain the query result, attach the query result to the packet header and forward it to the corresponding port;
[0018] If it is not a query packet, perform an update operation and forward the current data packet to the corresponding port.
[0019] Optionally, calculating the query start time block and time slot and obtaining the query result includes:
[0020] Calculate the query start time block and time slot in combination with the time lengths of the time block and time slot;
[0021] Judge whether the start time block is the latest time block, and obtain a second judgment result;
[0022] Obtain the query result according to the second judgment result.
[0023] Optionally, obtaining the query result according to the second judgment result includes:
[0024] If the start time block is the latest time block, calculate the frequency within the previous time slot from the start time slot to the current time slot within the start time block, and obtain a first query result;
[0025] If the start time block is not the latest time block, calculate the frequency from the start time slot to the end of the time block within the start time block, and then query the time blocks between the start time block and the current time block in the query mode of the CM sketch to obtain a second query result;
[0026] Obtain the query result according to the first query result and the second query result.
[0027] Optionally, performing an update operation and 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 is incremented by 1;
[0029] If the current data packet is in a new time slot, then according to the minimum count value ctr min and the minimum slot value min Update the ratio and frequency information in the corresponding time blocks and time slots, and reset the hashed buckets in AuxCM;
[0030] After completing the above operations, the current data packet is forwarded to the corresponding port.
[0031] Optional, based on the minimum count value ctr min and the minimum slot value min Updating ratio and frequency information in 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 slot 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 The previous time slots bkt.r[s] are updated, the stored ratios are updated, and the frequency information bkt.freq is updated.
[0035] Compared with the prior art, the present invention has the following advantages and technical effects:
[0036] (1) Implementing frequency estimation based on sliding windows completely in the data plane: The present invention is completely implemented in the data plane, avoiding the limitation of the traditional technical solution that needs to rely on the complex operations of the control plane. At the same time, the present invention uses a sliding window model to perform frequency estimation, which is in line with the time-related characteristics of network data flow and also meets the timeliness requirements of most applications. In addition, the present invention uses the ASIC chip on the programmable hardware switch to achieve line-speed processing rate, thereby achieving nanosecond delay and Tbps-level high throughput.
[0037] (2) Low memory consumption: The time blocks used in the present invention are time blocks with a relatively long coverage time, and the memory occupied by the ratio is extremely low (usually several bits). Therefore, the present invention can be efficiently deployed on hardware switches with limited memory. Since the present invention only occupies extremely low 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: The present invention performs logical cutting on time blocks through a ratio mechanism. When a time block is cut into several smaller time slots, the time granularity is finer, and thus the accuracy of query is higher. This effectively improves the service quality and user experience.
[0039] (4) Flexible adjustment of time block size: Before starting the program, network administrators can freely define the size of time blocks, and then adjust the size of the time window, so as to apply to network applications with different time sensitivities. This enhances the manageability and adaptability of the system.
[0040] (5) Based on the low memory occupancy of large time blocks, the present invention significantly improves the time granularity and query accuracy by introducing a ratio mechanism, overcomes the memory and computing limitations on P4 switches, can be efficiently implemented on the data plane, and improves network performance and service quality. Description of the Drawings
[0041] The drawings forming a part of this application are used to provide a further understanding of this application. The schematic embodiments of this application and their descriptions are used to explain this application and do not constitute an improper limitation to this application. In the drawings:
[0042] Figure 1 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 is a schematic diagram of the data structure of a frequency estimation embodiment according to an embodiment of the present invention;
[0044] Figure 3 is a flowchart of the P4 programmable hardware switch pipeline processing of a frequency estimation embodiment according to an embodiment of the present invention. Detailed Embodiments
[0045] It should be noted that, without conflict, the embodiments in this application and the features in the embodiments can be combined with each other. The following will refer to the drawings and combine with embodiments to detail this application.
[0046] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from 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] Get the data packet, perform hash operation on the data packet and obtain the time block and time slot of the current data packet according to the entry time of the data packet;
[0049] Clear a column of buckets in the next time block of the time block of the current data packet;
[0050] Determine whether the current data packet is a query packet based on the packet header of the current data packet, and obtain the determination result;
[0051] According to the judgment result, combined with the cleared time blocks and time slots, an update or query operation is performed, and the current data packet is forwarded to the corresponding port.
[0052] Specifically, when a data packet arrives, a hash operation is performed and the time block and time slot to which it belongs are calculated based on its entry time;
[0053] Clear a column of buckets in the next time block of the time block to which it belongs, and the column number cleared next time should be the next column of the current column;
[0054] According to the packet header, determine whether the current packet is a query packet. If so, use the ratio to calculate the frequency in the corresponding time slot in the query start time block. In other time blocks, no ratio calculation is involved. The query method of the conventional CM sketch is used for operation. Finally, with ctr min Add up to get the query result; if not, determine whether the data packet is in a new time slot compared to the previous data packet. If so, quantize the frequency in the previous time slot into a ratio and store it in the corresponding time block. If not, increment the counter in the corresponding bucket of AuxCM by 1.
[0055] More specifically, clearing a column of buckets in the next time block of the time block to which the data packet belongs, and the number of the column to be cleared next time should be the next column of the current column, including:
[0056] Set a global variable to record which column is cleared, and increment the global variable by 1 after clearing.
[0057] Furthermore, performing a hash operation on the data packet includes:
[0058] Select a number of hash functions equal to the number of rows of the sketch used to implement the time blocks;
[0059] Extract the flow identifier of the data packet, and input the flow identifier into the hash functions respectively to obtain the array subscripts of the corresponding rows. The array subscripts are used to locate the positions where the updates or queries triggered by the current data packet are performed.
[0060] Furthermore, according to the entry time of the data packet, obtaining the time block and time slot of the current data packet includes:
[0061] Calculate the time block and time slot of the current data packet according to the entry time in combination with the time lengths of each time block and time slot.
[0062] Furthermore, according to the judgment result, in combination with the cleared time block and time slot, perform update or query operations, and forward the current data packet to the corresponding port, including:
[0063] If it is a query packet, calculate the starting time block and time slot of the query, obtain the query result, attach the query result to the packet header and forward it to the corresponding port;
[0064] If it is not a query packet, perform an update operation and forward the current data packet to the corresponding port.
[0065] Furthermore, calculating the starting time block and time slot of the query and obtaining the query result includes:
[0066] Calculate the starting time block and time slot of the query in combination with the time lengths of the time block and time slot;
[0067] Judge whether the starting time block is the latest time block to obtain a second judgment result;
[0068] Obtain the query result according to the second judgment result.
[0069] Furthermore, obtaining the query result according to the second judgment result includes:
[0070] If the starting time block is the latest time block, calculate the frequency within the previous time slot from the starting time slot to the current time slot within the starting time block to obtain a 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 query the time blocks between the starting time block and the current time block in the query manner of the CM sketch to obtain a second query result;
[0072] Obtain the query result according to the first query result and the second query result.
[0073] Furthermore, performing the update operation and forwarding the current data packet to the corresponding port includes:
[0074] If the current data packet is not in a new time slot, increment the counter value of the bucket hashed in AuxCM by 1 respectively;
[0075] If the current data packet is in a new time slot, update the ratio and frequency information in the corresponding time block and time slot according to the minimum count value ctr min and the minimum slot value slot min and reset the bucket hashed in AuxCM;
[0076] After completing the above operations, forward the current data packet to the corresponding port.
[0077] Furthermore, updating the ratio and frequency information in the corresponding time block and time slot according to ctr min and slot min includes:
[0078] Obtain the time block blk min corresponding to slot slot and the time slot slot min corresponding to blk slot within; spec ;
[0079] According to the time block blk slot and the time slot slot spec , update the ratio bkt.r[slot spec ;
[0080] For each time slot bkt.r[s] before slot spec , update the stored ratio and update the frequency information bkt.freq.
[0081] Specifically, calculating the frequency within the corresponding time slot using the ratio at the start time block of the query includes:
[0082] Find the bucket bkt tgt with the minimum frequency value, and calculate bkt tgt .freq·qratSum / ratSum.
[0083] Specifically, quantizing the frequency in the previous time slot as a ratio and storing it in the corresponding time block includes:
[0084] Find the slot slot where the previous time slot is specifically located in the time block blk spec , and calculate In addition, for the time slots s in this time block earlier than slot spec , it is necessary to traverse and update their corresponding ratios respectively, and the calculation is:
[0085] The present embodiment will be described in detail below with reference to the accompanying drawings:
[0086] The data structure of this embodiment is as Figure 2 shown. This data structure includes n + 1 time blocks to form a time window, and each time block is implemented with a CM sketch. Each bucket of the CM sketch is divided into two parts: frequency and several ratios. Additionally, when each packet arrives, if it directly increments the frequency part of the CM sketch in the time block by 1 without using an additional data structure, it is obvious that the frequencies in each time slot within the time block cannot be known. Therefore, an additional auxiliary CM sketch, AuxCM, is required to record in which time slot the previous packet of the current flow appeared and how much frequency has been accumulated in that time slot.
[0087] Next, in combination with Figure 1 、 Figure 3 the technical solution proposed in this embodiment will be described in detail. The specific measurement steps are as follows:
[0088] In the initial state, the bucket values of all sketches are 0.
[0089] Step 1: When a packet arrives, perform a hash operation and calculate the time block and time slot to which it belongs based on its entry time.
[0090] Specifically, in this embodiment, both the CM sketch of the time block and AuxCM can be regarded as two-dimensional arrays allocated with three rows. Therefore, three appropriate (independent and computationally efficient) hash functions should be selected before the program starts. For each packet, each hash function takes the flow identifier (e.g., five-tuple: source IP address, destination IP address, source port number, destination port number, protocol) as input and outputs the array subscript corresponding to each row of the packet. In this embodiment, a total of three array subscripts are stored.
[0091] Next, on the Intel Tofino hardware switch, a timestamp, denoted as t ing . This timestamp is used to calculate the time block and time slot to which it belongs. Specifically, given that the time length covered by a time block is T and the time length covered by a time slot is slotT, the time block to which the packet belongs is blk pkt = t ing >> log2T, and the time slot to which it belongs is slot pkt = t ing>> log2slotT. It can be seen that both the time blocks and time slots obtained by this calculation method are monotonically increasing. However, since memory allocation or recycling is not performed during program operation in this embodiment, the calculated time block and time slot to which it belongs 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. Since slot pkt itself already contains blk pkt this data (because T = m · slot T), therefore, for this embodiment, only mapping slot pkt is required. Thus, the time slot to which the data packet truly belongs in a time block is slot blk = slot pkt mod m.
[0092] Step 2: Clear a column of buckets in the next time block of the time block to which the data packet belongs, and the number of columns to be cleared next time should be the next column of the current column.
[0093] Since there is no method for batch clearing registers on the data plane, the next time block of the current time block is cleared in a gradual manner. This approach effectively clears the expired information (the next time block of the current time block is the oldest time block), and at the same time reuses the oldest time block, avoiding dynamic memory management during operation.
[0094] Specifically, assume that a CM sketch of a time block has C columns, and a global variable colNo needs to be maintained, with its initial value being 0. Whenever the switch receives a packet and calculates the time block blk pkt to which it belongs, the column of buckets at colNo mod C in the time block blk pkt + 1 is cleared. Then, colNo is incremented by 1.
[0095] Step 3: Determine whether the current data packet is a query packet, and there are the following two cases:
[0096] a. The header information of the data packet meets the header unique to the query packet set by the user. The user can set the header content for differentiating query packets from other network data packets according to the actual situation, such as setting a Type value that does not conform to any EthernetII standard. In this case, the query operation should be triggered.
[0097] b. The header information of the data packet does not meet the header unique to the query packet set by the user. In this case, the update operation should be triggered.
[0098] First, the update operation is described. Generally, the update operation mainly includes three algorithms: FetchAux (obtain ctr from AuxCMmin and slot min ), RstAux (reset the bucket hashed to in AuxCM), and BlkUpdate (update according to ctr min and slot min in the corresponding time block).
[0099] The FetchAux algorithm first finds the minimum slot value in the three buckets corresponding to the three array subscripts in AuxCM (refer to the structure of each bucket in the Auxiliary CM sketch in Figure 2 ), and this value is the slot min . Then, for all buckets in the three buckets where the slot value is equal to slot min , find the minimum counter value, and this value is the ctr min .
[0100] The RstAux algorithm sets the slot values of all buckets in the three buckets corresponding to the three array subscripts in AuxCM where the slot value is less than or equal to slot min to slot pkt , and sets the counter value to 1.
[0101] The BlkUpdate algorithm is an important algorithm related to the ratio in the present invention. When the current data packet is in a different (i.e., later) time slot from the previous data packet belonging to the same flow, this algorithm should be called to update the ratio in the corresponding time block. Before calling this algorithm, it is necessary to call the FetchAux algorithm to obtain slot min and ctr min . The role of slot min is to locate the time block and time slot that should be updated, and ctr min records the accumulated frequency within the time of this time slot of slot min .
[0102] The BlkUpdate algorithm first calculates which time block and which time slot in all time blocks this time slot is according to slot min . The specific time block is: blk slot =(slot min >>log2m)mod N, and the specific time slot is slot spec =slot min -blk slot ·m.
[0103] Next, this embodiment illustrates the time block blk slotHow should one bucket bkt in it be updated. The other buckets follow the same method. Denote the frequency in the bucket as bkt.freq and the ratio in the bucket as bkt.r[·]. First, update where b is the number of bits of a ratio. Next, since new data is introduced in this time block, the time slots within the time block spec before should also be updated. Specifically, for each time slot spec s before, it is updated to:
[0104] Finally, add ctr min to the original bkt.freq to obtain the updated bkt.freq, that is, bkt.freq = bkt.freq + ctr min .
[0105] The complete process of the update algorithm, that is, step 3.b, is as follows. First, call the FetchAux algorithm to obtain ctr min and slot min from AuxCM. If slot min = slot pkt , then increment the counter values of the buckets hashed into AuxCM by 1 respectively; otherwise, call the BlkUpdate algorithm to update the ratio and frequency information in the corresponding time block and time slot according to ctr min and slot min , and call the RstAux algorithm to reset the buckets hashed into AuxCM.
[0106] Next, the query operation is described. First, read the desired query stream ID and the desired query duration to be covered from the packet header. According to the entry time of this query packet and the desired query duration to be covered, the start time of the query can be obtained by subtraction, and then the start time block and time slot of the query can be obtained. Specifically, denote the desired query duration to be covered carried in the packet header as t len , and the start time slot of the query is: slot sp = (t ing - t len ) >> log2slotT, and the start time block is: blk sp = slot sp >> log2m. In addition, it is also necessary to map slot sp to [0, m - 1], and the calculation is: slot spb = slot sp - m · blk sp .
[0107] Next, it is necessary to read data from the bucket hashed to from the start time block and calculate. Note that at this time, the hash calculation should not use the stream ID of the query packet itself as the hash input, but should use the stream ID that the query packet hopes to query as the hash input to obtain the hash output as the subscript. First, find the bucket with the smallest frequency value among the three buckets corresponding to the subscripts in the start time block, and denote this bucket as bkt tgt . Accumulate the ratios of the time slots from slot tgt to m - 1 (including both left and right) in bkt spb , and denote the accumulated result as qratSum. Accumulate the ratios of the time slots from 0 to m - 1 (including both left and right) in bkt tgt , and denote the accumulated result as ratSum. Then, the frequency to be added to the final result in the start time block is bkt tgt .freq·qratSum / ratSum.
[0108] It should be noted that the above algorithm is for the case where the start time block and the current time block are not the same time block. If the start time block and the current time block of the query are in the same time block, qratSum should be the sum of the ratios of the time slots from slot spb to slot blk - 1 (including both left and right), and ratSum should be the sum of the ratios of the time slots from 0 to slot blk - 1 (including both left and right).
[0109] In addition, due to the limitations of the P4 switch, the formula bkt tgt .freq·qratSum / ratSum cannot accurately calculate. The division implemented in this embodiment depends on the binary form of the divisor. By observing in which positions the binary form of the divisor is 1 to determine how to perform right shifts and additions to estimate the division. For example, 's binary form is (0.001001001...)2, then can be estimated as according to specific needs. This formula can be easily calculated using a series of right shift and addition operations. Obviously, this will introduce a certain truncation error.
[0110] Next, if the start time block and the current time block of the query are not in the same time block, for the time blocks in between, in the query manner of the ordinary CM sketch, only focus on the frequency values, obtain several smallest frequency values respectively, and accumulate them into the final result.
[0111] Finally, call the FetchAux algorithm to obtain ctr min , add it to the final result, and complete the query.
[0112] The complete process of the query algorithm, that is, step 3.a. First, calculate the starting time block and time slot of the query according to the query information carried in the packet header. In the starting time block, use the ratio mechanism to calculate the frequency that should be added to the final result in this time block; in the time blocks between the starting time block and the current time block, only focus on the frequency value in the bucket, and use the ordinary CM sketch query method to obtain the result and add it to the final result; finally, call the FetchAux algorithm to obtain the ctr min , and add it to the final result to complete the query.
[0113] Step 4: Forward the data packet to the corresponding port.
[0114] The above is only a preferred specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed in the present application should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A fine-grained sliding window network measurement method based on a P4 switch, characterized in that Including: Obtain a data packet, perform a hashing operation on the data packet, and obtain the time block and time slot of the current data packet according to the entry time of the data packet; Clear a column of buckets in the next time block of the time block of the current data packet; Combine the packet header of the current data packet to determine whether the current data packet is a query packet, and obtain a judgment result; According to the judgment result, combine the cleared time block and time slot, perform an update or query 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, wherein Performing a hashing operation on the data packet includes: Select a number of hash functions equal to the number of rows of the sketch used to implement the time block; Extract the flow identifier of the data packet, input the flow identifier into the hash functions respectively, and obtain the array subscripts of the corresponding rows, where the array subscripts are used to locate the position where the update or query triggered by the current data packet is performed.
3. The fine-grained sliding window network measurement method based on a P4 switch according to claim 1, wherein Obtaining the time block and time slot of the current data packet according to the entry time of the data packet includes: Calculate the time block and time slot of the current data packet according to the entry time in combination with the time lengths 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, wherein According to the judgment result, combine the cleared time block and time slot, perform an update or query operation, and forward the current data packet to the corresponding port includes: If it is a query packet, calculate the query start time block and time slot, obtain a query result, attach the query result to the packet header and forward it to the corresponding port; If it is not a query packet, perform an update operation and forward the current data packet to the corresponding port.
5. The fine-grained sliding window network measurement method based on a P4 switch according to claim 4, wherein, Calculating the query start time block and time slot and obtaining the query result includes: Calculate the query start time block and time slot in combination with the time lengths of the time block and time slot; Judge whether the start time block is the latest time block, and obtain a second judgment result; According to the second judgment result, obtain the query result.
6. The fine-grained sliding window network measurement method based on a P4 switch according to claim 5, wherein According to the second judgment result, obtaining the query result includes: If the start time block is the latest time block, calculate the frequency within the previous time slot from the start time slot to the current time slot in the start time block, and obtain a first query result; If the start time block is not the latest time block, calculate the frequency from the start time slot to the end of the time block in the start time block, and then query the time blocks between the start time block and the current time block in the query manner of the CM sketch, and obtain a second query result; Obtain the query result according to the first query result and the second query result.
7. A fine-grained sliding window network measurement method based on a P4 switch according to claim 4, characterized in that, Performing an update operation and forwarding the current data packet to the corresponding port includes: If the current data packet is not in a new time slot, increment the counter values of the buckets hashed into AuxCM by 1 respectively; If the current data packet is in a new time slot, update the ratio and frequency information in the corresponding time block and time slot according to the minimum count value ctr min and the minimum slot value slot min and reset the bucket hashed in AuxCM; After completing the above operations, forward the current data packet to the corresponding port.
8. A fine-grained sliding window network measurement method based on a P4 switch according to claim 7, characterized in that According to the minimum count value ctr min and the minimum slot value slot min Update the ratio and frequency information in the corresponding time block and time slot, including: Obtain slot min The corresponding time block blk slot and slot min The corresponding blk slot The time slots slot within spec ; According to the time block blk slot and the time slot slot spec , update the ratio bkt.r[slot spec ; For slot spec For each time slot bkt.r[s] before spec , update the ratio it stores and update the frequency information bkt.freq.
Citation Information
Patent Citations
Sketch based data center network flow analysis method
CN103647670A
Two-stage Hash-Sketch network flow measurement method based on time window
CN116055362A
Storage control device and storage control method
US20140351294A1
Network measurement method and apparatus
WO2021254474A1
KR20240132673A