Sketch network measurement method and electronic device based on deep learning

By training a pre-defined network model to obtain a traffic attribute prediction model, the problem of inaccurate count values ​​in Sketch network measurement is solved, and higher precision network traffic measurement is achieved.

CN112200256BActive Publication Date: 2024-11-26PENG CHENG LAB +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011110727.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-16
Publication Date
2024-11-26
Estimated Expiration
2040-10-16

AI Technical Summary

Technical Problem

In existing Sketch network measurement, the network traffic being measured needs to be frequently exchanged between the main hash table and the secondary hash table, leading to inaccurate count values.

Method used

By obtaining sampled traffic and attribute labels from the sketch, a preset network model is trained to obtain a traffic attribute prediction model. Based on the prediction results, the network traffic to be measured is inserted into the main hash table or the secondary hash table for network measurement.

Benefits of technology

This avoids frequent exchanges of network traffic between the main hash table and the secondary hash table, thus improving the accuracy of network measurements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112200256B_ABST
    Figure CN112200256B_ABST
Patent Text Reader

Abstract

The present invention discloses a sketch network measurement method and electronic device based on deep learning, including: obtaining a sampled flow in the sketch and a first attribute label corresponding to the sampled flow; training a preset network model according to the sampled flow and the first attribute label to obtain a flow attribute prediction model; inputting the network flow to be measured into the flow attribute prediction model to obtain the attribute category of the network flow to be measured; inserting the network flow to be measured into the sketch for network measurement according to the attribute category. The present invention trains a preset network model through the sampled flow in the sketch to obtain a flow attribute prediction model for predicting the attribute category of the network flow to be measured, inserts the network flow to be measured into the sketch for network measurement according to the prediction result of the flow attribute prediction model, avoids the frequent exchange of the network flow to be measured between the hash main table and the hash sub-table, and improves the accuracy of network measurement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network measurement technology, and in particular to a sketch network measurement method and electronic equipment based on deep learning. Background Art

[0002] Network status detection, network fault analysis, network security defense, etc. are important technologies to ensure the robustness and security of modern networks. Network measurement provides basic information for the above technologies and is the basis of the above technologies. However, with the rapid development of the network, measuring massive traffic data has become a difficult point in network measurement. It is necessary to improve the accuracy of measurement as much as possible under limited resources. Among them, Sketch is an approximate data structure based on hashing. Due to its theoretical balance between accuracy and resources, it is widely accepted in the field of network measurement.

[0003] Traditional Sketch uses a hash table and a hash sub-table to store network traffic with a number of packets greater than a preset packet threshold and less than or equal to the preset packet threshold, respectively. Since the properties of the network traffic to be tested cannot be determined in advance, traffic needs to be frequently exchanged between the hash table and the hash sub-table. The hash sub-table is a hash table without a flow ID tag, which means that multiple flows will be hashed to the same position, resulting in generally large count values.

[0004] Therefore, the prior art still needs to be improved and developed. Summary of the invention

[0005] In view of the above-mentioned defects of the prior art, the present invention provides a sketch network measurement method and electronic device based on deep learning, aiming to solve the problem that when the existing Sketch performs network measurement, the network traffic to be measured needs to be frequently exchanged between the hash main table and the hash sub-table, resulting in inaccurate counting values.

[0006] The technical solution adopted by the present invention to solve the technical problem is as follows:

[0007] A sketch network measurement method based on deep learning, including:

[0008] Obtaining a sampled flow in a sketch and a first attribute tag corresponding to the sampled flow;

[0009] Training a preset network model according to the sampled traffic and the first attribute label to obtain a traffic attribute prediction model;

[0010] Inputting the network traffic to be tested into the traffic attribute prediction model to obtain the attribute category of the network traffic to be tested;

[0011] The network traffic to be measured is inserted into the sketch according to the attribute category to perform network measurement.

[0012] The sketch network measurement method based on deep learning, wherein the step of training a preset network model according to the sampled traffic and the first attribute label to obtain a traffic attribute prediction model comprises:

[0013] Inputting the sampled traffic into a preset network model, and obtaining a predicted attribute label output by the preset network model;

[0014] The model parameters of the preset network model are updated according to the prediction attribute label and the first attribute label until the training status of the preset network model meets the preset conditions to obtain a traffic attribute prediction model.

[0015] The sketch network measurement method based on deep learning, wherein the step of updating the model parameters of the preset network model according to the predicted attribute label and the first attribute label until the training condition of the preset network model meets the preset conditions includes:

[0016] Determine a loss value according to the predicted attribute label and the first attribute label, and judge whether the loss value is less than a preset threshold;

[0017] If not, the model parameters of the preset network model are updated according to the preset parameter learning rate until the loss value is less than the preset threshold.

[0018] The sketch network measurement method based on deep learning, wherein the step of inputting the network traffic to be measured into the traffic attribute prediction model to obtain the attribute category of the network traffic to be measured comprises:

[0019] Inputting the network traffic to be tested into the traffic attribute prediction model, and obtaining the attribute category probability output by the traffic attribute prediction model;

[0020] According to the attribute category probability, the attribute category of the network traffic to be measured is obtained.

[0021] The sketch network measurement method based on deep learning, wherein the attribute category includes a first attribute category and a second attribute category, the sketch includes a hash main table and a hash sub-table, and the step of inserting the network traffic to be measured into the sketch for network measurement according to the attribute category includes:

[0022] When the attribute category is the first attribute category, inserting the network traffic to be measured into the hash master table for network measurement; wherein the number of data packets of the network traffic of the first attribute category is greater than a preset data packet threshold;

[0023] When the attribute category is the second attribute category, the network traffic to be measured is inserted into the hash sub-table for network measurement; wherein the number of data packets of the network traffic of the second attribute category is less than or equal to a preset data packet threshold.

[0024] The sketch network measurement method based on deep learning, wherein the step of inserting the network traffic to be measured into the hash master table for network measurement comprises:

[0025] Performing a hash operation on the flow ID of the network traffic to be tested by using the first hash function in the hash master table to obtain the position information of the network traffic to be tested in the hash master table;

[0026] The network traffic to be measured is inserted into the hash master table according to the location information to perform network measurement.

[0027] The sketch network measurement method based on deep learning, wherein the step of inserting the network traffic to be measured into the hash sub-table for network measurement comprises:

[0028] Performing a hash operation on the flow ID of the network traffic to be tested by using the second hash function in the hash sub-table to obtain counter information corresponding to the network traffic to be tested in the hash sub-table;

[0029] The network traffic to be measured is inserted into the hash sub-table according to the counter information to perform network measurement.

[0030] The sketch network measurement method based on deep learning, wherein the step of inserting the network traffic to be measured into the hash sub-table for network measurement according to the counter information comprises:

[0031] Mapping the flow ID of the network traffic to be tested to the counter through the second hash function to obtain the number of data packets of the network traffic to be tested;

[0032] When the number of data packets of the network traffic to be measured is greater than a preset data packet threshold, the network traffic to be measured is inserted into the hash master table for network measurement.

[0033] A terminal, comprising: a processor, a storage medium communicatively connected to the processor, the storage medium being suitable for storing a plurality of instructions; the processor being suitable for calling the instructions in the storage medium to execute the steps of implementing the deep learning-based sketch network measurement method.

[0034] A storage medium having a plurality of instructions stored thereon, wherein the instructions are suitable for being loaded and executed by a processor to perform steps of implementing the deep learning-based sketch network measurement method.

[0035] Beneficial effect: The present invention trains the preset network model through the sampled traffic in the sketch to obtain a traffic attribute prediction model for predicting the attribute category of the network traffic to be tested, and inserts the network traffic to be tested into the sketch for network measurement according to the prediction result of the traffic attribute prediction model, thereby avoiding the frequent exchange of the network traffic to be tested between the hash main table and the hash sub-table, and improving the accuracy of network measurement. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 It is a flowchart of an embodiment of a sketch network measurement method based on deep learning provided in Embodiment 1 of the present invention;

[0037] Figure 2 It is a schematic diagram of the existing sketch structure;

[0038] Figure 3 is a schematic diagram of the structure of a preset network model provided in the first embodiment of the present invention;

[0039] Figure 4 This is a functional principle diagram of a terminal provided in Embodiment 2 of the present invention. DETAILED DESCRIPTION

[0040] In order to make the purpose, technical solution and advantages of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0041] 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, rather than all the embodiments. The following description of at least one exemplary embodiment is actually only illustrative and is by no means intended to limit the present invention and its application or use. 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.

[0042] The sketch network measurement method based on deep learning provided by the present invention can be applied to a terminal. The terminal may be, but is not limited to, various personal computers, laptops, mobile phones, tablet computers, vehicle-mounted computers, and portable wearable devices. The terminal of the present invention adopts a multi-core processor. The processor of the terminal may be at least one of a central processing unit (CPU), a graphics processing unit (GPU), a video processing unit (VPU), and the like.

[0043] Embodiment 1

[0044] In order to solve the problem that when the existing Sketch performs counting, the attribute of the network traffic cannot be judged in advance, resulting in inaccurate counting values, the present invention provides a Sketch network measurement method based on deep learning.

[0045] Please refer to Figure 1 , Figure 1 It is a flowchart of an embodiment of a sketch network measurement method based on deep learning provided by the present invention.

[0046] In one embodiment of the present invention, the sketch network measurement method based on deep learning has four steps:

[0047] S100: Obtain a sampled flow in a sketch and a first attribute tag corresponding to the sampled flow.

[0048] Sketch is a data structure used to count the number of packets in network traffic. Traditional Sketch structures such as Figure 2 As shown, it includes a hash main table and a hash sub-table. The hash main table is used to count network traffic with a number of packets greater than a preset packet threshold, and the hash sub-table is used to count network traffic with a number of packets less than or equal to the preset packet threshold. The hash main table includes a flow ID and a counter, while the hash sub-table is a hash table without a flow ID tag.

[0049] In order to reduce the counting error brought by the network traffic exchanged from the hash secondary table to the hash primary table when the existing Sketch performs network measurement, the sampled traffic in the sketch and the first attribute label corresponding to the sampled traffic are obtained in this embodiment, so as to obtain the traffic attribute prediction model for predicting the attributes of the network traffic in the subsequent steps. The sampled traffic is the network traffic that has been measured by the sketch, and the number of packets and attribute categories are known. After the sampled traffic is queried by the sketch, the first attribute label corresponding to the sampled traffic can be generated for the subsequent preset network model learning.

[0050] S200: training a preset network model according to the sampled traffic and the first attribute label to obtain a traffic attribute prediction model.

[0051] In order to know the attribute category of network traffic in advance when network traffic is input into Sketch for counting, a network model is pre-set in this embodiment. After obtaining the sampled traffic and the first attribute label, the preset network model is trained according to the sampled traffic and the first attribute label to obtain a traffic attribute prediction model. Before the network traffic to be measured is inserted into Sketch for network measurement, the attribute category of the network traffic to be measured is determined by the traffic attribute prediction model, and then the network traffic to be measured is inserted into the hash main table or the hash sub-table for network measurement according to the attribute category of the network traffic to be measured, so as to avoid frequent exchange of traffic between the hash main table and the hash sub-table during network measurement, resulting in large measurement errors.

[0052] In a specific embodiment, step S200 specifically includes:

[0053] S210, inputting the sampled traffic into a preset network model, and obtaining a predicted attribute label output by the preset network model;

[0054] S220. Update the model parameters of the preset network model according to the prediction attribute label and the first attribute label until the training status of the preset network model meets the preset conditions to obtain a traffic attribute prediction model.

[0055] The structure of the preset network model in this embodiment is as follows Figure 3 As shown in Figure 1, it includes an embedding module, n convolution modules and a classifier. Each convolution module includes a convolution layer, an activation function ReLU and a pooling layer MaxPool, and the classifier includes a fully connected layer and a softmax function.

[0056] After obtaining the sampled traffic, the sampled traffic is preprocessed to convert the five-tuple data packets in the sampled traffic into a byte vector of length 13, and then the preprocessed sampled traffic is input into the preset network model. The preprocessed sampled traffic first passes through the embedding module, where each byte vector is mapped into a vector of length 256. The output scale of the preprocessed sampled traffic after passing through the embedding module is The matrix is ​​then passed through n convolution modules, and the output of the convolution module is passed through the classifier to output the predicted attribute label corresponding to the sampled traffic. The model parameters of the preset network model are updated according to the predicted attribute label and the first attribute label until the training of the preset network model meets the preset conditions to obtain the traffic attribute prediction model.

[0057] In a specific embodiment, step S220 includes:

[0058] S221, determining a loss value according to the predicted attribute label and the first attribute label, and judging whether the loss value is less than a preset threshold;

[0059] S222: If not, update the model parameters of the preset network model according to the preset parameter learning rate until the loss value is less than the preset threshold.

[0060] Specifically, in this embodiment, a threshold is pre-set for judging whether the training situation of the preset network model meets the preset conditions. After obtaining the predicted attribute label, the loss value is determined according to the predicted attribute label and the first attribute label. Generally, the smaller the loss value, the better the performance of the network model. After obtaining the loss value, it is further judged whether the loss value is less than the preset threshold; if so, it indicates that the training situation of the preset network model meets the preset conditions; if not, it indicates that the training situation of the preset network model does not meet the preset conditions, then the model parameters of the preset network model are updated according to the preset parameter learning rate, and the step of obtaining the predicted attribute label is continued until the loss value is less than the preset threshold.

[0061] S300: Input the network traffic to be tested into the traffic attribute prediction model to obtain the attribute category of the network traffic to be tested.

[0062] When network traffic needs to be measured, the network traffic to be measured is first input into the traffic attribute prediction model that has been trained in the previous step, and the attribute category of the network traffic to be measured is predicted by the traffic attribute prediction model to obtain the attribute category of the network traffic to be measured, so that in the subsequent steps, the network traffic to be measured can be inserted into the sketch according to the attribute category of the network traffic to be measured to avoid frequent exchange of traffic between the hash main table and the hash sub-table during network measurement, which leads to large measurement errors.

[0063] In a specific embodiment, step S300 specifically includes:

[0064] S310, inputting the network traffic to be measured into the traffic attribute prediction model, and obtaining the attribute category probability output by the traffic attribute prediction model;

[0065] S320: Obtain the attribute category of the network traffic to be tested according to the attribute category probability.

[0066] Before inputting the network traffic to be tested into the traffic attribute prediction model for attribute category prediction, the network traffic to be tested is preprocessed to convert the five-tuple data packets in the network traffic to be tested into a byte vector with a length of 13, and then the preprocessed network traffic to be tested is input into the preset network model. The preprocessed network traffic to be tested first passes through the embedding module, and each byte vector is mapped into a vector with a length of 256 in the embedding module. After the preprocessed network traffic to be tested passes through the embedding module, the output scale is The matrix is ​​then passed through n convolution modules. The output of the convolution module first acts on the fully connected layer in the classifier, and then outputs the predicted attribute category probability through the softmax function. Then, based on the attribute category probability, the attribute category of the network traffic to be tested is obtained. For example, when the attribute category includes the first attribute category and the second attribute category, and the probability of the first attribute category output by the traffic attribute prediction model is 0.2 and the probability of the second attribute category is 0.8, the attribute category of the network traffic to be tested is the second attribute category.

[0067] S400: insert the network traffic to be measured into a sketch according to the attribute category to perform network measurement.

[0068] Specifically, in this embodiment, a sketch and sampled traffic are constructed on the data plane. The data plane maintains a flow table to record the currently predicted network traffic. After the network traffic to be measured obtains the attribute prediction result in the traffic attribute prediction model, the attribute prediction result will be recorded in the flow table, and the network traffic to be measured will be inserted into the sketch for network measurement based on the attribute prediction result.

[0069] In a specific embodiment, step S400 includes:

[0070] S410, when the attribute category is the first attribute category, inserting the network traffic to be measured into the hash master table for network measurement; wherein the number of data packets of the network traffic of the first attribute category is greater than a preset data packet threshold;

[0071] S420: When the attribute category is the second attribute category, insert the network traffic to be measured into the hash sub-table for network measurement; wherein the number of data packets of the network traffic of the second attribute category is less than or equal to a preset data packet threshold.

[0072] Specifically, the sketch in this embodiment includes a hash main table and a hash sub-table, and the attribute category of the network traffic includes a first attribute category and a second attribute category, wherein the number of packets of the network traffic of the first attribute category is greater than a preset packet threshold, and the number of packets of the network traffic of the second attribute category is less than or equal to the preset packet threshold. When the attribute category of the network traffic to be tested predicted by the traffic attribute prediction model is the first attribute category, it means that the network traffic to be tested is a large flow, and the network traffic to be tested is inserted into the hash main table for network measurement; when the attribute category of the network traffic to be tested predicted by the traffic attribute prediction model is the second attribute category, it means that the network traffic to be tested is a small flow, and the network traffic to be tested is inserted into the hash sub-table for network measurement. When performing network measurement in this embodiment, the network traffic to be tested is inserted into the hash main table and the hash sub-table according to the attribute category, reducing the counting error brought in when the network traffic to be tested is exchanged from the hash sub-table to the hash main table, thereby improving the accuracy of network measurement.

[0073] In a specific embodiment, the step of inserting the network traffic to be measured into the hash master table for network measurement in step S410 specifically includes:

[0074] S411, performing a hash operation on the flow ID of the network traffic to be tested by using the first hash function in the hash master table to obtain the position information of the network traffic to be tested in the hash master table;

[0075] S412: Insert the network traffic to be measured into the hash master table according to the location information to perform network measurement.

[0076] Specifically, in this embodiment, each unit in the hash master table stores two tuples, and the two tuples include a flow ID and a data packet counter of the flow, and there are 5 first hash functions that can map network traffic to units in the hash master table. After determining that the attribute category of the network traffic to be tested is the first attribute category, the flow ID of the network traffic to be tested is obtained, and the flow ID of the network traffic to be tested is hashed by the first hash function in the hash master table to obtain the position information of the network traffic to be tested in the hash master table, and then the network traffic to be tested is inserted into the hash master table according to the position information for network measurement.

[0077] In a specific embodiment, the step of inserting the network traffic to be measured into the hash sub-table for network measurement in step S420 specifically includes:

[0078] S421, performing a hash operation on the flow ID of the network traffic to be tested by using the second hash function in the hash sub-table to obtain counter information corresponding to the network traffic to be tested in the hash sub-table;

[0079] S422: insert the network traffic to be measured into the hash sub-table according to the counter information to perform network measurement.

[0080] Specifically, in this embodiment, the hash sub-table is a 2D array (length w=28672, width d=2) with 2 hash functions, each dimension in the 2D array corresponds to a second hash function, and each unit in the 2D array corresponds to a flow data packet counter. After determining that the attribute category of the network traffic to be tested is the second attribute category, the flow ID of the network traffic to be tested is obtained, and the flow ID of the network traffic to be tested is hashed by the second hash function in the hash sub-table to obtain the counter information corresponding to the network traffic to be tested in the hash sub-table, and then the network traffic to be tested is inserted into the hash sub-table according to the counter information for network measurement.

[0081] In a specific embodiment, after step S422, the following steps are further included:

[0082] S423, mapping the flow ID of the network traffic to be tested to the counter through the second hash function, and obtaining the number of data packets of the network traffic to be tested;

[0083] S424: When the number of data packets of the network traffic to be measured is greater than a preset data packet threshold, insert the network traffic to be measured into the hash master table for network measurement.

[0084] Taking into account the prediction errors of the traffic attribute prediction model, in this embodiment, after the network traffic to be tested is inserted into the hash sub-table for network measurement, the flow ID of the network traffic to be tested is mapped to the counter through the second hash function to obtain the number of data packets of the network traffic to be tested, and it is determined whether the number of data packets of the network traffic to be tested is less than or equal to the preset data packet threshold. If not, it means that there is an error in the attribute category of the network traffic to be tested predicted by the traffic attribute prediction model, and the network traffic to be tested is inserted into the hash main table for network measurement.

[0085] Embodiment 2

[0086] Based on the above embodiment, the present invention further provides a terminal, whose principle block diagram can be shown as follows: Figure 4 As shown. The terminal includes a processor, a memory, a network interface, a display screen and a temperature sensor connected via a system bus. Among them, the processor of the terminal is used to provide computing and control capabilities. The memory of the terminal includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the terminal is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a sketch network measurement method based on deep learning is implemented. The display screen of the terminal can be a liquid crystal display screen or an electronic ink display screen, and the temperature sensor of the terminal is pre-set inside the device to detect the current operating temperature of the internal device.

[0087] Those skilled in the art will understand that Figure 4 The principle block diagram shown in the figure is only a block diagram of a partial structure related to the scheme of the present invention, and does not constitute a limitation on the terminal to which the scheme of the present invention is applied. The specific terminal may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0088] In one embodiment, a terminal is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, at least the following steps can be implemented:

[0089] Obtain the sampled flow in the sketch and the first attribute tag corresponding to the sampled flow;

[0090] Training a preset network model according to the sampled traffic and the first attribute label to obtain a traffic attribute prediction model;

[0091] Inputting the network traffic to be tested into the traffic attribute prediction model to obtain the attribute category of the network traffic to be tested;

[0092] The network traffic to be measured is inserted into the sketch according to the attribute category to perform network measurement.

[0093] In one embodiment, when the processor executes the computer program, it can also achieve: inputting the sampled traffic into a preset network model and obtaining the prediction attribute label output by the preset network model; updating the model parameters of the preset network model according to the prediction attribute label and the first attribute label until the training status of the preset network model meets the preset conditions to obtain a traffic attribute prediction model.

[0094] In one embodiment, when the processor executes the computer program, it can also achieve: determining a loss value based on the predicted attribute label and the first attribute label, and judging whether the loss value is less than a preset threshold; if not, updating the model parameters of the preset network model according to a preset parameter learning rate until the loss value is less than the preset threshold.

[0095] In one embodiment, when the processor executes the computer program, it can also achieve: inputting the network traffic to be tested into the traffic attribute prediction model, and obtaining the attribute category probability output by the traffic attribute prediction model; and obtaining the attribute category of the network traffic to be tested based on the attribute category probability.

[0096] In one embodiment, the processor can also achieve the following when executing the computer program: when the attribute category is the first attribute category, inserting the network traffic to be tested into the hash main table for network measurement; wherein the number of data packets of the network traffic of the first attribute category is greater than a preset data packet threshold; when the attribute category is the second attribute category, inserting the network traffic to be tested into the hash sub-table for network measurement; wherein the number of data packets of the network traffic of the second attribute category is less than or equal to the preset data packet threshold.

[0097] In one of the embodiments, when the processor executes the computer program, it can also achieve: performing a hash operation on the flow ID of the network traffic to be tested through the first hash function in the hash master table to obtain the position information of the network traffic to be tested in the hash master table; and inserting the network traffic to be tested into the hash master table according to the position information to perform network measurement.

[0098] In one embodiment, when the processor executes the computer program, it can also achieve: performing a hash operation on the flow ID of the network traffic to be tested through the second hash function in the hash sub-table to obtain the counter information corresponding to the network traffic to be tested in the hash sub-table; and inserting the network traffic to be tested into the hash sub-table according to the counter information to perform network measurement.

[0099] In one of the embodiments, when the processor executes the computer program, it can also achieve: mapping the flow ID of the network traffic to be tested to the counter through the second hash function to obtain the number of data packets of the network traffic to be tested; when the number of data packets of the network traffic to be tested is greater than a preset data packet threshold, inserting the network traffic to be tested into the hash master table for network measurement.

[0100] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0101] In summary, the present invention discloses a sketch network measurement method and electronic device based on deep learning, the method comprising: obtaining a sampled flow in a sketch and a first attribute label corresponding to the sampled flow; training a preset network model according to the sampled flow and the first attribute label to obtain a flow attribute prediction model; inputting the network flow to be measured into the flow attribute prediction model to obtain the attribute category of the network flow to be measured; inserting the network flow to be measured into the sketch for network measurement according to the attribute category. The present invention trains a preset network model through the sampled flow in the sketch to obtain a flow attribute prediction model for predicting the attribute category of the network flow to be measured, inserts the network flow to be measured into the sketch for network measurement according to the prediction result of the flow attribute prediction model, avoids the frequent exchange of the network flow to be measured between the hash main table and the hash sub-table, and improves the accuracy of network measurement.

[0102] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.

Claims

1. A sketch network measurement method based on deep learning, characterized in that: include: Obtain the sampled flow in the sketch and the first attribute tag corresponding to the sampled flow; Training a preset network model according to the sampled traffic and the first attribute label to obtain a traffic attribute prediction model; Inputting the network traffic to be tested into the traffic attribute prediction model to obtain the attribute category of the network traffic to be tested, wherein the attribute category includes a first attribute category and a second attribute category; Inserting the network traffic to be measured into a sketch according to the attribute category to perform network measurement, the sketch comprising a hash main table and a hash sub-table; The step of inserting the network traffic to be tested into the sketch for network measurement according to the attribute category comprises: When the attribute category is the first attribute category, inserting the network traffic to be measured into the hash master table for network measurement; wherein the number of data packets of the network traffic of the first attribute category is greater than a preset data packet threshold; When the attribute category is the second attribute category, inserting the network traffic to be measured into the hash sub-table for network measurement; wherein the number of data packets of the network traffic of the second attribute category is less than or equal to a preset data packet threshold; The step of inserting the network traffic to be measured into the hash sub-table to perform network measurement comprises: Performing a hash operation on the flow ID of the network traffic to be tested by using the second hash function in the hash sub-table to obtain counter information corresponding to the network traffic to be tested in the hash sub-table; Inserting the network traffic to be measured into the hash sub-table according to the counter information to perform network measurement; After the step of inserting the network traffic to be measured into the hash sub-table for network measurement according to the counter information, the following steps are included: Mapping the flow ID of the network traffic to be tested to the counter through the second hash function to obtain the number of data packets of the network traffic to be tested; When the number of data packets of the network traffic to be measured is greater than a preset data packet threshold, the network traffic to be measured is inserted into the hash master table for network measurement.

2. The deep learning-based sketch network measurement method according to claim 1, characterized in that: The step of training a preset network model according to the sampled traffic and the first attribute label to obtain a traffic attribute prediction model comprises: Inputting the sampled traffic into a preset network model, and obtaining a predicted attribute label output by the preset network model; The model parameters of the preset network model are updated according to the prediction attribute label and the first attribute label until the training status of the preset network model meets the preset conditions to obtain a traffic attribute prediction model.

3. The deep learning-based sketch network measurement method according to claim 2, characterized in that: The step of updating the model parameters of the preset network model according to the predicted attribute label and the first attribute label until the training condition of the preset network model meets the preset conditions includes: Determine a loss value according to the predicted attribute label and the first attribute label, and judge whether the loss value is less than a preset threshold; If not, the model parameters of the preset network model are updated according to the preset parameter learning rate until the loss value is less than the preset threshold.

4. The deep learning-based sketch network measurement method according to claim 1, characterized in that: The step of inputting the network traffic to be tested into the traffic attribute prediction model to obtain the attribute category of the network traffic to be tested includes: Inputting the network traffic to be tested into the traffic attribute prediction model, and obtaining the attribute category probability output by the traffic attribute prediction model; According to the attribute category probability, the attribute category of the network traffic to be measured is obtained.

5. The sketch network measurement method based on deep learning according to claim 1, characterized in that: The step of inserting the network traffic to be tested into the hash master table for network measurement comprises: Performing a hash operation on the flow ID of the network traffic to be tested by using the first hash function in the hash master table to obtain the position information of the network traffic to be tested in the hash master table; The network traffic to be measured is inserted into the hash master table according to the location information to perform network measurement.

6. A terminal, characterized in that: include: A processor and a storage medium communicatively connected to the processor, wherein the storage medium is suitable for storing a plurality of instructions; the processor is suitable for calling the instructions in the storage medium to execute the steps of implementing the deep learning-based sketch network measurement method described in any one of claims 1 to 5.

7. A storage medium having a plurality of instructions stored thereon, characterized in that: The instructions are suitable for being loaded and executed by a processor to perform the steps of implementing the deep learning-based sketch network measurement method described in any one of claims 1 to 5 above.