Traffic compression method, device and related equipment

By writing and reading characteristic data in the register array, and using loopback reading to achieve traffic compression, it solves the traffic compression versatility problem caused by insufficient device configuration in the existing technology, realizes traffic compression on any device, and reduces the cost cost.

CN118381833BActive Publication Date: 2024-10-18TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410823296.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-10-18
Estimated Expiration
2044-06-25

AI Technical Summary

Technical Problem

Existing technologies require additional hardware devices or special processing resources when performing traffic compression, resulting in devices with poor configurations being unable to perform traffic compression and lacking versatility.

Method used

By writing and reading characteristic data in the register array, traffic compression is achieved using loopback reading, which avoids dependence on special resources and improves the versatility of the method.

Benefits of technology

It realizes traffic compression on any configured device, improves the versatility and flexibility of the method, and reduces the processing cost of downstream devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118381833B_ABST
    Figure CN118381833B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a flow compression method, device and related equipment, which can be applied to the field of data processing technology. The method includes: writing the characteristic data of the first intermediate data packet into the register array to obtain the target write cumulative amount; if the target write cumulative amount reaches the data compression threshold, then based on the first intermediate data packet, an initial loopback data packet is generated; when the characteristic data of the first intermediate data packet is read, the first loopback read cumulative amount is obtained, and when the first loopback read cumulative amount does not reach the data compression threshold, a transition loopback data packet is generated through the initial loopback data packet and the read characteristic data; when the characteristic data of the second intermediate data packet is read, the second loopback read cumulative amount is obtained; if the second loopback read cumulative amount reaches the data compression threshold, a target data packet is generated through the transition loopback data packet and the read characteristic data. The use of the embodiment of the present application helps to improve the versatility of flow compression.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a flow compression method, device and related equipment. Background Art

[0002] Currently, when traffic data packets are compressed, special processing resources (such as mirror buffer resources) or additional hardware in a device are usually used to process the acquired traffic data packets to compress the acquired traffic data packets.

[0003] The inventors have discovered in practice that current solutions for traffic compression require the introduction of additional hardware devices or special processing resources, and are not suitable for devices with poor configurations. Once the special processing resources in the device are fully occupied or there are no additional hardware devices, traffic compression cannot be performed. Therefore, how to provide a more versatile traffic compression method is an urgent problem to be solved. Summary of the invention

[0004] The embodiments of the present application provide a traffic compression method, apparatus, and related equipment, which can read characteristic data from a register array by means of loopback reading, thereby helping to improve the versatility of traffic compression.

[0005] The present application embodiment provides a traffic compression method, which is executed by a target switching device and includes:

[0006] Writing characteristic data of the first intermediate data packet into the register array, obtaining the target write cumulative amount of the data packet to be compressed associated with the register array; the data packet to be compressed includes the first intermediate data packet and the second intermediate data packet; the second intermediate data packet is the intermediate data packet written into the register array before the first intermediate data packet;

[0007] If the target write cumulative amount reaches the data compression threshold associated with the register array, generating an initial loopback data packet for loopback reading based on the first intermediate data packet;

[0008] When the characteristic data of the first intermediate data packet is read from the register array through the initial loop data packet, the first loop reading cumulative amount of the data packet to be compressed is obtained, and when the first loop reading cumulative amount does not reach the data compression threshold, a transition loop data packet for loop reading is generated through the initial loop data packet and the characteristic data of the read first intermediate data packet;

[0009] When the characteristic data of the second intermediate data packet is read from the register array through the transition loop data packet, the second loop reading cumulative amount of the data packet to be compressed is obtained;

[0010] If the second loop reading accumulation reaches the data compression threshold, a target data packet for sending to a target analysis device is generated by using the transition loop data packet and the characteristic data of the data packet to be compressed.

[0011] On the one hand, an embodiment of the present application provides a traffic compression device, which runs on a target switching device and includes:

[0012] A feature writing module is used to write feature data of a first intermediate data packet into a register array, and obtain a target write cumulative amount of a data packet to be compressed associated with the register array; the data packet to be compressed includes a first intermediate data packet and a second intermediate data packet; the second intermediate data packet is an intermediate data packet written into the register array before the first intermediate data packet;

[0013] A read judgment module, configured to generate an initial loopback data packet for loopback reading based on the first intermediate data packet if the target write cumulative amount reaches a data compression threshold associated with the register array;

[0014] A data loopback reading module is used to obtain a first loopback reading cumulative amount of the data packet to be compressed when the characteristic data of the first intermediate data packet is read from the register array through the initial loopback data packet, and to generate a transition loopback data packet for loopback reading through the initial loopback data packet and the characteristic data of the first intermediate data packet read when the first loopback reading cumulative amount does not reach the data compression threshold;

[0015] A data loopback reading module, used for obtaining a second loopback reading cumulative amount of the data packet to be compressed when the characteristic data of the second intermediate data packet is read from the register array through the transition loopback data packet;

[0016] The target data packet generation module is used to generate a target data packet for sending to a target analysis device through the transition loop data packet and the characteristic data of the data packet to be compressed if the second loop reading cumulative amount reaches the data compression threshold.

[0017] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program is suitable for being loaded and executed by a processor so that a computer device having the processor executes the method provided by the embodiment of the present application.

[0018] In one aspect, the present application provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in the present application.

[0019] By using the embodiment of the present application, when performing traffic compression, the characteristic data contained in the intermediate data packet can be written into the register array, and the written characteristic data can be read from the register array, the register array is an array stored in the register, and the register can be a general register in the target switching device, so that traffic compression can be achieved without special processing resources, thereby improving the versatility of traffic compression. In addition, the embodiment of the present application can read the characteristic data from the register array in a loopback manner, so that in a switching device that cannot directly perform a loop operation, the characteristic data of multiple intermediate data packets can be read, and it is not limited by the switching device not supporting the loop operation, thereby improving the versatility of traffic compression. Therefore, the characteristic data can be read from the register array in a loopback reading manner, which helps to improve the versatility of traffic compression. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0021] Figure 1 It is a schematic diagram of a network architecture of a data processing system provided in an embodiment of the present application;

[0022] Figure 2 This is a schematic diagram of a traffic compression scenario provided by an embodiment of the present application;

[0023] Figure 3 It is a flow chart of a flow compression method provided in an embodiment of the present application;

[0024] Figure 4 This is a schematic diagram of the effect of writing data into a register array provided by an embodiment of the present application;

[0025] Figure 5 This is a schematic diagram of the effect of a data loop reading provided by an embodiment of the present application;

[0026] Figure 6 It is a flow chart of another flow compression method provided in an embodiment of the present application;

[0027] Figure 7 It is a schematic diagram of the internal interaction logic of a target switching device provided in an embodiment of the present application;

[0028] Figure 8 It is a schematic diagram of a processing flow of a data processing component provided in an embodiment of the present application;

[0029] Fig. 9 It is a schematic diagram of a process of obtaining an intermediate data packet provided in an embodiment of the present application;

[0030] Fig.10 It is a flowchart of a data processing component provided in an embodiment of the present application;

[0031] Fig.11 It is a scenario diagram of a flow compression method provided in an embodiment of the present application;

[0032] Fig.12 It is a structural schematic diagram of a flow compression device provided in an embodiment of the present application;

[0033] Fig.13 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

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

[0035] The following is an introduction to some technical terms involved in the embodiments of the present application:

[0036] 1. Payload refers to the actual data transmitted in a data packet, which can be understood as the "effective data" in the data packet. It should be understood that the payload can vary according to different protocols and application scenarios. In the Internet, the payload can be various forms of data such as text, pictures, audio, video, etc. Generally speaking, a data packet can be composed of a data packet header information and a payload. Among them, the data packet header information is the part of the data packet used to transmit control information, which contains some metadata of the data packet, such as the source address (such as the source IP address), the destination address (such as the destination IP address), the protocol type, the data packet length and other information. This information can help network devices correctly forward and process data packets.

[0037] 2. Registers refer to some small storage areas in the central processing unit (CPU) for storing data, which are used to temporarily store data involved in the operation and the results of the operation. In the embodiment of the present application, the characteristic data extracted from the traffic data packet in the register can be recorded in the form of an array, and the array can be stored through the register. Then, the array for recording the characteristic data stored through the register can be called a register array.

[0038] 3. The quintuple refers to the five basic attributes of a network data packet, including the source IP address, destination IP address, source port number, destination port number and the type of transport protocol. In network communications, each data packet contains these five attributes, which together constitute the unique identification of the data packet. Source IP address: refers to the IP address of the computer that sends the data packet, used to identify the source of the data packet. Destination IP address: refers to the IP address of the computer that receives the data packet, used to determine the destination of the data packet. Source port number: refers to the port number used by the computer that sends the data packet, used to identify which application the data packet is sent from. Destination port number: refers to the port number used by the computer that receives the data packet, used to identify which application the data packet should be handed over to for processing. Transport protocol: refers to the protocol used when sending data packets, such as TCP, UDP, etc.

[0039] 4. Spectroscopy refers to the technology of using spectroscopic technology to disperse the optical signal in an optical fiber to multiple output ports to achieve signal distribution and transmission. This process is achieved through a spectrometer, which is a key device in the optical network. It is used to divide the optical signal in an optical fiber into multiple signals to meet the needs of multiple users or devices to access the network at the same time. For example, in an embodiment of the present application, the data to be sent to the cloud server can be collected by the spectrometer, and the collected data can be compressed by the intelligent switching device and sent to the target analysis device for flow analysis.

[0040] 5. Internet Service Provider (ISP), an Internet service provider, is a telecommunications operator that provides comprehensive Internet access services, information services, and value-added services to a wide range of users.

[0041] See also Figure 1 , Figure 1 Schematic diagram of a network architecture of a data processing system provided in an embodiment of the present application. Figure 1As shown, in the data processing system, an interactive device for data interaction, a target switching device for traffic compression, and a traffic analysis device may be included. For example, the interactive device may include at least an interactive device 100a and an interactive device 110a, and network communication may be performed between the interactive device 100a and the interactive device 110a. It should be understood that the interactive device may refer to an interactive device whose received and sent traffic data packets need to be analyzed. For example, the interactive device 100a may be a server of a network service provider, and the interactive device 110a may be a cloud server. Then, the interactive device 100a (i.e., the server of the network service provider) may send a traffic data packet to the interactive device 110a (i.e., the cloud server) so that the cloud server can perform corresponding processing on the received traffic data packet. In the embodiment of the present application, the traffic data packet sent to the interactive device 110a may be split to the target switching device, so that the target switching device may subsequently perform traffic compression on the traffic data packet and send it to the target analysis device for traffic analysis. For example, the number of traffic data packets received by the cloud server within a certain period of time may be analyzed to determine whether there is a sudden surge in the number of traffic data packets received by the cloud server, thereby determining whether the cloud server is under malicious attack, so that the cloud server under malicious attack may be protected later. It should be understood that in the embodiment of the present application, the number of interactive devices may not be limited, and the embodiment of the present application may perform traffic analysis on the traffic data packets received and sent by any interactive device.

[0042] It should be understood that the target switching device (such as the target switching device 120a) can be used to perform traffic compression processing on the acquired traffic data packets, and then the target data packets (also called compressed data packets) obtained by traffic compression can be sent to the traffic analysis device. It should be understood that the traffic data packets acquired by the target switching device can be traffic data packets to be subjected to traffic analysis, and the traffic data packets can be obtained by spectroscopically collecting the traffic data packets sent by the interactive device 100a to the interactive device 110a. It should be understood that in a network, the number of target switching devices can be one or more, and the number of target switching devices is not limited here. It is understandable that the target switching device can be an intelligent switch, such as a P4 intelligent switch (Programming Protocol-independent PacketProcessors, a type of programmable switch).

[0043] A traffic analysis device (such as traffic analysis device 130a) may be a device for performing traffic analysis on a target data packet sent by a target switching device, and may also be referred to as a target analysis device. It should be understood that the number of traffic analysis devices may be one or more, and the number of traffic analysis devices is not limited herein. The traffic analysis device may be an IDS (Intrusion Detection System) analysis device.

[0044] See also Figure 2 , Figure 2 Schematic diagram of a flow compression scenario provided by an embodiment of the present application. Figure 2 As shown, the target switching device 120a can receive the traffic data packet from the interactive device 100a to the interactive device 110a obtained by the optical splitting collection. For example, the interactive device 100a sends the traffic data packet L1 to the interactive device 110a (eg, Figure 2 211a in FIG), and then the traffic data packet L1 is split by the optical splitter to the target switching device 120a.

[0045] It should be understood that when the target switching device 120a obtains the traffic data packet L1, it can extract the characteristics of the traffic data packet L1 to obtain the characteristic data T4 (such as Figure 2 212a in FIG. ), and then the intermediate data packet A1 (such as Figure 2 As shown in 213a in FIG. 1 ), the intermediate data packet A1 includes characteristic data T4, which may specifically refer to the payload of the intermediate data packet A1 as characteristic data T4. It should be understood that the characteristic data T4 extracted here may be data on N characteristic dimensions, where N is a positive integer. For example, the N characteristic dimensions may be data of a triplet of a traffic data packet, such as the N characteristic dimensions may include: source IP address, destination IP address, source port number, destination port number, transmission protocol type, etc.

[0046] Further, the characteristic data T4 can be written into the register array 214a. It should be understood that the register array may include a sub-array for each characteristic dimension. Here, the characteristic data T4 includes data of one characteristic dimension as an example, and the register array 214 includes the sub-array of the one characteristic dimension. The register array 214a may include 8 storage locations, each of which is associated with a corresponding index identifier, for example, the index identifier is 0-7. It should be understood that when the characteristic data T4 is written into the register array 214a, the characteristic data T4 can be written into the storage location with the smallest index identifier in the empty storage location, for example, the characteristic data T4 can be written into the storage location with the index identifier of 3. It should be understood that before writing the characteristic data T4, the characteristic data T1, the characteristic data T2 and the characteristic data T3 are also written into the register array 214a, and the characteristic data T1, the characteristic data T2 and the characteristic data T3 are not read to generate the data packet to be sent to the traffic analysis device, that is, the traffic compression is not performed. It should be understood that before writing the characteristic data T4, the write cumulative amount is 3, and after writing the characteristic data T4, the write cumulative amount is increased by one, that is, the write cumulative amount is updated to 4.

[0047] Furthermore, it is possible to write whether the accumulated amount reaches the data compression threshold (such as Figure 2 If the accumulated amount of writing does not reach the data compression threshold, the intermediate data packet A1 may be discarded (as shown in 215a in FIG. 1 ). Figure 2 If the accumulated amount of writing reaches the data compression threshold, the loopback data packet can be determined based on the intermediate data packet A1, and the characteristic data T4 stored at the storage location with index 3 can be read from the register array 210a based on the loopback data packet (as shown in 216a in FIG. 216b ). Figure 2 217a in the figure). The loopback data packet may be a data packet used for loopback reading. It should be understood that the metadata associated with the loopback data packet may include a read index identifier, which may be used to indicate the index identifier of the storage location where the feature data to be read is stored. For example, based on the intermediate data packet A1, the read index identifier in the metadata associated with the loopback data packet is determined to be 3 (i.e., the index identifier of the storage location where the feature data T4 is stored). It should be understood that after reading the feature data once, the loopback read cumulative amount may be updated. The loopback read cumulative amount is used to record the cumulative amount of the feature data of the intermediate data packet read, i.e., the number of times the feature data is read. For example, after reading the feature data T4 of the intermediate data packet A1, the loopback read cumulative amount may be added from 0 to 1, i.e., the loopback read cumulative amount is 1 after reading the feature data T4 of the intermediate data packet A1.

[0048] Furthermore, the accumulated amount can be looped back to see whether it reaches the data compression threshold (e.g. Figure 2 If the accumulated loopback reading amount does not reach the data compression threshold, a new loopback data packet (such as Figure 2 219a in FIG), and then based on the new loopback data packet, read the feature data stored in the storage location corresponding to the previous index identifier from the register array 210a (as shown in FIG. Figure 2 Further, after reading the characteristic data stored in the storage location corresponding to the previous index identifier from the register array 210a, a new loop reading cumulative amount can be obtained, that is, the loop reading cumulative amount is updated, so as to determine whether the new loop reading cumulative amount reaches the data compression threshold. If the new loop reading cumulative amount does not reach the data compression threshold, the above-mentioned step of reading the characteristic data from the register array can be repeated (that is, as shown in FIG. Figure 2 219a and 220a in the figure), until the accumulated loop reading reaches the data compression threshold, the target data packet (such as Figure 2 221a in FIG. 2). It should be understood that, Figure 2 As shown, in the process of repeatedly executing the step of reading the characteristic data stored in the storage location corresponding to the previous index identifier from the register array 210a, the characteristic data stored in the storage location with index identifiers of 2, 1, and 0 may be read in sequence, that is, characteristic data T3, characteristic data T2, and characteristic data T1 are read in sequence. It should be understood that the order of reading characteristic data is opposite to the order of writing characteristic data, that is, when writing characteristic data, it is written in the order of increasing index identifiers, and when reading characteristic data, it is read in the order of decreasing index identifiers.

[0049] It should be understood that when determining the target data packet based on the read characteristic data and the latest loopback data packet, the target switching device 120a can send the target data packet to the traffic analysis device 130a (step S222a). Furthermore, the traffic analysis device 130a can perform traffic analysis based on the target data packet, such as counting the number of traffic data packets associated with the target data packet, counting the number of times a certain illegal IP accesses the interactive device 110a, etc., which is not limited here.

[0050] It should be understood that the traffic compression method proposed in the present invention does not rely on additional programmable switch hardware, can effectively compress traffic, and reduce the processing cost of downstream devices (such as target analysis devices). The compression ratio is dynamically set by the control plane, and N packets are compressed into one packet and sent, which does not affect the normal operation of the device. The embodiment of the present application supports the extraction and compression of features of the entire flow or any protocol. For example, it can be to extract feature fields related to DDoS (distributed denial of service) attacks, such as quintuples and other features, and some features are set with custom dimensionality reduction operations (i.e., the dimensionality reduction operation of feature data through dimensionality reduction expressions), and the feature dimensionality reduction output is 0 or 1, which improves the compression ratio, so that smaller feature data can be compressed to improve the effect of traffic compression. In addition, the traffic compression method provided in the embodiment of the present application is highly versatile, does not rely on dedicated hardware, is simple and flexible to implement, can be applied to various general programmable switches, the solution is stable and controllable, and ordinary register resources are allocated to cache data packets, and special resources of the system (such as mirror cache resources) are not occupied. In addition, the embodiment of the present application proposes a traffic compression solution, which can extract characteristic data of traffic data packets at the network traffic entrance (i.e., at the target switching device deployed before entering the target analysis device) and cache it in a register. When a certain number is accumulated, it is compressed into a large packet and sent. This can effectively reduce the pps (number of packets per second) and bps (traffic per second) of the downstream target analysis device, thereby reducing the processing cost of traffic analysis.

[0051] It should be noted that this application can display a prompt interface, pop-up window or output voice prompt information before collecting relevant data of the user and during the process of collecting relevant data of the user. The prompt interface, pop-up window or voice prompt information is used to prompt the user that its relevant data is currently being collected, so that this application only starts to execute the relevant steps of obtaining relevant data of the user after obtaining the confirmation operation issued by the user to the prompt interface or pop-up window, otherwise (that is, when the confirmation operation issued by the user to the prompt interface or pop-up window is not obtained), the relevant steps of obtaining relevant data of the user are terminated, that is, the relevant data of the user is not obtained. In other words, all user data collected by this application are collected with the consent and authorization of the user, and the collection, use and processing of relevant user data need to comply with the relevant laws, regulations and standards of the relevant regions.

[0052] It is understood that the above scenarios are only examples and do not constitute a limitation on the application scenarios of the technical solutions provided in the embodiments of the present application. The technical solutions of the present application can also be applied to other scenarios. For example, it is known to those skilled in the art that with the evolution of the system architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0053] For further information, see Figure 3 , Figure 3 is a flow chart of a traffic compression method provided by an embodiment of the present application. The method can be executed by a target switching device, for example, the target switching device is Figure 1 The method may at least include the following steps S101 to S105.

[0054] S101. Write characteristic data of the first intermediate data packet into the register array, and obtain the target write cumulative amount of the data packet to be compressed associated with the register array; the data packet to be compressed includes the first intermediate data packet and the second intermediate data packet; the second intermediate data packet is the intermediate data packet written into the register array before the first intermediate data packet.

[0055] The first intermediate data packet may be the latest intermediate data packet obtained. The second intermediate data packet is an intermediate data packet written into the register array before the first intermediate data packet. The number of the second intermediate data packets may be one or more, which is not limited here.

[0056] An intermediate data packet may refer to a data packet whose payload is characteristic data. It should be understood that the characteristic data may be data obtained by extracting features from the traffic data in the traffic data packet, such as data of a five-tuple in the traffic data packet, data of a payload, and the like, and further, the intermediate data packet may be a data packet constructed based on characteristic data obtained by extracting features from the traffic data in the traffic data packet, that is, a data packet that uses the characteristic data obtained by extracting features from the traffic data in the traffic data packet as a payload. It should be understood that the data packet type of the intermediate data packet (such as the first intermediate data packet and the second intermediate data packet) is a mirror type (also referred to as an intermediate processing type), and the mirror type may refer to the type of data packet determined based on the characteristic data, because the mirror operation is used in the process of determining the intermediate data packet, so the data packet type of the intermediate data packet is referred to as a mirror type.

[0057] Among them, the register array may refer to a sub-array of registers used to store data in the target switching device. It should be understood that the register array may include K storage locations, K is a positive integer, and one storage location is used to store characteristic data of an intermediate data packet. The value of K is greater than or equal to the data compression threshold, and the data compression threshold can be used to indicate the intermediate data packet corresponding to the characteristic data used to construct a target data packet, that is, to indicate how many traffic data packets are compressed into one data. Further, the value of K can be an integer multiple of the data compression threshold (such as the value of K is P times the data compression threshold), then a register array can be used to store the characteristic data of the data packet to be compressed for P times of traffic compression. For example, if the data compression threshold is 8, then the value of K should be a multiple of 8. For example, if the value of K is 32 times of 8, that is, K is 256, the register array can be used to store the characteristic data of the data packet to be compressed for 32 times of traffic compression. It should be understood that each of the K storage locations may be associated with a corresponding index identifier, which is used to identify a storage location in a subarray, and the value range of the index identifier of the K storage locations may be 0 to N-1. For example, if the register array includes 256 storage locations (i.e., K=256), the index identifiers of the 256 storage locations are 0 to 255. It should be understood that after the characteristic data are written to the K storage locations in the register array, the register array may be reset to record the characteristic data of the newly acquired intermediate data packet through the reset register array. It should be understood that in the embodiments of the present application, the characteristic data used to construct the target data packet is stored based on the general registers in the target switching device, and there is no need to store the characteristic data based on some special resources. It can be used in any programmable switching device with general registers. In addition, some devices (such as P4) do not provide API operating system memory, and cannot directly implement data caching and reading. The present application implements the storage of characteristic data by allocating register arrays (one array or multiple sub-arrays), and implements a circular queue (i.e., repeatedly writing data in the same register array) by resetting the register array (or resetting the write pointer of the register array), which helps to reduce the device's restrictions on data storage and improve the versatility of traffic compression.

[0058] Among them, the data packet to be compressed refers to an intermediate data packet to be subjected to traffic compression, and specifically may refer to an intermediate data packet whose characteristic data is to be read from the register array to construct a target data packet (i.e., a data packet obtained by traffic compression). In other words, the data packet to be compressed associated with the register array may refer to an intermediate data packet whose corresponding characteristic data is written into the register array and whose characteristic data is not read from the register array to construct the target data packet (i.e., no traffic compression is performed). It should be understood that the target switching device can continuously extract features from the received traffic data packets to obtain feature data, so as to obtain intermediate data packets based on the extracted feature data, and then each time the intermediate data packets are written into the register array, the intermediate data packets can be determined as data packets to be compressed, and the number of data packets to be compressed (i.e., the cumulative write amount of data packets to be compressed) is increased by 1. When the number of data packets to be compressed associated with the register array reaches the data compression threshold, the feature data of the written data packets to be compressed can be read from the register array to perform traffic compression, and then the data packet to be compressed that has undergone traffic compression can be determined as a compressed data packet, and the number of data packets to be compressed associated with the register array (i.e., the cumulative write amount of data packets to be compressed) can be set to 0. In other words, the cumulative write amount of data packets to be compressed is cleared to zero, and then, the above-mentioned feature extraction of the traffic data packets can be repeatedly performed to obtain feature data, and the feature data based on the extraction can be repeatedly performed to obtain feature data. After the intermediate data packet constructed by the characteristic data is written into the register array, the intermediate data packet is determined as the data packet to be compressed, and the number of data packets to be compressed (i.e., the cumulative writing amount of the data packets to be compressed) is continuously updated (i.e., each time the characteristic data of an intermediate data packet is written in the register array, the cumulative writing amount of the data packets to be compressed is increased by 1), until the number of data packets to be compressed associated with the register array reaches the data compression threshold, the characteristic data of the written data packet to be compressed is read from the register array again to perform traffic compression, the data packet to be compressed that has been traffic compressed is determined as a compressed data packet, and the number of data packets to be compressed associated with the register array (i.e., the cumulative writing amount of the data packets to be compressed) can be set to 0, thereby the above steps can be continuously repeated, and each time a certain number of characteristic data of the data packets to be compressed are cumulatively written in the register array, the target data packet can be constructed based on the characteristic data of the data packets to be compressed in the register array.

[0059] Among them, the target write cumulative amount is the write cumulative amount of the intermediate data packets to be compressed after the characteristic data of the first intermediate data packet is written into the register array. The write cumulative amount refers to the number of intermediate data packets to be compressed (i.e., data packets to be compressed) written into the register array, that is, the number of times the characteristic data of the intermediate data packets are written into the register array.

[0060] It should be understood that obtaining the target write cumulative amount of the data packet to be compressed associated with the register array may include the following steps: when writing the characteristic data of the first intermediate data packet into the register array, obtaining the initial write cumulative amount of the data packet to be compressed associated with the register array, updating the initial write cumulative amount, and obtaining the target write cumulative amount of the data packet to be compressed. It should be understood that the initial write cumulative amount refers to the write cumulative amount of the intermediate data packet to be compressed before writing the characteristic data of the first intermediate data packet into the register array. For example, the initial write cumulative amount may be an initial value (such as 0), or the write cumulative amount of the data packet to be compressed after the previous intermediate data packet of the first intermediate data packet is written into the register array. The initial write cumulative amount may be updated by adding 1 to the initial write cumulative amount, that is, the write cumulative amount is added by 1 for each characteristic data of an intermediate data packet written.

[0061] It is understandable that the feature data of the intermediate data packet (such as the first intermediate data packet) may include feature dimension data of N feature dimensions, where N is a positive integer. The feature dimension refers to the dimension required for feature extraction, such as the source IP, destination IP, source port, destination port, etc. of the traffic data packet. A feature dimension data may be data on a feature dimension.

[0062] It is understandable that in the embodiment of the present application, the register array may include a sub-array corresponding to each feature dimension, that is, the register array may include N sub-arrays, one feature dimension corresponds to one sub-array, that is, one sub-array is used to store feature dimension data of the same feature dimension. For example, if the N feature dimensions include two feature dimensions, namely, source IP and destination IP, then the data for the feature dimension of source IP in the feature data of each intermediate data packet may be stored through sub-array Z1, and the data for the feature dimension of destination IP in the feature data of each intermediate data packet may be stored through sub-array Z2. Each sub-array may include K storage locations, and each K storage location in each sub-array is associated with a corresponding index identifier. It should be understood that the value range of the index identifier of each sub-array is the same, and the index identifier of the storage position for storing the feature dimension data of different feature dimensions of the same intermediate data packet in each sub-array is the same. For example, the sub-array Z1 corresponding to the feature dimension of source IP and the sub-array Z2 corresponding to the feature dimension of destination IP both include 256 storage locations. When the intermediate data packet A1 is obtained, the data for the feature dimension of source IP in the intermediate data packet A1 can be written to the storage position with index identifier 25 in the sub-array Z1, and the data for the feature dimension of destination IP in the intermediate data packet A1 can be written to the storage position with index identifier 25 in the sub-array Z1, and the data for the feature dimension of destination IP in the intermediate data packet A1 can be written to the storage position with index identifier 25 in the sub-array Z2.

[0063] Specifically, the characteristic data of the first intermediate data packet is the first characteristic data, and the first characteristic data includes the first characteristic dimension data of N characteristic dimensions, where N is a positive integer; the register array includes N sub-arrays corresponding to the N characteristic dimensions, one sub-array corresponds to one characteristic dimension, and each sub-array in the N sub-arrays includes K storage locations, where K is a positive integer, and the value of K is greater than or equal to the data compression threshold; the K storage locations included in each sub-array are associated with corresponding index identifiers; then, writing the characteristic data of the first intermediate data packet into the register array may include the following steps: determining an empty storage location from the K storage locations of any sub-array in the N sub-arrays, and determining the smallest index identifier among the index identifiers corresponding to the empty storage location as the first index identifier; determining the first storage location of each sub-array from the K storage locations of each sub-array based on the first index identifier; the index identifier of the first storage location of each sub-array is the first index identifier; and writing the first characteristic dimension data of each characteristic dimension in the N characteristic dimensions into the first storage location in the sub-array corresponding to each characteristic dimension, respectively.

[0064] The first characteristic data may refer to the characteristic data of the first intermediate data packet. It should be understood that the introduction of the characteristic dimension data of the N characteristic dimensions can refer to the above-mentioned related description, which will not be repeated here, and the introduction of the K storage locations in each sub-array can refer to the above-mentioned related description, which will not be repeated here.

[0065] Among them, the empty storage position in each sub-array may refer to a storage position where the characteristic dimension data is not written. It should be understood that when writing the characteristic dimension data of each intermediate data packet in any sub-array, it is written in sequence from low to high in accordance with the index identifier, then the smallest index identifier among the index identifiers corresponding to the empty storage position may be the index identifier of the storage position where the characteristic dimension data of the latest intermediate data packet is to be written. The first index identifier may refer to the index identifier of the storage position used to write the characteristic dimension data of the first intermediate data packet. The first storage position is the storage position corresponding to the first index identifier in each sub-array.

[0066] For example, the value range of the index identifier of each sub-array in the register array is 0-255. When the first intermediate data packet is obtained, the storage position with the index identifier 0-20 in any sub-array has been written with the characteristic dimension data, and the empty storage position in any sub-array is the storage position with the index identifier 21-255. Then, the smallest index identifier (i.e., 21) among the index identifiers 21-255 can be determined as the first index identifier, and the storage position corresponding to the first index identifier (i.e., 21) in each sub-array is determined as the first storage position. Then, the dimensional characteristic data of the first intermediate data packet can be stored in the first storage position in each sub-array (i.e., the storage position with the index identifier 21).

[0067] Among them, if the N feature dimensions include a first feature dimension and a second feature dimension, then writing the first feature dimension data of each feature dimension in the N feature dimensions into the first storage position in the sub-array corresponding to each feature dimension, respectively, may include the following steps: writing the first feature dimension data of the first feature dimension into the first storage position in the sub-array corresponding to the first feature dimension, respectively, and writing the first feature dimension data of the second feature dimension into the first storage position in the sub-array corresponding to the second feature dimension, respectively.

[0068] For example, see Figure 4 , Figure 4 Schematic diagram of the effect of writing data into a register array provided by an embodiment of the present application. Figure 4 As shown, register array 410a may include sub-arrays corresponding to three feature dimensions, such as sub-array 401a (such as the sub-array corresponding to feature dimension 0), sub-array 402a (such as the sub-array corresponding to feature dimension 1) and sub-array 403a (such as the sub-array corresponding to feature dimension 2), each of which may include 256 storage locations, and the indexes of the 256 storage locations are 0-255. Figure 4 When the feature data T5 in the intermediate data packet A2 is written into the register array 410a, the feature data T5 in the intermediate data packet A2 can be written into the register array 410a. It should be understood that in the register array 410a to which the feature data T5 is to be written, the empty storage positions may include storage positions with index identifiers 4-255, wherein the smallest index identifier is 4, that is, the first index identifier is 4, and the storage position corresponding to it is the first storage position (e.g. Figure 4 After the feature data T5 is written into the register array 410a, the feature dimension data of the corresponding feature dimension in the feature data T5 is written into the storage location with the index mark 4 in each sub-array in the register array (as shown in FIG. Figure 4 As shown in 414a in the figure, for example, feature dimension data T50 corresponding to feature dimension 0 in feature data T5 is written into sub-array 401a, feature dimension data T51 corresponding to feature dimension 1 in feature data T5 is written into sub-array 402a, and feature dimension data T52 corresponding to feature dimension 2 in feature data T5 is written into sub-array 403a. Further, it can be understood that when a new intermediate data packet is subsequently acquired, the feature data can be written into the register array in the order of increasing index identifiers. After the feature data is written into each storage location in the register array, the register array can be reset to rewrite the feature data into the reset register array.

[0069] Optionally, the register array can be a single array, and the feature dimension data of N feature dimensions can be written as a whole to a storage location in the single array. It should be understood that if the register array is a single array, the single array can be called a target array, and the target array includes K storage locations, each storage location is associated with a corresponding index identifier, then, writing the feature data of the first intermediate data packet to the register array includes the following steps: determining an empty storage location from the K storage locations in the target array, and determining the smallest index identifier among the index identifiers corresponding to the empty storage location as the first index identifier; determining the storage location corresponding to the first index identifier among the K storage locations of the target array as the first storage location of the target array; and writing the first feature dimension data of each feature dimension in the N feature dimensions to the first storage location in the target array. Among them, the method for determining the first index identifier and the first storage location can refer to the above-mentioned related description, which will not be repeated here.

[0070] Optionally, in an embodiment of the present application, a write pointer may be used to record the storage location to which the next data is to be written, and the index identifier of the storage location to which the next data is to be written may be referred to as a write index identifier (i.e., the index identifier of the storage location pointed to by the write pointer). Then, writing the feature data of the first intermediate data packet to the register array may include the following steps: obtaining the write index identifier associated with the write pointer, and determining the first storage location of each sub-array from the K storage locations of each sub-array based on the write index identifier; the index identifier of the first storage location of each sub-array is the write index identifier; and writing the first feature dimension data of each feature dimension in the N feature dimensions into the first storage location in the sub-array corresponding to each feature dimension.

[0071] Furthermore, each time the characteristic data of an intermediate data packet is written into the storage location corresponding to the write pointer, the write pointer can be updated (that is, the write index identifier is updated), that is, the index identifier of the storage location pointed to by the write pointer is increased by one, until the write pointer points to the last storage location of the register array, the write pointer can be reset, that is, the write pointer points to the first storage location of the register array (that is, the storage location with an index identifier of 0). Furthermore, in the embodiment of the present application, the register array may not be reset, but when new data is written, the data in the storage location pointed to by the write pointer is overwritten to realize cyclic reading and writing of the register array. For example, the register array includes 256 storage locations (the value range of the index identifier is 0-255). If the write pointer points to the storage location of index identifier 255 (that is, the last storage location of the register array), after the characteristic data of the intermediate data packet is stored in the storage location of index identifier 255 pointed to by the write pointer, the write pointer is reset to point to the storage location of index identifier 0, that is, the write index identifier is reset to 0. It should be understood that at this time, data is already stored in the storage location of index identifier 0. When the characteristic data of the next intermediate data packet to be written is obtained, the characteristic data of the intermediate data packet can be directly overwritten and written to the storage location of index identifier 0, and then the write pointer is updated to point to the storage location of index identifier 1. Then, when the characteristic data of the next intermediate data packet to be written is obtained, the characteristic data of the intermediate data packet can be directly overwritten and written to the storage location of index identifier 1, and so on, until the write pointer points to the last storage location of the register array, thereby realizing the cyclic writing of the characteristic data of each intermediate data packet in the same register array, reducing the waste of storage space.

[0072] Among them, the second intermediate data packet can be an intermediate data packet written into the register array before the first intermediate data packet, and the second intermediate data packet is an intermediate data packet that has not been subjected to traffic compression. It should be understood that the second intermediate data packet may include one or more sub-intermediate data packets. For the convenience of description, the previous intermediate data packet of the first intermediate data packet included in the second intermediate data packet (i.e., the last intermediate data packet in the second intermediate data packet) may be referred to as the first sub-intermediate data packet, the last intermediate data packet in the second intermediate data packet may be referred to as the second sub-intermediate data packet, and the intermediate data packet between the second sub-intermediate data packet and the second sub-intermediate data packet may be referred to as the third sub-intermediate data packet. It should be understood that the first intermediate data packet and the last intermediate data packet in the second intermediate data packet described herein refer to the first intermediate data packet and the last data packet arranged when sorting from early to late based on the time when the characteristic data is written into the register array. It should be understood that in the embodiment of the present application, if the second intermediate data packet includes only one sub-intermediate data packet, the first sub-intermediate data packet and the second sub-intermediate data packet are the same intermediate data packet, and if the second intermediate data packet includes only two sub-intermediate data packets, the third sub-intermediate data packet does not exist in the second intermediate data packet. For example, the data packets to be compressed include: A1, A2, A3, A4, A5, A6, among which A6 is the first intermediate data packet, and the second intermediate data packet includes: A1, A2, A3, A4, A5, then A5 is the second sub-intermediate data packet, A1 is the first sub-intermediate data packet, and A2, A3 and A4 are the third sub-intermediate data packets.

[0073] S102: If the target write cumulative amount reaches the data compression threshold associated with the register array, an initial loopback data packet for loopback reading is generated based on the first intermediate data packet.

[0074] Among them, based on the above description, it can be known that the data compression threshold refers to the number of intermediate data packets used for traffic compression. It should be understood that if the target write cumulative amount reaches the data compression threshold associated with the register array, it means that the characteristic data can be read from the register array to generate a compressed target data packet. For example, the data compression threshold is 8. When the first intermediate data packet is obtained, the characteristic data of the first intermediate data packet is written to the register array, and the write cumulative amount is updated from 7 to 8 (the number of the second intermediate data packets is 7), that is, the target write cumulative amount is 8, then the target write cumulative amount reaches the data compression threshold associated with the register array, and then the characteristic data can be read from the register array, which can be read specifically by loopback reading.

[0075] Among them, the initial loopback data packet may be a loopback data packet to be subjected to data loopback processing. The loopback data packet may refer to a data packet whose data packet type is a loopback type. It should be understood that the data packet type of the initial loopback data packet is a loopback type, wherein the loopback type may refer to the type of data packet used for data loopback processing. It should be understood that the loopback processing here may refer to a processing process of reading the characteristic data of each data packet to be compressed in turn by repeatedly executing the same data reading process, and the data reading process may be a processing process of reading characteristic data from a register array based on a loopback data packet (such as an initial loopback data packet). It should be understood that since some devices (such as P4) do not support reading multiple index values ​​of a register array at one time, nor do they support loop operations, in an embodiment of the present application, multiple indexes of a register can be simulated by looping through a data packet, so that the characteristic data of multiple intermediate data packets can be read in a switching device that cannot directly perform a loop operation, and is not restricted by the switching device not supporting loop operations, thereby improving the versatility of traffic compression.

[0076] Among them, the data reading process may include: when it is determined that the data packet type of the loopback data packet is a loopback type, determining a read index identifier from the metadata of the loopback data packet, reading characteristic data stored at a storage location indicated by the read index identifier from a register array, obtaining a cumulative amount of loopback reads of the data packet to be compressed, and determining a loopback output data packet of the data reading process based on the cumulative amount of loopback reads.

[0077] Among them, the read index identifier can be an index identifier for indicating the storage location of the characteristic data to be read from the register array. In other words, the characteristic data can be read from the corresponding storage location in the register array based on the read index identifier, that is, the characteristic data can be read from the storage location corresponding to the read index identifier in the register array. For example, the read index identifier in the metadata of the initial loop data packet can be the above-mentioned first index identifier, that is, the index identifier corresponding to the storage location where the characteristic data of the first intermediate data packet is stored, and then the characteristic data (that is, the characteristic data of the first intermediate data packet) at the storage location corresponding to the read index identifier (that is, the first index identifier) ​​can be read from the register array.

[0078] The loopback reading cumulative amount refers to the number of intermediate data packets corresponding to the characteristic data read for loopback reading, that is, the number of times the characteristic data is read from the register array. It should be understood that the loopback reading cumulative amount can be updated (e.g., plus 1) each time the characteristic data is read.

[0079] It should be understood that the loop output data packet may refer to a data packet obtained each time the data reading process is executed. Wherein, determining the loop output data packet of the data reading process based on the accumulated loop reading amount may include: if the accumulated loop reading amount does not reach the data compression threshold, then determining a transition loop data packet based on the read characteristic data and the initial loop data packet (specifically, the payload of the initial loop data packet may be updated based on the read characteristic data to obtain a transition loop data packet), the transition loop data packet belongs to the above-mentioned loop output data packet, and the transition loop data packet refers to a data packet of the loop type determined based on the read characteristic data, that is, the transition loop data packet is a loop data packet that has been subjected to data loop processing. Then, the transition loop data packet may be repeatedly input into the data reading process to read the characteristic data of the previous intermediate data packet from the register array, and a new loop output data packet may be determined based on the read characteristic data. If the accumulated amount of loop readings reaches the data compression threshold, the target data packet is determined based on the read characteristic data and the transition loop data packet (specifically, the payload of the transition loop data packet is updated based on the read characteristic data to obtain the target data packet). The transition loop data packet belongs to the above-mentioned loop output data packet, and the target data packet can be subsequently sent to the target analysis device.

[0080] S103. When the characteristic data of the first intermediate data packet is read from the register array through the initial loop data packet, the first loop reading cumulative amount of the data packet to be compressed is obtained. When the first loop reading cumulative amount does not reach the data compression threshold, a transition loop data packet for loop reading is generated through the initial loop data packet and the characteristic data of the read first intermediate data packet.

[0081] It should be understood that the characteristic data of the first intermediate data packet is written into the first storage position corresponding to the first index identifier in the register array, and the characteristic data of the first intermediate data packet is read from the register array, which can be reading the characteristic data of the first intermediate data packet from the first storage position in the register array.

[0082] The first loop read cumulative amount refers to the loop read cumulative amount after the characteristic data of the first intermediate data packet is read from the register array.

[0083] Specifically, the metadata associated with the initial loop data packet includes the initial loop read cumulative amount of the data packet to be compressed; then, obtaining the first loop read cumulative amount of the data packet to be compressed may include the following steps: obtaining the initial loop read cumulative amount from the metadata associated with the initial loop data packet, updating the initial loop read cumulative amount, and obtaining the first loop read cumulative amount of the data packet to be compressed.

[0084] The initial loop read cumulative amount refers to the loop read cumulative amount when the characteristic data of the first intermediate data packet is not read from the register, for example, the initial loop read cumulative amount is 0. The initial loop read cumulative amount may be updated by adding 1 to the initial loop read cumulative amount, that is, each time the characteristic data of the intermediate data packet is read from the register array, the loop read cumulative amount is added by 1 until the loop read cumulative amount increases to the data compression threshold.

[0085] Specifically, the characteristic data of the first intermediate data packet is the first characteristic data, and the first characteristic data includes the first characteristic dimension data of N characteristic dimensions, where N is a positive integer; the register array includes N sub-arrays corresponding to the N characteristic dimensions, and one sub-array corresponds to one characteristic dimension; each sub-array in the N sub-arrays includes a first storage position for storing the first characteristic dimension data of the corresponding characteristic dimension, and the index identifier of the first storage position of each sub-array is the first index identifier; the read index identifier in the metadata associated with the initial loopback data packet is the first index identifier; then, reading the characteristic data of the first intermediate data packet from the register array through the initial loopback data packet may include the following steps: obtaining the first index identifier from the metadata associated with the initial loopback data packet, and determining the first storage position of each sub-array from the storage positions included in each sub-array based on the first index identifier; reading the first characteristic dimension data of the characteristic dimension corresponding to each sub-array from the first storage position of each sub-array, and determining the read first characteristic data based on the read first characteristic dimension data of each characteristic dimension.

[0086] Among them, the first characteristic data refers to the characteristic data of the first intermediate data packet. Based on the above description, it can be known that the first index identifier refers to the index identifier of the storage location used to store the first characteristic data, that is, the storage location corresponding to the first index identifier in each sub-array is used to store the first characteristic dimension data of the corresponding characteristic dimension in the first characteristic data. It should be understood that the read index identifier in the metadata associated with the initial loop data packet is the first index identifier (that is, the read index identifier of the initial loop data packet can be determined based on the index identifier of the storage location where the characteristic data of the first intermediate data packet (that is, the last data packet to be compressed in a round of traffic compression) is stored (that is, the first index identifier), and then when the initial loop data packet is obtained, the characteristic data in the register array is read based on the read index identifier of the first index identifier.

[0087] It should be understood that when the cumulative amount of the first loop reading does not reach the data compression threshold, it means that a sufficient number of characteristic data of the intermediate data packets have not been read, and therefore it is necessary to continue to read the characteristic data from the storage position corresponding to the previous index identifier of the first index identifier in the register array. Then, the transition loop data packet can be determined based on the characteristic data read from the storage position corresponding to the first index identifier, and then the characteristic data is read from the register array based on the transition loop data packet. The read index identifier in the metadata of the transition loop data packet is the previous index identifier of the first index identifier. That is to say, when performing a loop reading of the characteristic data in the register array, each time the characteristic data stored in the storage position corresponding to the previous index identifier is read, that is, the read index identifier gradually decreases until the characteristic data corresponding to the data compression threshold (such as 8) is read.

[0088] Specifically, the second intermediate data packet includes a first sub-intermediate data packet, and the first sub-intermediate data packet is the previous intermediate data packet of the first intermediate data packet; the register array includes a second storage location for storing characteristic data of the first sub-intermediate data packet, and the index identifier of the second storage location is a second index identifier; a transition loopback data packet for loopback reading is generated through the initial loopback data packet and the characteristic data of the read first intermediate data packet, including: updating the payload in the initial loopback data packet based on the characteristic data of the read first intermediate data packet to obtain an initial loopback update data packet, updating the read index identifier in the metadata of the updated initial loopback data packet to the second index identifier, and determining the initial loopback update data packet after the updated read index identifier as a transition loopback data packet; the read index identifier in the metadata associated with the transition loopback data packet is used to read the characteristic data of the first sub-intermediate data packet from the storage location corresponding to the second index identifier based on the transition loopback data packet.

[0089] Among them, the first sub-intermediate data packet refers to the previous intermediate data packet of the first intermediate data packet included in the second intermediate data packet. The second storage position refers to the storage position in the register array for storing the characteristic data of the second sub-intermediate data. The second index identifier is the index identifier of the storage position (i.e., the second storage position) in the register array for storing the characteristic data of the second sub-intermediate data. It should be understood that the first sub-intermediate data packet is the previous intermediate data packet of the first intermediate data packet, then, the second storage position is the previous storage position of the first storage position, and the second index identifier is the previous index identifier of the first index identifier, that is, the second index identifier is 1 less than the first index identifier.

[0090] It should be understood that the initial loop update data packet refers to a data packet obtained after updating the payload of the initial loop data packet. The payload in the initial loop data packet is the characteristic data of the first intermediate data packet. Updating the payload in the initial loop data packet based on the characteristic data of the first intermediate data packet read is equivalent to overwriting the data in the payload based on the characteristic data of the first intermediate data packet read, thereby obtaining the initial loop update data packet.

[0091] It should be understood that the initial loop update data packet can be configured with a read index identifier for the next data read required, and the read index identifier configured for the initial loop update data packet is the previous index identifier of the first index identifier (i.e., the second index identifier), and the initial loop update data packet with the read index identifier configured as the first index identifier is then determined as a transition loop data packet, and the characteristic data in the corresponding storage location (i.e., the second storage location corresponding to the second index identifier) ​​can be read based on the read index identifier in the metadata of the transition loop data packet, thereby realizing the reading process of the loop read.

[0092] Optionally, in an embodiment of the present application, if the target write cumulative amount does not reach the data compression threshold associated with the register array, the first intermediate data packet is discarded.

[0093] It should be understood that if the target write cumulative amount does not reach the data compression threshold associated with the register array, it means that after writing the characteristic data of the first intermediate data packet, the number of data packets to be compressed that write the characteristic data into the register array does not reach the condition for performing a flow compression, and then the first intermediate data packet can be discarded, and then the characteristic data of the next intermediate data packet can be waited to be written into the register array, until the cumulative amount of writing reaches the data compression threshold, and then the characteristic data is read from the register array to generate the intermediate data packet. It is worth noting that the first intermediate data packet is discarded here, but the characteristic data in the first intermediate data packet has been written into the register array. When flow compression is required later, it is only necessary to read the characteristic data of the first intermediate data packet from the corresponding storage position in the register array, thereby only needing to record the characteristic data in the register array, without having to record the data of the complete intermediate data packet, reducing the storage space of the register occupied by the register array, and when flow compression is performed later, the final target data packet can be directly constructed based on the read characteristic data, without having to perform the operation of obtaining characteristic data from the intermediate data packet, which helps to improve the efficiency of flow compression.

[0094] S104, when the characteristic data of the second intermediate data packet is read from the register array through the transition loop data packet, the second loop reading cumulative amount of the data packet to be compressed is obtained.

[0095] It should be understood that, based on the above description, the second intermediate data packet may include one or more sub-intermediate data packets written before the first intermediate data packet.

[0096] Wherein, if the second intermediate data packet includes only one sub-intermediate data packet, the first sub-intermediate data packet (i.e., the previous intermediate data packet of the first intermediate data packet) and the second sub-intermediate data packet (i.e., the first sub-intermediate data packet of the second intermediate data packet) in the second intermediate data packet are the same intermediate data packet, and the sub-intermediate data packet included in the second intermediate data packet is referred to as the first sub-intermediate data packet. Then, when the characteristic data of the second intermediate data packet is read from the register array through the transition loop data packet, the second loop read cumulative amount of the data packet to be compressed is obtained, which may include the following steps: based on the transition loop data packet, the characteristic data of the first sub-intermediate data packet is read from the register array, and the first loop read cumulative amount of the data packet to be compressed is updated (such as adding 1) to obtain the second sub-loop read cumulative amount of the data packet to be compressed. Wherein, based on the transition loop data packet, the characteristic data of the first sub-intermediate data packet is read from the register array, and the method of reading the characteristic data of the first intermediate data packet from the register array based on the initial loop data packet can be referred to, and will not be repeated here. That is to say, the read index identifier in the metadata of the transition intermediate data packet is the index identifier of the storage location where the first sub-intermediate data packet is stored (i.e., the previous index identifier of the first index identifier), and the characteristic data of the first sub-intermediate data packet can be read from the storage location corresponding to the previous index identifier of the first index identifier in the register array (i.e., the second index identifier). It should be understood that in this case, the data compression threshold is 2, and then after reading the characteristic data of the first sub-intermediate data packet, it can be determined that the accumulated amount of loopback reading has reached the data compression threshold (i.e., 2).

[0097] Specifically, the second intermediate data packet includes a second sub-intermediate data packet and a first sub-intermediate data packet, the second sub-intermediate data packet is the first intermediate data packet in the intermediate data packet corresponding to the target write cumulative amount, and the first sub-intermediate data packet is the intermediate data packet before the first intermediate data packet; the payload of the transition loop data packet includes the characteristic data of the first intermediate data packet; then, when the characteristic data of the second intermediate data packet is read from the register array through the transition loop data packet, obtaining the second loop read cumulative amount of the data packet to be compressed may include the following steps: based on the transition loop data packet, reading the characteristic data of the first sub-intermediate data packet from the register array, updating the first loop read cumulative amount of the data packet to be compressed, and obtaining the first sub-intermediate data packet of the data packet to be compressed. The loop read cumulative amount; the first sub-loop read cumulative amount belongs to the second loop read cumulative amount; when the first sub-loop read cumulative amount does not reach the data compression threshold, the payload of the transition loop data packet is updated by reading the characteristic data of the first sub-intermediate data packet to obtain an updated transition loop data packet; the payload of the updated transition loop data packet includes the characteristic data of the first sub-intermediate data packet and the characteristic data of the first intermediate data packet; when the characteristic data of the second sub-intermediate data packet is read from the register array based on the updated transition loop data packet, the first sub-loop read cumulative amount of the data packet to be compressed is updated to obtain the second sub-loop read cumulative amount of the data packet to be compressed; the second sub-loop read cumulative amount belongs to the second loop read cumulative amount.

[0098] It should be understood that when the second intermediate data packet only includes the second sub-intermediate data packet and the first sub-intermediate data packet, the characteristic data of the first sub-intermediate data packet can be read from the register array first, and then the characteristic data of the second sub-intermediate data packet can be read. In this case, it should be understood that in this case, the data compression threshold is 2, and then after reading the characteristic data of the second sub-intermediate data packet, it can be determined that the cumulative amount of loop reads has reached the data compression threshold (i.e., 3). It should be understood that the transition loop data packet determined based on the initial loop data packet includes the characteristic data of the first intermediate data packet, and the read index identifier in the metadata of the transition loop data packet is the previous index identifier of the first index identifier (i.e., the second index identifier).

[0099] The first sub-loop read cumulative amount refers to the loop read cumulative amount when the characteristic data of the first sub-intermediate data packet is read. The second sub-loop read cumulative amount refers to the loop read cumulative amount when the characteristic data of the second sub-intermediate data packet is read. The second sub-loop read cumulative amount is greater than the first sub-loop read cumulative amount, and the second sub-loop read cumulative amount is greater than the first sub-loop read cumulative amount by 1.

[0100] It should be understood that, based on the transition loop data packet, the characteristic data of the first sub-intermediate data packet is read from the register array, and reference can be made to the method of reading the characteristic data of the first intermediate data packet from the register array based on the initial loop data packet. Specifically, the read index identifier (the read index identifier is the second index identifier in this case) can be obtained from the metadata in the transition loop data packet, and then the characteristic data of the first sub-intermediate data packet can be read from the storage location corresponding to the second index identifier in the register array.

[0101] Further, when the characteristic data packet of the first sub-intermediate data packet is read, it can be determined whether the accumulated amount of the first sub-loop reading reaches the data compression threshold. When the accumulated amount of the first sub-loop reading does not reach the data compression threshold, the payload of the transition loop data packet can be updated by the characteristic data of the first sub-intermediate data packet read to obtain an updated transition loop data packet, that is, a transition loop data packet required for the next loop reading can be generated, which can specifically include: based on the characteristic data of the first intermediate data packet included in the payload of the transition loop data packet and the characteristic data of the first sub-intermediate data packet read, the first intermediate number included in the payload of the transition loop data packet is obtained to obtain an updated transition loop data packet. Then, the payload of the updated transition loop data packet includes the characteristic data of the first intermediate data packet and the first sub-intermediate data packet. It should be understood that the read index identifier in the metadata of the updated transition loop data packet is configured as the previous index identifier of the second index identifier (i.e., the index identifier of the second sub-intermediate data packet), and the data packet type still remains the loop type.

[0102] Furthermore, the processing process of reading the characteristic data of the second sub-intermediate data packet from the register array based on the updated transition loop data packet can refer to the above-mentioned description of reading the characteristic data of the first sub-intermediate data packet from the register array based on the transition loop data packet, which will not be repeated here. In other words, the read index identifier (the read index identifier is the previous index identifier of the second index identifier in this case) can be obtained from the metadata in the updated transition loop data packet, and then the characteristic data of the first sub-intermediate data packet can be read from the storage location corresponding to the previous index identifier of the second index identifier in the register array.

[0103] Furthermore, when the characteristic data of the second sub-intermediate data packet is read from the register array, the first sub-loop reading cumulative amount of the data packet to be compressed is updated, and 1 may be added to the first sub-loop reading cumulative amount, thereby obtaining the second sub-loop reading cumulative amount of the data packet to be compressed. Furthermore, it may be determined whether the second sub-loop reading cumulative amount reaches a data compression threshold. When the second sub-loop reading cumulative amount reaches the data compression threshold, the characteristic data may no longer be read from the register array, thereby generating a target data packet based on the characteristic data of each intermediate data packet read.

[0104] It should be understood that if the second intermediate data packet can also include the first sub-intermediate data packet, the second sub-intermediate data packet, and the third sub-intermediate data packet in the first sub-intermediate data packet and the second sub-intermediate data packet, and the third sub-intermediate data packet is one or more intermediate data packets, then when the characteristic data of the second intermediate data packet is read from the register array through the transition loop data packet, obtaining the second loop read cumulative amount of the data packet to be compressed can include the following steps: based on the transition loop data packet, reading the characteristic data of the first sub-intermediate data packet from the register array, updating the first loop read cumulative amount of the data packet to be compressed, obtaining the updated loop read cumulative amount, and when the updated loop read cumulative amount is not When the data compression threshold is reached, the step of reading the characteristic data of the third sub-intermediate data packet from the register array based on the updated transition loop data packet is first repeated to read the characteristic data of each third sub-intermediate data packet. After reading the characteristic data of each third sub-intermediate data packet, the cumulative amount of loopback reading does not reach the data compression threshold, and then the characteristic data of the second sub-intermediate data packet can be read from the register array based on the updated transition loop data packet of each third sub-intermediate data packet read, and the cumulative amount of loopback reading is updated. Each updated cumulative amount of loopback reading belongs to the second cumulative amount of loopback reading until the updated cumulative amount of loopback reading reaches the data packet compression threshold. Among them, each time the characteristic data of the third sub-intermediate data packet is read from the register array based on the updated transition loop data packet, the relevant description of reading the characteristic data of the second sub-intermediate data packet from the register array based on the updated transition loop data packet can be referred to, and will not be repeated here.

[0105] For example, see Figure 5 , Figure 5 Schematic diagram of the effect of a data loop reading provided by an embodiment of the present application. Figure 5As shown, the register array 510a may include sub-arrays corresponding to three feature dimensions, such as sub-array 501a (such as the sub-array corresponding to feature dimension 0), sub-array 502a (such as the sub-array corresponding to feature dimension 1) and sub-array 503a (such as the sub-array corresponding to feature dimension 2), each of which may include 256 storage locations, and the index identifiers of the 256 storage locations are 0-255. When the accumulated uncompressed intermediate data packets written in the register array reach the data compression threshold (such as the data compression threshold is 8), the feature data can be read from the register array to perform traffic compression. For example, when the feature data (i.e., feature dimension data T80, feature dimension data T81, feature dimension data T82) is written in the storage location with index identifier 7, the accumulated amount of writing reaches the data compression threshold, and then the feature data at the storage locations with index identifiers 0-7 can be obtained in sequence to perform traffic compression.

[0106] Specifically, after obtaining the loopback data packet H0 (such as Figure 5 511a in the figure), the characteristic data can be read from the register array based on the loopback data packet H0 (step S51a). The loopback data packet H0 can be the initial loopback data packet mentioned above, and the loopback data packet H0 can include characteristic dimension data T80, characteristic dimension data T81, and characteristic dimension data T82. The data packet type in the metadata 521a of the loopback data packet H0 is a loopback type, the loopback read cumulative amount is 0, and the read index is identified as 7. Then, when reading the characteristic data from the register array based on the loopback data packet H0, the characteristic data at the storage location with the index identification of 7 can be read, that is, the characteristic dimension data in the area indicated by 504a (that is, characteristic dimension data T80, characteristic dimension data T81, and characteristic dimension data T82) can be read.

[0107] Further, when the accumulated loop reading amount does not reach the data compression threshold, a loop data packet H1 is generated based on the read characteristic data and the loop data packet H0 (step S52a), which is equivalent to updating the payload of the loop data packet H0 with the read characteristic data. Figure 5512a in the figure) may include feature dimension data T80, feature dimension data T81, and feature dimension data T82. The data packet type in the metadata 522a of the loopback data packet H1 is a loopback type, the loopback read cumulative amount is 1, and the read index identifier is 6. Further, based on the loopback data packet H1, feature data is read from the register array (step S53a). Specifically, based on the read index identifier in the metadata of the loopback data packet H1, the feature data at the storage location with the index identifier of 6 is read, that is, the feature dimension data in the area indicated by 505a (that is, feature dimension data T70, feature dimension data T71, and feature dimension data T72) can be read. Further, when the loopback read cumulative amount does not reach the data compression threshold, based on the read feature data and the loopback data packet H1, a loopback data packet H2 is generated (step S54a). The generated loopback data packet H2 (as shown in FIG. 512a in the figure) is generated. Figure 5 The characteristic dimension data T80, characteristic dimension data T81, characteristic dimension data T82, and characteristic dimension data T70, characteristic dimension data T71, characteristic dimension data T72 may be included in the metadata 523a associated with the loopback data packet H2. The data packet type in the metadata 523a is the loopback type, the loopback read cumulative amount is 2, and the read index identifier is 5. Further, the characteristic data may be read again from the register array based on the loopback data packet H2, and then the characteristic data stored in the storage locations with index identifiers of 5, 4, 3, 2, 1, and 0 may be read in sequence, so as to generate the target data packet based on the characteristic data of the 8 intermediate data packets read.

[0108] S105: If the second loop reading cumulative amount reaches the data compression threshold, a target data packet for sending to a target analysis device is generated by using the transition loop data packet and the characteristic data of the data packet to be compressed.

[0109] It should be understood that if the second loop reading cumulative amount reaches the data compression threshold, it means that the number of intermediate data packets corresponding to the characteristic data currently read has reached the condition for performing a flow compression.

[0110] It should be understood that, by using the transition loop data packet and the characteristic data of the data packet to be compressed that is read, a target data packet for sending to a target analysis device is generated. This can be done as follows: when the second loop reading cumulative amount reaches the data compression threshold, the transition loop data packet used to read the characteristic data of the last intermediate data packet (i.e., the second sub-intermediate data packet in the second intermediate data packet) is determined as the target transition loop data packet, and then the characteristic data of each intermediate data packet included in the payload of the target transition loop data packet and the characteristic data of the last intermediate data packet that is read are used to update the payload in the transition loop data packet to obtain the target data packet.

[0111] Specifically, if the second loopback reading cumulative amount reaches the data compression threshold, then a target data packet for sending to a target analysis device is generated by using the transition loopback data packet and the characteristic data of the data packet to be compressed that is read, which may include the following steps: when the second loopback reading cumulative amount reaches the data compression threshold, the characteristic data of the first intermediate data packet and the characteristic data of the first sub-intermediate data packet are determined from the payload of the updated transition loopback data packet; based on the characteristic data of the first intermediate data packet, the characteristic data of the first sub-intermediate data packet and the characteristic data of the second sub-intermediate data packet that is read, the characteristic data of the data packet to be compressed that is read is determined; based on the characteristic data of the data packet to be compressed that is read, the payload in the updated transition loopback data packet is updated to obtain a loopback completion data packet; the data packet type in the metadata associated with the loopback completion data packet is configured as a loopback completion type; and the loopback completion data packet with the loopback completion type is determined as a target data packet for sending to a target analysis device.

[0112] Among them, the loop completion data packet may refer to a data packet that updates the payload in the updated transition loop data packet based on the characteristic data of the data packet to be compressed that is read, and then the data packet type of the loop complete data packet may be configured as a loop completion type, so as to determine the loop completion data packet with the loop completion type as the target data packet. The loop completion type refers to the type of the data packet that has completed the data loop processing. It should be understood that in this scenario, when the second loop reading cumulative amount reaches the data compression threshold, the updated transition loop data packet may be a transition loop data packet for reading the second sub-intermediate data packet, that is, the transition loop data packet for reading the second sub-intermediate data packet may be determined as the above-mentioned target transition loop data packet, and then the characteristic data of the first intermediate data packet and the characteristic data of the first sub-intermediate data packet are determined from the payload of the target transition loop data packet.

[0113] It should be understood that if the second intermediate data packet includes a larger number of intermediate data packets, then when the second loop reading cumulative amount reaches the data compression threshold, the transition loop data packet used to read the characteristic data of the last intermediate data packet (i.e., the second sub-intermediate data packet in the second intermediate data packet) is determined as the target transition loop data packet, and then the characteristic data of each intermediate data packet included in the payload of the target transition loop data packet, as well as the characteristic data of the last intermediate data packet read, are used to determine the characteristic data of the data packet to be compressed, and then the target data packet is generated based on the characteristic data of the data packet to be compressed. Specifically, the payload in the target transition loop data packet may be updated based on the characteristic data of the data packet to be compressed read to obtain the target data packet.

[0114] For example, taking a five-tuple as an example, first allocate a register array of length 255, which may include sub-arrays corresponding to feature dimensions such as source IP, source port, target IP, target port, and protocol. When writing data, write the feature dimension data of each feature dimension into their respective sub-arrays starting from index 0, and after writing, add the write pointer +1 (that is, add 1 to the write index identifier). After writing to the end of the sub-array, reset the write pointer index to 0 and start writing data (or reset the register array and start writing data from the storage location with index identifier 0). When reading data, there are independent variables count (i.e., the cumulative amount of loopback reading) and read_idx (read index identifier) ​​in the metadata of each loopback data packet, which record the count of the read data packet and the current read index respectively. Read the feature data of the data packet in reverse (i.e., the index identifier is from large to small). For each feature data packet read, count count +1 (i.e., the cumulative amount of loopback reading +1), read_idx index -1 (i.e., the read index identifier -1), until count (i.e., the cumulative amount of loopback reading) reaches N (i.e., the data compression threshold), and the target data packet can be generated based on the read feature data.

[0115] It should be understood that, further, after obtaining the target data packet, a data packet sending port for sending the target data packet may be determined, and then the target data packet may be sent to the target analysis device based on the data packet sending port.

[0116] When the target analysis device obtains the target data packet, it can obtain the characteristic data of each intermediate data packet from the payload of the target data packet, for example, it can obtain the characteristic data of the first intermediate data packet and the characteristic of the second intermediate data packet is protective gear, and then it can perform traffic analysis and processing based on the obtained characteristic data of each intermediate data packet, for example, it can count the number of traffic data packets received in a certain time period, and count the number of traffic data packets sent by each source IP.

[0117] See also Figure 6 , Figure 6 FIG. 1 is a flow chart of another method for traffic compression provided by an embodiment of the present application. The method may be executed by a target switching device, for example, the target switching device is Figure 1 The method may at least include the following steps S201 to S207.

[0118] S201. When a first traffic data packet is obtained through a data processing component, N feature dimensions sent by a proxy component are obtained, feature dimension data of the N feature dimensions are extracted from traffic data in the first traffic data packet, and first feature data is determined based on the feature dimension data of the extracted N feature dimensions.

[0119] It should be understood that the target switching device includes a proxy component deployed on the control plane and a data processing component deployed on the data plane. Among them, the control plane is a layer for controlling and managing the operation of the switching device, and the data plane is used to process and forward various types of data on different ports of the target switching device. In an embodiment of the present application, a proxy component for managing the processing process of traffic compression can be deployed in the control plane, and a data processing component for performing traffic compression can be deployed in the data plane. It should be understood that the proxy component can send parameters required in the traffic compression process to the data processing component. For example, the proxy component can send N feature dimensions to be extracted to the data processing component, and can also send data compression thresholds and some available port information to the data processing component, etc., which are not limited here.

[0120] It should be understood that some parameters sent by the proxy component to the data processing component can be obtained from the traffic compression configuration file, and the traffic compression configuration file can refer to a file used to configure the parameters required for traffic compression. For example, the traffic compression configuration file can configure N feature dimensions to be extracted, data compression thresholds for traffic compression, and other information. In other words, the proxy component is used to obtain N feature dimensions or data compression thresholds from the traffic compression configuration file for sending to the data processing component. It should be understood that the traffic compression configuration file can be customized by the user. In other words, in the embodiment of the present application, the user can adjust the traffic compression configuration file to customize some parameters in the traffic compression process, such as how many traffic data packets can be compressed into one data packet (i.e., the data compression threshold), and which feature dimensions of data can be extracted for traffic compression (i.e., N feature dimensions), thereby improving the flexibility of the traffic compression process.

[0121] See also Figure 7 , Figure 7 Schematic diagram of the internal interaction logic of a target switching device provided by an embodiment of the present application. Figure 7 As shown, on the target switching device (such as Figure 7 In the example shown in 701a in FIG. 701a, a control plane 711a and a data plane 712a may be included. An agent component 7111a may be deployed on the control plane 711a. The introduction of the agent component can refer to the above-mentioned related description, which is not repeated here. A data processing component 7121a may be deployed on the data plane. The introduction of the data processing component 7121a can refer to the above-mentioned related description.

[0122] It should be understood that in the embodiment of the present application, the proxy component can send table items to the data processing component, and perform port management on the data processing component. Among them, the table items sent to the data processing component can be sent to the data processing component for N feature dimensions that need to be feature extracted, and the table items of reduced feature dimensions that need to be reduced in dimension for feature data, etc., which are not limited here. The proxy component performs port management on the data processing component, which may include periodically querying whether the data packet sending port in the data processing component is available. When the port is abnormal, the abnormal port can be removed from the available port list of the data processing component, and then the new available port list is sent to the data processing component, so that the data processing component can send the target data packet based on the port in the available port list.

[0123] Furthermore, after the received traffic data packet is compressed by the data processing component, the compressed target data can be obtained, and then the compressed target data packet can be sent to the target analysis device 702a, so that the target analysis device 702a can perform traffic analysis based on the received target data packet.

[0124] See also Figure 8 , Figure 8 Schematic diagram of a processing flow of a data processing component provided in an embodiment of the present application. Figure 8 As shown, in the data processing component 802a in the target switching device 801a, a first processing management line 803a and a second processing pipeline 804a may be included. The first processing pipeline 803a may include a first inlet processing pipeline 831a and a first outlet processing pipeline 832a.

[0125] Among them, the first inlet processing pipeline 831a can be used to extract feature data from the traffic data packet, and construct an initial intermediate data packet based on the extracted feature data, and then copy the initial intermediate data packet to the traffic data packet based on the data volume of the initial intermediate data packet to obtain transitional intermediate data. Among them, the initial intermediate data packet can refer to a data packet obtained by taking the extracted feature data as a payload data packet and adding data packet header information to the feature data as the payload, wherein the data packet header information may include header information on multiple network communication layers, for example, UDP (a transport layer communication protocol) header information may be added to the transport layer, and then IP (a network layer communication protocol) header information may be added to the network layer, and then Ethernet header information may be added to the data link layer to obtain an Ethernet frame, thereby determining the obtained Ethernet frame as the initial intermediate data packet. It should be understood that the data content of the initial intermediate data packet is consistent with the data content of the intermediate data packet finally obtained. The transitional intermediate data packet refers to a data packet obtained by copying the traffic data packet based on the initial intermediate data packet. It should be understood that the transitional intermediate data packet may include data in the initial intermediate data packet, as well as uncopied data belonging to the traffic data packet (such as original data). For example, if the data volume of the traffic data packet is 1500 bytes and the data volume of the initial intermediate data packet is 66 bytes, the initial intermediate data packet can be copied to the first 66 bytes in the traffic data packet. The resulting transitional intermediate data packet includes 66 bytes of data in the initial intermediate data packet and 1434 (i.e. 1500-66) bytes of uncopied data belonging to the traffic data packet (i.e. original data).

[0126] The first egress processing pipeline 832a can be used to perform mirror interception processing on the transition intermediate data packet output by the first ingress processing pipeline. Specifically, the transition intermediate data packet can be mirror intercepted based on the data volume of the initial intermediate data packet, thereby intercepting the original data in the transition intermediate data packet to obtain the target data packet. It is understandable that after obtaining the target data packet, the transition intermediate data packet can be discarded.

[0127] The second processing pipeline 804a may include a second inlet processing pipeline 841a and a second outlet processing pipeline 842a. The second outlet processing pipeline 842a may be used to perform corresponding processing based on the data packet type of the input data packet. If the second outlet processing pipeline 842a receives an intermediate data packet output by the first outlet processing pipeline 832a, the intermediate data packet may be written into the register array, and then the accumulated write amount may be obtained. If the accumulated write amount does not reach the data compression threshold, the intermediate data packet may be discarded, and the next intermediate data packet may be waited for. If the accumulated write amount reaches the data compression threshold, a loopback data packet (i.e., an initial loopback data packet) may be generated based on the intermediate data packet, and the generated loopback data packet may be input into the second inlet processing pipeline 841a. If the second egress processing pipeline 842a receives the loopback data packet output by the second ingress processing pipeline 841a, the characteristic data can be read from the register array based on the read index identifier of the metadata associated with the loopback data packet, and the accumulated loopback reading amount can be obtained. When the accumulated loopback reading amount does not reach the data compression threshold, a new loopback data packet can be generated based on the read characteristic data and the acquired loopback data packet, so that the next characteristic data can be read based on the new loopback data packet (specifically, the characteristic data stored in the storage location corresponding to the previous index identifier can be read). When the accumulated loopback reading amount does not reach the data compression threshold, a target data packet can be generated based on the read characteristic data and the acquired loopback data packet, and the target data packet can be input into the second ingress processing pipeline 841a. If the second egress processing pipeline 842a receives the target data packet output by the second ingress processing pipeline 841a, the target data packet can be directly sent to the target analysis device based on a certain data packet sending port.

[0128] Among them, the second inlet processing pipeline 841a can be used to receive the loopback data packet or the target data packet generated by the second outlet processing pipeline 842a, and then the second inlet processing pipeline 841a can select the output port of the second outlet processing pipeline based on the type of the received data packet. If the second inlet processing pipeline 841a receives the loopback data packet, the output port of the second outlet processing pipeline can be determined as the loopback port based on the loopback type of the loopback data packet. If the second inlet processing pipeline 841a receives the target data packet, the output port of the second outlet processing pipeline can be determined as the data packet sending port based on the loopback completion type of the target data packet, so that when the second outlet processing pipeline 842a receives the target data packet, it can send the compressed target data packet to the target analysis device 805a based on the determined data packet sending port. It should be understood that when the second inlet processing pipeline 841a selects the data packet sending port, the data packet sending port can be selected from the available ports in a load balancing manner, and the available port is issued by the proxy component.

[0129] It is understandable that in the embodiment of the present application, feature data dimensionality reduction can be performed on the data of all or part of the N feature dimensions in the traffic data packet, and then the data obtained based on the feature data dimensionality reduction can be determined as feature dimension data. It should be understood that the feature dimension that needs to be reduced in feature data (i.e., the reduced feature dimension) can be sent by the proxy component to the data processing component. If the feature dimension belongs to the reduced feature dimension, the initial feature data of the feature dimension (i.e., the data directly extracted from the traffic data of the traffic data packet) can be reduced in feature data, and then the data obtained by reducing the feature data of the initial feature data is used as the feature dimension data of the feature dimension; if the feature dimension does not belong to the reduced feature dimension, the initial feature data of the feature dimension may not be reduced in feature data, and then the initial feature data can be directly used as the feature dimension data of the feature dimension.

[0130] Specifically, the N feature dimensions include feature dimension i, where i is less than or equal to N positive integers; the proxy component is used to send the dimension reduction feature dimension to be subjected to feature data dimension reduction and the feature dimension reduction expression corresponding to the dimension reduction feature dimension to the data processing component; then, extracting feature dimension data of N feature dimensions from the traffic data in the first traffic data packet may include the following steps: extracting initial feature data of feature dimension i from the traffic data in the first traffic data packet; if feature dimension i belongs to the dimension reduction feature dimension, obtaining the feature dimension reduction expression corresponding to feature dimension i sent by the proxy component, and based on the feature dimension reduction expression corresponding to feature dimension i, performing feature data dimension reduction processing on the initial feature data of feature dimension i to obtain first-category feature dimension data corresponding to feature dimension i; if feature dimension i does not belong to the dimension reduction feature dimension, determining the initial feature data of feature dimension i as second-category feature dimension data corresponding to feature dimension i; determining the first-category feature dimension data or the second-category feature dimension data corresponding to feature dimension i as feature dimension data of feature dimension i, and determining feature dimension data of N feature dimensions based on the feature dimension data of feature dimension i.

[0131] It should be understood that the feature dimension i can be the i-th feature dimension among N feature dimensions, and the value of i can be 0-N, that is, the feature dimension i can be any feature dimension among the N feature dimensions. It should be understood that the proxy component can be used to send the reduced dimension feature dimension to be subjected to feature data dimension reduction and the feature dimension reduction expression corresponding to the reduced dimension feature dimension to the data processing component. Among them, the reduced dimension feature dimension can refer to the feature dimension to be subjected to feature data dimension reduction, and the feature dimension reduction expression can refer to the expression for performing feature data dimension reduction on the data of the reduced dimension feature dimension, that is, by substituting the data of the reduced dimension feature dimension into the feature dimension reduction expression, the feature dimension data after the feature data dimension reduction can be obtained. It can be understood that the reduced dimension feature dimension sent by the proxy component to the data processing component can be sent in the form of a list. It should be understood that the reduced dimension feature dimension can be all or part of the N feature dimensions.

[0132] Among them, the initial feature data refers to the data on the feature dimension i included in the traffic data of the traffic data packet. For example, the feature dimension i is the source IP. If the source IP in the traffic data packet is 126.168.3.4, then the initial feature data for the feature dimension of the source IP in the traffic data packet is 126.168.3.4.

[0133] The first type of feature dimension data may refer to feature dimension data obtained by performing feature data dimensionality reduction processing, and the second type of feature dimension data may refer to feature dimension data directly using the initial feature data, that is, feature dimension data without performing feature data dimensionality reduction. It should be understood that for a feature dimension, either the first type of feature data or the second type of feature dimension data is obtained, that is, the first type of feature dimension data or the second type of feature dimension data corresponding to feature dimension i is determined as the feature dimension data of feature dimension i.

[0134] Furthermore, based on the method of determining the feature dimension data of the feature dimension i, feature dimension data of N feature dimensions may be determined, and then the first feature data may be determined based on the feature dimension data of the N feature dimensions.

[0135] It should be understood that the feature dimension reduction expression corresponding to the feature dimension i is determined based on the needs of traffic analysis. For example, if the target analysis device only needs to count the number of traffic data packets received by a certain cloud server for traffic analysis, it can only obtain the initial feature data of one feature dimension (such as the source IP address) and reduce the dimension of the initial feature data of the feature dimension, such as reducing the dimension of the source IP address in the traffic data packet to a value of 1. In other words, the dimension reduction feature dimension expression can be for any source IP address, feature dimension data = 1, and then the target analysis device can directly determine the number of traffic data packets based on the number of target data packets, that is, one target data packet corresponds to the traffic data packet corresponding to the data compression threshold (such as 8). Then, each time the target analysis device receives a target data packet, it means that the traffic data packet received by the interactive device is increased by 8, and then the number of traffic data packets received by the cloud server in a certain period of time can be obtained based on the target data packets received in a certain period of time multiplied by the data compression threshold.

[0136] For another example, if the target analysis device needs to count the number of traffic data packets sent based on abnormal ports for traffic analysis, that is, it is necessary to analyze whether the source port of the traffic data packet is a normal port or an abnormal port, wherein the normal port is a port with a value range of 0-1024, and the abnormal port is a port with a port number greater than 1024. Then, the N feature dimensions can be the feature dimension of the source port, and the data of the feature dimension of the source port can be reduced in feature data dimension. For example, when the port number is 0-1024, the feature dimension data is determined to be 1 to indicate that the source port of the corresponding traffic data packet is a normal port, and when the port number is greater than 0-1024, the feature dimension data is determined to be 0 to indicate that the source port of the corresponding traffic data packet is an abnormal port. Furthermore, when the target analysis device obtains the target data packet, it can determine the feature dimension data with data of 0 based on the feature dimension data in the target data packet, so that the number of feature dimension data with data of 0 can be counted, thereby obtaining the number of traffic data packets sent based on the abnormal port. It should be understood that in this scenario, the dimension reduction feature dimension expression can be, for source ports with port numbers between 0 and 1024, feature dimension data = 1, and for source ports with port numbers greater than 1024, feature dimension data = 0. It should be understood that in the embodiment of the present application, other traffic analysis can also be performed, and the feature dimensions for feature extraction and how to reduce the feature data can be determined based on business needs. For example, it can be customized by submitting a traffic compression configuration file to the control plane of the target switching device.

[0137] S202: Construct a first intermediate data packet for traffic compression based on the first characteristic data and the first traffic data packet.

[0138] Specifically, the data processing component includes a first processing pipeline for determining an intermediate data packet, and the first processing pipeline includes a first inlet processing pipeline and a first outlet processing pipeline; then, based on the first characteristic data and the first traffic data packet, constructing a first intermediate data packet for traffic compression may include the following steps: when the first characteristic data is determined through the first inlet processing pipeline, the first characteristic data is used as the payload of the data packet through the first inlet processing pipeline, and data packet header information is added to the first characteristic data as the payload to obtain an initial intermediate data packet; based on the data volume of the initial intermediate data packet, the initial intermediate data packet is copied to the first traffic data packet to obtain a transitional intermediate data packet; through the first outlet processing pipeline, based on the data volume of the initial intermediate data packet, the transitional intermediate data packet is mirrored and intercepted to obtain a mirrored data packet, the data packet type of the metadata associated with the mirrored data packet is configured as a mirrored type, and the mirrored data packet with the mirrored type is determined as the first intermediate data packet for traffic compression.

[0139] Among them, the method for determining the initial intermediate data packet and the transition intermediate data packet can refer to the above-mentioned related description, which will not be repeated here. It should be understood that the data packet header information added for the characteristic data includes the destination device information for indicating that the data packet is sent to the target analysis device, for example, it may include the IP address, MAC address and other information of the target analysis device. It should be understood that the mirror data packet can be a data packet that performs mirror interception processing on the transition intermediate data packet without configuring the data packet type, and then when the data packet type of the metadata associated with the mirror data packet is configured as the mirror type, the intermediate data packet (such as the first intermediate data packet) is determined.

[0140] See also Fig. 9 , Fig. 9 FIG. 1 is a flow chart of obtaining an intermediate data packet provided by an embodiment of the present application. Fig. 9As shown, the traffic data packet 901a may include an Ethernet header 1 (e.g., occupying (148B), an IP header 1 (e.g., occupying 20B), a payload 1, and some header information of other communication protocols (e.g., header information of a tunneling protocol, an ICMP protocol, etc.). Furthermore, in the first inlet processing pipeline, feature extraction may be performed on the traffic data packet 901a to obtain feature data T1, and then an initial intermediate data packet 902a is generated based on the feature data T1 obtained by feature extraction (step S91a). The initial intermediate data packet 902a may include feature data T1, and the feature data T1 may be the payload of the initial intermediate data packet 902a. The initial intermediate data packet 902a may also include data packet header information, such as a UDP header, an IP header 2, and an Ethernet header 2. It can be understood that the Ethernet header 2 in the initial intermediate data packet 902a The Ethernet header 1 in the traffic data packet 901a may be different, and the IP header 2 in the initial intermediate data packet 902a may be different from the IP header 1 in the traffic data packet 901a. It can be understood that in the embodiment of the present application, the header information added to the characteristic data T1 at the transport layer may be a UDP header, that is, the protocol type used at the transport layer may be a UDP protocol. This is because the UDP protocol does not require a three-way handshake to establish a link before communication can be carried out, and thus after the target data packet is generated, the target data packet can be directly sent to the target analysis device. Furthermore, the initial intermediate data packet can be copied to the traffic data packet (step S92a) to obtain a transition intermediate data packet 903a. Among them, the transition intermediate data packet 903a may include the data in the initial intermediate data packet 902a, as well as the uncopied data belonging to the traffic data packet (that is, the original data, such as Fig. 9 904a in FIG. 1 ).

[0141] Further, in the first egress processing pipeline, the unrewritten data belonging to the traffic data packet in the transition intermediate data packet can be mirrored (step S93a), that is, when the transition intermediate data packet is mirrored, the original data in the transition intermediate data packet 903a is intercepted to obtain the intermediate data packet 905a. It can be seen that the data in the intermediate data packet 905a is consistent with the data in the initial intermediate data packet 902a. It should be understood that the metadata 906a associated with the intermediate data packet 905a may include a data packet type, a loopback read cumulative amount, and a read index identifier, wherein the data packet type is a mirror type, and since the data packet of the mirror type is not used for loopback reading, its corresponding loopback read cumulative amount is 0 (or can be a null value), and the read index identifier can be a null value.

[0142] S203, write the characteristic data of the first intermediate data packet into the register array, and obtain the target write cumulative amount of the data packet to be compressed associated with the register array; the data packet to be compressed includes the first intermediate data packet and the second intermediate data packet; the second intermediate data packet is the intermediate data packet written into the register array before the first intermediate data packet.

[0143] Specifically, the target switching device includes a data processing component deployed on the data plane; the data processing component includes a first processing pipeline for determining an intermediate data packet, and a second processing pipeline for reading and writing the intermediate data packet, and the second processing pipeline includes a second export processing pipeline; then, writing the characteristic data in the first intermediate data packet to the register array and obtaining the target write cumulative amount of the data packet to be compressed associated with the register array can include the following steps: when the first intermediate data packet is determined based on the first processing pipeline, the first intermediate data packet is input into the second export processing pipeline, and the data packet type of the first intermediate data packet is obtained from the metadata of the first intermediate data packet through the second export processing pipeline; the data packet type of the first intermediate data packet is a mirror type; when it is determined through the second export processing pipeline that the data packet type of the first intermediate data packet is a mirror type, the characteristic data of the first intermediate data packet is written to the register array, the initial write cumulative amount of the data packet to be compressed associated with the register array is obtained, the initial write cumulative amount is updated, and the target write cumulative amount is obtained.

[0144] It should be understood that the first processing pipeline and the second processing pipeline can be introduced with reference to the above Figure 7 The method of writing the characteristic data of the first intermediate data packet into the register array can refer to the above Figure 4 For the method of determining the target write cumulative amount, please refer to the above related description and will not be repeated here.

[0145] S204: If the target write cumulative amount reaches the data compression threshold associated with the register array, an initial loopback data packet for loopback reading is generated based on the first intermediate data packet.

[0146] Specifically, if the target write cumulative amount reaches the data compression threshold associated with the register array, an initial loopback data packet for loopback reading is generated based on the first intermediate data packet, including: when it is determined through the second egress processing pipeline that the target write cumulative amount reaches the data compression threshold associated with the register array, the data packet type in the metadata associated with the first intermediate data packet is updated to a loopback type, and the first intermediate data packet whose data packet type is updated to the loopback type is determined as the initial loopback data packet.

[0147] It should be understood that the process of determining the initial loopback data packet can refer to the above related description, which will not be repeated here.

[0148] Optionally, the target switching device also includes a proxy component deployed on the control plane; the proxy component is used to determine the loopback port for loopback reading; the second processing pipeline includes a second inlet processing pipeline; then, the embodiment of the present application may also include the following steps: inputting the initial loopback data packet into the second inlet processing pipeline through the loopback port, and obtaining the data packet type of the initial loopback data packet from the metadata of the initial loopback data packet through the second inlet processing pipeline; the data packet type of the initial loopback data packet is the loopback type; determining the loopback port based on the loopback type, and using the loopback port as the first output port associated with the initial loopback data packet; the first output port is used to input the transition loopback data packet into the second inlet processing pipeline through the first output port when a transition loopback data packet is determined through the second outlet processing pipeline based on the read feature data and the initial loopback data packet.

[0149] It should be understood that the first output port can be an output port associated with the initial loopback data packet, and the first output port can be an output port of a data packet generated based on the second egress processing pipeline after the initial loopback data packet is input into the second egress processing pipeline. The loopback port can be a port for looping back the data packet and inputting it into the second ingress processing pipeline. The loopback port can be configured by an agent component in the control plane, such as configuring a port with a specified port number as a loopback port. Further, the first output port is used to input the transition loopback data packet into the second ingress processing pipeline through the first output port when the transition loopback data packet is determined by the second egress processing pipeline based on the read characteristic data and the initial loopback data packet, thereby realizing the entire loopback process.

[0150] S205. When the characteristic data of the first intermediate data packet is read from the register array through the initial loop data packet, the first loop reading cumulative amount of the data packet to be compressed is obtained. When the first loop reading cumulative amount does not reach the data compression threshold, a transition loop data packet for loop reading is generated through the initial loop data packet and the characteristic data of the read first intermediate data packet.

[0151] S206: When the characteristic data of the second intermediate data packet is read from the register array through the transition loop data packet, the second loop reading cumulative amount of the data packet to be compressed is obtained.

[0152] S207: If the second loop reading cumulative amount reaches the data compression threshold, a target data packet for sending to a target analysis device is generated by using the transition loop data packet and the characteristic data of the data packet to be compressed.

[0153] Optionally, the target switching device includes a proxy component deployed on the control plane and a data processing component deployed on the data plane; the proxy component is used to determine the loopback port for loopback reading and the data packet sending port for data packet sending; the data processing component includes a second processing pipeline, and the second processing pipeline includes a second egress processing pipeline and a second ingress processing pipeline; then, the embodiment of the present application may also include the following steps: inputting the target data packet into the second ingress processing pipeline through the loopback port, and obtaining the data packet type of the target data packet from the metadata of the target data packet through the second ingress processing pipeline; the data packet type of the target data packet is a loopback completion type; determining the data packet sending port based on the loopback completion type, and using the data packet sending port as the second output port associated with the target data packet; when it is determined through the second egress processing pipeline that the data packet type of the target data packet is a loopback completion type, sending the target data packet to the target analysis device through the second output port, so that the target analysis device parses the target data packet to obtain characteristic data of the first intermediate data packet and characteristic data of the second intermediate data packet, and performs traffic analysis processing based on the characteristic data of the first intermediate data packet and the characteristic data of the second intermediate data packet.

[0154] The data packet sending port may be a port for sending the target data packet to the target analysis device. The second output port may be an output port associated with the target data packet, and the second output port may be a port for sending the target data packet based on the second output processing pipeline after the target data packet is input into the second output processing pipeline.

[0155] It should be understood that the target analysis device can parse the target data packet to obtain various characteristic data (such as the characteristic data of the first intermediate data packet and the characteristic data of the second intermediate data packet), and then perform traffic analysis based on the characteristic data of the first intermediate data packet and the characteristic data of the second intermediate data packet. The specific method of performing traffic analysis can be found in the above-mentioned relevant description and will not be elaborated here.

[0156] See also Fig.10 , Fig.10 Schematic diagram of a data processing component provided in an embodiment of the present application. Fig.10 As shown, the data processing component can receive traffic data packets from multiple data packet receiving ports, such as data packet receiving port Po1, data packet receiving port Po2, data packet receiving port Po3, etc. Then, in the data processing component, the compressed target data packet can be determined through the first processing pipeline and the second processing pipeline, wherein the first processing pipeline includes a first inlet processing pipeline 1001a and a first outlet processing pipeline 1002a, and the second processing pipeline includes a second inlet processing pipeline 1003a and a second outlet processing pipeline 1004a.

[0157] Further, the traffic data packet can be input into the first inlet processing pipeline 1001a, and in the first inlet processing pipeline 1001a, the traffic data packet can be analyzed by the inlet analyzer 1, so that the traffic data in the traffic data packet can be feature extracted (i.e., extracting the initial feature data of N feature dimensions), and then feature calculation (i.e., feature data dimension reduction) can be performed to generate feature data (also called feature key), and then the above-mentioned transition intermediate data packet can be obtained by the inlet reverse analyzer 1. It should be understood that the target switching device can include a manager (i.e., Packet Replication Engine & Traffic Manager), which can be used to perform traffic management and packet replication in the target switching device.

[0158] Further, the transition intermediate data packet output by the first inlet processing pipeline 1001a can be input to the first outlet processing pipeline 1002a. In the first outlet processing pipeline 1002a, the transition intermediate data packet can be analyzed by the outlet analyzer 1, and the transition intermediate data packet can be image intercepted to intercept the original data in the transition intermediate data packet, and then the intermediate data packet is determined based on the outlet inverse analyzer 1.

[0159] Furthermore, the intermediate data packet can be input into the second egress processing pipeline 1004a. In the second egress processing pipeline, the intermediate data packet can be analyzed by the egress analyzer 2 to determine the data packet type of the intermediate data packet. When it is determined that the data packet type of the intermediate data packet is a mirror type, characteristic data of the intermediate data packet can be stored (specifically, the characteristic data can be stored in a register array, which is not described in detail here). Furthermore, it can be determined whether the cumulative write amount reaches the data compression threshold. If the cumulative write amount reaches the data compression threshold, a loopback data packet can be generated (that is, an initial loopback data packet is generated, and its specific generation process can refer to the above-mentioned related description, which is not described in detail here). Furthermore, when the initial loopback data packet is determined by the egress inverse analyzer 2, the initial intermediate data packet is input into the second ingress processing pipeline 1003a through the loopback port; if the cumulative write amount does not reach the data compression threshold, the intermediate data packet can be discarded, and then wait for a new intermediate data packet to be written.

[0160] Furthermore, when the second inlet processing pipeline 1003a receives a loopback data packet (such as an initial loopback data packet or a transition loopback data packet), the loopback data packet can be parsed by the inlet analyzer 2, and then the output port can be selected according to the data packet type. For example, the loopback port can be determined as the output port based on the loopback type of the loopback data packet, and then the loopback data packet that is the same as the input loopback data packet can be retrieved based on the inlet inverse analyzer 2.

[0161] Further, the loopback data packet can be input into the second egress processing pipeline 1004a, in which the loopback data packet can be analyzed by the egress analyzer 2, and then the data packet type can be determined, and then the data packet type of the loopback data packet can be determined to be a loopback type, and then the characteristic data can be read (specifically, the characteristic data can be read from the register array, and the specific reading process is not repeated here). Further, it can be determined whether the accumulated amount of loopback reading reaches the data compression threshold, and if the accumulated amount of non-loopback reading does not reach the data compression threshold, the loopback reading can be continued, and then the egress reverse analyzer 2 can generate a new loopback data packet based on the characteristic data and the loopback data packet read by the loopback, and the new loopback data packet is input into the second inlet processing pipeline 1003a through the loopback port, so that the output port of the new loopback data packet is selected by the second inlet processing pipeline 1003a, and then the new data packet is input into the second egress processing pipeline 1004a, thereby repeating the process from the second inlet processing pipeline to the second egress processing pipeline until the accumulated amount of loopback reading reaches the data compression threshold. When the accumulated amount of loopback reading reaches the data compression threshold, a target data packet can be generated, and then when the target data packet is obtained based on the egress inverse analyzer 2, the target data packet can be input into the second inlet processing pipeline 1003a through the loopback port.

[0162] Further, when the second inlet processing pipeline 1003a receives the target data packet, the target data packet can be parsed by the inlet analyzer 2, and then the output port can be selected according to the data packet type. For example, the data packet sending port can be determined as the output port based on the loop completion type of the target data packet, such as determining the data packet sending port Po34 as the output port, and then the target data packet identical to the input target data packet can be retrieved based on the inlet reverse analyzer 2. Further, the target data packet can be input into the second outlet processing pipeline 1004a, and then the target data packet can be analyzed by the outlet analyzer 2 to determine the data packet type of the target data packet. When it is determined that the data packet type of the target data packet is the loop completion type, the target data packet can be directly sent. Specifically, when the target data packet is determined based on the outlet reverse analyzer 2, the target data packet can be sent based on the output port (such as the data packet sending port Po34) determined by the second inlet processing pipeline 1003a.

[0163] It is understandable that in an embodiment of the present application, in a data processing component, multiple groups of processing pipelines may be deployed, one group of processing pipelines includes a first processing pipeline and a second processing pipeline, and the processing logic of each group of processing pipelines is the same, and specific reference may be made to the processing logic of the first processing pipeline and the second processing pipeline, which will not be described in detail here. It is understandable that different groups of processing pipelines may be used to process data packets received by different data packet receiving ports, such as one group of processing pipelines for performing flow compression on flow packets received by data packet receiving ports with port numbers of 1-16, and another group of processing pipelines for performing flow compression on flow packets received by data packet receiving ports with port numbers of 16-32, thereby performing flow compression on multiple groups of data processing pipelines in parallel, thereby improving the efficiency of flow compression.

[0164] See also Fig.11 , Fig.11 Schematic diagram of a flow compression method provided by an embodiment of the present application. Fig.11 As shown, the network service provider 1101a (i.e., ISP) can send traffic data packets to the public network switching platform 1102a (such as TIX, which is used to forward the data packets to the cloud server), so that the public network switching platform 1102a can forward the traffic data packets to the cloud server (such as cloud server 1103a). Then, the traffic data packets sent by the network service provider to each cloud server can be split by an optical splitter to an intranet switch, such as intranet switch 1 (such as Fig.11 1104a in the figure) or the intranet switch 2 (as shown in Fig.11 As shown in 1105a in FIG. 1 , the intranet switch may be a switching device for forwarding traffic data packets to be analyzed. The intranet switch may be an ECOPT (a type of switch) switch. The number of intranet switches is not limited here. Further, the intranet switch may send the traffic data packets to the target switching device, such as the target switching device 1 (such as Fig.11 1106a in FIG. 1106a ) and the target switching device 2 (as shown in FIG. Fig.11 1107a in FIG. 1107 ), the number of target switching devices is not limited here. After the traffic data packet is compressed based on the target switching device, a compressed target data packet can be obtained, and then the target data packet can be sent to the target analysis device. For example, the target analysis device can be target analysis device 1 (such as Fig.11 1108a in FIG. 1108a), target analysis device 2 (such as Fig.11 1109a in FIG. 1109 ), target analysis device 3 (such as Fig.11 1110a in FIG. 1110a), target analysis device 4 (such as Fig.11As shown in 1111a in the figure), the number of target analysis devices is not limited here. The target analysis device can then perform traffic analysis based on the received target data packets, and then perform corresponding processing based on the results of the traffic analysis. For example, if the analysis shows that the cloud server 1103a is under malicious attack, the data packets sent to the cloud server 1103a can be pulled into the protection device, so that the data packets sent to the cloud server 1103a can be cleaned by the protection device (such as denying access to illegal addresses), and then the data packets after traffic cleaning are sent to the cloud server 1103a, thereby preventing the cloud server from being attacked and improving the security of the cloud server.

[0165] See also Fig.12 , Fig.12 Schematic diagram of a flow compression device provided in an embodiment of the present application. Fig.12 As shown, the traffic compression device 1 can be a computer program (including program code) running on a target switching device (for example, the target switching device 120a mentioned above), for example, the traffic compression device 1 is an application software; it can be understood that the traffic compression device 1 can be used to execute the corresponding steps of the traffic compression method provided in the embodiment of the present application. Fig.12 As shown, the traffic compression device 1 may include: a feature writing module 11, a reading and judging module 12, a data loop reading module 13, and a target data packet generating module 14;

[0166] The feature writing module 11 is used to write the feature data of the first intermediate data packet into the register array, and obtain the target write cumulative amount of the data packet to be compressed associated with the register array; the data packet to be compressed includes the first intermediate data packet and the second intermediate data packet; the second intermediate data packet is the intermediate data packet written into the register array before the first intermediate data packet;

[0167] A read judgment module 12, configured to generate an initial loopback data packet for loopback reading based on the first intermediate data packet if the target write cumulative amount reaches a data compression threshold associated with the register array;

[0168] The data loopback reading module 13 is used to obtain a first loopback reading cumulative amount of the data packet to be compressed when the characteristic data of the first intermediate data packet is read from the register array through the initial loopback data packet, and generate a transition loopback data packet for loopback reading through the initial loopback data packet and the characteristic data of the first intermediate data packet read when the first loopback reading cumulative amount does not reach the data compression threshold;

[0169] A data loopback reading module 13, configured to obtain a second loopback reading cumulative amount of the data packet to be compressed when the characteristic data of the second intermediate data packet is read from the register array through the transition loopback data packet;

[0170] The target data packet generating module 14 is used to generate a target data packet for sending to a target analysis device through the transition loop data packet and the read characteristic data of the data packet to be compressed if the second loop reading cumulative amount reaches the data compression threshold.

[0171] The characteristic data of the first intermediate data packet is the first characteristic data; the target switching device includes a proxy component deployed on the control plane and a data processing component deployed on the data plane; the proxy component is used to obtain N characteristic dimensions for sending to the data processing component from the traffic compression configuration file; N is a positive integer;

[0172] The flow compression device 1 further includes: an intermediate data packet generating module 15;

[0173] The intermediate data packet generation module 15 is specifically used for:

[0174] When the first traffic data packet is obtained through the data processing component, the N feature dimensions sent by the proxy component are obtained, feature dimension data of the N feature dimensions are extracted from the traffic data in the first traffic data packet, and the first feature data is determined based on the extracted feature dimension data of the N feature dimensions;

[0175] Based on the first characteristic data and the first traffic data packet, the first intermediate data packet for traffic compression is constructed.

[0176] The N feature dimensions include a feature dimension i, i being less than or equal to N positive integers; the proxy component is used to send the reduced feature dimension to be subjected to feature data dimensionality reduction and the feature dimensionality reduction expression corresponding to the reduced feature dimension to the data processing component;

[0177] The intermediate data packet generation module 15 is specifically used for:

[0178] Extracting initial feature data of the feature dimension i from the traffic data in the first traffic data packet;

[0179] If the feature dimension i belongs to the dimension reduction feature dimension, obtain the feature dimension reduction expression corresponding to the feature dimension i issued by the proxy component, and perform feature data dimension reduction processing on the initial feature data of the feature dimension i based on the feature dimension reduction expression corresponding to the feature dimension i to obtain the first type of feature dimension data corresponding to the feature dimension i;

[0180] If the feature dimension i does not belong to the dimension reduction feature dimension, the initial feature data of the feature dimension i is determined as the second type of feature dimension data corresponding to the feature dimension i;

[0181] The first type of feature dimension data or the second type of feature dimension data corresponding to the feature dimension i is determined as the feature dimension data of the feature dimension i, and the feature dimension data of the N feature dimensions are determined based on the feature dimension data of the feature dimension i.

[0182] Wherein, the data processing component comprises a first processing pipeline for determining an intermediate data packet, the first processing pipeline comprising a first inlet processing pipeline and a first outlet processing pipeline;

[0183] The intermediate data packet generating module 15 is specifically used for:

[0184] When the first characteristic data is determined by the first inlet processing pipeline, the first characteristic data is used as a payload of a data packet by the first inlet processing pipeline, and data packet header information is added to the first characteristic data as the payload to obtain an initial intermediate data packet;

[0185] Based on the data volume of the initial intermediate data packet, the initial intermediate data packet is copied to the first traffic data packet to obtain a transitional intermediate data packet;

[0186] Through the first egress processing pipeline, the transitional intermediate data packet is mirrored and intercepted based on the data volume of the initial intermediate data packet to obtain a mirrored data packet, the data packet type of the metadata associated with the mirrored data packet is configured as a mirrored type, and the mirrored data packet having the mirrored type is determined as the first intermediate data packet for traffic compression.

[0187] The flow compression device 1 further includes: an intermediate data packet discarding module 16;

[0188] The intermediate data packet discarding module 16 is specifically used for:

[0189] If the target write cumulative amount does not reach the data compression threshold associated with the register array, the first intermediate data packet is discarded.

[0190] The feature data of the first intermediate data packet is the first feature data, the first feature data includes first feature dimension data of N feature dimensions, N is a positive integer; the register array includes N sub-arrays corresponding to the N feature dimensions, one sub-array corresponds to one feature dimension, each of the N sub-arrays includes K storage locations, K is a positive integer, and the value of K is greater than or equal to the data compression threshold; the K storage locations included in each sub-array are associated with corresponding index identifiers;

[0191] The feature writing module 11 is specifically used for:

[0192] Determine an empty storage position from the K storage positions of any subarray of the N subarrays, and determine the smallest index identifier among the index identifiers corresponding to the empty storage position as the first index identifier;

[0193] Determine a first storage position of each sub-array from the K storage positions of each sub-array based on the first index identifier; the index identifier of the first storage position of each sub-array is the first index identifier;

[0194] The first feature dimension data of each feature dimension of the N feature dimensions is respectively written into the first storage position in the sub-array corresponding to each feature dimension.

[0195] The feature data of the first intermediate data packet is the first feature data, and the first feature data includes first feature dimension data of N feature dimensions, where N is a positive integer; the register array includes N sub-arrays corresponding to the N feature dimensions, and one sub-array corresponds to one feature dimension; each of the N sub-arrays includes a first storage location for storing the first feature dimension data on the corresponding feature dimension, and the index identifier of the first storage location of each sub-array is a first index identifier; the read index identifier in the metadata associated with the initial loopback data packet is the first index identifier;

[0196] The data loopback reading module 13 is specifically used for:

[0197] Acquire the first index identifier from metadata associated with the initial loopback data packet, and determine a first storage position of each sub-array from the storage positions included in each sub-array based on the first index identifier;

[0198] The first feature dimension data of the feature dimension corresponding to each sub-array is read from the first storage position of each sub-array respectively, and the read first feature data is determined based on the read first feature dimension data of each feature dimension.

[0199] The metadata associated with the initial loop data packet includes the initial loop reading cumulative amount of the data packet to be compressed;

[0200] The data loopback reading module 13 is specifically used for:

[0201] The initial loop read cumulative amount is obtained from metadata associated with the initial loop data packet, and the initial loop read cumulative amount is updated to obtain a first loop read cumulative amount of the data packet to be compressed.

[0202] The second intermediate data packet includes a first sub-intermediate data packet, and the first sub-intermediate data packet is an intermediate data packet before the first intermediate data packet; the register array includes a second storage location for storing characteristic data of the first sub-intermediate data packet, and the index identifier of the second storage location is a second index identifier;

[0203] The data loopback reading module 13 is specifically used for:

[0204] The payload in the initial loop data packet is updated based on the characteristic data of the first intermediate data packet read to obtain an initial loop update data packet, the read index identifier in the metadata of the updated initial loop data packet is updated to the second index identifier, and the initial loop update data packet after the updated read index identifier is determined as the transition loop data packet; the read index identifier in the metadata associated with the transition loop data packet is used to read the characteristic data of the first sub-intermediate data packet from the storage location corresponding to the second index identifier based on the transition loop data packet.

[0205] The second intermediate data packet includes a second intermediate sub-data packet and a first intermediate sub-data packet, the first intermediate sub-data packet is the previous intermediate data packet of the first intermediate data packet; the second intermediate sub-data packet is the first intermediate data packet in the second intermediate data packet, and the payload of the transition loopback data packet includes characteristic data of the first intermediate data packet;

[0206] The data loopback reading module 13 is specifically used for:

[0207] Based on the transition loop data packet, characteristic data of the first sub-intermediate data packet is read from the register array, and the first loop read cumulative amount of the data packet to be compressed is updated to obtain the first sub-loop read cumulative amount of the data packet to be compressed; the first sub-loop read cumulative amount belongs to the second loop read cumulative amount;

[0208] When the accumulated amount of the first sub-loop readings does not reach the data compression threshold, the payload of the transition loop data packet is updated by reading the characteristic data of the first sub-intermediate data packet to obtain an updated transition loop data packet; the payload of the updated transition loop data packet includes the characteristic data of the first sub-intermediate data packet and the characteristic data of the first intermediate data packet;

[0209] When the characteristic data of the second sub-intermediate data packet is read from the register array based on the updated transition loop data packet, the first sub-loop read cumulative amount of the data packet to be compressed is updated to obtain the second sub-loop read cumulative amount of the data packet to be compressed; the second sub-loop read cumulative amount belongs to the second loop read cumulative amount.

[0210] Wherein, the target data packet generating module 14 is specifically used for:

[0211] When the accumulated amount of the second loop reading reaches the data compression threshold, determining the characteristic data of the first intermediate data packet and the characteristic data of the first sub-intermediate data packet from the payload of the updated transition loop data packet;

[0212] Based on the characteristic data of the first intermediate data packet, the characteristic data of the first sub-intermediate data packet and the characteristic data of the second sub-intermediate data packet, the characteristic data of the read data packet to be compressed is determined, and the payload in the updated transition loop data packet is updated based on the characteristic data of the read data packet to be compressed to obtain a loop completion data packet, and the data packet type in the metadata associated with the loop completion data packet is configured as a loop completion type, and the loop completion data packet with the loop completion type is determined as a target data packet for sending to a target analysis device.

[0213] The target switching device includes a data processing component deployed on a data plane; the data processing component includes a first processing pipeline for determining an intermediate data packet, and a second processing pipeline for reading and writing the intermediate data packet, and the second processing pipeline includes a second egress processing pipeline;

[0214] The feature writing module 11 is specifically used for:

[0215] When the first intermediate data packet is determined based on the first processing pipeline, the first intermediate data packet is input into the second egress processing pipeline, and a data packet type of the first intermediate data packet is obtained from metadata of the first intermediate data packet through the second egress processing pipeline; the data packet type of the first intermediate data packet is a mirror type;

[0216] When it is determined through the second egress processing pipeline that the data packet type of the first intermediate data packet is the mirror type, the characteristic data of the first intermediate data packet is written into the register array, the initial write accumulation of the data packet to be compressed associated with the register array is obtained, the initial write accumulation is updated, and the target write accumulation is obtained.

[0217] The reading judgment module 12 is specifically used for:

[0218] When it is determined through the second egress processing pipeline that the target write accumulation amount reaches the data compression threshold associated with the register array, the packet type in the metadata associated with the first intermediate packet is updated to a loop type, and the first intermediate packet whose packet type is updated to the loop type is determined as the initial loop packet.

[0219] Wherein, the target switching device further comprises an agent component deployed on the control plane; the agent component is used to determine the loopback port for loopback reading; the second processing pipeline comprises a second inlet processing pipeline;

[0220] The flow compression device 1 further includes: a first output port determination module 17;

[0221] The first output port determination module 17 is specifically used for:

[0222] Inputting the initial loopback data packet into the second inlet processing pipeline through the loopback port, obtaining the data packet type of the initial loopback data packet from the metadata of the initial loopback data packet through the second inlet processing pipeline; the data packet type of the initial loopback data packet is a loopback type;

[0223] The loopback port is determined based on the loopback type, and the loopback port is used as the first output port associated with the initial loopback data packet; the first output port is used to input the transition loopback data packet into the second inlet processing pipeline through the first output port when the transition loopback data packet is determined based on the read characteristic data and the initial loopback data packet through the second egress processing pipeline.

[0224] The target switching device includes an agent component deployed on a control plane and a data processing component deployed on a data plane; the agent component is used to determine a loopback port for loopback reading and a data packet sending port for data packet sending; the data processing component includes a second processing pipeline, and the second processing pipeline includes a second egress processing pipeline and a second ingress processing pipeline;

[0225] The flow compression device 1 further includes: a data packet sending module 18;

[0226] The data packet sending module 18 is specifically used for:

[0227] Inputting the target data packet into the second inlet processing pipeline through the loopback port, obtaining the data packet type of the target data packet from the metadata of the target data packet through the second inlet processing pipeline; the data packet type of the target data packet is a loopback completion type;

[0228] Determine the data packet sending port based on the loop completion type, and use the data packet sending port as a second output port associated with the target data packet;

[0229] When it is determined through the second egress processing pipeline that the packet type of the target data packet is the loop completion type, the target data packet is sent to the target analysis device through the second output port, so that the target analysis device parses the target data packet to obtain the characteristic data of the first intermediate data packet and the characteristic data of the second intermediate data packet, and performs traffic analysis processing based on the characteristic data of the first intermediate data packet and the characteristic data of the second intermediate data packet.

[0230] See also Fig.13 , Fig.13 Schematic diagram of the structure of a computer device provided in an embodiment of the present application. Fig.13 As shown, the computer device 1000 may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, the user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the user interface 1003 may optionally include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 1005 may optionally also be at least one storage device located away from the aforementioned processor 1001. As Fig.13 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application program.

[0231] In such Fig.13In the computer device 1000 shown, the network interface 1004 can provide a network communication function; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the device control application stored in the memory 1005 to execute the description of the flow compression method in any of the corresponding embodiments above, which will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated.

[0232] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the aforementioned flow compression device 1, and the computer program includes program instructions. When the processor executes the program instructions, it can execute the description of the flow compression method in the previous embodiment, so it will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.

[0233] The above-mentioned computer-readable storage medium can be the flow compression device provided by any of the aforementioned embodiments or the internal storage unit of the above-mentioned computer device, such as the hard disk or memory of the computer device. The computer-readable storage medium can also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (smart media card, SMC), a secure digital (secure digital, SD) card, a flash card (flash card), etc. equipped on the computer device. Furthermore, the computer-readable storage medium can also include both the internal storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium can also be used to temporarily store data that has been output or is to be output.

[0234] In addition, it should be noted here that: the embodiment of the present application also provides a computer program product or a computer program, which includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided by any of the corresponding embodiments in the foregoing text. In addition, the description of the beneficial effects of adopting the same method will not be repeated. For technical details not disclosed in the computer program product or computer program embodiment involved in this application, please refer to the description of the method embodiment of this application.

[0235] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories), or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0236] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, device, product, or equipment that includes a series of steps or units is not limited to the listed steps or modules, but optionally includes steps or modules that are not listed, or optionally includes other step units inherent to these processes, methods, devices, products, or equipment.

[0237] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0238] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A flow compression method, characterized in that: The method is performed by a target switching device, and the method includes: Writing characteristic data of a first intermediate data packet into a register array, and obtaining a target cumulative amount of data packets to be compressed associated with the register array; the data packets to be compressed include the first intermediate data packet and a second intermediate data packet; the second intermediate data packet is an intermediate data packet written into the register array before the first intermediate data packet; If the target write cumulative amount reaches the data compression threshold associated with the register array, generating an initial loopback data packet for loopback reading based on the first intermediate data packet; When the characteristic data of the first intermediate data packet is read from the register array through the initial loop data packet, a first loop reading cumulative amount of the data packet to be compressed is obtained, and when the first loop reading cumulative amount does not reach the data compression threshold, a transition loop data packet for loop reading is generated through the initial loop data packet and the characteristic data of the first intermediate data packet read; When the characteristic data of the second intermediate data packet is read from the register array through the transition loop data packet, obtaining the second loop reading cumulative amount of the data packet to be compressed; If the second loop reading accumulation reaches the data compression threshold, a target data packet for sending to a target analysis device is generated through the transition loop data packet and the read characteristic data of the data packet to be compressed.

2. The method according to claim 1, characterized in that The characteristic data of the first intermediate data packet is the first characteristic data; the target switching device includes a proxy component deployed on the control plane and a data processing component deployed on the data plane; the proxy component is used to obtain N characteristic dimensions from the traffic compression configuration file for sending to the data processing component; N is a positive integer; The method further comprises: When the first traffic data packet is obtained through the data processing component, the N feature dimensions sent by the proxy component are obtained, feature dimension data of the N feature dimensions are extracted from the traffic data in the first traffic data packet, and the first feature data is determined based on the extracted feature dimension data of the N feature dimensions; Based on the first characteristic data and the first traffic data packet, the first intermediate data packet for traffic compression is constructed.

3. The method according to claim 2, characterized in that The N feature dimensions include a feature dimension i, where i is a positive integer less than or equal to N; the proxy component is used to send the reduced dimension feature dimension to be subjected to feature data dimensionality reduction and the feature dimension reduction expression corresponding to the reduced dimension feature dimension to the data processing component; The extracting the feature dimension data of the N feature dimensions from the traffic data in the first traffic data packet includes: Extracting initial feature data of the feature dimension i from the traffic data in the first traffic data packet; If the feature dimension i belongs to the dimension reduction feature dimension, obtain the feature dimension reduction expression corresponding to the feature dimension i issued by the proxy component, and perform feature data dimension reduction processing on the initial feature data of the feature dimension i based on the feature dimension reduction expression corresponding to the feature dimension i to obtain the first type of feature dimension data corresponding to the feature dimension i; If the feature dimension i does not belong to the dimension reduction feature dimension, the initial feature data of the feature dimension i is determined as the second type of feature dimension data corresponding to the feature dimension i; The first type of feature dimension data or the second type of feature dimension data corresponding to the feature dimension i is determined as the feature dimension data of the feature dimension i, and the feature dimension data of the N feature dimensions are determined based on the feature dimension data of the feature dimension i.

4. The method according to claim 2, characterized in that: The data processing component includes a first processing pipeline for determining an intermediate data packet, the first processing pipeline including a first ingress processing pipeline and a first egress processing pipeline; The step of constructing the first intermediate data packet for traffic compression based on the first characteristic data and the first traffic data packet includes: When the first characteristic data is determined by the first inlet processing pipeline, the first characteristic data is used as a payload of a data packet by the first inlet processing pipeline, and data packet header information is added to the first characteristic data as the payload to obtain an initial intermediate data packet; Based on the data volume of the initial intermediate data packet, the initial intermediate data packet is copied to the first traffic data packet to obtain a transitional intermediate data packet; Through the first egress processing pipeline, the transitional intermediate data packet is mirrored and intercepted based on the data volume of the initial intermediate data packet to obtain a mirrored data packet, the data packet type of the metadata associated with the mirrored data packet is configured as a mirrored type, and the mirrored data packet having the mirrored type is determined as the first intermediate data packet for traffic compression.

5. The method according to claim 1, characterized in that The method further comprises: If the target write cumulative amount does not reach the data compression threshold associated with the register array, the first intermediate data packet is discarded.

6. The method according to claim 1, characterized in that The feature data of the first intermediate data packet is the first feature data, the first feature data includes first feature dimension data of N feature dimensions, N is a positive integer; the register array includes N sub-arrays corresponding to the N feature dimensions, one sub-array corresponds to one feature dimension, each of the N sub-arrays includes K storage locations, K is a positive integer, and the value of K is greater than or equal to the data compression threshold; the K storage locations included in each sub-array are associated with corresponding index identifiers; The step of writing the characteristic data of the first intermediate data packet into the register array comprises: Determine an empty storage position from the K storage positions of any subarray of the N subarrays, and determine the smallest index identifier among the index identifiers corresponding to the empty storage position as the first index identifier; Determine a first storage position of each sub-array from the K storage positions of each sub-array based on the first index identifier; the index identifier of the first storage position of each sub-array is the first index identifier; The first feature dimension data of each feature dimension of the N feature dimensions is respectively written into the first storage position in the sub-array corresponding to each feature dimension.

7. The method according to claim 1, characterized in that The feature data of the first intermediate data packet is first feature data, the first feature data includes first feature dimension data of N feature dimensions, N is a positive integer; the register array includes N sub-arrays corresponding to the N feature dimensions, one sub-array corresponds to one feature dimension; Each of the N sub-arrays includes a first storage location for storing first feature dimension data on a corresponding feature dimension, and the index identifier of the first storage location of each sub-array is a first index identifier; The read index identifier in the metadata associated with the initial loopback data packet is the first index identifier; The method further comprises: Acquire the first index identifier from metadata associated with the initial loopback data packet, and determine a first storage position of each sub-array from the storage positions included in each sub-array based on the first index identifier; The first feature dimension data of the feature dimension corresponding to each sub-array is read from the first storage position of each sub-array respectively, and the read first feature data is determined based on the read first feature dimension data of each feature dimension.

8. The method according to claim 1, characterized in that: The metadata associated with the initial loop data packet includes the initial loop read cumulative amount of the data packet to be compressed; The step of obtaining the first loop read cumulative amount of the data packet to be compressed includes: The initial loop read cumulative amount is obtained from metadata associated with the initial loop data packet, and the initial loop read cumulative amount is updated to obtain a first loop read cumulative amount of the data packet to be compressed.

9. The method according to claim 1, characterized in that: The second intermediate data packet includes a first sub-intermediate data packet, and the first sub-intermediate data packet is an intermediate data packet before the first intermediate data packet; the register array includes a second storage location for storing characteristic data of the first sub-intermediate data packet, and the index identifier of the second storage location is a second index identifier; The step of generating a transition loopback data packet for loopback reading by using the initial loopback data packet and the characteristic data of the first intermediate data packet read includes: The payload in the initial loop data packet is updated based on the characteristic data of the first intermediate data packet read to obtain an initial loop update data packet, the read index identifier in the metadata of the updated initial loop data packet is updated to the second index identifier, and the initial loop update data packet after the updated read index identifier is determined as the transition loop data packet; the read index identifier in the metadata associated with the transition loop data packet is used to read the characteristic data of the first sub-intermediate data packet from the storage location corresponding to the second index identifier based on the transition loop data packet.

10. The method according to claim 1, characterized in that The second intermediate data packet includes a second sub-intermediate data packet and a first sub-intermediate data packet, the first sub-intermediate data packet is the previous intermediate data packet of the first intermediate data packet; the second sub-intermediate data packet is the first intermediate data packet in the second intermediate data packet, and the payload of the transition loop data packet includes characteristic data of the first intermediate data packet; When the characteristic data of the second intermediate data packet is read from the register array through the transition loop data packet, obtaining the second loop read cumulative amount of the data packet to be compressed includes: Based on the transition loop data packet, characteristic data of the first sub-intermediate data packet is read from the register array, and the first loop read cumulative amount of the data packet to be compressed is updated to obtain the first sub-loop read cumulative amount of the data packet to be compressed; the first sub-loop read cumulative amount belongs to the second loop read cumulative amount; When the accumulated amount of the first sub-loop readings does not reach the data compression threshold, the payload of the transition loop data packet is updated by reading the characteristic data of the first sub-intermediate data packet to obtain an updated transition loop data packet; the payload of the updated transition loop data packet includes the characteristic data of the first sub-intermediate data packet and the characteristic data of the first intermediate data packet; When the characteristic data of the second sub-intermediate data packet is read from the register array based on the updated transition loop data packet, the first sub-loop read cumulative amount of the data packet to be compressed is updated to obtain the second sub-loop read cumulative amount of the data packet to be compressed; the second sub-loop read cumulative amount belongs to the second loop read cumulative amount.

11. The method according to claim 10, characterized in that If the second loop reading cumulative amount reaches the data compression threshold, a target data packet for sending to a target analysis device is generated by using the transition loop data packet and the read characteristic data of the data packet to be compressed, including: When the accumulated amount of the second loop reading reaches the data compression threshold, determining the characteristic data of the first intermediate data packet and the characteristic data of the first sub-intermediate data packet from the payload of the updated transition loop data packet; Based on the characteristic data of the first intermediate data packet, the characteristic data of the first sub-intermediate data packet and the characteristic data of the second sub-intermediate data packet, the characteristic data of the read data packet to be compressed is determined, and the payload in the updated transition loop data packet is updated based on the characteristic data of the read data packet to be compressed to obtain a loop completion data packet, and the data packet type in the metadata associated with the loop completion data packet is configured as a loop completion type, and the loop completion data packet with the loop completion type is determined as a target data packet for sending to a target analysis device.

12. The method according to claim 1, characterized in that The target switching device includes a data processing component deployed on the data plane; the data processing component includes a first processing pipeline for determining an intermediate data packet, and a second processing pipeline for reading and writing the intermediate data packet, and the second processing pipeline includes a second egress processing pipeline; The step of writing the characteristic data of the first intermediate data packet into the register array and obtaining the target write cumulative amount of the data packet to be compressed associated with the register array includes: When the first intermediate data packet is determined based on the first processing pipeline, the first intermediate data packet is input into the second egress processing pipeline, and a data packet type of the first intermediate data packet is obtained from metadata of the first intermediate data packet through the second egress processing pipeline; The data packet type of the first intermediate data packet is a mirror type; When it is determined through the second egress processing pipeline that the data packet type of the first intermediate data packet is the mirror type, the characteristic data of the first intermediate data packet is written into the register array, the initial write accumulation of the data packet to be compressed associated with the register array is obtained, the initial write accumulation is updated, and the target write accumulation is obtained.

13. The method according to claim 12, characterized in that If the target write cumulative amount reaches the data compression threshold associated with the register array, generating an initial loopback data packet for loopback reading based on the first intermediate data packet, including: When it is determined through the second egress processing pipeline that the target write accumulation amount reaches the data compression threshold associated with the register array, the packet type in the metadata associated with the first intermediate packet is updated to a loop type, and the first intermediate packet whose packet type is updated to the loop type is determined as the initial loop packet.

14. The method according to claim 12 or 13, characterized in that The target switching device further comprises an agent component deployed on the control plane; the agent component is used to determine a loopback port for loopback reading; the second processing pipeline comprises a second inlet processing pipeline; The method further comprises: Inputting the initial loopback data packet into the second inlet processing pipeline through the loopback port, obtaining the data packet type of the initial loopback data packet from the metadata of the initial loopback data packet through the second inlet processing pipeline; the data packet type of the initial loopback data packet is a loopback type; The loopback port is determined based on the loopback type, and the loopback port is used as the first output port associated with the initial loopback data packet; the first output port is used to input the transition loopback data packet into the second inlet processing pipeline through the first output port when the transition loopback data packet is determined based on the read characteristic data and the initial loopback data packet through the second egress processing pipeline.

15. The method according to claim 1, characterized in that The target switching device includes an agent component deployed on the control plane and a data processing component deployed on the data plane; the agent component is used to determine a loopback port for loopback reading and a data packet sending port for data packet sending; the data processing component includes a second processing pipeline, and the second processing pipeline includes a second egress processing pipeline and a second ingress processing pipeline; The method further comprises: Inputting the target data packet into the second inlet processing pipeline through the loopback port, obtaining the data packet type of the target data packet from the metadata of the target data packet through the second inlet processing pipeline; the data packet type of the target data packet is a loopback completion type; Determine the data packet sending port based on the loop completion type, and use the data packet sending port as a second output port associated with the target data packet; When it is determined through the second egress processing pipeline that the packet type of the target data packet is the loop completion type, the target data packet is sent to the target analysis device through the second output port, so that the target analysis device parses the target data packet to obtain the characteristic data of the first intermediate data packet and the characteristic data of the second intermediate data packet, and performs traffic analysis processing based on the characteristic data of the first intermediate data packet and the characteristic data of the second intermediate data packet.

16. A flow compression device, characterized in that: The device is run on a target switching device, and the device includes: A feature writing module, used to write feature data of a first intermediate data packet into a register array, and obtain a target write cumulative amount of a data packet to be compressed associated with the register array; the data packet to be compressed includes the first intermediate data packet and a second intermediate data packet; the second intermediate data packet is an intermediate data packet written into the register array before the first intermediate data packet; A read judgment module, configured to generate an initial loopback data packet for loopback reading based on the first intermediate data packet if the target write cumulative amount reaches a data compression threshold associated with the register array; a data loopback reading module, configured to obtain a first loopback reading cumulative amount of the data packet to be compressed when the characteristic data of the first intermediate data packet is read from the register array through the initial loopback data packet, and to generate a transition loopback data packet for loopback reading through the initial loopback data packet and the characteristic data of the first intermediate data packet read when the first loopback reading cumulative amount does not reach the data compression threshold; A data loopback reading module, configured to obtain a second loopback reading cumulative amount of the data packet to be compressed when the characteristic data of the second intermediate data packet is read from the register array through the transition loopback data packet; The target data packet generation module is used to generate a target data packet for sending to a target analysis device through the transition loop data packet and the characteristic data of the data packet to be compressed if the second loop reading cumulative amount reaches the data compression threshold.

17. A computer device, characterized in that: including memory and processor; The memory is connected to the processor, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method according to any one of claims 1 to 15.

18. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 15.

19. A computer program product, characterized in that The method comprises a computer program / instruction, which implements the method according to any one of claims 1 to 15 when executed by a processor.

Citation Information

Patent Citations

  • Data writing, compressing and reading method and data processing method and device

    CN110879800A

  • Network traffic retrieval method and device, equipment and storage medium

    CN115858462A