Network measurement method and device based on two-order three-level sketch
By using the data structure of two-level and three-level sketches in network measurement to distinguish hash calculations of data flows of different sizes, the problem of insufficient detection accuracy and throughput in the existing technology is solved, and efficient network traffic monitoring is achieved.
Patent Information
- Application Number
- CN202411055423.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-02
- Publication Date
- 2024-10-15
AI Technical Summary
Existing network measurement methods are difficult to achieve high detection accuracy under limited memory, and due to multiple memory accesses and complex insertion query processes, they cannot keep up with high-speed network flows, resulting in insufficient throughput and affecting network management efficiency.
Using a network measurement method based on two-level and three-level sketches, by creating the data structure of the main unit and the secondary unit, the primary unit corresponds to a hash function, and the secondary unit includes a multi-layer counter array and a hash function, and the hash is distinguished according to the size of the data stream. calculation, reducing the number of overall hash calculations and improving throughput and accuracy.
The accuracy and throughput of network measurements are significantly improved, with the average relative error reduced by 98% and throughput increased by 1.08 to 5.01 times, proving that persistent items can be efficiently detected in high-speed network flows.
Smart Images

Figure CN118784516A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network measurement technology, and in particular to a network measurement method and device based on a two-order three-level sketch. Background Art
[0002] Network measurement is essential for efficient network management, such as congestion control, troubleshooting, anomaly detection, and traffic scheduling. To achieve efficient network management, persistence is a new feature of network traffic. Since it can detect data flow information within multiple time windows, persistence measurement is of great significance in network security, fraud detection, etc. However, existing methods have two problems: (1) it is challenging to achieve high detection accuracy under limited memory; (2) due to multiple memory accesses and complex insertion query processes, their throughput cannot keep up with high-speed network flows, which poses a challenge in practical deployment.
[0003] Therefore, the design of data structures for persistent item measurements needs to follow the following principles: first, the designed data structures should have sufficient throughput to support high-speed network flows; second, the designed data structures should maintain sufficient accuracy and memory efficiency to support efficient network management.
[0004] In order to detect persistent items in high-speed data streams, sampling-based methods such as Small-Space (SS) have been proposed, which tracks persistent items by sampling and stores the sampled information in a hash table. However, the large number of non-persistent items recorded will lead to reduced storage efficiency and loss of persistent items. In order to solve the shortcomings of sampling methods, encoding-based methods such as PIE encode each item by code instead of ID to reduce memory consumption. However, encoding and decoding require complex calculations, making PIE unable to match high-speed network traffic. At present, sketch structures are widely used in persistent item measurement. Among them, classic sketches include CM, CU, Count, etc., which are composed of simple counter arrays. However, they need to adopt some supplementary data structures to implement persistent item measurement such as Bloom filters, and due to hash conflicts, Bloom filters will produce false positive errors, reducing detection accuracy. Therefore, proposing new solutions to design a more accurate and fast persistent item measurement method with high memory efficiency is a research problem that urgently needs to be solved. Summary of the invention
[0005] The present application provides a network measurement method and device based on a two-order three-level sketch to solve the problem of low accuracy and throughput of network measurement in the prior art.
[0006] In a first aspect, the present application provides a network measurement method based on a two-order three-level sketch, comprising:
[0007] Creating a data structure including a main unit and a secondary unit, wherein the main unit corresponds to a hash function, the secondary unit includes a first counter array and a second counter array, the first counter array includes d hash functions, the second counter array includes λ layer counter groups, each layer counter group includes multiple counters, the main unit has multiple buckets, each bucket in the main unit contains a data flow transfer information; and the data flow transfer information includes a flow identifier and a count value;
[0008] For each packet of the input data structure, the following operations are performed:
[0009] Mapping the data packet to a bucket in the main unit as a first bucket using a hash function corresponding to the main unit;
[0010] If the flow identifier of the first bucket is the same as the flow identifier of the data packet, the data flow transfer information corresponding to the first bucket is updated using the sum of the count value of the first bucket and the unit value;
[0011] If the flow identifier of the first bucket is different from the flow identifier of the data packet, the bucket with the smallest count value among the multiple buckets after the first bucket is used as the minimum value bucket;
[0012] The data packet is mapped to d counters of the first counter array using d hash functions corresponding to the sub-units, and based on the counter values of the d counters mapped to the first counter array by the data packet, the layer number of the data packet in the second counter array and the counter value of at least one counter of the corresponding layer are determined, and the count value of the data packet is updated based on the counter value of at least one counter of the corresponding layer.
[0013] In a second aspect, the present application provides a network measurement device based on a two-order three-level sketch, comprising:
[0014] A structure creation module is used to create a data structure including a main unit and a secondary unit, the main unit corresponds to a hash function, the secondary unit includes a first counter array and a second counter array, the first counter array includes d hash functions, the second counter array includes λ layer counter groups, each layer counter group includes multiple counters, the main unit has multiple buckets, each bucket in the main unit contains a data flow transfer information; and the data flow transfer information includes a flow identifier and a count value;
[0015] The step execution module includes:
[0016] A mapping module, used for mapping the data packet to a bucket in the main unit as a first bucket by using a hash function corresponding to the main unit;
[0017] A first updating module, configured to update the data flow transfer information corresponding to the first bucket by using the sum of the count value of the first bucket and the unit value if the flow identifier of the first bucket is the same as the flow identifier of the data packet;
[0018] A minimum value bucket determination module, configured to use, if the flow identifier of the first bucket is different from the flow identifier of the data packet, a bucket with the smallest count value among the multiple buckets after the first bucket as the minimum value bucket;
[0019] The second update module is used to map the data packet to the d counters of the first counter array by using the d hash functions corresponding to the sub-units, and determine the layer number of the data packet in the second counter array and the counter value of at least one counter of the corresponding layer based on the counter value of the d counters of the first counter array mapped to the data packet, and update the count value of the data packet based on the counter value of at least one counter of the corresponding layer.
[0020] The present application provides a network measurement method and device based on a two-order three-level sketch, by creating a data structure including a main unit and a secondary unit, the main unit corresponds to a hash function, the secondary unit includes a first counter array and a second counter array, the first counter array includes d hash functions, the second counter array includes a λ-layer counter group, each layer of the counter group includes a plurality of counters, the main unit has a plurality of buckets, each bucket in the main unit contains a data flow transfer information; and the data flow transfer information includes a flow identifier and a count value; for each data packet of the input data structure, the following operations are performed: the data packet is mapped to a bucket in the main unit as the first bucket using the hash function corresponding to the main unit; if If the flow identifier of the first bucket is the same as the flow identifier of the data packet, the data flow information corresponding to the first bucket is updated by using the sum of the count value of the first bucket and the unit value; if the flow identifier of the first bucket is different from the flow identifier of the data packet, the bucket with the smallest count value among the multiple buckets after the first bucket is used as the minimum value bucket; the data packet is mapped to the d counters of the first counter array using the d hash functions corresponding to the secondary unit, and based on the counter values of the d counters mapped to the first counter array by the data packet, the number of layers of the data packet in the second counter array and the counter value of at least one counter of the corresponding layer are determined, and the count value of the data packet is updated based on the counter value of at least one counter of the corresponding layer. The present application distinguishes data streams of different sizes according to the main unit and the secondary unit through the constructed data structure, thereby greatly improving the network measurement accuracy; and based on the main unit and the secondary unit, the number of hash calculations for data streams of different sizes is realized, and larger data streams only need to perform hash calculations of the main unit, while smaller data streams also need to perform hash calculations of the secondary unit, reducing the overall number of hash calculations, thereby improving the throughput of network measurement. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0022] Figure 1 It is a data structure diagram of a network measurement method based on a two-order three-level sketch provided in an embodiment of the present application;
[0023] Figure 2 It is a flow chart of the implementation of the network measurement method based on the two-order three-level sketch provided in the embodiment of the present application;
[0024] Figure 3 It is a structural schematic diagram of an insertion embodiment of a network measurement method based on a two-order three-level sketch provided in an embodiment of the present application;
[0025] Figure 4 It is a structural schematic diagram of a query embodiment of a network measurement method based on a two-order three-level sketch provided in an embodiment of the present application;
[0026] Figure 5 It is a structural schematic diagram of a network measurement device based on a two-order three-level sketch provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0028] In order to make the purpose, technical solutions and advantages of the present application clearer, specific embodiments will be described below in conjunction with the accompanying drawings.
[0029] Figure 1 A schematic diagram of the data structure of a network measurement method based on a two-order three-level sketch provided in an embodiment of the present application. Figure 1 As shown, the data structure includes a primary unit and a secondary unit.
[0030] The main unit corresponds to a hash function h1(·), that is, it has multiple buckets, each of which contains a data flow transfer information, and the data flow transfer information includes a flow identifier ID and a count value. The main unit is mainly used to record the data flow transfer information of the data packet of the input data structure.
[0031] The embodiment of the present application records the ID and corresponding size of the data packet through the main unit, which is used to accurately record the persistent item information and reduce the error interference and redundant hash calculation of non-persistent items. The persistent item information represents a data stream that appears more than a specified threshold in multiple measurement cycles, and each data stream contains multiple data packets.
[0032] The slave unit includes a first counter array and a second counter array.
[0033] The first counter array contains a number of independent hash functions h2(·),…,h d+1 (·) associated counter arrays, the first counter array contains ω G counters, each of size δ G Bit.
[0034] The second counter array is a multi-layer structure, including λ layers of counter groups, each layer of counter group includes multiple counters, L ij represents the jth counter of the i-th layer (1≤i≤λ, 1≤j≤ω j ), where the size of each counter in each layer of counter group is δ G bits, and there is δ i+1 =2*δ i , L i With L i+1 The relationship is as follows: L i,2j-1 and L i,2j With L i+1,2j Associated.
[0035] The embodiment of the present application includes two different counter arrays through the secondary unit for storing non-persistent items.
[0036] Reference Figure 1 , the main unit and the secondary unit together form the second stage. The first stage is the pre-unit, which is a pre-unit with k hash functions e1(·),…,e k (·) An associated Bloom filter is used to identify the ID of the filtered data stream in advance. In the embodiment of the present application, a Bloom filter is formed by a pre-unit to filter repeated data streams, reduce the number of hash calculations, and improve the throughput of network measurement.
[0037] Based on the data structure created above, and for each data packet input into the data structure, see Figure 2 , which shows a flowchart of the implementation of the network measurement method based on the two-order three-level sketch provided in the embodiment of the present application, which is described in detail as follows:
[0038] In step 201, the data packet is mapped to a bucket in the main unit as a first bucket using a hash function corresponding to the main unit.
[0039] In an embodiment of the present application, for each data packet input into the main unit, a hash function h1(·) corresponding to the main unit is used to calculate a bucket of the data packet in the main unit, and the data packet is mapped to the bucket of the main unit as the first bucket.
[0040] In a possible implementation, before step 201, the method should further include:
[0041] Calculate k storage locations of the data packet in the pre-unit and the value in each storage location by using k hash functions corresponding to the pre-unit;
[0042] Determine whether the values of the data packet in the k storage locations are all 1;
[0043] If the values of the data packet in the k storage locations are all 1, the data packet is discarded;
[0044] If the data values of the data packet in the k storage locations are not all 1, the data packet is inserted into the main unit, and the value of the data packet in the corresponding position of the pre-unit is set to 1.
[0045] Optionally, the data packet is input into a front-end unit, and k hash functions e1(·),…,e1(·),…,e2(·),…,e3(·),…,e4(·),…,e5(·),…,e6(·),…,e7(·),…,e8(·),…,e9(·),…,e10(·),…,e11(·),…,e12(·),…,e13(·),…,e14(·), k (·) Calculate the k storage locations of the data packet in the front unit and the values in the k storage locations, and determine whether the values in the k storage locations are all 1.
[0046] If the values of the data packet in the k storage locations are all 1, it means that the data flow has been recorded in the current measurement period and there is no need to record it again, and the data packet can be discarded.
[0047] If the values of the data packet in the k storage locations are not all 1, it means that the data stream has not been recorded in the current measurement cycle and needs to be recorded in the current measurement cycle, that is, the data packet is inserted into the main unit, and the value of the corresponding storage location of the data packet in the front unit after insertion is set to 1, indicating that the data packet has been recorded in the current measurement cycle and does not need to be recorded again. The number of hash calculations is reduced, and the throughput of persistent item network measurement is improved.
[0048] In step 202, if the flow identifier of the first bucket is the same as the flow identifier of the data packet, the data flow transfer information corresponding to the first bucket is updated using the sum of the count value of the first bucket and the unit value.
[0049] In an embodiment of the present application, it is determined whether the flow identifier of the first bucket is the same as the flow identifier of the data packet. If the flow identifier of the first bucket is the same as the flow identifier of the data packet, the data flow flow information corresponding to the first bucket is updated using the sum of the count value in the first bucket and the unit value 1.
[0050] In a possible implementation, before step 202, the method may further include:
[0051] Determine whether the first bucket is empty;
[0052] If the first bucket is empty, the flow identifier and count value of the data packet are used as the data flow transfer information of the first bucket;
[0053] If the first bucket is not an empty bucket, it is determined whether the flow identifier contained in the first bucket is the same as the flow identifier of the data packet.
[0054] Optionally, after obtaining the first bucket, it is determined whether the first bucket is empty. If the first bucket is empty, the flow identifier and count value of the data packet are directly used as the data flow transfer information of the first bucket, and the insertion of the data packet in the current measurement period ends. If the first bucket is not empty, it is necessary to determine whether the flow identifier contained in the first bucket is the same as the flow identifier of the data packet.
[0055] The count value in each data packet is 1.
[0056] It should be noted that the main unit mentioned above is mainly used to record persistent item information. If the first bucket is empty, the flow identifier and count value of the data packet are used to update the data flow information of the first bucket. This situation meets the requirements because the main unit may have the possibility that the data packet is not a persistent item.
[0057] In a possible implementation, step 202 may include:
[0058] If the flow identifier of the first bucket is the same as the flow identifier of the data packet, the sum of the count value of the first bucket and the unit value and the flow identifier of the first bucket are used to form the data flow transfer information of the first bucket.
[0059] Optionally, if the flow identifier of the first bucket is the same as the flow identifier of the data packet, the sum of the count value of the first bucket and the unit value 1, and the flow identifier of the first bucket are used to form the data flow transfer information of the first bucket, that is, the data flow transfer information (ID, value)
[0060] In step 203, if the flow identifier of the first bucket is different from the flow identifier of the data packet, the bucket with the smallest count value among the multiple buckets after the first bucket is used as the minimum value bucket.
[0061] In an embodiment of the present application, if the flow identifier of the first bucket is different from the flow identifier of the data packet, it is necessary to traverse in order and obtain the bucket with the smallest count value among the multiple buckets after the first bucket, and define the bucket with the smallest count value as the minimum value bucket.
[0062] In a possible implementation, step 203 may include:
[0063] If the flow identifier of the first bucket is different from the flow identifier of the data packet, then traverse m buckets from the first bucket downward in order, and determine whether an empty bucket appears during the traversal process according to the traversal order, and determine whether a bucket with the same flow identifier as the flow identifier of the data packet appears during the traversal process;
[0064] If an empty bucket appears during the traversal process, the flow identifier and count value of the data packet are used as the data flow transfer information of the first empty bucket that appears during the traversal process, and the traversal is stopped;
[0065] If there is a bucket with the same flow identifier as the data packet during the traversal process, the first bucket with the same flow identifier as the data packet is obtained in the traversal order, and the count value of the bucket and the unit value are used to update the count value in the data flow transfer information of the bucket;
[0066] If no empty bucket appears during the traversal, and no bucket with the same flow identifier as the flow identifier of the data packet appears during the traversal, the bucket with the smallest count value is selected from the m buckets as the minimum value bucket.
[0067] Optionally, if the flow identifier of the first bucket is different from the flow identifier of the data packet, m buckets are traversed sequentially from the position of the first bucket downward, and it is determined whether an empty bucket appears during the traversal process according to the traversal order, and it is determined whether a bucket with a flow identifier that is the same as the flow identifier of the data packet appears during the traversal process. That is, as long as an empty bucket appears or as long as the flow identifiers are the same, the corresponding steps are executed, and the traversal action is stopped immediately.
[0068] If an empty bucket appears during the traversal process, the flow identifier and count value of the data packet are used as the data flow information of the first empty bucket appearing during the traversal process, the traversal is stopped, and the corresponding data packet ends the action.
[0069] If there is a bucket with the same flow identifier as the data packet during the traversal process, the first bucket with the same flow identifier as the data packet is obtained in the traversal order, and the first bucket with the same flow identifier as the data packet can be defined as the target bucket. Then, the count value of the target bucket and the unit value 1 are used to update the count value in the data flow flow information of the target bucket, and the traversal is stopped, and the action ends with the corresponding data packet.
[0070] If there is no empty bucket during the traversal process, and no bucket with the same flow identifier as the flow identifier of the data packet is found during the traversal process, the bucket with the smallest count value is selected from the m buckets as the minimum value bucket. Among them, the data flow transfer information of the minimum value bucket is (f min , v min ), f min is the flow identifier of the minimum bucket, v min is the count value of the minimum bucket.
[0071] In the embodiment of the present application, the insertion of the persistent item information is completed through various judgments in the main unit, which can not only improve the network measurement accuracy, but also reduce the number of hash calculations of the persistent items and improve the throughput.
[0072] In step 204, the data packet is mapped to d counters of the first counter array using d hash functions corresponding to the sub-unit, and based on the counter values of the d counters mapped to the first counter array, the layer number of the data packet in the second counter array and the counter value of at least one counter of the corresponding layer are determined, and the count value of the data packet is updated based on the counter value of at least one counter of the corresponding layer.
[0073] In the embodiment of the present application, after determining the minimum value bucket, the data packet is mapped to the d counters of the first counter array using the d hash functions corresponding to the sub-unit. Then, based on the counter values of the d counters mapped to the first counter array by the data packet, the number of layers of the data packet in the second counter array and the counter value of at least one counter in the counter group of the layer are determined. Finally, the count value of the data packet is updated based on the counter value of at least one counter in the counter group of the layer.
[0074] In a possible implementation, step 204 may include:
[0075] Mapping the data packet to d counters of the first counter array using d hash functions corresponding to the secondary units, obtaining counter values corresponding to the d counters, and selecting a minimum counter value from the d counter values as a first minimum counter value;
[0076] The first minimum counter value is used to determine the layer number of the counter group corresponding to the data packet in the second counter array and the minimum counter value in the layer counter group, and the count value of the data packet is updated based on the minimum counter value in the layer counter group.
[0077] Optionally, the data packet is mapped to the d counters of the first counter array using d hash functions corresponding to the sub-units, and the counter values corresponding to the d counters are obtained. Then, the minimum counter value is selected from the d counter values as the first minimum counter value by operations such as shifting and bitwise AND. The first minimum counter value is used to determine the number of layers of the counter group corresponding to the data packet in the second counter array and the minimum counter value in the counter group at the layer. Finally, the count value of the data packet is updated based on the minimum counter value in the counter group at the layer.
[0078] In a possible implementation, determining the layer number of the counter group corresponding to the data packet in the second counter array and the minimum counter value in the layer counter group by using the first minimum counter value, and updating the count value of the data packet based on the minimum counter value in the layer counter group may include:
[0079] Determine the layer number of the counter group corresponding to the data packet in the second counter array as the current layer counter group by using the first minimum counter value, and determine the multiple counters of the multiple counters corresponding to the first minimum counter value in the current layer counter group as the first counter;
[0080] The sum of the minimum counter value and the unit value among the counter values corresponding to the first counters is used as the current first value;
[0081] Determine whether the current first value is not greater than the maximum counter value of the current layer counter group;
[0082] If the current first value is not greater than the maximum counter value, the count value of the minimum value bucket is updated using the current first value;
[0083] If the current first value is greater than the maximum counter value of the current layer counter group, the current first value is inserted into the target counter in the next layer counter group; the target counter is the counter at the target position in the next layer counter group, and the target position is the position of the counter corresponding to the minimum counter value in the current counter layer;
[0084] The current first value is used as the current first value in the next layer counter group, and the next layer counter group is used as the current layer counter group, and it is returned to determine whether the current first value is not greater than the maximum counter value of the current layer counter group.
[0085] Optionally, the number of layers of the counter group corresponding to the data packet in the second counter array is used as the current layer counter group, and multiple counters corresponding to the first minimum counter value in the current layer counter group are determined as first counters. The sum of the minimum counter value and the unit value 1 among the counter values corresponding to the first counters is used as the current first value through operations such as shifting and bitwise AND.
[0086] Determine whether the current first value is not greater than the maximum counter value of the current layer counter group: If the current first value is not greater than the maximum counter value of the current layer counter group, use the current first value to update the count value of the minimum value bucket.
[0087] If the current first value is greater than the maximum counter value of the current layer counter group, the current first value is inserted into the target counter in the next layer counter group, where the target counter value is the counter at the target position in the next layer counter group, and the target position is the position of the counter corresponding to the minimum counter value in the current counter layer. Then, the current first value is used as the current first value in the next layer counter group, and the next layer counter group is used as the current layer counter group, and the step of determining whether the current first value is not greater than the maximum counter value of the current layer counter group is returned to continue execution, and the count value of the data packet is updated according to the updated current first value through iterative determination.
[0088] In a possible implementation, after updating the count value of the data packet based on the minimum counter value in the layer counter group, the method may further include:
[0089] Determine whether the count value of the updated data packet is not greater than a preset threshold, where the preset threshold is the product of the count value of the minimum bucket and a preset constant;
[0090] If the updated count value of the data packet is not greater than the preset threshold, the updated count value of the data packet and the flow identifier of the data packet are determined as the data flow transfer information of the data packet;
[0091] If the count value of the updated data packet is greater than a preset threshold, the data flow circulation information of the minimum value bucket is updated using the updated count value of the data packet and the flow identifier of the data packet, and after the data flow circulation information of the minimum value bucket is updated, the unupdated minimum value bucket is mapped to the d counters of the first counter array using the d hash functions corresponding to the sub-unit, and based on the minimum counter value of the unupdated minimum value bucket mapped to the d counters of the first counter array, the number of layers of the unupdated minimum value bucket in the second counter array and the counter value of at least one counter of the corresponding layer are determined, and the count value of the data flow circulation information in the unupdated minimum value bucket is determined based on the counter value of at least one counter of the corresponding layer.
[0092] Optionally, after updating the count value of the data packet, the present application also needs to determine whether the updated count value of the data packet is not greater than a preset threshold, where the preset threshold is the product of the count value of the minimum value bucket and a preset constant.
[0093] If the updated count value of the data packet is not greater than the preset threshold, the updated count value of the data packet and the flow identifier of the data packet are used to determine the data flow transfer information of the data packet, and the insertion is ended.
[0094] If the count value of the updated data packet is greater than the preset threshold, the data flow transfer information of the minimum value bucket is first updated using the count value of the updated data packet and the flow identifier of the data packet. After the data flow transfer information of the minimum value bucket is updated, the unupdated minimum value bucket is retained and used as a new data packet to perform the following steps:
[0095] In the first step, the new data packet is mapped to the d counters of the first counter array by using the d hash functions corresponding to the slave units.
[0096] In the second step, based on the minimum counter value among the d counters in the first counter array mapped to the new data packet, the layer number of the new data packet in the second counter array and the counter value of at least one counter in the corresponding layer are determined.
[0097] In the third step, a count value of data flow transfer information of a new data packet is determined based on a counter value of at least one counter of a corresponding layer, and the count value is stored in a counter of a corresponding layer.
[0098] The main unit in this application mainly contains persistent item information, but there are still some non-persistent items in the main unit. However, if there are persistent items in the secondary unit, they can be recalled and replaced in the main unit immediately, reducing the loss of persistent items and improving measurement accuracy.
[0099] In a possible implementation, after taking the current first value as the current first value in the next-layer counter group and taking the next-layer counter group as the current-layer counter group, and returning to determine whether the current first value is not greater than the maximum counter value of the current-layer counter group, the method may further include:
[0100] The first minimum counter value is updated using the updated value of the number of layers of the counter group in the second counter array corresponding to the current first value.
[0101] Optionally, when it is necessary to enter the next layer of counter group, after iterative judgment, it is necessary to update the first minimum counter value in the first counter array according to the number of layers of the counter group in the second counter array corresponding to the updated current first value, so that the first minimum counter value in the updated first counter array is consistent with the value of the number of layers of the counter group in the second counter array after the updated current first value.
[0102] After the data packet is inserted, the embodiment of the present application can also use the query function to determine whether the embodiment of the present application can improve the measurement accuracy and throughput. The query steps are as follows:
[0103] Step 1, reception by the front-end unit: input the data packet into the front-end unit, calculate k storage locations of the data packet in the front-end unit using k hash functions corresponding to the front-end unit, and determine that the values of the data packet in the k storage locations are all 1.
[0104] Step 2, main unit query: use a hash function corresponding to the main unit to map the data packet to a bucket in the main unit, and traverse the m buckets starting from this position in sequence. If there is a bucket with the same flow identifier as the data packet, return the count value of the corresponding bucket and the sequence ends; otherwise, go to step 3.
[0105] Step three, sub-unit query: use the d hash functions corresponding to the sub-unit to map the data packet to the d counters of the first counter array, and obtain the minimum counter value of the d counters through shift, bitwise AND and other operations, obtain the layer number of the data packet in the second counter array from the minimum counter value, obtain the corresponding counter value in the counter group of this layer, and return the counter value, and the query ends.
[0106] The present application can also perform software deployment testing on a server configured with a twelve-core 3.2GHz i5-10505 processor and 16GB RAM. In addition, multiple data sets were selected for experiments. The experimental results show that the embodiment of the present application is improved by 1.02 to 5.6 times compared with other solutions, and the average relative error has decreased by 98%. In addition, its throughput is improved by 1.08 to 5.01 times compared with other solutions. This shows that the embodiment of the present application has excellent accuracy and speed in the persistent item measurement task.
[0107] The present application provides a network measurement method based on a two-order three-level sketch, by creating a data structure including a main unit and a secondary unit, the main unit corresponds to a hash function, the secondary unit includes a first counter array and a second counter array, the first counter array includes d hash functions, the second counter array includes a λ layer counter group, each layer counter group includes a plurality of counters, the main unit has a plurality of buckets, each bucket in the main unit contains a data flow transfer information; and the data flow transfer information includes a flow identifier and a count value; for each data packet of the input data structure, the following operations are performed: the data packet is mapped to a bucket in the main unit as the first bucket using the hash function corresponding to the main unit; if the first bucket If the flow identifier of the bucket is the same as the flow identifier of the data packet, the data flow information corresponding to the first bucket is updated by using the sum of the count value of the first bucket and the unit value; if the flow identifier of the first bucket is different from the flow identifier of the data packet, the bucket with the smallest count value among the multiple buckets after the first bucket is used as the minimum value bucket; the data packet is mapped to the d counters of the first counter array using the d hash functions corresponding to the secondary unit, and based on the counter values of the d counters mapped to the first counter array by the data packet, the number of layers of the data packet in the second counter array and the counter value of at least one counter of the corresponding layer are determined, and the count value of the data packet is updated based on the counter value of at least one counter of the corresponding layer. The present application distinguishes data streams of different sizes according to the main unit and the secondary unit through the constructed data structure, thereby greatly improving the network measurement accuracy; and based on the main unit and the secondary unit, the number of hash calculations for data streams of different sizes is realized, and larger data streams only need to perform hash calculations of the main unit, while smaller data streams still need to perform hash calculations of the secondary unit, reducing the overall number of hash calculations, thereby improving the throughput of network measurement.
[0108] The use of the above-mentioned two-order three-level sketch-based network measurement method is explained below through an implementation example.
[0109] Assume k=3, d=3, m=3, λ=2, and the counter sizes are 2 bits and 4 bits respectively, and the preset constant μ=2. Take a measurement time period as an example, refer to Figure 3 , where the arrow line indicates the insertion process of a network data packet.
[0110] For the input data packets f1, f2, and f3, the corresponding positions in the pre-unit are first obtained through the hash functions e1(·), e2(·), and e2(·). For data packet f3, the values mapped to the positions of the pre-unit are 1, 1, and 1, respectively, so the data packet f3 is discarded; for data packets f1 and f2, the values mapped to the positions are 1, 1, 0 and 1, 0, 1, respectively, which means that the current measurement time period does not exist, so both need to enter the second stage. In the second stage, a specific mapping position is first obtained through a hash function h1(·), such as Figure 3 The location mapped to the packet f1 satisfies the flow identifier match, so it is directly updated by one, that is, (f1,17)→(f1,18) is inserted and completed. Figure 3 The bucket mapped to by data packet f2 does not satisfy the empty bucket or flow identifier matching condition, so the three buckets are traversed sequentially from this position downward. None of these three buckets meet the conditions for receiving data packet f2, so data packet f2 continues to be inserted into the secondary unit, and the minimum bucket (f4,7) among the three buckets is obtained. First, the first counter array L is obtained through h2(·), h3(·), and h4(·). G The corresponding counter is used to obtain the minimum counter value, which is 1, indicating that the data packet f2 in the current measurement time period is in the first layer counter group L1 of the second counter array. The counter of the candidate part is obtained through shift, bitwise and other operations, and overflow judgment is performed. 2 does not overflow, that is, it is updated and added by one; 3 overflows, so it is necessary to go to the second layer counter group L2 to update and add 1 to 4, and at the same time, the first counter array L G The position of is updated to 2, indicating that the data packet f2 is located in the second layer counter group L2. The two positions are judged whether to replace, and both do not meet the interaction condition, so the insertion ends.
[0111] Query implementation example Figure 4 As shown in the figure, for the input network data packets f1 and f2, the corresponding positions in the preamble unit are first obtained through the hash functions e1(·), e2(·), and e2(·). For data packets f1 and f2, the values of the positions they are mapped to are all 1, 1, 1, which means they currently exist, so they both need to enter the second stage for query. First, the specific mapping position is obtained through the hash function h1(·), as shown in the figure. Figure 4 The bucket mapped to by data packet f1 satisfies the flow identifier match, so the value 20 of the corresponding bucket is directly returned, and the query ends. Figure 4 The bucket mapped to by data packet f2 does not satisfy the flow identifier matching condition, so the three buckets are traversed sequentially from this position downwards. None of these three buckets match the flow identifier of data packet f2, so data packet f2 continues to query the secondary unit. First, the first counter array L is obtained by using the hash function h2(·), h3(·), h4(·) GThe corresponding counters are obtained and the minimum counter value is 1, which means that the data packet f2 is in the first-layer counter group L1. The counters in the first-layer counter group L1 are obtained through shifting, bitwise AND and other operations. The minimum counter value is 3 and returned, and the query ends.
[0112] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0113] The following is an embodiment of the device of the present application. For details not described in detail, please refer to the corresponding method embodiment described above.
[0114] Figure 5 A schematic diagram of the structure of a network measurement device based on a two-order three-level sketch provided in an embodiment of the present application is shown. For ease of explanation, only the part related to the embodiment of the present application is shown, which is described in detail as follows:
[0115] like Figure 5 As shown, the network measurement device 5 based on the two-order three-level sketch includes:
[0116] The structure creation module 51 is used to create a data structure including a main unit and a secondary unit, the main unit corresponds to a hash function, the secondary unit includes a first counter array and a second counter array, the first counter array includes d hash functions, the second counter array includes λ layer counter groups, each layer counter group includes multiple counters, the main unit has multiple buckets, each bucket in the main unit contains a data flow transfer information; and the data flow transfer information includes a flow identifier and a count value;
[0117] The step execution module 52 includes:
[0118] A mapping module 521, configured to map the data packet to a bucket in the main unit as a first bucket by using a hash function corresponding to the main unit;
[0119] A first updating module 522 is configured to update the data flow transfer information corresponding to the first bucket by using the sum of the count value of the first bucket and the unit value if the flow identifier of the first bucket is the same as the flow identifier of the data packet;
[0120] A minimum value bucket determination module 523 is configured to use a bucket with the smallest count value among the multiple buckets after the first bucket as the minimum value bucket if the flow identifier of the first bucket is different from the flow identifier of the data packet;
[0121] The second update module 524 is used to map the data packet to d counters of the first counter array using d hash functions corresponding to the sub-unit, and based on the counter values of the d counters mapped to the first counter array by the data packet, determine the layer number of the data packet in the second counter array and the counter value of at least one counter of the corresponding layer, and update the count value of the data packet based on the counter value of at least one counter of the corresponding layer.
[0122] The present application provides a network measurement device based on a two-order three-level sketch, by creating a data structure including a main unit and a secondary unit, the main unit corresponds to a hash function, the secondary unit includes a first counter array and a second counter array, the first counter array includes d hash functions, the second counter array includes a λ-layer counter group, each layer of the counter group includes a plurality of counters, the main unit has a plurality of buckets, each bucket in the main unit contains a data flow transfer information; and the data flow transfer information includes a flow identifier and a count value; for each data packet of the input data structure, the following operations are performed: the data packet is mapped to a bucket in the main unit as the first bucket using the hash function corresponding to the main unit; if the first bucket If the flow identifier of the bucket is the same as the flow identifier of the data packet, the data flow information corresponding to the first bucket is updated by using the sum of the count value of the first bucket and the unit value; if the flow identifier of the first bucket is different from the flow identifier of the data packet, the bucket with the smallest count value among the multiple buckets after the first bucket is used as the minimum value bucket; the data packet is mapped to the d counters of the first counter array using the d hash functions corresponding to the secondary unit, and based on the counter values of the d counters mapped to the first counter array by the data packet, the number of layers of the data packet in the second counter array and the counter value of at least one counter of the corresponding layer are determined, and the count value of the data packet is updated based on the counter value of at least one counter of the corresponding layer. The present application distinguishes data streams of different sizes according to the main unit and the secondary unit through the constructed data structure, thereby greatly improving the network measurement accuracy; and based on the main unit and the secondary unit, the number of hash calculations for data streams of different sizes is realized, and larger data streams only need to perform hash calculations of the main unit, while smaller data streams still need to perform hash calculations of the secondary unit, reducing the overall number of hash calculations, thereby improving the throughput of network measurement.
[0123] In a possible implementation, the device may further include an empty barrel determination module, which may be used to:
[0124] Determine whether the first bucket is empty;
[0125] If the first bucket is empty, the flow identifier and count value of the data packet are used as the data flow transfer information of the first bucket;
[0126] If the first bucket is not an empty bucket, it is determined whether the flow identifier contained in the first bucket is the same as the flow identifier of the data packet.
[0127] In a possible implementation, the first update module may be used to:
[0128] If the flow identifier of the first bucket is the same as the flow identifier of the data packet, the sum of the count value of the first bucket and the unit value and the flow identifier of the first bucket are used to form the data flow transfer information of the first bucket.
[0129] In a possible implementation, the minimum bucket determination module may be used to:
[0130] If the flow identifier of the first bucket is different from the flow identifier of the data packet, then traverse m buckets from the first bucket downward in order, and determine whether an empty bucket appears during the traversal process according to the traversal order, and determine whether a bucket with the same flow identifier as the flow identifier of the data packet appears during the traversal process;
[0131] If an empty bucket appears during the traversal process, the flow identifier and count value of the data packet are used as the data flow transfer information of the first empty bucket that appears during the traversal process, and the traversal is stopped;
[0132] If there is a bucket with the same flow identifier as the data packet during the traversal process, the first bucket with the same flow identifier as the data packet is obtained in the traversal order, and the count value of the bucket and the unit value are used to update the count value in the data flow transfer information of the bucket;
[0133] If no empty bucket appears during the traversal, and no bucket with the same flow identifier as the flow identifier of the data packet appears during the traversal, the bucket with the smallest count value is selected from the m buckets as the minimum value bucket.
[0134] In a possible implementation, the second update module may be used to:
[0135] Mapping the data packet to d counters of the first counter array using d hash functions corresponding to the secondary units, obtaining counter values corresponding to the d counters, and selecting a minimum counter value from the d counter values as a first minimum counter value;
[0136] The first minimum counter value is used to determine the layer number of the counter group corresponding to the data packet in the second counter array and the minimum counter value in the layer counter group, and the count value of the data packet is updated based on the minimum counter value in the layer counter group.
[0137] In a possible implementation, the second update module may also be used to:
[0138] Determine the layer number of the counter group corresponding to the data packet in the second counter array as the current layer counter group by using the first minimum counter value, and determine the multiple counters of the multiple counters corresponding to the first minimum counter value in the current layer counter group as the first counter;
[0139] The sum of the minimum counter value and the unit value among the counter values corresponding to the first counters is used as the current first value;
[0140] Determine whether the current first value is not greater than the maximum counter value of the current layer counter group;
[0141] If the current first value is not greater than the maximum counter value, the count value of the minimum value bucket is updated using the current first value;
[0142] If the current first value is greater than the maximum counter value of the current layer counter group, the current first value is inserted into the target counter in the next layer counter group; the target counter is the counter at the target position in the next layer counter group, and the target position is the position of the counter corresponding to the minimum counter value in the current counter layer;
[0143] The current first value is used as the current first value in the next layer counter group, and the next layer counter group is used as the current layer counter group, and it is returned to determine whether the current first value is not greater than the maximum counter value of the current layer counter group.
[0144] In a possible implementation, the second update module may also be used to:
[0145] Determine whether the count value of the updated data packet is not greater than a preset threshold, where the preset threshold is the product of the count value of the minimum bucket and a preset constant;
[0146] If the updated count value of the data packet is not greater than the preset threshold, the updated count value of the data packet and the flow identifier of the data packet are determined as the data flow transfer information of the data packet;
[0147] If the count value of the updated data packet is greater than a preset threshold, the data flow circulation information of the minimum value bucket is updated using the updated count value of the data packet and the flow identifier of the data packet, and after the data flow circulation information of the minimum value bucket is updated, the unupdated minimum value bucket is mapped to the d counters of the first counter array using the d hash functions corresponding to the sub-unit, and based on the minimum counter value of the unupdated minimum value bucket mapped to the d counters of the first counter array, the number of layers of the unupdated minimum value bucket in the second counter array and the counter value of at least one counter of the corresponding layer are determined, and the count value of the data flow circulation information in the unupdated minimum value bucket is determined based on the counter value of at least one counter of the corresponding layer.
[0148] In a possible implementation, the second update module may also be used to:
[0149] The first minimum counter value is updated using the updated value of the number of layers of the counter group in the second counter array corresponding to the current first value.
[0150] In a possible implementation, the data structure may further include a preamble unit, the preamble unit corresponding to k hash functions;
[0151] The device may further include a filtering module, which may be used to:
[0152] Calculate k storage locations of the data packet in the pre-unit and the value in each storage location by using k hash functions corresponding to the pre-unit;
[0153] Determine whether the values of the data packet in the k storage locations are all 1;
[0154] If the values of the data packet in the k storage locations are all 1, the data packet is discarded;
[0155] If the data values of the data packet in the k storage locations are not all 1, the data packet is inserted into the main unit, and the value of the data packet in the corresponding position of the pre-unit is set to 1.
[0156] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0157] Those of ordinary skill in the art will appreciate that the templates, units, and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0158] If the module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, it can implement the steps of the above-mentioned network measurement method embodiments based on two-order three-level sketches. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device that can carry the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory, random access memory, electrical carrier signal, telecommunication signal and software distribution medium.
[0159] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A network measurement method based on two-order three-level sketches, characterized in that: include: A data structure including a main unit and a sub-unit is created, wherein the main unit corresponds to a hash function, the sub-unit includes a first counter array and a second counter array, the first counter array includes d hash functions, the second counter array includes a λ-layer counter group, each layer of the counter group includes a plurality of counters, the main unit has a plurality of buckets, each bucket in the main unit contains a data flow transfer information; and the data flow transfer information includes a flow identifier and a count value; the following operations are performed for each data packet of the input data structure: the data packet is mapped to a bucket in the main unit as a first bucket using the hash function corresponding to the main unit; if the flow identifier of the first bucket is the same as the flow identifier of the data packet, the data flow transfer information corresponding to the first bucket is updated using the sum of the count value of the first bucket and the unit value; if the flow identifier of the first bucket is different from the flow identifier of the data packet, the bucket with the smallest count value among the multiple buckets after the first bucket is used as the minimum value bucket; The data packet is mapped to d counters of the first counter array using d hash functions corresponding to the sub-units, and based on the counter values of the d counters mapped to the first counter array by the data packet, the layer number of the data packet in the second counter array and the counter value of at least one counter of the corresponding layer are determined, and the count value of the data packet is updated based on the counter value of at least one counter of the corresponding layer.
2. The network measurement method based on two-order three-level sketch according to claim 1 is characterized in that: Before updating the data flow transfer information corresponding to the first bucket by using the sum of the count value of the first bucket and the unit value if the flow identifier of the first bucket is the same as the flow identifier of the data packet, the method includes: Determining whether the first bucket is an empty bucket; If the first bucket is an empty bucket, the flow identifier and the count value of the data packet are used as the data flow transfer information of the first bucket; If the first bucket is not an empty bucket, it is determined whether the flow identifier contained in the first bucket is the same as the flow identifier of the data packet.
3. The network measurement method based on two-order three-level sketch according to claim 2 is characterized in that: If the flow identifier of the first bucket is the same as the flow identifier of the data packet, updating the data flow transfer information corresponding to the first bucket by using the sum of the count value of the first bucket and the unit value, including: If the flow identifier of the first bucket is the same as the flow identifier of the data packet, the sum of the count value and the unit value of the first bucket and the flow identifier of the first bucket are used to form the data flow transfer information of the first bucket.
4. The network measurement method based on two-order three-level sketch according to claim 1 is characterized in that: If the flow identifier of the first bucket is different from the flow identifier of the data packet, the bucket with the smallest count value among the multiple buckets after the first bucket is used as the minimum value bucket, including: If the flow identifier of the first bucket is different from the flow identifier of the data packet, then traverse m buckets from the position of the first bucket downward in sequence, and determine whether an empty bucket appears during the traversal process according to the traversal order, and determine whether a bucket with a flow identifier that is the same as the flow identifier of the data packet appears during the traversal process; If an empty bucket appears during the traversal process, the flow identifier and count value of the data packet are used as the data flow transfer information of the first empty bucket that appears during the traversal process, and the traversal is stopped; If there is a bucket with the same flow identifier as the data packet during the traversal process, the first bucket with the same flow identifier as the data packet is obtained in the traversal order, and the count value of the bucket and the unit value are used to update the count value in the data flow transfer information of the bucket; If no empty bucket appears during the traversal process, and no bucket whose flow identifier is the same as the flow identifier of the data packet appears during the traversal process, the bucket with the smallest count value is selected from the m buckets as the minimum value bucket.
5. The network measurement method based on two-order three-level sketch according to claim 4 is characterized in that: The method of mapping the data packet to the d counters of the first counter array by using the d hash functions corresponding to the sub-units, and determining the number of layers of the data packet in the second counter array and the counter value of at least one counter of the corresponding layer based on the counter values of the d counters of the first counter array mapped to the data packet, and updating the count value of the data packet based on the counter value of at least one counter of the corresponding layer, includes: Mapping the data packet to d counters of the first counter array using d hash functions corresponding to the secondary unit, obtaining counter values corresponding to the d counters, and selecting a minimum counter value from the d counter values as a first minimum counter value; The first minimum counter value is used to determine the layer number of the counter group corresponding to the data packet in the second counter array and the minimum counter value in the layer counter group, and the count value of the data packet is updated based on the minimum counter value in the layer counter group.
6. The network measurement method based on two-order three-level sketch according to claim 5 is characterized in that: The step of determining the number of layers of the counter group corresponding to the data packet in the second counter array and the minimum counter value in the layer counter group by using the first minimum counter value, and updating the count value of the data packet based on the minimum counter value in the layer counter group, comprises: Determine the layer number of the counter group corresponding to the data packet in the second counter array by using the first minimum counter value as the current layer counter group, and determine the multiple counters corresponding to the first minimum counter value in the current layer counter group as the first counter; The sum of the minimum counter value and the unit value among the counter values corresponding to the first counters is used as the current first value; Determine whether the current first value is not greater than the maximum counter value of the current layer counter group; If the current first value is not greater than the maximum counter value, updating the count value of the data packet using the current first value; If the current first value is greater than the maximum counter value of the current layer counter group, the current first value is inserted into the target counter in the next layer counter group; the target counter is the counter at the target position in the next layer counter group, and the target position is the position of the counter corresponding to the minimum counter value in the current counter layer; The current first value is used as the current first value in the next layer counter group, and the next layer counter group is used as the current layer counter group, and the determination of whether the current first value is not greater than the maximum counter value of the current layer counter group is returned.
7. The network measurement method based on two-order three-level sketch according to claim 6 is characterized in that: After updating the count value of the data packet based on the minimum counter value in the counter group at the layer, the method further includes: Determine whether the count value of the updated data packet is not greater than a preset threshold, where the preset threshold is the product of the count value of the minimum value bucket and a preset constant; If the updated count value of the data packet is not greater than the preset threshold, the updated count value of the data packet and the flow identifier of the data packet are determined as the data flow transfer information of the data packet; If the count value of the updated data packet is greater than the preset threshold, the data flow circulation information of the minimum value bucket is updated using the updated count value of the data packet and the flow identifier of the data packet, and after updating the data flow circulation information of the minimum value bucket, the unupdated minimum value bucket is mapped to the d counters of the first counter array using the d hash functions corresponding to the sub-unit, and based on the minimum counter value of the unupdated minimum value bucket mapped to the d counters of the first counter array, the number of layers of the unupdated minimum value bucket in the second counter array and the counter value of at least one counter of the corresponding layer are determined, and the count value of the data flow circulation information in the unupdated minimum value bucket is determined based on the counter value of at least one counter of the corresponding layer.
8. The network measurement method based on two-order three-level sketch according to claim 6 is characterized in that: After taking the current first value as the current first value in the next layer counter group and taking the next layer counter group as the current layer counter group, and returning the step of determining whether the current first value is not greater than the maximum counter value of the current layer counter group, the method further includes: The first minimum counter value is updated using the value of the number of layers of the counter group in the second counter array corresponding to the updated current first value.
9. The network measurement method based on two-order three-level sketch according to claim 1 is characterized in that: The data structure also includes a pre-unit, the pre-unit corresponding to k hash functions; Before mapping the data packet to a bucket in the main unit using a hash function corresponding to the main unit, and mapping the data packet to the bucket of the main unit as the first bucket, the method further includes: Calculate k storage locations of the data packet in the pre-unit and a value in each storage location by using k hash functions corresponding to the pre-unit; Determine whether the values of the data packet in the k storage locations are all 1; If the values of the data packet in the k storage locations are all 1, the data packet is discarded; If the data values of the data packet in the k storage locations are not all 1, the data packet is inserted into the main unit, and the value of the data packet at the position corresponding to the pre-unit is set to 1.
10. A network measurement device based on a two-order three-level sketch, characterized in that: include: A structure creation module is used to create a data structure including a main unit and a secondary unit, the main unit corresponds to a hash function, the secondary unit includes a first counter array and a second counter array, the first counter array includes d hash functions, the second counter array includes λ layer counter groups, each layer counter group includes multiple counters, the main unit has multiple buckets, each bucket in the main unit contains a data flow transfer information; and the data flow transfer information includes a flow identifier and a count value; The step execution module includes: A mapping module, used for mapping the data packet to a bucket in the main unit as a first bucket by using a hash function corresponding to the main unit; A first updating module, configured to update the data flow transfer information corresponding to the first bucket by using the sum of the count value of the first bucket and the unit value if the flow identifier of the first bucket is the same as the flow identifier of the data packet; A minimum value bucket determination module, configured to use, if the flow identifier of the first bucket is different from the flow identifier of the data packet, a bucket with the smallest count value among the multiple buckets after the first bucket as the minimum value bucket; The second update module is used to map the data packet to the d counters of the first counter array by using the d hash functions corresponding to the sub-units, and determine the layer number of the data packet in the second counter array and the counter value of at least one counter of the corresponding layer based on the counter value of the d counters of the first counter array mapped to the data packet, and update the count value of the data packet based on the counter value of at least one counter of the corresponding layer.
Citation Information
Cited By
Route-independent network measurement system and method
CN119484328A
