A data stream state determination method and device, computer equipment and storage medium

By combining hash function groups and counter groups, and utilizing preset thresholds and update rules, the problem of large data stream state detection errors in existing technologies is solved, and accurate judgment of data stream state is achieved.

CN117201341BActive Publication Date: 2026-11-24CHINA ACAD OF SAFETY SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310881651.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-18
Publication Date
2026-11-24
Estimated Expiration
2043-07-18

AI Technical Summary

Technical Problem

Existing technologies, when distinguishing between normal and abnormal data streams, are affected by data streams with fewer data packets during the counting process, resulting in large errors in detecting the status of the data stream and making it difficult to achieve accurate detection.

Method used

By employing a combination of hash function groups and counter groups, the initial state of the data stream is determined by the first hash function, the normal or abnormal state of the data stream is judged by the first and second preset thresholds, and the count is accurately determined by the update rules. The abnormal data stream is further confirmed by the second hash function group, thereby achieving accurate detection of the data stream state.

Benefits of technology

It enables precise detection of data stream status, distinguishes between normal and abnormal data streams, reduces errors, and improves the accuracy of data stream status judgment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117201341B_ABST
    Figure CN117201341B_ABST
Patent Text Reader

Abstract

This application provides a method, apparatus, computer device, and storage medium for determining the state of a data stream. The method involves inputting the identifier of the data stream to be detected, to which the data packet belongs, into a preset first hash function group to obtain a first target counter address group. The first hash function group includes at least one first hash function, and each of these first hash functions is unique. The first target counter address group includes at least one first target counter address, and each of the first hash functions corresponds to one of the at least one first target counter addresses. The state of the data stream to be detected is determined based on the readings of the first target counters in the first target counter group, where the first target counter group is the counter group indicated by the first target counter address group. This method enables accurate detection of the data stream state.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of Internet data transmission, and more specifically, to a method, apparatus, computer device, and storage medium for determining the state of a data stream. Background Technology

[0002] With the continuous development of the Internet, the scale of the network is also growing. The status of data streams in the network can intuitively reflect the network's operating status, and it has the characteristics of dynamism, high speed and massive volume. In the existing technology, considering that abnormal data streams have a high transmission frequency, normal data streams and abnormal data streams can be distinguished by the transmission frequency of data streams within a period. Therefore, when users transmit data through the network, the status of all data streams within a certain period is usually determined by statistically counting the number of all data streams sent within a certain period and then comparing the number of all data streams sent within that period with the standard number.

[0003] The inventors discovered in their research that the above method combines the process of distinguishing between normal and abnormal data streams with the process of counting and estimating the number of data packets in abnormal data streams. As a result, the data packet counting process of abnormal data streams is greatly affected by data streams containing fewer data packets, leading to a larger error in the count estimation of the number of data packets in data streams containing more data packets. This makes it difficult to achieve accurate detection of the data stream status. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide a data stream state determination method, apparatus, computer device and storage medium to achieve accurate detection of data stream state.

[0005] In a first aspect, embodiments of this application provide a data stream state determination method, the method comprising:

[0006] When a data packet contained in a data stream to be detected is received, the identifier of the data stream to be detected is input into a preset first hash function group to obtain a first target counter address group. The first hash function group includes at least one first hash function, and each of the at least one first hash function is different. The first target counter address group includes at least one first target counter address, and each of the at least one first hash function corresponds to one of the at least one first target counter addresses.

[0007] The state of the data stream to be detected is determined based on the reading of the first target counter in the first target counter group, wherein the first target counter group is the counter group indicated by the first target counter address group.

[0008] Optionally, determining the state of the data stream to be detected based on the reading of the first target counter in the first target counter group includes:

[0009] Determine whether the reading of each first target counter in the first target counter group is greater than a first preset threshold;

[0010] If the reading of each first target counter in the first target counter group is greater than the first preset threshold, then the identifier of the data stream to be detected is input into the preset second hash function group to obtain the second target counter address group. The second hash function group includes at least one second hash function, and each of the at least one second hash function is different. The second target counter address group includes at least one second target counter address, and each of the at least one second hash function corresponds to one of the at least one second target counter addresses.

[0011] The readings of the second target counters in the second target counter group are updated according to the second preset update rule, wherein the second target counter group is the counter group indicated by the second target counter address group;

[0012] Determine whether the updated reading of each second target counter in the second target counter group is greater than the second preset threshold.

[0013] If the updated reading of each second target counter in the second target counter group is greater than the second preset threshold, then the state of the data stream to be detected is determined to be an abnormal state.

[0014] Optionally, after determining whether the reading of each first target counter in the first target counter group is greater than a first preset threshold, the method further includes:

[0015] If there is a first target counter in the first target counter group with a reading less than or equal to the first preset threshold, then the state of the data stream to be detected is determined to be normal.

[0016] Optionally, after determining that the state of the data stream to be detected is normal, the method further includes:

[0017] The readings of the first target counter in the first target counter group are updated according to the first preset update rule.

[0018] Optionally, after determining whether the updated readings of each second target counter in the second target counter group are all greater than a second preset threshold, the method further includes:

[0019] If there is a second target counter in the second target counter group whose updated reading is less than or equal to the second preset threshold, then the state of the data stream to be detected is determined to be normal.

[0020] Optionally, after determining that the state of the data stream to be detected is an abnormal state, the method further includes:

[0021] The data stream to be detected is intercepted;

[0022] And / or, intercept data originating from a target Internet Protocol address, wherein the target Internet Protocol address is the Internet Protocol address that originates the data stream to be detected.

[0023] Secondly, embodiments of this application provide a data stream state determination apparatus, the apparatus comprising:

[0024] The counter address group determination module is used to input the identifier of the data stream to be detected into a preset first hash function group when a data packet contained in the data stream to be detected is received, thereby obtaining a first target counter address group. The first hash function group includes at least one first hash function, and each of the at least one first hash function is different. The first target counter address group includes at least one first target counter address, and each of the at least one first hash function corresponds to one of the at least one first target counter addresses.

[0025] The data stream status determination module is used to determine the status of the data stream to be detected based on the reading of the first target counter in the first target counter group, wherein the first target counter group is the counter group indicated by the first target counter address group.

[0026] Optionally, when the data stream state determination module determines the state of the data stream to be detected based on the reading of the first target counter in the first target counter group, it is specifically used for:

[0027] Determine whether the reading of each first target counter in the first target counter group is greater than a first preset threshold;

[0028] If the reading of each first target counter in the first target counter group is greater than the first preset threshold, then the identifier of the data stream to be detected is input into the preset second hash function group to obtain the second target counter address group. The second hash function group includes at least one second hash function, and each of the at least one second hash function is different. The second target counter address group includes at least one second target counter address, and each of the at least one second hash function corresponds to one of the at least one second target counter addresses.

[0029] The readings of the second target counters in the second target counter group are updated according to the second preset update rule, wherein the second target counter group is the counter group indicated by the second target counter address group;

[0030] Determine whether the updated reading of each second target counter in the second target counter group is greater than the second preset threshold.

[0031] If the updated reading of each second target counter in the second target counter group is greater than the second preset threshold, then the state of the data stream to be detected is determined to be an abnormal state.

[0032] Optionally, after determining whether the reading of each first target counter in the first target counter group is greater than a first preset threshold, the data stream state determination module is further configured to:

[0033] If there is a first target counter in the first target counter group with a reading less than or equal to the first preset threshold, then the state of the data stream to be detected is determined to be normal.

[0034] Optionally, after determining the state of the data stream to be detected as normal, the data stream state determination module is further configured to:

[0035] The readings of the first target counter in the first target counter group are updated according to the first preset update rule.

[0036] Optionally, after determining whether the updated readings of each second target counter in the second target counter group are all greater than the second preset threshold, the data stream state determination module is further configured to:

[0037] If there is a second target counter in the second target counter group whose updated reading is less than or equal to the second preset threshold, then the state of the data stream to be detected is determined to be normal.

[0038] Optionally, after determining the state of the data stream to be detected as an abnormal state, the data stream state determination module is further configured to:

[0039] The data stream to be detected is intercepted;

[0040] And / or, intercept data originating from a target Internet Protocol address, wherein the target Internet Protocol address is the Internet Protocol address that originates the data stream to be detected.

[0041] Thirdly, embodiments of this application provide a computer device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the computer device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the data flow state determination method described in any of the optional embodiments of the first aspect are performed.

[0042] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the data stream state determination method described in any of the optional embodiments of the first aspect.

[0043] The technical solution provided in this application includes, but is not limited to, the following beneficial effects:

[0044] When a data packet contained in a data stream to be detected is received, the identifier of the data stream to be detected is input into a preset first hash function group to obtain a first target counter address group. The first hash function group includes at least one first hash function, and each of the at least one first hash function is different. The first target counter address group includes at least one first target counter address, and each of the at least one first hash function corresponds to one of the at least one first target counter addresses. Through the above steps, the address of the counter used to judge the state of the data stream to be detected can be determined based on the unique identifier of each data stream to be detected; the state of the data stream to be detected is determined based on the reading of the first target counter in the first target counter group, where the first target counter group is the counter group indicated by the first target counter address group. Through the above steps, the state of the data stream to be detected can be judged based on the counter reading corresponding to each data stream to be detected.

[0045] Using the above method, a counter is determined for judging the status of each data stream to be detected by using its unique identifier and a preset hash function. The first counter is used to filter data streams containing fewer data packets, and the second counter is used to count data streams containing more data packets. Then, the status of each data stream to be detected is judged based on the data stream count obtained from the counter reading, so as to achieve accurate detection of the data stream status.

[0046] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0047] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0048] Figure 1 A flowchart of a data stream state determination method provided in Embodiment 1 of the present invention is shown;

[0049] Figure 2 A flowchart of a method for determining abnormal data stream states provided in Embodiment 1 of the present invention is shown;

[0050] Figure 3 This diagram illustrates the structure of a data stream state determination device provided in Embodiment 2 of the present invention.

[0051] Figure 4 A schematic diagram of the structure of a computer device provided in Embodiment 3 of the present invention is shown. Detailed Implementation

[0052] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0053] Example 1

[0054] To facilitate understanding of this application, the following is combined with... Figure 1 The flowchart of the data stream state determination method provided in Embodiment 1 of the present invention will be described in detail for Embodiment 1 of this application.

[0055] See Figure 1 The above, Figure 1 A flowchart of a data stream state determination method provided in Embodiment 1 of the present invention is shown, wherein the method includes steps S101 to S102:

[0056] S101: When a data packet contained in the data stream to be detected is received, the identifier of the data stream to be detected is input into a preset first hash function group to obtain a first target counter address group. The first hash function group includes at least one first hash function, and each of the at least one first hash function is different. The first target counter address group includes at least one first target counter address, and each of the at least one first hash function corresponds to one of the at least one first target counter addresses.

[0057] Specifically, before inputting the identifier of the data stream to be detected into the preset first hash function group to obtain the first target counter address group, the data stream to be detected can be obtained by the following method: obtaining the target data packet in the target data transmission link, and extracting the data stream to be detected from the target data packet according to the user's needs. The identifier of the data stream to be detected includes, but is not limited to, the source address of the target data packet, the receiving address of the target data packet, the port number, etc.

[0058] A hash function, also known as a hash algorithm, can transform an input of arbitrary length into an output of fixed length, resulting in a hash value. In this scheme, the first hash function is used to obtain the address (hash value) of the counter based on the identifier of the data stream (an input of arbitrary length). One data stream identifier can obtain one counter address through one hash function. Therefore, inputting an identifier into multiple different first hash functions (first hash function group) will result in multiple corresponding counter addresses (first target counter address group).

[0059] For example, given an identifier for a data stream A to be detected, and a preset first hash function group including first hash function B, first hash function C, and first hash function D, the identifier of the data stream A to be detected is input into first hash function B to obtain the first target counter address AB, the identifier of the data stream A to be detected is input into first hash function C to obtain the first target counter address AC, and the identifier of the data stream A to be detected is input into first hash function D to obtain the first target counter address AD. The above three first target counter addresses (first target counter address AB, first target counter address AC, and first target counter address AD) form a first target counter address group.

[0060] S102: Determine the state of the data stream to be detected based on the reading of the first target counter in the first target counter group, wherein the first target counter group is the counter group indicated by the first target counter address group.

[0061] Specifically, the first target counter group is determined based on the address of the first target counter group, and then the status of the data stream to be detected is determined based on the reading of the first target counter in the first target counter group.

[0062] The principle behind this judgment is that abnormal data streams usually include a large number of data packets. Therefore, a hash function can be used to determine a counter for counting data streams containing a large number of data packets. Then, the reading of the counter is used to determine whether the data stream meets the conditions for being judged as an abnormal data stream, or whether the reading of the counter meets the conditions for being judged as a normal data stream.

[0063] It is worth noting that the data link to be tested (such as a fiber optic link) includes multiple data streams, and each data stream includes multiple data packets. Therefore, each of the multiple data streams to be tested is tested in the order in which it was obtained, according to the method in steps S101 to S102. The reading of the counter after the previous data stream to be tested ends is used as the initial reading of the counter when testing the current data stream to be tested.

[0064] For example, if the data link to be detected contains three data streams to be detected, namely the first data stream, the second data stream, and the third data stream, and the three data streams to be detected are obtained in the order that the first data stream is obtained first, then the second data stream is obtained, and finally the third data stream is obtained, then the first data stream is detected first according to the method in steps S101 to S102, and after obtaining the status of the first data stream, the second data stream is detected according to the method in steps S101 to S102, and after obtaining the status of the second data stream, the third data stream is detected according to the method in steps S101 to S102, and after obtaining the status of the third data stream.

[0065] In one feasible implementation plan, see Figure 2 The above, Figure 2 The flowchart illustrates a method for determining an abnormal state of a data stream according to Embodiment 1 of the present invention, wherein determining the state of the data stream to be detected based on the reading of the first target counter in the first target counter group includes steps S201 to S205:

[0066] S201: Determine whether the reading of each first target counter in the first target counter group is greater than the first preset threshold.

[0067] Specifically, it is determined whether the reading of each first target counter in the first target counter group is greater than a first preset threshold. The first preset threshold is set in advance based on the condition that it can determine whether the data stream to be detected is a large data stream (containing more characters than the standard value).

[0068] S202: If the reading of each first target counter in the first target counter group is greater than the first preset threshold, then the identifier of the data stream to be detected is input into a preset second hash function group to obtain a second target counter address group. The second hash function group includes at least one second hash function, and each of the at least one second hash function is different. The second target counter address group includes at least one second target counter address, and each of the at least one second hash function corresponds to one of the at least one second target counter addresses.

[0069] Specifically, if the reading of each first target counter in the first target counter group is greater than the first preset threshold, it indicates that the data stream to be detected is a large data stream. In this case, the identifier of the data stream to be detected needs to be input into the preset second hash function group to obtain the second target counter address group.

[0070] S203: Update the reading of the second target counter in the second target counter group according to the second preset update rule, wherein the second target counter group is the counter group indicated by the second target counter address group.

[0071] Specifically, after obtaining the second target counter address group, the corresponding second target counter can be determined based on all the second target counter addresses in the second target counter address group. Then, the reading of the second target counter is updated according to the second preset update rule to obtain the updated reading.

[0072] The second preset update rules include, but are not limited to:

[0073] Rule 1: Increment the readings of all second target counters in the second target counter group by 1.

[0074] Rule 2: Increment the reading of the second target counter with the smallest reading in the second target counter group by 1.

[0075] S204: Determine whether the updated readings of each second target counter in the second target counter group are all greater than the second preset threshold.

[0076] Specifically, it is determined whether the updated readings of each second target counter in the second target counter group are greater than a second preset threshold. The second preset threshold is set in advance based on the condition that can determine whether the data stream to be detected is an abnormal data stream.

[0077] S205: If the updated reading of each second target counter in the second target counter group is greater than the second preset threshold, then the state of the data stream to be detected is determined to be an abnormal state.

[0078] Specifically, if the updated reading of each second target counter in the second target counter group is greater than the second preset threshold, that is, the condition for being judged as an abnormal data stream is met, then the state of the data stream to be detected is determined to be an abnormal state.

[0079] When updating according to the above rule 2 as the second preset update rule, the judgment method of step S204 includes: judging whether the readings of the updated counters with the smallest readings in the second target counter group are all greater than the second preset threshold; the judgment method of step S205 is: if so, the state of the data stream to be detected is determined to be an abnormal state.

[0080] In one feasible implementation, after determining whether the reading of each first target counter in the first target counter group is greater than a first preset threshold, the method further includes:

[0081] If there is a first target counter in the first target counter group with a reading less than or equal to the first preset threshold, then the state of the data stream to be detected is determined to be normal.

[0082] Specifically, if there is a first target counter in the first target counter group whose reading is less than or equal to the first preset threshold, that is, the condition for being judged as an abnormal data stream is not met, then the state of the data stream to be detected is determined to be normal.

[0083] In one feasible implementation, after determining that the state of the data stream to be detected is normal, the method further includes:

[0084] The readings of the first target counter in the first target counter group are updated according to the first preset update rule.

[0085] Specifically, the first preset update rule is to increment the reading of each first target counter in the first target counter group by 1 according to the target probability (for example, the target probability can be set to one in ten thousand). The specific implementation method includes:

[0086] Generate a random number within the target interval. When the ratio of the random number to the maximum value in the target interval is greater than or equal to the target probability, increment the reading of each first target counter in the first target counter group by 1. When the ratio of the random number to the maximum value in the target interval is less than the target probability, do not update the reading of the first target counter in the first target counter group.

[0087] In one feasible implementation, after determining whether the updated readings of each second target counter in the second target counter group are all greater than a second preset threshold, the method further includes:

[0088] If there is a second target counter in the second target counter group whose updated reading is less than or equal to the second preset threshold, then the state of the data stream to be detected is determined to be normal.

[0089] Specifically, if there is a second target counter in the second target counter group whose updated reading is less than or equal to the second preset threshold, then the state of the data stream to be detected is determined to be normal.

[0090] In one feasible implementation, after determining that the state of the data stream to be detected is an abnormal state, the method further includes:

[0091] The data stream to be detected is intercepted.

[0092] Specifically, abnormal data streams are intercepted so that the receiving end cannot receive them.

[0093] And / or, intercept data originating from a target Internet Protocol address, wherein the target Internet Protocol address is the Internet Protocol address that originates the data stream to be detected.

[0094] Specifically, the Internet Protocol address, also known as the IP address, intercepts all other data sent by the IP address that sent the data stream to be detected.

[0095] Alternatively, normal and abnormal data streams can be treated the same, with all streams undergoing normal counter updates. Users can then query the number of data packets contained in each data stream at any time.

[0096] Alternatively, a dedicated counter can be set up to count abnormal data streams.

[0097] It is worth noting that after the state of a data stream is detected using the above method, the readings of the first target counter in the first target counter group and the second target counter in the second target counter group will be updated. When detecting the state of the next data stream, the updated reading of the first target counter is used as the reading of the first target counter to determine the state of the next data stream, and the updated reading of the second target counter is used as the basis for updating the next data stream.

[0098] In other words, when judging multiple data streams to be detected, it is not simply a matter of repeated judgment. Instead, because the counter reading is updated during the earlier detection, the subsequent detection is based on the updated and accumulated counter reading.

[0099] Example 2

[0100] See Figure 3 As shown, Figure 3 This diagram illustrates the structure of a data stream state determination device according to Embodiment 2 of the present invention, wherein, as shown... Figure 3 As shown, the data stream status determination device provided in Embodiment 2 of the present invention includes:

[0101] The counter address group determination module 301 is used to input the identifier of the data stream to be detected into a preset first hash function group when a data packet contained in the data stream to be detected is received, thereby obtaining a first target counter address group. The first hash function group includes at least one first hash function, and each of the at least one first hash function is different. The first target counter address group includes at least one first target counter address, and each of the at least one first hash function corresponds to one of the at least one first target counter addresses.

[0102] The data stream status determination module 302 is used to determine the status of the data stream to be detected based on the reading of the first target counter in the first target counter group, wherein the first target counter group is the counter group indicated by the first target counter address group.

[0103] In one feasible implementation, when the data stream state determination module determines the state of the data stream to be detected based on the reading of the first target counter in the first target counter group, it is specifically used for:

[0104] The process involves several steps: First, determining whether the reading of each first target counter in the first target counter group is greater than a first preset threshold. If the reading of each first target counter in the first target counter group is greater than the first preset threshold, then inputting the identifier of the data stream to be detected into a preset second hash function group to obtain a second target counter address group. The second hash function group includes at least one second hash function, and each of these second hash functions is distinct. The second target counter address group includes at least one second target counter address, and each of these second hash functions corresponds to one of the at least one second target counter addresses. Next, the readings of the second target counters in the second target counter group are updated according to a second preset update rule. The second target counter group is the counter group indicated by the second target counter address group. Finally, the process involves determining whether the updated readings of each second target counter in the second target counter group are greater than a second preset threshold. If the updated readings of each second target counter in the second target counter group are greater than the second preset threshold, then the state of the data stream to be detected is determined to be abnormal.

[0105] In a feasible implementation, after determining whether the reading of each first target counter in the first target counter group is greater than a first preset threshold, the data stream state determination module is further configured to:

[0106] If there is a first target counter in the first target counter group with a reading less than or equal to the first preset threshold, then the state of the data stream to be detected is determined to be normal.

[0107] In one feasible implementation, after determining the state of the data stream to be detected as normal, the data stream state determination module is further configured to:

[0108] The readings of the first target counter in the first target counter group are updated according to the first preset update rule.

[0109] In a feasible implementation, after determining whether the updated readings of each second target counter in the second target counter group are all greater than a second preset threshold, the data stream state determination module is further configured to:

[0110] If there is a second target counter in the second target counter group whose updated reading is less than or equal to the second preset threshold, then the state of the data stream to be detected is determined to be normal.

[0111] In one feasible implementation, after determining the state of the data stream to be detected as an abnormal state, the data stream state determination module is further configured to:

[0112] The data stream to be detected is intercepted; and / or, data originating from a target Internet Protocol address is intercepted, wherein the target Internet Protocol address is the Internet Protocol address that originates the data stream to be detected.

[0113] Example 3

[0114] Based on the same application concept, see [link / reference] Figure 4 As shown, Figure 4 A schematic diagram of the structure of a computer device provided in Embodiment 3 of the present invention is shown, wherein, as Figure 4 As shown, the computer device 400 provided in Embodiment 3 of this application includes:

[0115] The computer device 400 includes a processor 401, a memory 402, and a bus 403. The memory 402 stores machine-readable instructions that can be executed by the processor 401. When the computer device 400 is running, the processor 401 communicates with the memory 402 through the bus 403. When the machine-readable instructions are executed by the processor 401, they perform the steps of the data flow state determination method shown in Embodiment 1 above.

[0116] Example 4

[0117] Based on the same concept, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of a data flow state determination method as described in any of the above embodiments.

[0118] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0119] The computer program product for determining the state of a data stream provided in this embodiment of the invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation details, please refer to the method embodiments, which will not be repeated here.

[0120] The data flow state determination device provided in this embodiment of the invention can be specific hardware on a device or software or firmware installed on the device. The implementation principle and technical effects of the device provided in this embodiment of the invention are the same as those in the foregoing method embodiments. For the sake of brevity, any parts not mentioned in the device embodiments can be referred to the corresponding content in the foregoing method embodiments. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can all be referred to the corresponding processes in the above method embodiments, and will not be repeated here.

[0121] In the embodiments provided by this invention, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0122] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0123] In addition, the functional units in the embodiments provided by the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0124] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0125] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0126] Finally, it should be noted that the above-described embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. All should be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for determining the state of a data stream, characterized in that, The method includes: When a data packet contained in a data stream to be detected is received, the identifier of the data stream to be detected is input into a preset first hash function group to obtain a first target counter address group. The first hash function group includes at least one first hash function, and each of the at least one first hash function is different. The first target counter address group includes at least one first target counter address, and each of the at least one first hash function corresponds to one of the at least one first target counter addresses. The state of the data stream to be detected is determined based on the reading of the first target counter in the first target counter group, wherein the first target counter group is the counter group indicated by the first target counter address group; Determining the state of the data stream to be detected based on the reading of the first target counter in the first target counter group includes: Determine whether the reading of each first target counter in the first target counter group is greater than a first preset threshold; If the reading of each first target counter in the first target counter group is greater than the first preset threshold, then the identifier of the data stream to be detected is input into the preset second hash function group to obtain the second target counter address group. The second hash function group includes at least one second hash function, and each of the at least one second hash function is different. The second target counter address group includes at least one second target counter address, and each of the at least one second hash function corresponds to one of the at least one second target counter addresses. The readings of the second target counters in the second target counter group are updated according to the second preset update rule. The second target counter group is the counter group indicated by the second target counter address group. The second preset update rule is: increment the reading of the second target counter with the smallest reading in the second target counter group by 1. Determine whether the updated reading of each second target counter in the second target counter group is greater than the second preset threshold. If the updated reading of each second target counter in the second target counter group is greater than the second preset threshold, then the state of the data stream to be detected is determined to be an abnormal state. If there is a first target counter in the first target counter group with a reading less than or equal to the first preset threshold, then the state of the data stream to be detected is determined to be normal. The readings of the first target counters in the first target counter group are updated according to the first preset update rule, wherein the first preset update rule is to increment the reading of each first target counter in the first target counter group by 1 according to the target probability.

2. The method according to claim 1, characterized in that, After determining whether the updated readings of each second target counter in the second target counter group are all greater than a second preset threshold, the method further includes: If there is a second target counter in the second target counter group whose updated reading is less than or equal to the second preset threshold, then the state of the data stream to be detected is determined to be normal.

3. The method according to any one of claims 1 to 2, characterized in that, After determining that the state of the data stream to be detected is an abnormal state, the method further includes: The data stream to be detected is intercepted; And / or, Data sent from a target Internet Protocol address is intercepted, wherein the target Internet Protocol address is the Internet Protocol address that sent the data stream to be detected.

4. A data stream state determination device, characterized in that, The device includes: The counter address group determination module is used to input the identifier of the data stream to be detected into a preset first hash function group to obtain a first target counter address group. The first hash function group includes at least one first hash function, and each of the at least one first hash function is different. The first target counter address group includes at least one first target counter address, and each of the at least one first hash function corresponds to one of the at least one first target counter addresses. The data stream status determination module is used to determine the status of the data stream to be detected based on the reading of the first target counter in the first target counter group, wherein the first target counter group is the counter group indicated by the first target counter address group; When the data stream state determination module determines the state of the data stream to be detected based on the reading of the first target counter in the first target counter group, it is specifically used for: Determine whether the reading of each first target counter in the first target counter group is greater than a first preset threshold; If the reading of each first target counter in the first target counter group is greater than the first preset threshold, then the identifier of the data stream to be detected is input into the preset second hash function group to obtain the second target counter address group. The second hash function group includes at least one second hash function, and each of the at least one second hash function is different. The second target counter address group includes at least one second target counter address, and each of the at least one second hash function corresponds to one of the at least one second target counter addresses. The readings of the second target counters in the second target counter group are updated according to the second preset update rule. The second target counter group is the counter group indicated by the second target counter address group. The second preset update rule is: increment the reading of the second target counter with the smallest reading in the second target counter group by 1. Determine whether the updated reading of each second target counter in the second target counter group is greater than the second preset threshold. If the updated reading of each second target counter in the second target counter group is greater than the second preset threshold, then the state of the data stream to be detected is determined to be an abnormal state. If there is a first target counter in the first target counter group with a reading less than or equal to the first preset threshold, then the state of the data stream to be detected is determined to be normal. The readings of the first target counters in the first target counter group are updated according to the first preset update rule, wherein the first preset update rule is to increment the reading of each first target counter in the first target counter group by 1 according to the target probability.

5. A computer device, characterized in that, include: The computer device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the computer device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, they perform the steps of the data flow state determination method as described in any one of claims 1 to 3.

6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the data stream state determination method as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Long stream recognition method, data flow measuring method and device thereof

    CN101459560A

  • Data flow frequency estimation method and system based on double-layer structure and medium

    CN111782700A