Methods, devices, electronic equipment, and storage media for parsing network traffic.
Patent Information
- Application Number
- CN202310249619.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-10
- Publication Date
- 2026-09-01
- Estimated Expiration
- 2043-03-10
AI Technical Summary
[0003]相关技术中,在接收到网络流量后,需要占用一定的CPU资源对网络数据进行处理,对于网络包的协议转换、分发控制场景以及一些音视频或者文件服务等网络吞吐较大的场景,将会耗费较多的CPU资源用于处理网络数据,从而降低服务器的工作效率
[0026] In this disclosure, after receiving network traffic, the server performs traffic diversion through the following steps to reduce CPU processing: First, it responds to the traffic processing command, obtains the network traffic to be processed and the traffic information, then queries the preprocessing policy corresponding to the traffic type, and preprocesses the network traffic using the preprocessing policy to obtain the initial parsed traffic. Then, if the traffic identifier indicates that the network traffic belongs to the first type of traffic set, the initial parsed traffic is pushed to the target memory, wherein the target memory is directly connected to the application to which the network traffic is to be received. Finally, if the traffic identifier indicates that the network traffic belongs to the second type of traffic set, the initial parsed traffic is sent to the target device corresponding to the traffic identifier, and the target device processes the initial parsed traffic.
Smart Images

Figure CN116389372B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of cloud computing technology, and more specifically, to a method, apparatus, electronic device, and storage medium for parsing network traffic. Background Technology
[0002] With the rapid development of the Internet, the increasingly rich Internet services have brought about an explosive growth in data traffic, which has also brought new challenges to the transmission and processing capabilities of network traffic data, and the application demand for network traffic has gradually increased.
[0003] In related technologies, after receiving network traffic, a certain amount of CPU resources are required to process the network data. For scenarios involving protocol conversion and distribution control of network packets, as well as scenarios with high network throughput such as audio, video, or file services, a lot of CPU resources will be consumed to process network data, thereby reducing the working efficiency of the server.
[0004] There is currently no effective solution to the above problems. Summary of the Invention
[0005] This invention provides a method, apparatus, electronic device, and storage medium for parsing network traffic, to at least solve the technical problem in related technologies that consuming a lot of CPU resources and reducing server efficiency when parsing network traffic.
[0006] According to one aspect of the present invention, a method for parsing network traffic is provided, comprising: responding to a traffic processing instruction to obtain network traffic to be processed and traffic information, wherein the traffic information includes: traffic type and traffic identifier; querying a preprocessing strategy corresponding to the traffic type and using the preprocessing strategy to preprocess the network traffic to obtain initial parsed traffic; if the traffic identifier indicates that the network traffic belongs to a first type of traffic set, pushing the initial parsed traffic to a target memory, wherein the target memory is directly connected to the application to which the network traffic is to be received; if the traffic identifier indicates that the network traffic belongs to a second type of traffic set, sending the initial parsed traffic to a target device corresponding to the traffic identifier, and having the target device process the initial parsed traffic, wherein the traffic in the first type of traffic set and the second type of traffic set does not include traffic processed by a central processing unit (CPU).
[0007] Optionally, before responding to the traffic processing instruction, the process includes: receiving a set of preprocessing strategies transmitted from the development end, wherein the set of preprocessing strategies contains N preprocessing strategies, each of which corresponds to a traffic type, and N is a positive integer greater than or equal to 1; establishing a mapping relationship between each of the preprocessing strategies and the traffic type to obtain a strategy mapping table; and storing the set of preprocessing strategies and the strategy mapping table in a programming memory.
[0008] Optionally, before responding to the traffic processing instruction and obtaining the network traffic to be processed and traffic information, the method further includes: controlling the baseboard management controller to monitor whether the user terminal is transmitting network traffic to the network card; and generating the traffic processing instruction by the baseboard management controller when the baseboard management controller detects that the user terminal is transmitting network traffic to the network card.
[0009] Optionally, the preprocessing strategy is one of the following: protocol conversion strategy, compression strategy, decompression strategy, encryption strategy, decryption strategy, signature strategy, verification strategy, routing communication strategy, and bus communication strategy.
[0010] Optionally, the traffic in the second type of traffic set includes: traffic to be accelerated, complex control traffic, and a portion of traffic with a throughput higher than a preset throughput threshold.
[0011] Optionally, the target device includes: a bypass hardware accelerator. The step of sending the initial parsing traffic to the target device corresponding to the traffic identifier and having the target device process the initial parsing traffic includes: when the traffic identifier indicates that the network traffic is the traffic to be accelerated, sending the initial parsing traffic to the bypass hardware accelerator, and having the bypass hardware accelerator send the traffic data in the initial parsing traffic to the target memory.
[0012] Optionally, the target device includes a network data designator processor. The step of sending the initial parsed traffic to the target device corresponding to the traffic identifier and having the target device process the initial parsed traffic includes: when the traffic identifier indicates that the network traffic is the complex control traffic, sending the initial parsed traffic to the network data designator processor, having the network data designator processor perform logical processing on the initial parsed traffic, and sending the traffic data obtained from the logical processing to the target memory.
[0013] Optionally, the target device includes a logic gate array module. The step of sending the initial parsed traffic to the target device corresponding to the traffic identifier and having the target device process the initial parsed traffic includes: when the traffic identifier indicates that the network traffic is a portion of the traffic with a throughput higher than a preset throughput threshold, sending the initial parsed traffic to the logic gate array module, having the logic gate array module perform logical processing on the initial parsed traffic, and sending the traffic data obtained from the logical processing to the target memory.
[0014] Optionally, after the target device processes the initial parsed traffic, the method further includes: generating a traffic data application notification and sending the traffic data application notification to the central processing unit (CPU), wherein, after receiving the traffic data application notification, the CPU invokes an application program indicated by the message address carried in the traffic data application notification to consume the traffic data stored in the target memory.
[0015] According to another aspect of the present invention, a network traffic parsing apparatus is also provided, comprising: a response unit, configured to respond to a traffic processing instruction and acquire network traffic to be processed and traffic information, wherein the traffic information includes: traffic type and traffic identifier; a query unit, configured to query a preprocessing strategy corresponding to the traffic type and preprocess the network traffic using the preprocessing strategy to obtain initial parsed traffic; a push unit, configured to push the initial parsed traffic to a target memory when the traffic identifier indicates that the network traffic belongs to a first type of traffic set, wherein the target memory is directly connected to the application to which the network traffic is to be received; and a sending unit, configured to send the initial parsed traffic to a target device corresponding to the traffic identifier when the traffic identifier indicates that the network traffic belongs to a second type of traffic set, wherein the target device processes the initial parsed traffic, wherein the traffic in the first type of traffic set and the second type of traffic set does not include traffic processed by a central processing unit (CPU).
[0016] Optionally, the network traffic parsing device further includes: a first receiving module, configured to receive a set of preprocessing strategies transmitted from the development end, wherein the set of preprocessing strategies contains N preprocessing strategies, each of which corresponds to a traffic type, and N is a positive integer greater than or equal to 1; a first establishing module, configured to establish a mapping relationship between each of the preprocessing strategies and the traffic type to obtain a strategy mapping table; and a first storage module, configured to store the set of preprocessing strategies and the strategy mapping table in a programming memory.
[0017] Optionally, the network traffic parsing device further includes: a first control module, used to control the baseboard management controller to monitor whether the user terminal transmits network traffic to the network card; and a first generation module, used to generate the traffic processing instruction by the baseboard management controller when the baseboard management controller detects that the user terminal is transmitting network traffic to the network card.
[0018] Optionally, the preprocessing strategy is one of the following: protocol conversion strategy, compression strategy, decompression strategy, encryption strategy, decryption strategy, signature strategy, verification strategy, routing communication strategy, and bus communication strategy.
[0019] Optionally, the traffic in the second type of traffic set includes: traffic to be accelerated, complex control traffic, and a portion of traffic with a throughput higher than a preset throughput threshold.
[0020] Optionally, the target device includes a bypass hardware accelerator, and the sending unit includes a first sending module, configured to send the initial parsing traffic to the bypass hardware accelerator when the traffic identifier indicates that the network traffic is the traffic to be accelerated, and the bypass hardware accelerator sends the traffic data in the initial parsing traffic to the target memory.
[0021] Optionally, the target device includes a network data designator, and the sending unit further includes a second sending module, configured to send the initial parsing traffic to the network data designator when the traffic identifier indicates that the network traffic is the complex control traffic, wherein the network data designator performs logical processing on the initial parsing traffic and sends the traffic data obtained from the logical processing to the target memory.
[0022] Optionally, the target device includes a logic gate array module, and the sending unit further includes a third sending module, configured to send the initial parsed traffic to the logic gate array module when the traffic identifier indicates that the network traffic is a portion of the traffic with a throughput higher than a preset throughput threshold, wherein the logic gate array module performs logical processing on the initial parsed traffic and sends the traffic data obtained from the logical processing to the target memory.
[0023] Optionally, the network traffic parsing device further includes: a second generation module, configured to generate a traffic data application notification and send the traffic data application notification to the central processing unit (CPU), wherein, after receiving the traffic data application notification, the CPU invokes an application program indicated by the message address based on the message address carried in the traffic data application notification to consume the traffic data stored in the target memory.
[0024] According to another aspect of the present invention, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform any of the above-described network traffic parsing methods.
[0025] According to another aspect of the present invention, an electronic device is also provided, including one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement any of the above-described network traffic parsing methods.
[0026] In this disclosure, after receiving network traffic, the server performs traffic diversion through the following steps to reduce CPU processing: First, it responds to the traffic processing command, obtains the network traffic to be processed and the traffic information, then queries the preprocessing policy corresponding to the traffic type, and preprocesses the network traffic using the preprocessing policy to obtain the initial parsed traffic. Then, if the traffic identifier indicates that the network traffic belongs to the first type of traffic set, the initial parsed traffic is pushed to the target memory, wherein the target memory is directly connected to the application to which the network traffic is to be received. Finally, if the traffic identifier indicates that the network traffic belongs to the second type of traffic set, the initial parsed traffic is sent to the target device corresponding to the traffic identifier, and the target device processes the initial parsed traffic.
[0027] In this disclosure, upon receiving network traffic packets, a pre-set preprocessing strategy is queried based on the traffic type to preprocess the traffic. The preprocessed network traffic is then distributed. For the first type of traffic set, it is directly stored in hardware memory for consumption by the application. For the second type of traffic set, the traffic data is processed through a specific target device. This allows some traffic to bypass CPU processing, reducing the CPU workload and improving the overall hardware efficiency. This solves the technical problem in related technologies where parsing network traffic consumes a lot of CPU resources and reduces server efficiency. Attached Figure Description
[0028] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0029] Figure 1 This is a flowchart of an optional network traffic parsing method according to an embodiment of the present invention;
[0030] Figure 2 This is a schematic diagram of an optional network traffic transmission process according to an embodiment of the present invention;
[0031] Figure 3 This is a schematic diagram of an optional network traffic parsing device according to an embodiment of the present invention;
[0032] Figure 4 This is a hardware structure block diagram of an electronic device (or mobile device) for a network traffic parsing method according to an embodiment of the present invention. Detailed Implementation
[0033] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0034] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0035] To facilitate understanding of the present invention by those skilled in the art, some terms or nouns involved in the various embodiments of the present invention are explained below:
[0036] The central processing unit (CPU) is the core of a computer system for computation and control; it is the final execution unit for information processing and program execution.
[0037] It should be noted that the network traffic parsing method and apparatus in this disclosure can be used in the field of cloud computing technology when parsing network traffic, and can also be used in any field other than cloud computing technology when parsing network traffic. This disclosure does not limit the application field of the network traffic parsing method and apparatus.
[0038] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, traffic data, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0039] The following embodiments of the present invention can be applied to various systems / applications / devices that parse network traffic. Through programmable data pipelines, it can efficiently handle various network packet protocol conversions, encryption and decryption, routing, bus and other scenarios that the CPU is not particularly good at, thereby reducing CPU resource consumption, improving network data processing performance and reducing overall hardware data processing energy consumption.
[0040] The following embodiments of the present invention can be applied to various network traffic processing systems / applications / devices. By using bypass hardware accelerators, network data designated processors, logic gate arrays and other modules to process a portion of network traffic and identify different types of network traffic, the processing efficiency of a portion of network traffic can be accelerated, enabling this portion of traffic to be processed quickly and improving the processing performance of network data.
[0041] The present invention will now be described in detail with reference to various embodiments.
[0042] Example 1
[0043] According to an embodiment of the present invention, an embodiment of a method for parsing network traffic is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0044] Figure 1 This is a flowchart of an optional network traffic parsing method according to an embodiment of the present invention, such as... Figure 1 As shown, the method includes the following steps:
[0045] Step S101: Respond to the traffic processing instruction and obtain the network traffic to be processed and traffic information, wherein the traffic information includes: traffic type and traffic identifier;
[0046] Step S102: Query the preprocessing strategy corresponding to the traffic type, and use the preprocessing strategy to preprocess the network traffic to obtain the initial parsed traffic;
[0047] Step S103: If the traffic identifier indicates that the network traffic belongs to the first type of traffic set, the initial parsed traffic is pushed to the target memory, wherein the target memory is directly connected to the application to which the network traffic is to be delivered.
[0048] Step S104: If the traffic identifier indicates that the network traffic belongs to the second type of traffic set, the initial parsing traffic is sent to the target device corresponding to the traffic identifier, and the target device processes the initial parsing traffic. The traffic in the first type of traffic set and the second type of traffic set does not include traffic processed by the central processing unit (CPU).
[0049] Through the above steps, the system first responds to the traffic processing command, obtains the network traffic to be processed and the traffic information, then queries the preprocessing policy corresponding to the traffic type, and uses the preprocessing policy to preprocess the network traffic to obtain the initial parsed traffic. Then, if the traffic identifier indicates that the network traffic belongs to the first type of traffic set, the initial parsed traffic is pushed to the target memory, where the target memory is directly connected to the application to which the network traffic is to be received. Finally, if the traffic identifier indicates that the network traffic belongs to the second type of traffic set, the initial parsed traffic is sent to the target device corresponding to the traffic identifier, and the target device processes the initial parsed traffic.
[0050] In this embodiment, after receiving network traffic packets, the traffic is preprocessed by querying a pre-set preprocessing strategy based on the traffic type. The preprocessed network traffic is then split. The first type of traffic set is directly stored in the hardware memory for consumption by the application. The second type of traffic set is processed by a specific target device, thereby eliminating the need for some traffic to be processed by the CPU, reducing the CPU workload, improving the overall efficiency of the hardware, and solving the technical problem in related technologies where parsing network traffic consumes a lot of CPU resources and reduces the efficiency of the server.
[0051] The embodiments of the present invention will now be described in detail with reference to the steps described above.
[0052] This invention proposes to delegate the processing of various protocol conversions, encryption / decryption, routing, and non-business logic tasks of network packets to the network traffic processing module. This allows these tasks to be completed before data is transmitted to memory, thereby decoupling the management plane from the business plane, reducing CPU resource consumption, and enabling the CPU to run in its preferred area, thus improving the overall efficiency of the server.
[0053] Optionally, before responding to the traffic processing instruction, the process includes: receiving a set of preprocessing strategies transmitted from the development end, wherein the set of preprocessing strategies contains N preprocessing strategies, each preprocessing strategy corresponds to a traffic type, and N is a positive integer greater than or equal to 1; establishing a mapping relationship between each preprocessing strategy and the traffic type to obtain a strategy mapping table; and storing the set of preprocessing strategies and the strategy mapping table in the programming memory.
[0054] It should be noted that before parsing network traffic, specific business logic for processing network traffic needs to be written for different traffic types. This includes logic programs for compression, decompression, encryption, decryption, signature, and verification of network packets for different protocols, thereby generating preprocessing strategies. There is a mapping relationship between preprocessing strategies and traffic types. This mapping relationship is presented through a strategy mapping table. The logic programs and strategy mapping tables carried by these preprocessing strategies are stored in a programmable memory, which is connected to a programmable data pipeline.
[0055] Optionally, before responding to the traffic processing command and obtaining the network traffic to be processed and traffic information, the method further includes: controlling the baseboard management controller to monitor whether the user terminal is transmitting network traffic to the network card; and generating a traffic processing command by the baseboard management controller when the baseboard management controller detects that the user terminal is transmitting network traffic to the network card.
[0056] It should be noted that when the user transmits network traffic to the server, the baseboard control controller configured in the network traffic processing module will receive the traffic packet arrival notification, generate traffic processing instructions, and then call the programmable data pipeline to preprocess the network traffic.
[0057] Step S101: Respond to the traffic processing command and obtain the network traffic to be processed and traffic information.
[0058] It should be noted that the main body of this embodiment of the invention is a server. The server communicates with the user terminal. The network card on the server receives network traffic packets transmitted by the user terminal. The server is configured with a dedicated network traffic processing module, which is responsible for preprocessing, accelerating, and performing complex control processing on the network traffic, thereby reducing the workload of the central processing unit (CPU). After being processed by the network traffic processing module, the network traffic can be directly stored in the server memory for consumption by the application, without needing to be processed by the CPU again.
[0059] It should be noted that after receiving a network traffic packet, the network card will perform preliminary parsing of the traffic packet to obtain information related to the traffic packet. The traffic packet is split into traffic data and traffic information. The traffic information is used to indicate the traffic type and traffic identifier. The traffic type determines the preprocessing strategy of the traffic packet, and the traffic identifier is used to distribute network traffic.
[0060] Step S102: Query the preprocessing strategy corresponding to the traffic type, and use the preprocessing strategy to preprocess the network traffic to obtain the initial parsed traffic.
[0061] Optionally, the preprocessing strategy may be one of the following: protocol conversion strategy, compression strategy, decompression strategy, encryption strategy, decryption strategy, signature strategy, verification strategy, routing communication strategy, or bus communication strategy.
[0062] It should be noted that the preprocessing strategy for a network traffic can be obtained by querying the traffic type policy mapping table. For example, a decompression strategy needs to be configured for compressed traffic packets, and a decryption strategy needs to be configured for encrypted traffic packets. Preprocessing the network traffic can obtain the initial parsed traffic.
[0063] Step S103: If the traffic identifier indicates that the network traffic belongs to the first type of traffic set, the initial parsed traffic is pushed to the target memory.
[0064] It should be noted that the first type of traffic set includes, but is not limited to: network traffic to be processed by protocol conversion, network traffic to be compressed or decompressed, network traffic to be encrypted or decrypted, network traffic to be signed, network traffic to be verified, and network traffic to be routed or bus-connected. For different types of network traffic, the configured preprocessing strategy is invoked for parsing. After parsing, the traffic can be directly stored in the server memory for consumption by the application. The baseboard control controller of the network traffic processing module communicates with the baseboard control controller on the server CPU side to inform the server that this part of the traffic has been preprocessed and can be used directly by the application.
[0065] Step S104: If the traffic identifier indicates that the network traffic belongs to the second type of traffic set, the initial parsing traffic is sent to the target device corresponding to the traffic identifier, and the target device processes the initial parsing traffic.
[0066] Optionally, the traffic in the second type of traffic set includes at least one of the following: traffic to be accelerated, complex control traffic, and a portion of traffic with a throughput higher than a preset throughput threshold.
[0067] It should be noted that the second type of traffic set refers to traffic with special needs, such as images and videos that consume a lot of memory, traffic data with a large throughput, and some important data, which need to be forwarded to the target device, processed by the traffic processing device, and then stored in memory for consumption.
[0068] Optionally, the target device includes a bypass hardware accelerator, and the sending unit includes a first sending module, used to send the initial parsing traffic to the bypass hardware accelerator when the traffic identifier indicates that the network traffic is traffic to be accelerated, and the bypass hardware accelerator sends the traffic data in the initial parsing traffic to the target memory.
[0069] It should be noted that some network traffic data is of high importance and needs to be quickly transferred to the target memory for consumption. When handling this type of network traffic, it is necessary to configure a bypass hardware accelerator, such as using remote memory management to transfer data directly between the server memory and the application, without the application needing to consume it.
[0070] Optionally, the target device includes: a network data designated processor, which sends the initial parsed traffic to the target device corresponding to the traffic identifier, and the target device processes the initial parsed traffic, including: when the traffic identifier indicates that the network traffic is complex control traffic, sending the initial parsed traffic to the network data designated processor, performing logical processing on the initial parsed traffic by the network data designated processor, and sending the traffic data obtained from the logical processing to the target memory.
[0071] It should be noted that some special traffic networks require more complex control logic. For example, sensitive traffic data or traffic data with access permissions need to be processed by a designated network data processor to control the network traffic and send the processed network traffic to the server memory.
[0072] Optionally, the target device includes: a logic gate array module, which sends the initial parsed traffic to the target device corresponding to the traffic identifier, and the target device processes the initial parsed traffic, including: when the traffic identifier indicates that the network traffic is a portion of the traffic with a throughput higher than a preset throughput threshold, sending the initial parsed traffic to the logic gate array module, performing logical processing on the initial parsed traffic by the logic gate array module, and sending the traffic data obtained from the logical processing to the target memory.
[0073] It should be noted that for some high-throughput network traffic exceeding the preset throughput threshold, a logic gate array processing strategy needs to be configured. This involves writing specific business logic to process this traffic efficiently. For example, streaming media network traffic is a high-throughput application scenario. This part of the network traffic does not require high processing speed, but it does require a high compression ratio. Therefore, specific business logic needs to be written to limit the compression ratio, thereby improving the efficiency of network traffic processing.
[0074] Optionally, after the target device processes the initial parsed traffic, the method further includes: generating a traffic data application notification and sending the traffic data application notification to the central processing unit (CPU). Upon receiving the traffic data application notification, the CPU invokes an application program indicated by the message address carried in the traffic data application notification to consume the traffic data stored in the target memory.
[0075] It should be noted that after preprocessing the network traffic, the first type of traffic set is directly stored in the server memory. The baseboard control controller of the network traffic processing module will communicate with the baseboard control controller of the server to inform the server that the network traffic has completed operations such as packet compression and decompression, encryption and decryption, signing and verification, and the application can use it directly.
[0076] After the network traffic is preprocessed, the second type of traffic set is sent to the target device for special processing and then stored in the server memory. After the network traffic is stored in the server memory, a traffic data application notification is generated. After the server's baseboard control controller receives the notification, it notifies the central server CPU to process the data. The CPU will wake up the relevant application to consume the traffic data in memory according to the address of the message carried in the traffic data application notification.
[0077] The present invention will now be described with reference to a more specific embodiment, in which the subject of the embodiment is a server.
[0078] Figure 2 This is a schematic diagram of an optional network traffic transmission process according to an embodiment of the present invention, such as... Figure 2 As shown, the server has a network traffic inlet, and the user end transmits network traffic to the network card through this inlet. In this embodiment of the invention, the server is configured with a network traffic processing module and a programmable memory. The programmable memory is connected to a programmable data pipeline. The programmable data pipeline is used to call the written business logic to preprocess the network traffic. The preprocessed network traffic will be split. For some regular traffic with small throughput and small memory usage, it is directly stored in the server memory for direct use by the application.
[0079] For some traffic with special requirements, including traffic to be accelerated, traffic with complex control, and traffic with throughput exceeding a preset throughput threshold, it is necessary to process it through specific devices and then store it in the server memory. The network traffic processing module is equipped with a baseboard control controller, which is mainly responsible for monitoring whether network traffic is entering the server, calling programmable data pipelines to preprocess the network traffic, and communicating with another baseboard control controller on the server CPU side. This other baseboard control controller is used to communicate with the central processing unit (CPU) and inform the CPU of the notification information transmitted by the baseboard control controller of the traffic processing module. After receiving the notification, the CPU will wake up the relevant application to consume the traffic data in memory.
[0080] The specific implementation steps are as follows:
[0081] Step 1: Write specific business logic for processing network traffic, such as logic programs for compression and decompression, encryption and decryption, signing and verification of network packets for different protocols, and store this logic in a programmable memory;
[0082] Step 2: The network card receives network traffic;
[0083] Step 3: When the baseboard control controller detects incoming network traffic on the current server, it will invoke the programmable data pipeline to process the network traffic;
[0084] Step 4: After receiving instructions from the baseboard control controller, the programmable data pipeline will obtain traffic data from the network card and then process it differently according to the type and identifier of the network traffic.
[0085] First, based on the type of network traffic, relevant preprocessing strategies are invoked, including: protocol conversion strategy, compression strategy, decompression strategy, encryption strategy, decryption strategy, signature strategy, verification strategy, routing communication strategy, and bus communication strategy, thereby obtaining the initial parsed traffic.
[0086] Step 5: Distribute network traffic according to network traffic identifiers. For regular traffic with low throughput and low memory usage, store it directly in the server memory for direct use by applications. For traffic with special requirements, including traffic to be accelerated, complex control traffic, and traffic with throughput exceeding the preset throughput threshold, it needs to be processed by specific devices before being stored in the server memory.
[0087] Some network traffic is of high importance and needs to be quickly transmitted to the target memory for consumption. When handling this type of network traffic, it is necessary to configure a bypass hardware accelerator, such as using remote memory management to transmit traffic data directly between the server memory and the application, without the application having to perform the consumption operation.
[0088] For certain special network traffic types that require more complex control logic, such as sensitive network traffic or network traffic with access permissions, it is necessary to call a network data designated processor to perform complex control processing on the special traffic data and send the processed network traffic to the server memory.
[0089] For some high-throughput network traffic exceeding a preset throughput threshold, it is necessary to configure a logical gate array (GGAR) processing strategy. This involves writing specific business logic to process this traffic efficiently. For example, streaming media network traffic is a high-throughput application scenario. This traffic data does not require high processing speed but has high compression ratio requirements. Therefore, it is necessary to write specific business logic to limit the compression ratio, thereby improving the efficiency of network traffic processing.
[0090] Step Six: After processing, the network traffic is stored in the server memory. The baseboard control controller of the network traffic processing module communicates with the baseboard control controller on the server CPU side to inform the server that this part of the network data has completed operations such as packet compression and decompression, encryption and decryption, signing and verification, as well as acceleration and complex control processing operations, and the application can use it directly.
[0091] Step 7: After receiving the notification, the server's baseboard control controller will instruct the central processing unit (CPU) to process the data. The CPU will then invoke the relevant application to consume the data in memory based on the address of the message.
[0092] In this embodiment, by employing a programmable data pipeline to preprocess network traffic, it is possible to efficiently handle various network packet protocol conversions, encryption / decryption, routing, bus operations, and other scenarios that the CPU is not particularly adept at. This allows most non-business logic processing tasks, such as packet encryption / decryption and signature verification, to be completed before data is transmitted to memory. This decouples the management plane from the business plane, reduces CPU resource consumption, improves network data processing performance, and reduces overall hardware data processing power consumption. Simultaneously, by using bypass hardware accelerators, network data designated processors, logic gate arrays, and other modules to process special traffic and identify different types of network traffic, the processing efficiency of special traffic can be accelerated, enabling this part of the traffic to be processed quickly and improving network data processing performance.
[0093] The following is a detailed description with reference to another embodiment.
[0094] Example 2
[0095] The network traffic parsing device provided in this embodiment includes multiple implementation units, each of which corresponds to a specific implementation step in Embodiment 1 above.
[0096] Figure 3 This is a schematic diagram of an optional network traffic parsing device according to an embodiment of the present invention, such as... Figure 2 As shown, the parsing device may include: a response unit 31, a query unit 32, a push unit 33, and a sending unit 34, wherein,
[0097] The response unit 31 is used to respond to traffic processing instructions and obtain the network traffic to be processed and traffic information, wherein the traffic information includes: traffic type and traffic identifier;
[0098] The query unit 32 is used to query the preprocessing strategy corresponding to the traffic type, and to preprocess the network traffic using the preprocessing strategy to obtain the initial parsed traffic;
[0099] Push unit 33 is used to push the initial parsed traffic to the target memory when the traffic identifier indicates that the network traffic belongs to the first type of traffic set, wherein the target memory is directly connected to the application to which the network traffic is to be delivered;
[0100] The sending unit 34 is used to send the initial parsing traffic to the target device corresponding to the traffic identifier when the traffic identifier indicates that the network traffic belongs to the second type of traffic set, and the target device processes the initial parsing traffic. The traffic in the first type of traffic set and the second type of traffic set does not include traffic processed by the central processing unit (CPU).
[0101] The aforementioned network traffic parsing device responds to traffic processing instructions through response unit 31 to obtain the network traffic to be processed and traffic information; queries the preprocessing strategy corresponding to the traffic type through query unit 32, and preprocesses the network traffic using the preprocessing strategy to obtain initial parsed traffic; pushes the initial parsed traffic to the target memory through push unit 33 when the traffic identifier indicates that the network traffic belongs to the first type of traffic set, wherein the target memory is directly connected to the application to which the network traffic is to be received; and sends the initial parsed traffic to the target device corresponding to the traffic identifier through sending unit 34 when the traffic identifier indicates that the network traffic belongs to the second type of traffic set, and the target device processes the initial parsed traffic.
[0102] In this embodiment, after receiving network traffic packets, the traffic is preprocessed by querying a pre-set preprocessing strategy based on the traffic type. The preprocessed network traffic is then split. The first type of traffic set is directly stored in the hardware memory for consumption by the application. The second type of traffic set is processed by a specific device, thereby eliminating the need for some traffic to be processed by the CPU, reducing the CPU workload, improving the overall efficiency of the hardware, and solving the technical problem in related technologies where parsing network traffic consumes a lot of CPU resources and reduces the efficiency of the server.
[0103] Optionally, the network traffic parsing device further includes: a first receiving module for receiving a set of preprocessing strategies transmitted from the development end, wherein the set of preprocessing strategies contains N preprocessing strategies, each preprocessing strategy corresponds to a traffic type, and N is a positive integer greater than or equal to 1; a first establishing module for establishing a mapping relationship between each preprocessing strategy and the traffic type to obtain a strategy mapping table; and a first storage module for storing the set of preprocessing strategies and the strategy mapping table in a programming memory.
[0104] Optionally, the network traffic parsing device further includes: a first control module, used to control the baseboard management controller to monitor whether the user terminal transmits network traffic to the network card; and a first generation module, used to generate traffic processing instructions by the baseboard management controller when the baseboard management controller detects that the user terminal is transmitting network traffic to the network card.
[0105] Optionally, the preprocessing strategy may be one of the following: protocol conversion strategy, compression strategy, decompression strategy, encryption strategy, decryption strategy, signature strategy, verification strategy, routing communication strategy, or bus communication strategy.
[0106] Optionally, the traffic in the second type of traffic set includes: traffic to be accelerated, complex control traffic, and a portion of traffic with a throughput higher than a preset throughput threshold.
[0107] Optionally, the target device includes a bypass hardware accelerator, and the sending unit 34 includes a first sending module, used to send the initial parsing traffic to the bypass hardware accelerator when the traffic identifier indicates that the network traffic is traffic to be accelerated, and the bypass hardware accelerator sends the traffic data in the initial parsing traffic to the target memory.
[0108] Optionally, the target device includes a network data designator processor, and the sending unit 34 further includes a second sending module, used to send the initial parsing traffic to the network data designator processor when the traffic identifier indicates that the network traffic is complex control traffic, so that the network data designator processor performs logical processing on the initial parsing traffic and sends the traffic data obtained from the logical processing to the target memory.
[0109] Optionally, the target device includes a logic gate array module, and the transmitting unit 34 further includes a third transmitting module, used to send the initial parsed traffic to the logic gate array module when the traffic identifier indicates that the network traffic is a portion of the traffic with a throughput higher than a preset throughput threshold, so that the logic gate array module performs logical processing on the initial parsed traffic and sends the traffic data obtained from the logical processing to the target memory.
[0110] Optionally, the network traffic parsing device further includes: a second generation module, used to generate a traffic data application notification and send the traffic data application notification to the central processing unit (CPU), wherein, after receiving the traffic data application notification, the CPU invokes the application program indicated by the message address carried in the traffic data application notification to consume the traffic data stored in the target memory.
[0111] The aforementioned network traffic parsing device may also include a processor and a memory. The aforementioned response unit 31, query unit 32, push unit 33, and send unit 34 are all stored in the memory as program units, and the processor executes the aforementioned program units stored in the memory to realize the corresponding functions.
[0112] The processor described above contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and network traffic can be parsed by adjusting kernel parameters.
[0113] The aforementioned memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0114] According to another aspect of the present invention, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to execute any of the above-described network traffic parsing methods.
[0115] According to another aspect of the present invention, an electronic device is also provided, including one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement any of the above-described network traffic parsing methods.
[0116] This application also provides a computer program product that, when executed on a data processing device, is suitable for executing an initialization program with the following steps: responding to a traffic processing instruction, obtaining the network traffic to be processed and traffic information, querying a preprocessing strategy corresponding to the traffic type, and using the preprocessing strategy to preprocess the network traffic to obtain initial parsed traffic; then, if a traffic identifier indicates that the network traffic belongs to a first type of traffic set, pushing the initial parsed traffic to a target memory, wherein the target memory is directly connected to the application to which the network traffic is to be received; and finally, if a traffic identifier indicates that the network traffic belongs to a second type of traffic set, sending the initial parsed traffic to the target device corresponding to the traffic identifier, whereby the target device processes the initial parsed traffic.
[0117] Figure 4 This is a hardware structure block diagram of an electronic device (or mobile device) according to an embodiment of the present invention for a method of parsing network traffic. Figure 4 As shown, an electronic device may include one or more ( Figure 4 The processor 402 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and the memory 404 for storing data may also be included. In addition, it may include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a keyboard, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 4 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device described above. For example, the electronic device may also include components that are more... Figure 4 The more or fewer components shown, or having the same Figure 4 The different configurations shown.
[0118] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0119] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0120] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0121] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0122] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0123] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0124] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for parsing network traffic, characterized in that, include: In response to a traffic processing command, the system acquires the network traffic to be processed and traffic information, wherein the traffic information includes: traffic type and traffic identifier; Query the preprocessing strategy corresponding to the traffic type, and use the preprocessing strategy to preprocess the network traffic to obtain the initial parsed traffic; If the traffic identifier indicates that the network traffic belongs to the first type of traffic set, the initial parsed traffic is pushed to the target memory, wherein the target memory is directly connected to the application to which the network traffic is to be delivered; If the traffic identifier indicates that the network traffic belongs to the second type of traffic set, the initial parsing traffic is sent to the target device corresponding to the traffic identifier, and the target device processes the initial parsing traffic. The traffic in the first type of traffic set and the second type of traffic set does not include traffic processed by the central processing unit (CPU). The target device includes: a bypass hardware accelerator; the step of sending the initial parsing traffic to the target device corresponding to the traffic identifier, and the target device processing the initial parsing traffic includes: If the traffic identifier indicates that the network traffic is traffic to be accelerated, the initial parsed traffic is sent to the bypass hardware accelerator, and the bypass hardware accelerator sends the traffic data in the initial parsed traffic to the target memory; The target device includes: a network data designator processor, which sends the initial parsing traffic to the target device corresponding to the traffic identifier, and the target device processes the initial parsing traffic, including: When the traffic identifier indicates that the network traffic is complex control traffic, the initial parsed traffic is sent to the network data designated processor, which performs logical processing on the initial parsed traffic and sends the traffic data obtained from the logical processing to the target memory; The target device includes: a logic gate array module, which sends the initial parsed traffic to the target device corresponding to the traffic identifier, and the target device processes the initial parsed traffic, including: When the traffic identifier indicates that the network traffic is a portion of the traffic with a throughput higher than a preset throughput threshold, the initial parsed traffic is sent to the logic gate array module, which performs logical processing on the initial parsed traffic and sends the traffic data obtained from the logical processing to the target memory.
2. The analytical method according to claim 1, characterized in that, Before responding to traffic processing instructions, including: Receive a set of preprocessing strategies transmitted from the development end, wherein the set of preprocessing strategies contains N preprocessing strategies, each of which corresponds to a traffic type, and N is a positive integer greater than or equal to 1; Establish a mapping relationship between each of the preprocessing strategies and the traffic types to obtain a strategy mapping table; The preprocessing strategy set and the strategy mapping table are stored in the programming memory.
3. The analytical method according to claim 1, characterized in that, Before responding to traffic processing instructions and obtaining the network traffic to be processed and traffic information, the process also includes: The control board controller monitors whether the user terminal transmits network traffic to the network card; When the baseboard control controller detects that the user terminal is transmitting network traffic to the network card, the baseboard control controller generates the traffic processing instruction.
4. The analytical method according to any one of claims 1 to 3, characterized in that, The preprocessing strategy is one of the following: protocol conversion strategy, compression strategy, decompression strategy, encryption strategy, decryption strategy, signature strategy, verification strategy, routing communication strategy, and bus communication strategy.
5. The analytical method according to claim 1, characterized in that, The traffic in the second type of traffic set includes: traffic to be accelerated, complex control traffic, and traffic with throughput exceeding a preset throughput threshold.
6. The analytical method according to any one of claims 1, characterized in that, After the initial parsed traffic is processed by the target device, the process further includes: A traffic data application notification is generated and sent to the central processing unit (CPU). Upon receiving the traffic data application notification, the CPU invokes the application indicated by the message address carried in the traffic data application notification to consume the traffic data stored in the target memory.
7. A network traffic parsing device, characterized in that, include: A response unit is used to respond to traffic processing instructions and obtain network traffic to be processed and traffic information, wherein the traffic information includes: traffic type and traffic identifier; The query unit is used to query the preprocessing strategy corresponding to the traffic type, and to preprocess the network traffic using the preprocessing strategy to obtain the initial parsed traffic; A push unit is configured to push the initial parsed traffic to a target memory when the traffic identifier indicates that the network traffic belongs to a first type of traffic set, wherein the target memory is directly connected to the application to which the network traffic is to be delivered; A sending unit is configured to, when the traffic identifier indicates that the network traffic belongs to a second type of traffic set, send the initial parsing traffic to a target device corresponding to the traffic identifier, whereby the target device processes the initial parsing traffic, wherein the traffic in the first type of traffic set and the second type of traffic set does not include traffic processed by the central processing unit (CPU); The target device includes a bypass hardware accelerator, and the sending unit includes a first sending module, which is used to send the initial parsing traffic to the bypass hardware accelerator when the traffic identifier indicates that the network traffic is traffic to be accelerated, and the bypass hardware accelerator sends the traffic data in the initial parsing traffic to the target memory. The target device includes a network data designator processor, and the sending unit further includes a second sending module, used to send the initial parsing traffic to the network data designator processor when the traffic identifier indicates that the network traffic is complex control traffic, so that the network data designator processor performs logical processing on the initial parsing traffic and sends the traffic data obtained from the logical processing to the target memory; The target device includes a logic gate array module, and the sending unit further includes a third sending module, which is used to send the initial parsed traffic to the logic gate array module when the traffic identifier indicates that the network traffic is a portion of the traffic with a throughput higher than a preset throughput threshold. The logic gate array module performs logical processing on the initial parsed traffic and sends the traffic data obtained from the logical processing to the target memory.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device containing the computer-readable storage medium to perform the network traffic parsing method according to any one of claims 1 to 6.
9. An electronic device, characterized in that, It includes one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the network traffic parsing method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Real-time traffic analysis over mobile networks
US10084712B1
Traffic management method and apparatus, traffic management strategy configuration method and apparatus, and device and medium
WO2022148050A1