A flow collection method, device, electronic device and storage medium

By obtaining network indicators and resource constraints, using a supervised learning model to predict the sampling rate of the target network, and adaptively adjusting traffic collection, it solves the problems of insufficient resource utilization and high network performance consumption in the existing technology, and achieves efficient and accurate Traffic collection.

CN115514686BActive Publication Date: 2024-10-22SANGFOR TECH INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110698895.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-23
Publication Date
2024-10-22
Estimated Expiration
2041-06-23

AI Technical Summary

Technical Problem

When system resources are limited, it is difficult for existing traffic collection technology to achieve high-accuracy traffic estimation, and setting the sampling rate too low will lead to a waste of resources. If the sampling rate is too high, it will consume a lot of network performance, making it difficult to find a balance.

Method used

By obtaining network indicators and resource constraints, determine the optimal network performance and corresponding sampling rate, use a supervised learning model for training, predict the target sampling rate of the target network, collect traffic based on this sampling rate, and adaptively adjust the sampling rate to maximize resource utilization.

Benefits of technology

When system resources are limited, the accuracy of estimating traffic scale is improved, system resources are maximized, network performance is optimized, and traffic collection is efficient and accurate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115514686B_ABST
    Figure CN115514686B_ABST
Patent Text Reader

Abstract

The present application discloses a flow collection method, device, electronic device and computer-readable storage medium, the method comprising: obtaining network indicators and resource constraints of a training network, and determining the optimal network performance corresponding to the training network and the sampling rate corresponding to the optimal network performance; using network indicators, resource constraints, optimal network performance and sampling rate to train a supervised learning model; inputting the target network indicators, target resource constraints and target network performance constraints of the target network into the trained model to determine the target sampling rate corresponding to the target network; and collecting flow from the target network based on the target sampling rate. The flow collection method provided by the present application can maximize the use of existing system resources and improve the accuracy of estimating flow scale by adaptively adjusting the sampling rate of the flow collector through network indicators, resource constraints and network performance constraints when system resources are limited.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and more specifically, to a flow collection method, device, electronic device, and a computer-readable storage medium. Background Art

[0002] When using traffic collection technologies such as Netflow, IPFIX (IP Flow Information Export), and sFlow, a static sampling rate is generally set for the flow collector to perform traffic collection in a non-full collection mode. Generally speaking, the higher the sampling rate set for the flow collector, the greater the amount of information that can be obtained, and therefore the higher the accuracy of the estimated traffic scale, but the greater the resources consumed and the impact on the original network performance. The lower the sampling rate, the lower the accuracy of the estimate, but the resources consumed / the impact on the original network performance. When system resources are limited, the sampling rate setting of the flow collector is limited and generally tends to be conservative, and cannot maximize the use of the system's existing resources to achieve maximum estimation accuracy.

[0003] Therefore, how to perform traffic collection at a sampling rate that is adaptive to system resources is a technical problem that those skilled in the art need to solve.

[0004] Application Contents

[0005] The purpose of the present application is to provide a flow collection method, device, electronic device and computer-readable storage medium, which realize flow collection at a sampling rate that is adaptive to system resources.

[0006] To achieve the above objectives, the present application provides a flow collection method, including:

[0007] Obtaining network indicators and resource constraints of a training network, and determining an optimal network performance corresponding to the training network and a sampling rate corresponding to the optimal network performance;

[0008] Performing supervised learning model training using the network indicator, the resource constraint, the optimal network performance and the sampling rate;

[0009] Inputting a target network indicator, a target resource constraint, and a target network performance constraint of the target network into the trained model to determine a target sampling rate corresponding to the target network;

[0010] Traffic is collected on the target network based on the target sampling rate.

[0011] Wherein, determining the optimal network performance corresponding to the training network and the sampling rate corresponding to the optimal network performance includes:

[0012] Determine candidate sampling rates, and determine the network performance of the training network at each of the candidate sampling rates;

[0013] An optimal network performance and a sampling rate corresponding to the optimal network performance are determined.

[0014] Among them, the network performance includes the network card transmission performance and the data forwarding plane network performance. The network card transmission performance includes the maximum data packet size transmitted per second by the network card and / or the maximum transmission rate of the network card. The data forwarding plane network performance includes any one or a combination of any several of the data transmission rate under zero packet loss condition of the data forwarding plane network, the maximum number of new connections per second of the data forwarding plane network and the maximum number of concurrent connections per second of the data forwarding plane network.

[0015] The network index includes any one or a combination of any one of the host network's data transmission index, data packet transmission index, error data packet transmission index, and the number of TCP connections in each state;

[0016] The data transmission indicator includes any one or a combination of any one of the data flow sending rate, receiving rate, sent data flow size and received data flow size;

[0017] The data packet transmission index includes any one or a combination of any one of a data packet sending rate, a receiving rate, a sent data packet size, and a received data packet size;

[0018] The error data packet transmission indicator includes any one or a combination of any several of the error data packet sending rate, the error data packet receiving rate, the number of error data packets sent and the number of error data packets received.

[0019] Among them, if the training network includes a virtual network, the network indicators also include any one or a combination of any several of the data traffic sending rate, data traffic receiving rate, data packet sending rate and data packet receiving rate between the virtual network and the host network.

[0020] The data flow includes any one or a combination of any one of the total data, unicast data, multicast data, broadcast data, multicast data, TCP data, UDP data and ICMP data;

[0021] The data packets include any one or a combination of any several of the total data packet amount, unicast data packets, multicast data packets, broadcast data packets, multicast data packets, TCP packet data, UDP packet data and ICMP packet data.

[0022] The resource constraints include any one or a combination of any one of the following: number of CPU cores, CPU operating frequency, memory capacity, storage capacity, and network card bandwidth capacity.

[0023] To achieve the above objectives, the present application provides a flow collection device, comprising:

[0024] An acquisition module, used to acquire network indicators and resource constraints of a training network, and determine an optimal network performance corresponding to the training network and a sampling rate corresponding to the optimal network performance;

[0025] A training module, used for performing supervised learning model training using the network indicators, the resource constraints, the optimal network performance and the sampling rate;

[0026] An input module, used to input a target network indicator, a target resource constraint, and a target network performance constraint of a target network into the trained model to determine a target sampling rate corresponding to the target network;

[0027] A collection module is used to collect traffic from the target network based on the target sampling rate.

[0028] To achieve the above objectives, the present application provides an electronic device, including:

[0029] Memory for storing computer programs;

[0030] A processor is used to implement the steps of the above-mentioned flow collection method when executing the computer program.

[0031] To achieve the above objectives, the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned traffic collection method are implemented.

[0032] It can be seen from the above scheme that a traffic collection method provided by the present application includes: obtaining network indicators and resource constraints of a training network, and determining the optimal network performance corresponding to the training network and the sampling rate corresponding to the optimal network performance; using the network indicators, the resource constraints, the optimal network performance and the sampling rate to perform supervised learning model training; inputting the target network indicators, target resource constraints and target network performance constraints of the target network into the trained model to determine the target sampling rate corresponding to the target network; and collecting traffic from the target network based on the target sampling rate.

[0033] In the present application, a model is trained for supervised learning using a training network with annotated optimal sampling rate. The trained model is used to predict the target sampling rate corresponding to the target network based on the target network indicators, target resource constraints and target network performance constraints of the target network. Traffic collection of the target network based on the target sampling rate can maximize the use of the resources of the target network, achieve optimal network performance, and improve the accuracy of the estimated traffic scale. It can be seen that the traffic collection method provided by the present application can maximize the use of existing system resources and improve the accuracy of the estimated traffic scale by adaptively adjusting the sampling rate of the convection collector through network indicators, resource constraints and network performance constraints when system resources are limited. The present application also discloses a traffic collection device, an electronic device and a computer-readable storage medium, which can also achieve the above-mentioned technical effects.

[0034] It should be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. The drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific implementation methods, they are used to explain the present disclosure, but do not constitute a limitation to the present disclosure. In the drawings:

[0036] Figure 1 The present invention is a flow chart of a flow collection method according to an exemplary embodiment;

[0037] Figure 2 is a structural diagram of a flow collection device according to an exemplary embodiment;

[0038] Figure 3 The figure is a structural diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0039] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In addition, in the embodiments of the present application, "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0040] The embodiment of the present application discloses a flow collection method, which realizes flow collection at a sampling rate that is adaptive to system resources.

[0041] See also Figure 1 , a flow chart of a flow collection method according to an exemplary embodiment is shown as follows: Figure 1 As shown, including:

[0042] S101: Acquire network indicators and resource constraints of a training network, and determine an optimal network performance corresponding to the training network and a sampling rate corresponding to the optimal network performance;

[0043] The purpose of this step is to obtain the training network and mark the optimal sampling rate. In the specific implementation, the network indicators and resource constraints of the training network are first obtained. The network indicators in this embodiment may include the data transmission indicators, data packet transmission indicators, error data packet transmission indicators and TCP (Chinese full name: Transmission Control Protocol, English full name: Transmission Control Protocol) connections in each state of the host network, etc., which are not specifically limited here. The states here may include LISTEN, SYN_SENT, ESTABLISHED, SYN_RECV, FIN_WAIT1, CLOSE_WAIT, FIN_WAIT2, LAST_ACK, TIME_WAIT, CLOSING, CLOSED. The resource constraints in this embodiment may include the number of CPU (Chinese full name: central processing unit, English full name: central processing unit) cores, CPU operating frequency, memory capacity, storage capacity, network card bandwidth capacity, etc., which are not specifically limited here.

[0044] It is understandable that the host in this embodiment may include a physical host or a virtual host, which is not limited here. The data transmission index may include a data flow sending rate, a receiving rate, a sent data flow size, a received data flow size, etc. The unit of the above data flow sending rate and receiving rate is bit / second, and the unit of the sent data flow size and the received data flow size is bit. The data packet transmission index may include a data packet sending rate, a receiving rate, a sent data packet size, a received data packet size, etc. The unit of the above data packet sending rate and receiving rate is pieces / second, and the unit of the sent data packet size and the received data packet size is pieces. The error data packet transmission index may include a sending error data packet rate, a receiving error data packet rate, a sent error data packet number, a received error data packet number, etc. The unit of the above sending error data packet rate and receiving error data packet rate is pieces / second, and the unit of the sent error data packet number and the received error data packet number is pieces.

[0045] Furthermore, if the training network includes a virtual network, the network indicators may also include the data flow sending rate, data flow receiving rate, data packet sending rate, and data packet receiving rate between the virtual network and the host network. The units of the data flow sending rate and data flow receiving rate between the virtual network and the host network are bits / second, and the units of the data packet sending rate and data packet receiving rate are pieces / second.

[0046] It should be noted that the data traffic in this embodiment may include the total amount of data, unicast data, multicast data, broadcast data, multicast data, TCP data, UDP (Chinese full name: User Datagram Protocol, English full name: User Datagram Protocol) data and ICMP (Internet Control Message Protocol) data, etc., and the data packets may include the total amount of data packets, unicast data packets, multicast data packets, broadcast data packets, multicast data packets, TCP packet data, UDP packet data and ICMP packet data, etc.

[0047] Secondly, determine the optimal network performance corresponding to the training network and the sampling rate corresponding to the optimal network performance. As a feasible implementation method, the determination of the optimal network performance corresponding to the training network and the sampling rate corresponding to the optimal network performance includes: determining candidate sampling rates, and determining the network performance of the training network at each candidate sampling rate; determining the optimal network performance and the sampling rate corresponding to the optimal network performance. In a specific implementation, the sampling rate of the stream collector can be adjusted to each candidate sampling rate, the network performance of the training network at each candidate sampling rate can be obtained, and the sampling rate corresponding to the optimal network performance can be determined, thereby obtaining the correspondence between network indicators, resource constraints, optimal network performance and sampling rate.

[0048] It can be understood that the network performance in this embodiment may include network card transmission performance and data forwarding plane network performance, etc. The network card transmission performance may include the maximum data packet size transmitted by the network card per second (in pieces / second), the maximum transmission rate of the network card (in bits / second), etc. The data forwarding plane network performance may include the data transmission rate (in bits / second) in the case of zero packet loss in the data forwarding plane network, the maximum number of new connections per second in the data forwarding plane network, the maximum number of concurrent connections per second in the data forwarding plane network, etc.

[0049] S102: Performing supervised learning model training using the network indicator, the resource constraint, the optimal network performance and the sampling rate;

[0050] In this embodiment, the training network in the previous step is used as the training sample and the sampling rate is used as the label for supervised learning model training. The trained model is used to predict the optimal sampling rate of the target network. The network performance of the target network is optimal at the optimal sampling rate. If the sampling rate predicted by the model is y, the labeled sampling rate is y'. The training loss function J may include a mean square error function, a mean absolute error loss function, etc., which are not specifically limited here. Specifically, the mean square error function is:

[0051] Where, 1≤i≤N, N is the total amount of data in the training network;

[0052] The mean absolute error loss function is:

[0053] Where N is the total amount of data in the training network.

[0054] S103: inputting a target network indicator, a target resource constraint, and a target network performance constraint of the target network into the trained model to determine a target sampling rate corresponding to the target network;

[0055] S104: Collect traffic on the target network based on the target sampling rate.

[0056] In the specific implementation, in order to maximize the use of the resources of the target network, the target network indicators, target resource constraints and target network performance constraints of the target network are obtained and input into the trained model to obtain the target sampling rate corresponding to the target network. The network performance of the target network is optimal under the target sampling rate, which is the above target network performance. The flow collector collects traffic from the target network based on the target sampling rate, which can improve the accuracy of estimating the traffic scale.

[0057] In an embodiment of the present application, a training network with an optimal sampling rate marked is used to train the model for supervised learning. The trained model is used to predict the target sampling rate corresponding to the target network based on the target network indicators, target resource constraints and target network performance constraints of the target network. Based on the target sampling rate, traffic is collected from the target network, which can maximize the use of the resources of the target network, achieve optimal network performance, and improve the accuracy of the estimated traffic scale. It can be seen that the traffic collection method provided in the embodiment of the present application, when the system resources are limited, can maximize the use of the existing resources of the system and improve the accuracy of the estimated traffic scale by adaptively adjusting the sampling rate of the convection collector through network indicators, resource constraints and network performance constraints.

[0058] A flow collection device provided in an embodiment of the present application is introduced below. The flow collection device described below and the flow collection method described above can be referenced to each other.

[0059] See also Figure 2 , a structural diagram of a flow collection device according to an exemplary embodiment is shown, such as Figure 2 As shown, including:

[0060] An acquisition module 201 is used to acquire network indicators and resource constraints of a training network, and determine an optimal network performance corresponding to the training network and a sampling rate corresponding to the optimal network performance;

[0061] A training module 202, configured to perform supervised learning model training using the network indicators, the resource constraints, the optimal network performance and the sampling rate;

[0062] An input module 203 is used to input a target network indicator, a target resource constraint, and a target network performance constraint of a target network into the trained model to determine a target sampling rate corresponding to the target network;

[0063] The collection module 204 is used to collect traffic from the target network based on the target sampling rate.

[0064] In an embodiment of the present application, a training network with an optimal sampling rate marked is used to train the model for supervised learning. The trained model is used to predict the target sampling rate corresponding to the target network based on the target network indicators, target resource constraints and target network performance constraints of the target network. Based on the target sampling rate, traffic is collected from the target network, which can maximize the use of the resources of the target network, achieve optimal network performance, and improve the accuracy of the estimated traffic scale. It can be seen that the traffic collection device provided in the embodiment of the present application can maximize the use of the existing resources of the system and improve the accuracy of the estimated traffic scale by adaptively adjusting the sampling rate of the convection collector through network indicators, resource constraints and network performance constraints when system resources are limited.

[0065] Based on the above embodiment, as a preferred implementation, the acquisition module 201 includes:

[0066] An acquisition unit, used to obtain network indicators and resource constraints for training the network;

[0067] A first determining unit, configured to determine candidate sampling rates, and determine the network performance of the training network at each of the candidate sampling rates;

[0068] The second determining unit is used to determine the optimal network performance and the sampling rate corresponding to the optimal network performance.

[0069] On the basis of the above embodiments, as a preferred implementation mode, the network performance includes network card transmission performance and data forwarding plane network performance, the network card transmission performance includes the maximum data packet size transmitted per second by the network card and / or the maximum transmission rate of the network card, and the data forwarding plane network performance includes any one or a combination of any several of the data transmission rate under zero packet loss condition of the data forwarding plane network, the maximum number of new connections per second of the data forwarding plane network, and the maximum number of concurrent connections per second of the data forwarding plane network.

[0070] Based on the above embodiment, as a preferred implementation mode, the network indicator includes any one or a combination of any several of the data transmission indicator, data packet transmission indicator, error data packet transmission indicator and the number of TCP connections in each state of the host network;

[0071] The data transmission indicator includes any one or a combination of any one of the data flow sending rate, receiving rate, sent data flow size and received data flow size;

[0072] The data packet transmission index includes any one or a combination of any one of a data packet sending rate, a receiving rate, a sent data packet size, and a received data packet size;

[0073] The error data packet transmission indicator includes any one or a combination of any several of the error data packet sending rate, the error data packet receiving rate, the number of error data packets sent and the number of error data packets received.

[0074] Based on the above embodiments, as a preferred implementation mode, if the training network includes a virtual network, the network indicators also include any one or a combination of any several of the data traffic sending rate, data traffic receiving rate, data packet sending rate and data packet receiving rate between the virtual network and the host network.

[0075] Based on the above embodiment, as a preferred implementation mode, the data traffic includes any one or a combination of any several of the total data, unicast data, multicast data, broadcast data, multicast data, TCP data, UDP data and ICMP data;

[0076] The data packets include any one or a combination of any several of the total data packet amount, unicast data packets, multicast data packets, broadcast data packets, multicast data packets, TCP packet data, UDP packet data and ICMP packet data.

[0077] Based on the above embodiments, as a preferred implementation mode, the resource constraints include any one or a combination of any one of the following: number of CPU cores, CPU operating frequency, memory capacity, storage capacity, and network card bandwidth capacity.

[0078] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0079] Based on the hardware implementation of the above program modules, and in order to implement the method of the embodiment of the present application, the embodiment of the present application further provides an electronic device, Figure 3 FIG. 1 is a structural diagram of an electronic device according to an exemplary embodiment. Figure 3 As shown, the electronic equipment includes:

[0080] Communication interface 1, capable of exchanging information with other devices such as network devices;

[0081] The processor 2 is connected to the communication interface 1 to realize information exchange with other devices, and is used to execute the traffic collection method provided by one or more technical solutions when running a computer program. The computer program is stored in the memory 3.

[0082] Of course, in actual application, the various components in the electronic device are coupled together through the bus system 4. It can be understood that the bus system 4 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 4 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, Figure 3 Various buses are labeled as bus system 4.

[0083] The memory 3 in the embodiment of the present application is used to store various types of data to support the operation of the electronic device. Examples of such data include: any computer program used to operate on the electronic device.

[0084] It can be understood that the memory 3 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM, SyncLink Dynamic Random Access Memory), and direct RAM bus random access memory (DRRAM, Direct Rambus Random Access Memory).The memory 2 described in the embodiments of the present application is intended to include but is not limited to these and any other suitable types of memory.

[0085] The method disclosed in the above embodiment of the present application can be applied to the processor 2, or implemented by the processor 2. The processor 2 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 2 or the instruction in the form of software. The above processor 2 may be a general-purpose processor, a DSP, or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 2 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present application, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium, which is located in the memory 3, and the processor 2 reads the program in the memory 3 and completes the steps of the above method in combination with its hardware.

[0086] When the processor 2 executes the program, the corresponding processes in the various methods of the embodiments of the present application are implemented, which will not be repeated here for the sake of brevity.

[0087] In an exemplary embodiment, the present application also provides a storage medium, namely a computer storage medium, specifically a computer-readable storage medium, for example, a memory 3 storing a computer program, and the computer program can be executed by a processor 2 to complete the steps of the aforementioned method. The computer-readable storage medium can be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface storage, optical disk, or CD-ROM.

[0088] A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium, which, when executed, executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, disks or optical disks.

[0089] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable an electronic device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.

[0090] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A flow collection method, It is characterized in that include: Obtaining network indicators and resource constraints of a training network, and determining an optimal network performance corresponding to the training network and a sampling rate corresponding to the optimal network performance; Performing supervised learning model training using the network indicator, the resource constraint, the optimal network performance and the sampling rate; Inputting a target network indicator, a target resource constraint, and a target network performance constraint of the target network into the trained model to determine a target sampling rate corresponding to the target network; Performing traffic collection on the target network based on the target sampling rate; Wherein, determining the optimal network performance corresponding to the training network and the sampling rate corresponding to the optimal network performance includes: Determine candidate sampling rates, and determine the network performance of the training network at each of the candidate sampling rates; An optimal network performance and a sampling rate corresponding to the optimal network performance are determined.

2. According to the flow collection method of claim 1, It is characterized in that The network performance includes the network card transmission performance and the data forwarding plane network performance. The network card transmission performance includes the maximum data packet size transmitted per second by the network card and / or the maximum transmission rate of the network card. The data forwarding plane network performance includes any one or a combination of several of the data transmission rate under zero packet loss condition of the data forwarding plane network, the maximum number of new connections per second of the data forwarding plane network, and the maximum number of concurrent connections per second of the data forwarding plane network.

3. According to the flow collection method of claim 1, It is characterized in that The network indicators include any one or a combination of any one of the host network's data transmission indicators, data packet transmission indicators, error data packet transmission indicators, and the number of TCP connections in each state; The data transmission indicator includes any one or a combination of any one of the data flow sending rate, receiving rate, sent data flow size and received data flow size; The data packet transmission index includes any one or a combination of any one of a data packet sending rate, a receiving rate, a sent data packet size, and a received data packet size; The error data packet transmission indicator includes any one or a combination of any several of the error data packet sending rate, the error data packet receiving rate, the number of error data packets sent and the number of error data packets received.

4. According to the flow collection method of claim 3, It is characterized in that If the training network includes a virtual network, the network indicators also include any one or a combination of any several of the data traffic sending rate, data traffic receiving rate, data packet sending rate and data packet receiving rate between the virtual network and the host network.

5. The flow collection method according to claim 3 or 4, It is characterized in that The data traffic includes any one or a combination of any one of the total data, unicast data, multicast data, broadcast data, multicast data, TCP data, UDP data and ICMP data; The data packets include any one or a combination of any several of the total data packet amount, unicast data packets, multicast data packets, broadcast data packets, multicast data packets, TCP packet data, UDP packet data and ICMP packet data.

6. According to the flow collection method of claim 1, It is characterized in that The resource constraints include any one or a combination of any one of the following: number of CPU cores, CPU operating frequency, memory capacity, storage capacity, and network card bandwidth capacity.

7. A flow collection device, It is characterized in that include: An acquisition module, used to acquire network indicators and resource constraints of a training network, and determine an optimal network performance corresponding to the training network and a sampling rate corresponding to the optimal network performance; A training module, used for performing supervised learning model training using the network indicators, the resource constraints, the optimal network performance and the sampling rate; An input module, used to input a target network indicator, a target resource constraint, and a target network performance constraint of a target network into the trained model to determine a target sampling rate corresponding to the target network; A collection module, used for collecting traffic of the target network based on the target sampling rate; The acquisition module is specifically used to: determine candidate sampling rates, and determine the network performance of the training network at each of the candidate sampling rates; determine the optimal network performance and the sampling rate corresponding to the optimal network performance.

8. An electronic device, It is characterized in that include: Memory for storing computer programs; A processor, configured to implement the steps of the flow collection method according to any one of claims 1 to 6 when executing the computer program.

9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the flow collection method according to any one of claims 1 to 6 are implemented.