A data flow calculation method, device and storage medium

By using a hash table-based stream-level measurement algorithm in network equipment, the data flow activity level is monitored in real time and whether to export stream records is determined, which solves the problem of low data flow calculation efficiency in high bandwidth environments and realizes high efficiency in data plane memory manage.

CN113595816BActive Publication Date: 2024-11-05TSINGHUA UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110808358.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-16
Publication Date
2024-11-05
Estimated Expiration
2041-07-16

AI Technical Summary

Technical Problem

Existing network measurement tools are difficult to achieve accurate measurements in high bandwidth environments, and insufficient memory usage control of data streams leads to inefficient efficiency.

Method used

Using a stream-level measurement algorithm based on the activity of data flow, the data packets are mapped to the main table and the auxiliary table through a hash table, and the data flow activity level is monitored in real time and decide whether to export stream records to free up memory space.

Benefits of technology

It effectively controls the memory usage of the data plane, improves the efficiency of data flow calculation, and is suitable for network equipment in high bandwidth environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113595816B_ABST
    Figure CN113595816B_ABST
Patent Text Reader

Abstract

This article discloses a data flow measurement method, device and storage medium. The data flow measurement method includes, according to the received data packet, obtaining the flow identifier of the data packet; according to the preset hash function and the flow identifier of the data packet, mapping the data packet to the hash bucket of the main table and the hash bucket of the auxiliary table respectively; judging whether the preset flow record export condition is met according to the first flow record of the data packet mapped in the hash bucket of the main table and the second flow record of the data packet mapped in the hash bucket of the auxiliary table; if the preset flow record export condition is met, determining a first flow record to be exported according to the first flow record of the data packet mapped in the hash bucket of the main table, and obtaining the data flow measurement result according to the determined first flow record to be exported. The data flow measurement method provided in this article can effectively control the memory usage of the data plane and improve the efficiency of data flow measurement as a whole.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to but are not limited to the field of network technology, and in particular, to a data flow measurement method, device, and storage medium. Background Art

[0002] The various statistical information generated by network measurement provides the most basic basis for network operators to perform various network management tasks, such as detection and correction of network configuration errors, traffic engineering and network attack detection. There are many kinds of network measurement tools at present, among which tcpdump and Wireshark can collect all data packets in the network, including packet headers and timestamps, so they can accurately reflect the network status, but they are not suitable for backbone links with bandwidths up to 100Gbps, because accurate measurement of high-speed links requires massive storage space and huge processing power. The other extreme of network measurement tools is to only report some highly generalized information about the network, such as SNMP only counts the number of packets passing through a certain port of the router. Although such tools have good scalability, the information they can provide for network management is really limited, so they are far from meeting actual needs. The third type of tools, including NetFlow and IPFIX and more complex algorithms that have emerged in recent years, aggregate data packets into flow records directly on the data plane after capturing packets, and then report flow-level information, thus achieving a good balance between information richness and scalability. Exploring better and more efficient data flow measurement methods has always been the research direction in this field. Summary of the invention

[0003] In view of this, the embodiments of the present application provide a data flow measurement method, device and storage medium, which can effectively control the memory occupancy of the data plane and improve the efficiency of data flow measurement as a whole.

[0004] The embodiments of the present application mainly provide the following technical solutions:

[0005] A data flow measurement method, comprising:

[0006] According to the received data packet, obtaining a flow identifier of the data packet;

[0007] According to a preset hash function and a flow identifier of the data packet, the data packet is mapped to a hash bucket of a main table and a hash bucket of an auxiliary table respectively; wherein the hash bucket of the main table records a first flow record, and the hash bucket of the auxiliary table records a second flow record; the first flow record includes: a flow identifier, a count value, and a state value, and the second flow record includes: a second flow record identifier, a count value, and a state value;

[0008] According to the first flow record mapped by the data packet in the main table hash bucket and the second flow record mapped by the data packet in the auxiliary table hash bucket, determining whether a preset flow record export condition is met;

[0009] In the case where a preset flow record export condition is met, a first flow record to be exported is determined according to the first flow record mapped by the data packet in the hash bucket of the main table, and a data flow measurement result is obtained according to the first flow record determined to be exported;

[0010] The main table includes one or more sub-tables.

[0011] An electronic device, comprising:

[0012] at least one processor;

[0013] and at least one memory and bus connected to the processor;

[0014] The processor and the memory communicate with each other via the bus; the processor is used to call program instructions in the memory to execute the data flow estimation method described in any of the above embodiments.

[0015] A computer-readable storage medium includes a stored program, wherein when the program is executed, the electronic device where the storage medium is located is controlled to execute the data flow estimation method described in any of the above embodiments.

[0016] The data flow measurement solution provided in the embodiment of the present application proposes a flow-level measurement algorithm based on the activity level of the data flow, which can monitor the activity level of the data flow in real time, and determine whether to export a certain data flow based on the activity level of the flow records maintained by the data plane, thereby freeing up memory space for more active data flows.

[0017] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by implementing the present application. Other advantages of the present application can be realized and obtained by the schemes described in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The accompanying drawings are used to provide an understanding of the technical solution of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solution of the present application and do not constitute a limitation on the technical solution of the present application.

[0019] Figure 1 A schematic diagram of a flow chart of a data flow calculation method in an embodiment of the present application;

[0020] Figure 2 This is a schematic diagram of a system framework for executing the method in an embodiment of the present application;

[0021] Figure 3 This is a schematic diagram of the first stream record of the main table and the second stream record of the auxiliary table in an embodiment of the present application;

[0022] Figure 4 A schematic diagram of a data flow example in data flow calculation in an embodiment of the present application;

[0023] Figure 5 It is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0024] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0025] It should be noted that all directional indications in the embodiments of the present invention (such as up, down, left, right, front, back, etc.) are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.

[0026] In addition, in the present invention, descriptions such as "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0027] In the present invention, unless otherwise clearly specified and limited, the terms "connection", "fixation", etc. should be understood in a broad sense. For example, "fixation" can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0028] In addition, the technical solutions between the various embodiments of the present invention can be combined with each other, but it must be based on the fact that ordinary technicians in the field can implement it. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0029] Although people have conducted extensive and in-depth research on flow-level network measurement algorithms in related technologies, they have always ignored a problem, that is, when the memory capacity of the data plane is limited, in order to continuously detect new data flows, what strategy should be adopted to export the flow records maintained by the data plane to make room for maintaining new data flows. Generally speaking, when a TCP flow receives a FIN packet or a RST packet, it means that the TCP flow has ended, so NetFlow recommends selecting the flow to be exported through FIN packets and RST packets, but analysis of real network traffic shows that about 40% of the flows in the network are non-TCP flows, and among the TCP flows that appear in one minute, about 20% of the flows fail to receive FIN packets or RST packets normally within the next 10 minutes. Therefore, the method of relying on FIN packets or RST packets for export decisions is not reliable, and a more general method is needed to decide when and which flow record to export. Other related technical solutions also include setting a timeout period or an export cycle, so that when a flow record does not receive a new data packet within the timeout period, it will be exported, or when an export cycle ends, the entire data plane will be exported at once, but these methods are found to be inefficient in actual use and testing.

[0030] The disclosed implementation proposes a flow level measurement method based on the activity level of data flows. The measurement method can monitor the activity level of data flows in real time, and decide whether to export a data flow based on the activity level of flow records maintained by the data plane, thereby making room for more active data flows.

[0031] The embodiment of the present application provides a data flow calculation method. In practical applications, the data flow calculation method can be applied to network equipment.

[0032] In an exemplary embodiment, the above-mentioned network device may be an electronic device with very high forwarding performance, such as a switch, a router, etc.

[0033] For example, taking the network device as a switch, the network device can be a physical switch or a virtual switch.

[0034] Embodiment 1

[0035] Figure 1 The following is a flow chart of a data flow calculation method in an embodiment of the present application. The data flow calculation method may include:

[0036] Step 101, obtaining a flow identifier of a received data packet;

[0037] Step 102, mapping the data packet to the hash bucket of the main table and the hash bucket of the auxiliary table respectively according to a preset hash function and the flow identifier of the data packet; wherein the hash bucket of the main table records the first flow record, and the hash bucket of the auxiliary table records the second flow record; the first flow record includes: the flow identifier, the count value and the status value, and the second flow record includes: the second flow record identifier, the count value and the status value;

[0038] Step 103, judging whether a preset flow record export condition is met according to the first flow record mapped by the data packet in the hash bucket of the main table and the second flow record mapped by the data packet in the hash bucket of the auxiliary table;

[0039] Step 104, when a preset flow record export condition is met, a first flow record to be exported is determined according to the first flow record mapped by the data packet in the hash bucket of the main table, and a data flow measurement result is obtained according to the first flow record determined to be exported;

[0040] The main table includes one or more sub-tables.

[0041] It should be noted that the number of sub-tables in the main table can be one or more, and can be flexibly set according to needs; optionally, when the main table includes 2-4 sub-tables, the overall efficiency is better.

[0042] In an exemplary embodiment, the second flow record identifier includes: the flow identifier, or a digest generated according to the flow identifier.

[0043] In an exemplary embodiment, the data flow estimation method is implemented by a flow record generator located in the data plane and a flow record collector located in the control plane. Figure 2 As shown. In an exemplary embodiment, the flow record generator executes steps 101-103 and part of the sub-steps of step 104. In step 104, the first flow record is exported and enters the flow record collector, which is not limited to the specific division of labor exemplified here. Among them, the flow record generator includes two hash tables-the main table M and the auxiliary table A. Each hash bucket of each table can store a flow record item, which are respectively called the first flow record and the second flow record. Among them, although in actual application, a flow record may contain a lot of information about a data flow, including start and end time, number of bytes and number of packets, etc. In an exemplary embodiment, each flow record is recorded as a two-tuple of <flow identifier, number of data packets> or a two-tuple of <flow identifier summary, number of data packets>.

[0044] For example, Figure 3As shown, each hash bucket in the main table includes a 104-bit flow identifier field, a 16-bit count value field, and a 32-bit state value field. Each hash bucket in the auxiliary table includes an 8-bit summary field, a 16-bit count value field, and a 32-bit state value field; or, each hash bucket in the auxiliary table includes a 104-bit flow identifier field, a 16-bit count value field, and a 32-bit state value field.

[0045] In an exemplary embodiment, the flow identifier is a five-tuple consisting of source and destination addresses, protocols, source and destination port numbers, so it occupies 104 bits of space, and in the auxiliary table, in order to save space, an 8-bit summary generated according to the flow identifier is used instead of directly storing the flow identifier itself. Optionally, the flow identifier can also be directly stored in the auxiliary table.

[0046] It should be noted that the flow identifier indicates the flow to be measured, and the data packets of the flow are measured according to the above method; other methods can also be selected to determine the flow identifier, not limited to the above examples. The flow identifier, count value, state value and digest length involved in the embodiments of the present disclosure are determined according to the needs of the relevant protocol or solution, and are not limited to the form of the above examples.

[0047] In an exemplary embodiment, the preset hash function includes: a sub-table hash function corresponding to each of the sub-tables and an auxiliary table hash function corresponding to the auxiliary table;

[0048] Accordingly, in step 102, the data packet is mapped to the hash bucket of the main table and the hash bucket of the auxiliary table respectively according to the preset hash function and the flow identifier of the data packet, including:

[0049] According to the hash function of each sub-table and the flow identifier of the data packet, the data packet is sequentially mapped to the hash bucket of each sub-table respectively;

[0050] According to the auxiliary table hash function and the flow identifier of the data packet, the data packet is mapped to a hash bucket of the auxiliary table.

[0051] It should be noted that each subtable corresponds to a subtable hash function, and each subtable corresponds to multiple subtable hash buckets; the number of subtable hash buckets corresponding to different subtables can be the same or different. The auxiliary table also corresponds to an auxiliary table hash function and multiple auxiliary table hash buckets, and the number of auxiliary table hash buckets can be the same as or different from the number of subtable hash buckets.

[0052] In an exemplary embodiment, the number of hash buckets corresponding to each sub-table is the same as the number of hash buckets in the auxiliary table.

[0053] In an exemplary embodiment, each sub-table hash bucket may be empty or may store a first flow record; each auxiliary table hash bucket may be empty or may store a second flow record.

[0054] It can be seen that according to step 102, the received data packets will be mapped to a hash bucket of each sub-table and a hash bucket of the auxiliary table in turn according to their flow identifiers. For example, the main table M includes d sub-tables M1, M2, M3, ...M d , auxiliary table A, then step 102 uses sub-table hash functions h1, h2, h3, ... h1 respectively for the received data packets according to their flow identifiers. d Perform hash operations and map the received data packets to d sub-tables M1, M2, M3, ...M in sequence. d In each hash bucket (also called sub-table hash bucket), the auxiliary table hash function g is used to perform hash operation according to its flow identifier, and the data packet is mapped to a hash bucket (also called auxiliary table hash bucket) of the auxiliary table A. The sub-table hash bucket stores the first flow record, and the auxiliary table hash bucket stores the second flow record.

[0055] It should be noted that, according to the hash function of the table (sub-table or auxiliary table) and the flow identifier of the data packet, the data packet is mapped to a hash bucket of the table, including:

[0056] A hash bucket index is determined according to a hash function of a table (sub-table or auxiliary table) and a flow identifier of a data packet, and the data packet is mapped to a hash bucket indicated by the hash bucket index in the table.

[0057] For example, the flow identifier f of a data packet is sequentially mapped to sub-tables M1, M2, M3, ...M d The indexes are h1(f), h2(f), h3(f), ...h d (f) is mapped to the auxiliary table hash bucket with index g(f) in auxiliary table A.

[0058] In an exemplary embodiment, mapping the data packets to the hash buckets of the sub-tables in sequence according to the hash functions of the sub-tables and the flow identifiers of the data packets includes:

[0059] Perform the following steps for each subtable in the main table:

[0060] Determine, according to the sub-table hash function of the sub-table, the hash bucket index of the sub-table corresponding to the flow identifier of the data packet;

[0061] In the case where the flow identifier of the data packet has been recorded in the sub-table hash bucket of the previous sub-table, subtract 1 from the state value in the first flow record in the sub-table hash bucket indicated by the hash bucket index;

[0062] When the flow identifier of the data packet is not recorded in the sub-table hash bucket of the previous sub-table and the sub-table hash bucket indicated by the hash bucket index is empty, write a first flow record into the sub-table hash bucket indicated by the hash bucket index; wherein the flow identifier in the first flow record is the flow identifier of the data packet, the count value in the first flow record is 1, and the state value in the first flow record is 1;

[0063] In the case where the flow identifier of the data packet has not been recorded in the sub-table hash bucket of the previous sub-table, the sub-table hash bucket indicated by the hash bucket index is not empty, and the flow identifier in the first flow record in the sub-table hash bucket indicated by the hash bucket index is the same as the flow identifier of the data packet, adding 1 to the count value in the first flow record in the sub-table hash bucket indicated by the hash bucket index, and setting the state value in the first flow record to the updated count value;

[0064] When the flow identifier of the data packet has not been recorded in the sub-table hash bucket of the previous sub-table, the sub-table hash bucket indicated by the hash bucket index is not empty, and the flow identifier in the first flow record in the sub-table hash bucket indicated by the hash bucket index is different from the flow identifier of the data packet, the state value in the first flow record in the sub-table hash bucket indicated by the hash bucket index is reduced by 1.

[0065] It should be noted that when the flow identifier of the data packet is recorded in any hash bucket of any subtable before the current subtable, it indicates that the flow identifier of the data packet has been recorded in the subtable hash bucket of the previous subtable; that is, the flow identifier of the data packet is recorded in the first flow record in any hash bucket of any subtable before the current subtable, it indicates that the flow identifier of the data packet has been recorded in the subtable hash bucket of the previous subtable.

[0066] It can be seen that when a data packet p arrives, its flow identifier f is first extracted, and then the data packet is mapped to sub-tables M1, M2, ..., M d The indices are h1(f),h2(f),...,h d (f) in the hash bucket. For any subtable M iIn the hash bucket of M1, if the data packet has not been recorded in the main table (this condition is obviously true for M1), first determine whether the hash bucket is empty. If the hash bucket is empty, then we write the flow identifier f into the flow identifier field of the hash bucket, and set the count value field and state value field of the hash bucket to 1. If the hash bucket is not empty but the value of its flow identifier field is the same as the flow identifier f, then increase the value of the count value field of the hash bucket by 1, and then set the value of the state value field of the hash bucket to the value of the updated count value field. In both cases, it is considered that the data packet has been recorded, so when updating subsequent hash tables (including the sub-tables of the main table and the auxiliary tables), we will adopt different strategies. If the hash bucket is not empty and the value of its flow identifier field is different from the flow identifier f of the received data packet, then reduce the value of its state value field by 1. However, if the data packet has been recorded in the sub-table of the previous main table, reduce the state value of the hash bucket by 1 without checking whether the flow identifier of the hash bucket is consistent with f.

[0067] It should be noted that the writing or updating of the identifier field, count value field and / or status value field in the sub-table hash bucket recorded in the above process has the same technical effect as writing or updating the first flow record in the sub-table, and technical personnel in this field can understand this aspect.

[0068] In an exemplary embodiment, mapping the data packet to a hash bucket of the auxiliary table according to the auxiliary table hash function and the flow identifier of the data packet includes:

[0069] Determine, according to the auxiliary table hash function, a hash bucket index of the auxiliary table corresponding to the flow identifier of the data packet;

[0070] In the case where the flow identifier of the data packet has been recorded in the hash bucket of the main table, subtract 1 from the state value in the second flow record in the hash bucket of the auxiliary table indicated by the hash bucket index;

[0071] When the flow identifier of the data packet is not recorded in the hash bucket of the main table, the hash bucket of the auxiliary table is updated according to the flow identifier of the data packet.

[0072] It should be noted that when the flow identifier of the data packet is recorded in any hash bucket of any sub-table of the main table, it indicates that the flow identifier of the data packet has been recorded in the hash bucket of the main table; that is, the flow identifier of the data packet is recorded in the first flow record in any hash bucket of any sub-table in the main table, it indicates that the flow identifier of the data packet has been recorded in the hash bucket of the main table.

[0073] It can be seen that after the main table completes the processing of the data packet, the data packet is mapped to the hash bucket indexed as g(f) in the auxiliary table for further processing. If the data packet has been recorded in the main table, then you only need to reduce the state value of the hash bucket of the auxiliary table by 1, thus completing the processing flow of the auxiliary table; if the data packet is not recorded in the main table, the hash bucket of the auxiliary table is further updated according to the flow identifier f.

[0074] In an exemplary embodiment, when the flow identifier of the data packet is not recorded in the main table hash bucket, updating the auxiliary table hash bucket according to the flow identifier of the data packet includes:

[0075] Determine, according to the flow identifier or a digest generated according to the flow identifier, a second flow record identifier corresponding to the data packet;

[0076] Rule 1: When the auxiliary table hash bucket indicated by the hash bucket index is empty, write the second flow record into the auxiliary table hash bucket indicated by the hash bucket index; wherein the second flow record identifier in the second flow record is the second flow record identifier corresponding to the data packet, the count value in the second flow record is 1, and the state value in the second flow record is the minimum state value in the first flow record mapped to the main table hash bucket of the data packet;

[0077] Rule 2: when the auxiliary table hash bucket indicated by the hash bucket index is not empty and the second flow record identifier in the second flow record in the auxiliary table hash bucket is the same as the second flow record identifier corresponding to the data packet, the count value and the state value of the second flow record in the auxiliary table hash bucket are respectively increased by 1;

[0078] Rule 3: When the auxiliary table hash bucket indicated by the hash bucket index is not empty and the second flow record identifier in the second flow record in the auxiliary table hash bucket is different from the second flow record identifier corresponding to the data packet, update the second flow record in the auxiliary table hash bucket indicated by the hash bucket index; wherein the second flow record identifier in the updated second flow record is the second flow record identifier corresponding to the data packet, the count value in the updated second flow record is 1, and the status value in the updated second flow record is the minimum status value in the first flow record mapped to the data packet in the main table hash bucket.

[0079] It should be noted that, in the process of further updating the auxiliary table hash bucket according to the flow identifier f, the second flow record identifier must first be determined. The flow identifier f can be selected as the second flow record tag, or an 8-bit summary D can be generated according to the flow identifier f as the second flow record tag; writing the auxiliary table hash bucket with the summary D as the second flow record tag can reduce the memory space occupied by the auxiliary table hash bucket. The specific selection of the second flow record identifier is determined according to the system configuration parameters.

[0080] In an exemplary embodiment, judging whether a preset flow record export condition is met according to a first flow record mapped by the data packet in a hash bucket of a main table and a second flow record mapped by the data packet in a hash bucket of an auxiliary table includes:

[0081] Determine a minimum count value and a minimum state value in the first flow record according to the first flow record mapped in all sub-table hash buckets;

[0082] (1) when the count value in the second flow record mapped to the data packet in the hash bucket of the auxiliary table is greater than the minimum count value in the first flow record, determining that a preset flow record export condition is satisfied;

[0083] or,

[0084] (2) When the state value of the second flow record mapped to the data packet in the hash bucket of the auxiliary table is greater than the minimum state value in the first flow record, it is determined that the preset flow record export condition is met.

[0085] In an exemplary embodiment, taking the example of generating an 8-bit summary D as a second flow record mark according to the flow identifier f, accordingly, when the flow identifier f of the data packet is not recorded by the main table hash bucket, updating the auxiliary table hash bucket according to the flow identifier of the data packet includes:

[0086] According to the flow identifier f of the data packet, determine the hash bucket with index g(f) in the auxiliary table;

[0087] Rule 1: If the hash bucket with index g(f) in the auxiliary table is empty, create a second flow record for the data flow (flow identifier f) in this hash bucket. Specifically, write the summary D into the summary field of the hash bucket, set the count value field of the hash bucket to 1, and set the state value field of the hash bucket to the minimum state value in the first flow record corresponding to the data flow in the previous main table.

[0088] Rule 2: If the hash bucket with index g(f) in the auxiliary table is not empty, but the value of the summary field of the hash bucket is the same as D, then the count value field and state value field of the hash bucket are increased by 1 respectively. Here, the flow record consisting of the flow identifier f and the count value of the updated hash bucket of the auxiliary table is recorded as R. If the count value field of the hash bucket of the auxiliary table is greater than the minimum count value in the first flow record corresponding to the data flow (flow identifier f) in the previous main table, then R is determined to be a flow record larger than the first flow record corresponding to the minimum count value; if the state value field of the hash bucket of the auxiliary table is greater than the minimum state value in the first flow record corresponding to the data flow in the previous main table, then R is determined to be a flow record more active than the flow record corresponding to the minimum state value. The above two situations will trigger the flow record upgrade program, and the first flow record corresponding to the minimum count value or the minimum state value in the main table will be exported, and the flow record R will be written into the hash bucket of the main table (sub-table) where the exported first flow record is located. In order to prevent repeated maintenance of a flow record in the main table, if these two situations occur at the same time, we only export and replace the flow record corresponding to the minimum count value with R.

[0089] Rule 3: If the hash bucket with index g(f) in the auxiliary table is not empty, and the value of the summary field of the hash bucket is different from D, it means that a conflict has occurred in the auxiliary table. The content of the hash bucket is discarded, and the content of the hash bucket is set in the same way as Rule 1, that is, the summary field, count value field, and status value field of the hash bucket are set to D, 1 and the minimum status value in the first stream record corresponding to the data stream in the previous main table, respectively.

[0090] In an exemplary embodiment, in step 103, judging whether a preset flow record export condition is met according to the first flow record mapped by the data packet in the hash bucket of the main table and the second flow record mapped by the data packet in the hash bucket of the auxiliary table includes:

[0091] Determine a minimum count value and a minimum state value in the first flow record according to the first flow record mapped in all sub-table hash buckets;

[0092] When the count value in the second flow record mapped to the data packet in the hash bucket of the auxiliary table is greater than the minimum count value in the first flow record, determining that a preset flow record export condition is met;

[0093] or,

[0094] When the state value in the second flow record mapped to the data packet in the hash bucket of the auxiliary table is greater than the minimum state value in the first flow record, it is determined that the preset flow record export condition is met.

[0095] In an exemplary embodiment, the step 104 of determining a first flow record to be exported according to the first flow record mapped by the data packet in the hash bucket of the main table includes:

[0096] In a case where the count value in the second flow record mapped to the data packet in the hash bucket of the auxiliary table is greater than the minimum count value in the first flow record, determining the first flow record to which the minimum count value belongs as a first flow record to be derived;

[0097] or,

[0098] When the state value of the second flow record mapped to the data packet in the hash bucket of the auxiliary table is greater than the minimum state value in the first flow record, and the count value of the second flow record mapped to the hash bucket of the auxiliary table is less than or equal to the minimum count value in the first flow record, the first flow record to which the minimum state value belongs is determined to be a first flow record to be exported.

[0099] It can be seen that after receiving the data packet, the flow identifier is first determined, and then the data packet is mapped to the hash buckets of each sub-table in turn according to step 102. The first flow records stored in the hash buckets of these sub-tables constitute the first flow records corresponding to the data packet. For example, the main table M includes d sub-tables, then after the received data packet is mapped to each of the M sub-tables, the corresponding d first flow records constitute the first flow record corresponding to the data packet. Those skilled in the art can determine the minimum count value and the minimum status value from the first flow record corresponding to the data packet according to the relevant scheme, without being limited to a specific method. How to specifically determine the minimum count value and the minimum status value in the first flow record corresponding to the data packet described in the first main table does not fall within the scope of protection or limitation of the embodiments of the present disclosure.

[0100] It can be seen that the first flow record determined to be derived in step 103 records the flow identifier and the count value, thereby obtaining the measurement result of the data flow indicated by the flow identifier.

[0101] In an exemplary embodiment, the method further comprises:

[0102] Step 105: When the preset flow record export condition is met, the sub-table hash bucket to which the first flow record to be exported belongs is updated according to the second flow record mapped by the data packet in the auxiliary table hash bucket.

[0103] In an exemplary embodiment, updating the sub-table hash bucket to which the first flow record determined to be derived belongs includes:

[0104] exporting the determined first-stream record;

[0105] Writing the new first flow record into the hash bucket of the sub-table to which the exported first flow record belongs;

[0106] The flow identifier in the new first flow record is the data packet flow identifier, and the count value and state value in the new first flow record are both the count values ​​of the data packet mapped in the second flow record in the hash bucket of the auxiliary table.

[0107] It can be seen that according to step 105, after the first flow record including the data flow measurement result information is exported, the first flow record at the position will be updated.

[0108] In an exemplary embodiment, the method further comprises:

[0109] Step 106, when the preset flow record export condition is met, the second flow record mapped by the data packet in the auxiliary table hash bucket is updated to the preset second flow record initial value. For example, the second flow record initial value (second flow record identifier, count value, state value) is (0, 0, 0); or, other initial values ​​are set.

[0110] In an exemplary embodiment, before step 101 or 102, the method further includes:

[0111] Step 100, initialize the first flow record in each sub-table hash bucket, and initialize the second flow record in the auxiliary table hash bucket.

[0112] In an exemplary embodiment, the initial value of the first flow record is (0, 0, 0); accordingly, determining whether the sub-table hash bucket is empty in the aforementioned step includes: when the flow identifier of the first flow record in the sub-table hash bucket is 0 and the count value is 0, determining that the sub-table hash bucket is empty; otherwise, determining that the sub-table hash bucket is not empty.

[0113] In an exemplary embodiment, the initial value of the second flow record is (0, 0, 0); accordingly, determining whether the auxiliary table hash bucket is empty in the aforementioned step includes: when the second flow record identifier of the second flow record in the auxiliary table hash bucket is 0 and the count value is 0, determining that the auxiliary table hash bucket is empty; otherwise, determining that the auxiliary table hash bucket is not empty.

[0114] It should be noted that those skilled in the art can use other initial values ​​to initialize the sub-table hash bucket and / or the auxiliary table hash bucket, not limited to the above examples. The corresponding method for determining whether the hash bucket of each table is empty can also be adjusted according to the different initial values, and examples are not given here one by one.

[0115] The data flow test solution provided by the disclosed embodiment maintains a state value domain in each sub-table hash bucket. When a data packet arrives, if the data packet belongs to the flow record maintained in this hash bucket, the value of the state value domain is restored to the value of the count value domain of this hash bucket, otherwise the value of the state value domain is reduced by 1, that is, the activity of a flow record is dynamically detected through a state value domain, and this activity can provide a decision basis for the subsequent first flow record export. This flow level measurement method based on the activity of data flow can monitor the activity of data flow in real time, and decide whether to export a certain data flow according to the activity of the flow record maintained by the data plane, thereby making room for more active data flows, effectively controlling the memory usage of the data plane, and improving the efficiency of data flow measurement as a whole.

[0116] Embodiment 2

[0117] The embodiment of the present disclosure provides a data flow estimation method, wherein the second flow record identifier of the auxiliary table is a summary generated according to the flow identifier, and the process includes:

[0118] Step 0: Initialize the first flow record in each hash bucket of the d sub-tables to an initial value (0, 0, 0), and initialize the second flow record in each hash bucket of the auxiliary table to an initial value (0, 0, 0).

[0119] Step 1: Receive data packets and map them into d sub-tables in sequence, including:

[0120] 1: Receive input data packet p;

[0121] 2: Set the initial value of the minimum count value to positive infinity, the initial value of the minimum state value to positive infinity, obtain the flow identifier f according to the data packet p, and set the initial value of the recorded identifier to -No (not recorded);

[0122] 3: For i=1 to d sub-tables, loop through the following steps 4-22

[0123] 4: Index <--h i (f) / / h i (...) is the subtable hash function, and the hash bucket index in the i-th subtable is determined according to the i-th subtable hash function;

[0124] 5: If no == recorded flag: / / Judge the recorded flag equals unrecorded, then execute step 6-20

[0125] 6: If M i [Index] is empty: / / If the hash bucket indicated by the index in the i-th subtable is empty, execute steps 7-8.

[0126] 7: M i[index]<--(f,1,1) / / Write the first stream record (f,1,1) into the hash bucket indicated by the index in the i-th subtable;

[0127] 8: Recorded Flag <--Yes / / Set the recorded flag to yes, indicating that it has been recorded;

[0128] 9: Otherwise if M i [index]. Flow identifier == f: / / If the hash bucket indicated by the index in the i-th subtable is not empty and the flow identifier recorded in the indicated hash bucket is the same as the flow identifier of the received data p, then execute steps 10-12

[0129] 10: M i [index].Count++ / / Increase the count value in the hash bucket indicated by the index in the i-th subtable by 1;

[0130] 11: M i [index].status value <--Mi[index].count value / / Update the status value in the hash bucket indicated by the index in the i-th subtable to the updated count value above;

[0131] 12: Recorded Flag <--Yes / / Set the recorded flag to yes, indicating that it has been recorded;

[0132] 13: Otherwise: / / If it is determined that the hash bucket indicated by the index in the i-th subtable is not empty, and the flow identifier recorded in the indicated hash bucket is different from the flow identifier of the received data p, then execute steps 14-20

[0133] 14: M i [index].status value — / / Decrease the status value in the hash bucket indicated by the index in the i-th subtable by 1;

[0134] 15: If M i [index].Count value < minimum count value: / / If the current count value in the hash bucket indicated by the index in the i-th subtable is less than the minimum count value, execute steps 16-17;

[0135] 16: Minimum count value <--M i [index].Count value / / Set the minimum count value to the current count value in the hash bucket indicated by the index in the i-th subtable;

[0136] 17: Count table <--i, count index <--index / / record the sub-table and sub-table hash bucket index corresponding to the current minimum count value;

[0137] 18: If M i[index].state value < minimum state value: / / If the current state value in the hash bucket indicated by the index in the i-th subtable is less than the minimum state value, execute steps 19-20;

[0138] 19: Minimum status value <--M i [index].state value / / Set the minimum state value to the current state value in the hash bucket indicated by the index in the i-th subtable;

[0139] 20: state table <--i, state index <--index / / record the sub-table and sub-table hash bucket index corresponding to the current minimum state value;

[0140] 21: Otherwise: / / If the recorded flag is equal to recorded, execute step 22

[0141] 22: M i [index].status value — / / Decrease the status value in the hash bucket indicated by the index in the i-th subtable by 1; Step 2: Map the data packet to the auxiliary table, including:

[0142] 23: Index <--g(f) / / g(...) is the auxiliary table hash function. According to the auxiliary table hash function, the hash bucket index of the data packet in the auxiliary table is determined;

[0143] 24: If no == recorded flag: / / , it is determined that the recorded flag is equal to unrecorded, then execute steps 25-36

[0144] 25: Generate 8-bit summary D from f / / Generate summary D based on the flow identifier of the data packet

[0145] 26: If A[index] is empty or D!=A[index].summary: / / , it is determined that the hash bucket indicated by the index in the auxiliary table is empty, or the summary recorded in the hash bucket indicated by the index in the auxiliary table is different from the generated summary D, then execute step 27;

[0146] 27: A[index]<--(D,1,minimum count value) / / Write or update the second stream record in the hash bucket indicated by the index in the auxiliary table (D,1,minimum count value)

[0147] 28: Otherwise: / / If it is determined that the hash bucket indicated by the index in the auxiliary table is not empty, and the digest recorded in the hash bucket indicated by the index in the auxiliary table is the same as the generated digest D, then execute step 29;

[0148] 29: A[index].status value++ / / The status value in the hash bucket indicated by the index in the auxiliary table is increased by 1;

[0149] 30: A[index].Count++ / / The count value in the hash bucket indicated by the index in the auxiliary table is increased by 1;

[0150] 31: If A[index].count value>minimum count value: / / , it is determined that the count value in the hash bucket indicated by the index in the auxiliary table is greater than the current minimum count value, then execute steps 32-33;

[0151] 32: Upgrade flow record (count table, count index, f, A[index]. count value) / / Satisfy the export conditions of the export flow record, export the first flow record and update the corresponding sub-table hash bucket;

[0152] 33: A[index]<--(0,0,0) / / Update the second stream record (0,0,0) of the hash bucket indicated by the index in the auxiliary table;

[0153] 34: Otherwise, if A[index].status value>minimum status value: / / , it is determined that the status value in the hash bucket indicated by the index in the auxiliary table is greater than the current minimum status value, then steps 35-36 are executed;

[0154] 35: Upgrade flow record (state table, state index, f, A[index]. count value) / / Satisfy the export flow record export conditions, export the first flow record and update the corresponding sub-table hash bucket;

[0155] 36: A[index]<--(0,0,0) / / Update the second stream record of the hash bucket indicated by the index in the auxiliary table (0,0,0);

[0156] 37: Otherwise: / / If the recorded flag is equal to recorded, execute step 38

[0157] 38: A[index].Status value— / / The status value in the hash bucket indicated by the index in the auxiliary table is reduced by 1

[0158] Among them, the function upgrade flow record (subtable identifier k, index, identifier, count value) includes:

[0159] 39: Export M k [index] flow record / / export the first flow record in the subtable hash bucket to which the minimum state value or minimum count value belongs;

[0160] 40: M k [index]<--(identifier, count value, count value) / / Update the first flow record in the hash bucket of the exported first flow record. The new first flow record is (identifier, count value, count value), that is, the count value and status value in the new first flow record are the count value (A[index].count value) of the second flow record mapped to the hash bucket of the auxiliary table where the data packet is located.

[0161] It can be seen that when the preset flow record export conditions are met, the flow record will be upgraded (the upgrade flow record function will be executed), including:

[0162] Determine the subtable hash bucket that meets the flow record export conditions and add the subtable hash bucket (M k [index]) in the first stream record, and the data stream measurement result is obtained;

[0163] Update the exported subtable hash bucket (M) with the new first-stream record (identifier, count value, count value) k [index]).

[0164] Among them, if the identifier of the first flow record in each hash bucket of the subtable is 0 and the count value is 0, then the hash bucket is determined to be empty; otherwise, the hash bucket is determined to be not empty. If the second flow record identifier of the second flow record in each hash bucket of the auxiliary table is 0 and the count value is 0, then the hash bucket is determined to be empty; otherwise, the hash bucket is determined to be not empty.

[0165] It should be noted that this embodiment provides a pseudo code process for implementing the data flow measurement method to assist in explaining the relevant steps in Embodiment 1, and does not limit the implementation process or steps of the data flow measurement method provided in the embodiment of the present disclosure. Those skilled in the art can use an equivalent method to implement the data flow measurement method provided in the embodiment of the present disclosure to achieve the measurement target.

[0166] Example

[0167] Based on the above embodiment, taking the main table including: sub-tables M1 and M2, and the auxiliary table including: table A as an example, the data flow measurement method provided in the embodiment of the present application is described below with a specific example. Figure 4 As shown. For any data packet, use f i To represent the packet itself, the packet's flow identifier, and the 8-bit summary of the packet's flow identifier.

[0168] Example 1: Data packet f1 is first mapped to an empty bucket in M1, so we set the flow identifier field of this empty bucket to f1, and set its count value field and state value field to 1. After that, this data packet continues to be mapped to the main table M2 and the auxiliary table A, but in these two tables we simply reduce their state values ​​by 1.

[0169] Example 2: Packet f2 is mapped to a packet in M1 with a different flow identifier f 11 The state value of this hash bucket is reduced by 1. Afterwards, f2 is mapped to a hash bucket of M2 with the same flow identifier f2, so the count value of this hash bucket is increased by 1, and its state value is set to the value of the updated count value field (i.e. 6). Finally, this data packet is mapped to a hash bucket of auxiliary table A and the state value of this hash bucket is reduced by 1.

[0170] Example 3: When packet f3 passes through the main table, it does not find a hash bucket with the same flow identifier, so the state value of the hash bucket it is mapped to is reduced by 1, and it records the minimum state value 3. Subsequently, it is mapped to an empty hash bucket in the auxiliary table A, so the summary field of this empty hash bucket is set to f3, its count value field is set to 1, and its state value field is set to the minimum state value 3 we recorded previously.

[0171] Example 4: Packet f4 does not find a hash bucket with the same flow identifier in the primary table, so it enters the auxiliary table after recording the minimum state value 2. There, it still encounters a hash bucket with a different digest f 17 Therefore, the content of this hash bucket is discarded, and then the digest field of this hash bucket is set to f4, its count field is set to 1, and its state field is set to the minimum state value recorded previously (i.e. 2).

[0172] Example 5: The minimum count value and minimum status value of data packet f5 recorded in the main table are 8 and 6 respectively. After entering the auxiliary table, it encounters a hash bucket with the same digest f5, so the count value and status value of this hash bucket are increased by 1 to 5 and 3 respectively. Since 5<8 and 3<6, the flow record upgrade procedure cannot be triggered.

[0173] Example 6: The minimum count value and minimum status value of data packet f6 in the main table are 4 and 0 respectively. In the auxiliary table, it encounters a hash bucket with the same digest f6, so the count value and status value of this hash bucket are increased by 1 respectively. Afterwards, since the count value 5 of the hash bucket in the auxiliary table is greater than the minimum count value 4, the flow record upgrade procedure is triggered, so the flow record (f6) in M1 is 20 ,4) is derived, then the flow identifier field of this hash bucket is set to f6, and the values ​​of its count value field and state value field are set to the count value of the new flow record (i.e. 5).

[0174] Example 7: The minimum count value and minimum status value of packet f7 recorded in the main table are 3 and -5 respectively. It is then mapped to a hash bucket with the same digest f7 in the auxiliary table. After the update, the count value and status value of this hash bucket are 2 and -4 respectively. The status value -4 is greater than the minimum status value -5 encountered by the packet in the main table, triggering the data flow upgrade procedure. Therefore, we update the flow record (d 22 ,5) Export and set the flow identifier of this hash bucket to f7, and set its count value field and state value field to the count value of the new flow record (i.e. 2).

[0175] Based on the same inventive concept, an embodiment of the present application also provides an electronic device. Figure 5 This is a schematic diagram of the structure of the electronic device in the embodiment of the present application, see Figure 5 As shown, the electronic device 50 includes: at least one processor 501; and at least one memory 502 and a bus 503 connected to the processor 501; wherein the processor 501 and the memory 502 communicate with each other through the bus 503; the processor 501 is used to call the program instructions in the memory 502 to execute the steps of the data flow measurement method in one or more of the above-mentioned embodiments.

[0176] The processor may be implemented by a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA). The memory may include a non-permanent memory in a computer-readable medium, a random access memory (RAM) and / or a non-volatile memory, such as a read-only memory (ROM) or a flash memory (Flash RAM), and the memory includes at least one memory chip.

[0177] It should be noted that in the embodiments of the present application, if the data stream processing method or data stream recovery method in one or more of the above embodiments is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can essentially or in other words, the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for an electronic device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods of each embodiment of the present application.

[0178] Correspondingly, based on the same inventive concept, an embodiment of the present application also provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored program, wherein when the program is running, the electronic device where the storage medium is located is controlled to execute the steps of the data flow measurement method in one or more of the above embodiments.

[0179] In practical applications, the computer-readable storage medium may be, for example, ROM / RAM, a magnetic disk, or an optical disk.

[0180] It should be noted here that the description of the above electronic device or computer-readable storage medium embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the electronic device or computer-readable storage medium embodiment of this application, please refer to the description of the method embodiment of this application for understanding.

[0181] The present application describes multiple embodiments, but the description is exemplary rather than restrictive, and it is obvious to those skilled in the art that there may be more embodiments and implementations within the scope of the embodiments described in the present application. Although many possible feature combinations are shown in the drawings and discussed in the specific embodiments, many other combinations of the disclosed features are also possible. Unless specifically limited, any feature or element of any embodiment may be used in combination with any other feature or element in any other embodiment, or may replace any other feature or element in any other embodiment.

[0182] The present application includes and contemplates combinations of features and elements known to those of ordinary skill in the art. The embodiments, features and elements disclosed in the present application may also be combined with any conventional features or elements to form a unique invention scheme defined by the claims. Any features or elements of any embodiment may also be combined with features or elements from other invention schemes to form another unique invention scheme defined by the claims. Therefore, it should be understood that any feature shown and / or discussed in the present application may be implemented individually or in any appropriate combination. Therefore, except for the limitations made according to the attached claims and their equivalents, the embodiments are not subject to other restrictions. In addition, various modifications and changes may be made within the scope of protection of the attached claims.

[0183] In addition, when describing representative embodiments, the specification may have presented the method and / or process as a specific sequence of steps. However, to the extent that the method or process does not rely on the specific order of the steps described herein, the method or process should not be limited to the steps of the specific order described. As will be understood by those of ordinary skill in the art, other sequences of steps are also possible. Therefore, the specific sequence of the steps set forth in the specification should not be interpreted as a limitation to the claims. In addition, the claims for the method and / or process should not be limited to the steps of performing them in the order written, and those skilled in the art can easily understand that these sequences can be changed and still remain within the spirit and scope of the embodiments of the present application.

[0184] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

Claims

1. A data flow measurement method, characterized in that: include: According to the received data packet, obtaining a flow identifier of the data packet; According to a preset hash function and a flow identifier of the data packet, the data packet is mapped to each hash bucket of the main table and the hash bucket of the auxiliary table respectively; wherein the first flow record is recorded in the hash bucket of the main table, and the second flow record is recorded in the hash bucket of the auxiliary table; the first flow record includes: a flow identifier, a count value and a state value, and the second flow record includes: a second flow record identifier, a count value and a state value; According to the first flow record mapped by the data packet in the main table hash bucket and the second flow record mapped by the data packet in the auxiliary table hash bucket, determining whether a preset flow record export condition is met; In the case where a preset flow record export condition is met, a first flow record to be exported is determined according to the first flow record mapped by the data packet in the hash bucket of the main table, and a data flow measurement result is obtained according to the first flow record determined to be exported; Wherein, the main table includes one or more sub-tables; The determining whether a preset flow record export condition is met according to the first flow record mapped by the data packet in the main table hash bucket and the second flow record mapped by the data packet in the auxiliary table hash bucket includes: Determine a minimum count value and a minimum state value in the first flow record according to the first flow record mapped in all sub-table hash buckets; When the count value in the second flow record mapped by the data packet in the hash bucket of the auxiliary table is greater than the minimum count value in the first flow record, it is determined that the preset flow record export condition is met; or, when the state value in the second flow record mapped by the data packet in the hash bucket of the auxiliary table is greater than the minimum state value in the first flow record, it is determined that the preset flow record export condition is met; The preset hash function includes: a sub-table hash function corresponding to each of the sub-tables and an auxiliary table hash function corresponding to the auxiliary table; According to a preset hash function and a flow identifier of the data packet, the data packet is mapped to a hash bucket of a main table and a hash bucket of an auxiliary table respectively, including: According to the hash function of each sub-table and the flow identifier of the data packet, the data packet is sequentially mapped to the hash bucket of each sub-table respectively; According to the auxiliary table hash function and the flow identifier of the data packet, the data packet is mapped to a hash bucket of the auxiliary table.

2. The method according to claim 1, characterized in that The second flow record identifier is: a flow identifier, or a summary generated according to the flow identifier.

3. The method according to claim 1, characterized in that The step of mapping the data packets to the hash buckets of the sub-tables in sequence according to the hash functions of the sub-tables and the flow identifiers of the data packets comprises: Perform the following steps for each subtable in the main table: Determine, according to the sub-table hash function of the sub-table, the hash bucket index of the sub-table corresponding to the flow identifier of the data packet; In the case where the flow identifier of the data packet has been recorded in the sub-table hash bucket of the previous sub-table, subtract 1 from the state value in the first flow record in the sub-table hash bucket indicated by the hash bucket index; When the flow identifier of the data packet is not recorded in the sub-table hash bucket of the previous sub-table and the sub-table hash bucket indicated by the hash bucket index is empty, write a first flow record into the sub-table hash bucket indicated by the hash bucket index; wherein the flow identifier in the first flow record is the flow identifier of the data packet, the count value in the first flow record is 1, and the state value in the first flow record is 1; In the case where the flow identifier of the data packet has not been recorded in the sub-table hash bucket of the previous sub-table, the sub-table hash bucket indicated by the hash bucket index is not empty, and the flow identifier in the first flow record in the sub-table hash bucket indicated by the hash bucket index is the same as the flow identifier of the data packet, adding 1 to the count value in the first flow record in the sub-table hash bucket indicated by the hash bucket index, and setting the state value in the first flow record to the updated count value; When the flow identifier of the data packet has not been recorded in the sub-table hash bucket of the previous sub-table, the sub-table hash bucket indicated by the hash bucket index is not empty, and the flow identifier in the first flow record in the sub-table hash bucket indicated by the hash bucket index is different from the flow identifier of the data packet, the state value in the first flow record in the sub-table hash bucket indicated by the hash bucket index is reduced by 1.

4. The method according to claim 1, characterized in that: The step of mapping the data packet to a hash bucket of the auxiliary table according to the auxiliary table hash function and the flow identifier of the data packet comprises: Determine, according to the auxiliary table hash function, a hash bucket index of the auxiliary table corresponding to the flow identifier of the data packet; In the case where the flow identifier of the data packet has been recorded in the hash bucket of the main table, subtract 1 from the state value in the second flow record in the hash bucket of the auxiliary table indicated by the hash bucket index; When the flow identifier of the data packet is not recorded in the hash bucket of the main table, the hash bucket of the auxiliary table is updated according to the flow identifier of the data packet.

5. The method according to claim 4, characterized in that When the flow identifier of the data packet is not recorded in the main table hash bucket, updating the auxiliary table hash bucket according to the flow identifier of the data packet includes: Determine, according to the flow identifier or a digest generated according to the flow identifier, a second flow record identifier corresponding to the data packet; When the auxiliary table hash bucket indicated by the hash bucket index is empty, write the second flow record into the auxiliary table hash bucket indicated by the hash bucket index; wherein the second flow record identifier in the second flow record is the second flow record identifier corresponding to the data packet, the count value in the second flow record is 1, and the state value in the second flow record is the minimum state value of the first flow record mapped to the main table hash bucket of the data packet; When the auxiliary table hash bucket indicated by the hash bucket index is not empty and the second flow record identifier in the second flow record in the auxiliary table hash bucket is the same as the second flow record identifier corresponding to the data packet, the count value and the state value of the second flow record in the auxiliary table hash bucket are respectively increased by 1; When the auxiliary table hash bucket indicated by the hash bucket index is not empty and the second flow record identifier in the second flow record in the auxiliary table hash bucket is different from the second flow record identifier corresponding to the data packet, the second flow record in the auxiliary table hash bucket indicated by the hash bucket index is updated; wherein the second flow record identifier in the updated second flow record is the second flow record identifier corresponding to the data packet, the count value in the updated second flow record is 1, and the status value in the updated second flow record is the minimum status value in the first flow record mapped to the data packet in the main table hash bucket.

6. The method according to claim 1, characterized in that The step of determining a first flow record to be exported according to the first flow record mapped by the data packet in the hash bucket of the main table includes: In a case where the count value in the second flow record mapped to the data packet in the hash bucket of the auxiliary table is greater than the minimum count value in the first flow record, determining the first flow record to which the minimum count value belongs as a first flow record to be derived; or, When the state value of the second flow record mapped to the data packet in the hash bucket of the auxiliary table is greater than the minimum state value in the first flow record, and the count value of the second flow record mapped to the hash bucket of the auxiliary table is less than or equal to the minimum count value in the first flow record, the first flow record to which the minimum state value belongs is determined to be a first flow record to be exported.

7. The method according to claim 6, characterized in that The method further comprises: When the preset flow record export condition is met, the sub-table hash bucket to which the first flow record determined to be exported belongs is updated according to the second flow record mapped by the data packet in the auxiliary table hash bucket.

8. The method according to claim 7, characterized in that The updating of the sub-table hash bucket to which the first flow record determined to be derived belongs includes: exporting the determined first-stream record; Writing the new first flow record into the hash bucket of the sub-table to which the exported first flow record belongs; The flow identifier in the new first flow record is the data packet flow identifier, and the count value and state value in the new first flow record are both the count values ​​of the data packet mapped in the second flow record in the hash bucket of the auxiliary table.

9. The method according to claim 6, characterized in that The method further comprises: When the preset flow record export condition is met, the second flow record mapped to the data packet in the hash bucket of the auxiliary table is updated to a preset second flow record initial value.

10. An electronic device, characterized in that: include: at least one processor; and at least one memory and bus connected to the processor; Wherein, the processor and the memory communicate with each other through the bus; The processor is used to call the program instructions in the memory to execute the data flow estimation method according to any one of claims 1 to 9.

11. A computer-readable storage medium comprising a stored program, characterized in that: When the program is running, the electronic device where the storage medium is located is controlled to execute the data flow estimation method according to any one of claims 1 to 9.