Large flow detection data processing method and system and storage medium

CN118535569AActive Publication Date: 2024-08-23HARBIN INSTITUTE OF TECHNOLOGY (SHENZHEN) (INSTITUTE OF SCIENCE AND TECHNOLOGY INNOVATION HARBIN INSTITUTE OF TECHNOLOGY SHENZHEN)

Patent Information

Application Number
CN202410414885.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-08
Publication Date
2024-08-23
Estimated Expiration
2044-04-08

Smart Images

  • Figure CN118535569A
    Figure CN118535569A
Patent Text Reader

Abstract

The invention provides a data processing method and system for large flow detection and a storage medium, a data storage structure is established, specifically, the data storage structure is established, the data storage structure is composed of W hash tables, each hash table comprises N hash buckets, the total number of the hash buckets is W * N, each hash bucket comprises a plurality of counters and entries, and the number of the counters and the entries is N; the fingerprint information and counter information of each stream are stored in an entry of a certain hash bucket of a certain hash table. The method has the advantages that some defects in the prior art are overcome, and remarkable improvement and optimization are achieved in the aspects of the storage space utilization rate, the element deletion accuracy, the large flow detection capacity, the throughput capacity, the adaptability and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a data processing method, system and storage medium for large flow detection. Background Art

[0002] Data stream measurement is a method of answering related query questions by recording relevant statistical information of multiple data streams arriving through certain data structures. The measurement module records the current frequency of elements of each stream, updates the corresponding statistical results every time a new element arrives, and answers the location of heavy hitter detection based on the recorded statistical results (Heavy Hitter: find all streams whose frequency exceeds a certain threshold).

[0003] Cuckoo Hash is a hash collision resolution strategy designed to improve the space efficiency of hash tables and ensure that the query time complexity is O(1). Its core mechanism relies on two hash functions to assign two potential storage locations to each key-value pair to handle possible collisions.

[0004] The uniqueness of Cuckoo Hashing lies in its paired hash function design, where each element is assigned two positions - a primary position and a backup position. When a conflict occurs, Cuckoo Hashing solves the problem by "kicking out" the element that already exists in the primary position to its backup position. If the backup position is also occupied, the process continues, kicking the new element to its backup position, and so on, until the number of times an element is kicked out reaches the set upper limit, at which time a rehash operation will be triggered to reallocate the hash table space. This method of making room for new elements through continuous "kick-out" operations is the core of Cuckoo Hash.

[0005] Cuckoo Filter based on Cuckoo Hash further optimizes the efficiency of handling hash conflicts and element deletions. Cuckoo Filter significantly improves space utilization by expanding the storage structure into a two-dimensional array and allowing multiple elements to be stored at each index, reaching a utilization rate of up to 98%. In addition, Cuckoo Filter introduces hash fingerprint technology to ensure that even when an element is "kicked out", it can be effectively relocated to other parts of the hash table through fingerprint information, reducing conflicts and improving space efficiency. Cuckoo Filter relies on Cuckoo Hash's dynamic element addition mechanism to reduce conflicts, while using hash fingerprints to ensure the uniqueness of data. However, the storage capacity of Cuckoo Filter is limited by the size of the hash table and the size of the fingerprint.

[0006] Although Cuckoo Hash and Cuckoo Filter have made progress in resolving hash conflicts and improving space utilization, they still face problems with high misjudgment rates and operational complexity when deleting elements. In addition, their performance is limited by the size of the hash table and fingerprint, especially when dealing with large amounts of network traffic, it is difficult to effectively identify large flows. Existing network measurement solutions require a trade-off between accuracy, speed, and memory usage, and it is difficult to meet the accurate measurement requirements under different traffic characteristics. In addition, storage overhead, computational overhead, and deviations caused by hash conflicts are also problems that need to be solved by existing solutions. In the task implementation of large flow detection, all Sketches used for frequency estimation can perform large flow detection simultaneously by adding a minimum heap, but the effect is not good. The insertion complexity is too high, and an additional heap is required, which destroys the simplicity of the sketch. Summary of the invention

[0007] The present invention provides a data processing method for large flow detection, including a step of establishing a data storage structure, wherein the step of establishing a data storage structure is as follows: constructing a data storage structure, wherein the data storage structure is composed of W hash tables, each hash table contains N hash buckets, and there are W*N hash buckets in total, each hash bucket contains multiple counters and entries, and the fingerprint information and counter information of each flow are stored in an entry of a hash bucket of a hash table.

[0008] As a further improvement of the present invention, the data storage structure includes cuckoo hashing, and cuckoo hashing calculates the position of the flow in another array through the current position of the flow and the fingerprint.

[0009] As a further improvement of the present invention, a designated entry is provided in the hash bucket, and the large flow information is stored through the designated entry.

[0010] As a further improvement of the present invention, the ID and the hash fingerprint are stored in the hash bucket.

[0011] The present invention also provides a data processing system for large flow detection, comprising: a memory, a processor, and a computer program stored in the memory, wherein the computer program is configured to implement the steps of the data processing method of the present invention when called by the processor.

[0012] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is configured to implement the steps of the data processing method of the present invention when called by a processor.

[0013] The beneficial effects of the present invention are as follows: the present invention overcomes some defects of the prior art and achieves significant improvements and optimizations in storage space utilization, accuracy of element deletion, large flow detection capability, throughput and adaptability. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 This is the data structure diagram of HeavyFinder;

[0015] Figure 2 It is a processing flow chart of the present invention. DETAILED DESCRIPTION

[0016] This paper discloses a data processing method for large flow detection and proposes an efficient storage structure called HeavyFinder, which aims to solve a series of challenges encountered in network traffic measurement and large flow detection, especially how to reduce memory requirements, lower the false positive rate, and improve detection accuracy while maintaining high throughput. HeavyFinder achieves these goals through the following key innovations:

[0017] Remove the Min-Heap structure: Traditional large flow detection algorithms rely on the Min-Heap to dynamically adjust the ranking of flows to keep track of the largest flow. However, the use of the Min-Heap increases the complexity of the algorithm and requires additional memory and time overhead for each insertion and deletion operation. HeavyFinder avoids these overheads by setting a special entry in each bucket (the special entry is a designated entry) to directly store large flow information.

[0018] Storing ID and hash fingerprint (Frp) at the same time: Unlike traditional counters that can only store ID or Frp, HeavyFinder's design allows each bucket to store ID and Frp at the same time, where ID is used to uniquely identify the flow, and Frp as a hash fingerprint enhances the uniqueness and retrieval efficiency of the data. This design not only increases the amount of information stored in the data, but also provides higher accuracy for large flow detection.

[0019] Real-time switching and ordered sorting within the bucket: HeavyFinder uses a clever design that allows real-time switching of the order of ID and FRP during the insertion process to achieve sorting of data within the bucket. This method simplifies the query process of large flow detection traffic, because when querying, only part of the top of the bucket needs to be traversed instead of a complete traversal, which significantly reduces the query complexity.

[0020] Load mechanism: To further improve accuracy, HeavyFinder introduces a load mechanism that allows the load of large flow detection to be balanced between the primary and backup buckets. This ensures that data is evenly distributed between different buckets, avoiding the problem of excessive congestion or uneven load on a single bucket.

[0021] In summary, through these innovative designs, HeavyFinder not only significantly improves throughput and insertion speed, but also achieves lower error rate and higher accuracy under limited memory resources, meeting the needs of efficient network traffic measurement and large flow detection.

[0022] The data structure of HeavyFinder is as follows Figure 1 As shown in the figure, it is mainly composed of a data structure based on Cuckoo Hash, which consists of two arrays. Each array consists of multiple buckets, and two candidate buckets are set for each element. Multiple entries are also set in each bucket to solve the hash conflict problem. In HeavyFinder, an additional top entry is set in each bucket to save possible large flow detection candidate flows. When large flows are inserted, they will enter the top-level entries and become large flow detection candidates through the accumulation of counters, and finally find the head large flow through sorting.

[0023] The data structure of HeavyFinder consists of W hash tables, each of which contains N hash buckets, for a total of W*N hash buckets. Each hash bucket contains multiple counters and entries, and the fingerprint information and counter information of each flow are stored in an entry in a hash bucket of a hash table, i.e., Array[x][y].Entry[z]. In this way, HeavyFinder can efficiently store and manage a large amount of traffic data and achieve accurate large flow detection.

[0024] The present invention introduces partial-key cuckoo hashing, which derives the alternate position of a flow based on its fingerprint. For a network packet p belonging to flow e, we calculate the index of its two candidate buckets as follows: h1(e) = hash(e), In the formula (XOR) ensures that h1(e) can also be calculated from h2(e) and the fingerprint of e, that is, Therefore, no matter which array a stream appears in, we can calculate its position in the other array using its current position and fingerprint:

[0025]

[0026] Table 1 is the overall data structure of the present invention

[0027]

[0028] like Figure 2 As shown, the insertion process of the present invention comprises the following steps:

[0029] Step S01: traverse the hash buckets in each hash table, use different hash functions to calculate M hash buckets Array[i][hi(f)], and obtain the fingerprint record in each hash bucket.

[0030] Step S02: Determine whether the fingerprint records in all elements are equal to the fingerprint inserted into the stream. If there are equal fingerprint records (i.e. Array[x][hx(f)].Entry[y].fpt=f.fpt), then execute step S03; otherwise, it is considered that there is no such stream record in the current data structure, and execute step a.

[0031] Step S03: Increase the value of the counter cnt in the found element, that is, increase Array[x][hx(f)].Entry[y].cnt.

[0032] Step S04: Determine whether the counter overflows, if so, execute step S05; if the counter cnt does not overflow, that is, the current bit length is sufficient to accommodate the new counter value, then the insertion process ends and directly goes to step a.

[0033] Step S05: After the element is inserted, it is compared with the large flow entries in its two primary and backup buckets to determine whether the inserted element is larger than the top element of the candidate bucket. If so, execute step 1, otherwise execute step S06.

[0034] Step S06: Try to exchange the elements of the current hash bucket. Compare the counter value of the inserted element with the counter value of the large flow entry, and insert the element to replace the hot flow element and enter the large flow entry.

[0035] Step 1: Kick the element out to the alternative bucket.

[0036] Step 2: After the element is inserted into the bottom common entry, it needs to be compared with the large flow entries in its two candidate buckets. If there is an empty position in the two large flow entries, the empty position is inserted; otherwise, the counter value of the inserted element needs to be compared with the counter value of the large flow entry to see whether the inserted element can replace the hot flow element and enter the large flow entry.

[0037] Step 3: Replace the top element of the candidate bucket, push the other elements down in turn, and then execute step e.

[0038] Step a: Determine whether there is an empty space in the current M hash buckets Array[i][hi(f)]. If so, then for the kicked element P, use the design of cuckoo hashing to try to find the position to complete the reinsertion; otherwise, execute step b.

[0039] Step b: Complete the processing of kicked elements; when an element is kicked out, according to the design of cuckoo hashing, its position in other hash tables can be calculated. If the original Array[x][hx(f)].Entry[k] is kicked out, according to the fingerprint and other information of the element, its position in the yth hash table can be calculated as hy(fk), that is, try to operate the hash bucket Array[y][hy(fk)] to determine whether there is an idle element position and the bit length of the counter of the idle position can accommodate the counter size of the kicked element. If there is a vacant position, complete the processing of the kicked element; if there is no vacant position, repeat the above steps and try to kick an element in the current hash bucket to other hash tables (this element may be different from the previously kicked element). If it still fails after several repetitions, this method will discard the current kicked element. End the operation.

[0040] Step c: If all hash buckets are full and no empty space can be found to place the current flow, the element P with the smallest counter value is replaced according to the pre-configured probability replacement strategy, and the new flow replaces P.

[0041] Step d: Kick out the minimum counter.

[0042] Step e: If there are free positions in the two large flow entries, insert the empty position; store the information of the current inserted flow f in the empty position we found (update the pointer information and counter information of the corresponding entry).

[0043] The present invention overcomes some defects of Cuckoo hash and Cuckoo Filter by improving the prior art and achieves the following advantages:

[0044] Reduce the false positive rate of element deletion: Compared with the existing Cuckoo hash, the present invention adopts a more effective deletion strategy, which can reduce the false positive rate of element deletion, thereby improving the accuracy and reliability of data storage.

[0045] Improve space utilization: Based on Cuckoo Filter, the present invention further optimizes the data structure and expands the array into a two-dimensional form so that each index can store multiple elements. This can more effectively utilize the table space, improve space utilization, and reduce storage overhead.

[0046] Improved large flow detection capability: Compared with the traditional Cuckoo Filter, the present invention has made improvements in large flow detection. By designing the orderly sorting of traffic, it can better identify and process large flows, and improve the accuracy and efficiency of large flow detection.

[0047] High throughput: This paper proposes a storage structure called HeavyFinder, which achieves high throughput without occupying additional memory by removing the minimum heap and setting special entries in each bucket to save large flows. This can improve the speed and efficiency of network measurement.

[0048] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.

Claims

1. A data processing method for large flow detection, characterized in that: Steps for establishing a data storage structure: Steps for establishing a data storage structure: Build a data storage structure. The data storage structure consists of W hash tables. Each hash table contains N hash buckets. There are a total of W*N hash buckets. Each hash bucket contains multiple counters and entries. The fingerprint information and counter information of each flow are stored in the entry of a hash bucket in a hash table.

2. The data processing method according to claim 1, characterized in that: The data storage structure includes a cuckoo hash, which calculates the position of a stream in another array using its current position and a fingerprint.

3. The data processing method according to claim 1, characterized in that: A designated entry is set in the hash bucket, and the large flow information is stored through the designated entry.

4. The data processing method according to claim 1, characterized in that: The hash bucket stores the ID and hash fingerprint.

5. The data processing method according to claim 1, characterized in that: During the insertion process, the order of ID and hash fingerprint is switched in real time to sort the data in the hash bucket.

6. The data processing method according to any one of claims 1 to 5, characterized in that: The data processing method comprises the following steps: Step S01: traverse the hash buckets in each hash table, use different hash functions to calculate M hash buckets, and obtain the fingerprint record in each hash bucket; Step S02: Determine whether the fingerprint records in all elements are equal to the fingerprint of the inserted stream. If so, execute step S03; otherwise, execute step a. Step S03: increase the value of the counter cnt in the found element; Step S04: Determine whether the calculator overflows, if so, execute step S05, otherwise execute step a; Step S05: After the element is inserted, it is compared with the large flow entries in the two primary and backup buckets to determine whether the inserted element is larger than the top element of the candidate bucket. If so, step 1 is executed; otherwise, step S06 is executed. Step S06: try to exchange the elements of the current hash bucket, and then end the insertion; Step 1: Kick the element out to the alternative bucket; Step 2: Compare the counter value of the inserted element with the counter value of the large flow entry to see whether the inserted element can replace the hot flow element and enter the large flow entry; Step 3: Replace the top element of the candidate bucket, push down the other elements in turn, and then execute step e; Step a: Determine whether there is an empty space in the current M hash buckets. If so, find the position of the element using the design of cuckoo hashing and insert it, and then end; Otherwise, execute step b; Step b: Complete the processing of kicked elements; Step c: According to the pre-configured probability replacement strategy, replace the element P with the smallest counter value, and the new flow replaces the position of P; Step d: Kick out the minimum counter; Step e: If there are free positions in the two large flow entries, insert the free positions; store the information of the current inserted flow in the free positions.

7. The data processing method according to claim 6, characterized in that: In step S06 , the counter value of the inserted element is compared with the counter value of the large flow entry, and the inserted element replaces the hot flow element and enters the large flow entry.

8. The data processing method according to claim 6, characterized in that: In step e, the pointer information and counter information of the corresponding entry are updated.

9. A data processing system for large flow detection, characterized in that: include: A memory, a processor and a computer program stored in the memory, wherein the computer program is configured to implement the steps of the data processing method according to any one of claims 1 to 8 when called by the processor.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is configured to implement the steps of the data processing method according to any one of claims 1 to 8 when called by a processor.

Citation Information

Patent Citations

  • Top-k flow accurate monitoring architecture based on small flow filtering

    CN113839835A

  • Cuckoo filters and cuckoo hash tables with biasing, compression, and decoupled logical sparsity

    US20190266252A1

Cited By

  • Layered large flow detection method compatible with programmable hardware

    CN119544624A