Network application data forwarding method and device

By intercepting and forwarding data requests from network applications, and using lock-free communication queues to process reply data, it solves the problems of CPU resource consumption and code modification of network applications in high-traffic scenarios, and achieves efficient and convenient data processing and maintenance.

CN116846991BActive Publication Date: 2024-09-27YUSUR TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310847334.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-11
Publication Date
2024-09-27
Estimated Expiration
2043-07-11

AI Technical Summary

Technical Problem

Existing network applications consume a lot of CPU resources for packet processing in high-traffic scenarios, resulting in low efficiency. Modifying the code to adapt to the DPDK protocol stack requires a lot of time and labor costs, and is inconvenient for later maintenance.

Method used

By intercepting the data requests of network applications, forwarding them to the target protocol stack according to the plane type, and processing the reply data in the lock-free communication queue, direct modification of the network application code is avoided, and the scheduling and maintenance of the protocol stack are facilitated.

Benefits of technology

It improves the data processing efficiency and reliability of network applications, saves time and labor costs, and simplifies the post-maintenance process. It is suitable for various types of network applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116846991B
    Figure CN116846991B
Patent Text Reader

Abstract

The present application provides a network application data forwarding method and device, the method comprising: intercepting a data request sent by the network application from outside the network application, wherein the data request includes the plane type to which it belongs in the network application; forwarding the data request to a target protocol stack corresponding to the plane type to which the data request belongs; if reply data for the data request returned by the target protocol stack is received, forwarding the reply data to the corresponding plane in the network application according to the plane type to which the data request belongs. The present application can effectively improve the efficiency and reliability of data processing of the network application without the need to develop the network application separately to adapt the protocol stack, can effectively save time and labor costs, and improve the convenience of later maintenance of the network application.
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 method and device for forwarding network application data. Background Art

[0002] A network application is a relatively traditional application used for network data processing. It is a network application system responsible for sending and receiving network message traffic and analyzing and processing data, including but not limited to current open source network processing applications (Nginx, Envoy, Suricata, etc.) and network traffic model applications developed by various enterprises to send and receive data traffic, analyze, proxy and control business processing. With the development of software technology, especially the emergence of cloud computing, big data and other services, a large amount of network data is in the process of real-time transmission. For network applications on the host, to process these massive network data, it is usually necessary to implement it based on the kernel protocol stack. The kernel protocol stack needs to consume a very high proportion of CPU resources such as 60% in large traffic scenarios to process interrupts triggered by messages, copy messages from kernel state to user state, etc. This is a great consumption for traditional network applications, and it needs to meet extremely high processing performance requirements. Therefore, if the CPU resources consumed in large traffic scenarios are saved and used for application processing messages to improve the data processing efficiency of network applications, it is one of the current research focuses.

[0003] At present, the efficiency and reliability of data processing in network applications can be improved by modifying the code of network applications to adapt to the network application data forwarding method of protocol stacks such as DPDK. For example, network applications such as Nginx, Envoy, and Suricata adapt to the protocol stack by modifying the code. However, this method not only requires modifying a large amount of code to achieve hard compatibility, but also consumes a lot of time and manpower costs, and is not convenient for the later maintenance of network applications. Therefore, it is urgent to design a network application data forwarding method that can ensure the efficiency and reliability of data processing in network applications and effectively improve the convenience of maintenance. Summary of the invention

[0004] In view of this, the embodiments of the present application provide a method and device for forwarding network application data to eliminate or improve one or more defects existing in the prior art.

[0005] One aspect of the present application provides a network application data forwarding method, comprising:

[0006] Intercepting a data request sent by the network application from outside the network application, wherein the data request includes a plane type to which the data request belongs in the network application;

[0007] Forwarding the data request to a target protocol stack corresponding to the plane type to which the data request belongs;

[0008] If reply data for the data request returned by the target protocol stack is received, the reply data is forwarded to a corresponding plane in the network application according to the plane type to which the data request belongs.

[0009] The forwarding of the data request to a target protocol stack corresponding to the plane type to which the data request belongs includes:

[0010] Based on the preset correspondence between each plane type and each protocol stack, a protocol stack corresponding to the plane type to which the data request belongs is determined as the current target protocol stack, wherein each of the protocol stacks includes: a kernel protocol stack and the DPDK network protocol stack.

[0011] In some embodiments of the present application, before forwarding the data request to the target protocol stack corresponding to the plane type to which the data request belongs, the method further includes:

[0012] The corresponding relationship between each of the plane types and each of the protocol stacks defined by a user is received and stored, or the corresponding relationship between each of the plane types and each of the protocol stacks is automatically generated according to each of the plane types in the acquired network application.

[0013] In some embodiments of the present application, if the various plane types in the network application include a management plane, a control plane, and a data plane, the correspondence between the various plane types and the various protocol stacks includes: the management plane and the control plane respectively correspond to the calling relationship between the kernel protocol stack, and the data plane corresponds to the calling relationship between the DPDK network protocol stack.

[0014] In some embodiments of the present application, if reply data for the data request returned by the target protocol stack is received, forwarding the reply data to a corresponding plane in the network application according to the plane type to which the data request belongs includes:

[0015] If the reply data returned by the DPDK network protocol stack for the data request is received, the target address corresponding to the restored data is added to the local lock-free communication queue to wait for uploading;

[0016] A dequeue operation is performed on the target address in the lock-free communication queue, and according to the plane type to which the data request belongs, reply data corresponding to the target address for the data request is sent to a corresponding plane in the network application.

[0017] In some embodiments of the present application, before adding the target address corresponding to the restored data to the local lock-free communication queue to wait for uploading, the process further includes:

[0018] Receive memory pool specification configuration parameters;

[0019] Applying for memory space based on the memory pool specification configuration parameters, and pre-allocating the content space based on the memory pool;

[0020] The communication queue is encapsulated according to the pre-allocated memory space, and the communication queue is lock-free based on the atomic operation to obtain a lock-free communication queue.

[0021] In some embodiments of the present application, intercepting a data request sent by the network application from outside the network application includes:

[0022] intercepting a data request sent by the network application from outside the network application based on a first data interface, wherein the first data interface is an interface pre-encapsulated locally and is the same as a sending data interface of the network application;

[0023] Correspondingly, sending the reply data corresponding to the target address for the data request to the corresponding plane in the network application includes:

[0024] The reply data for the data request corresponding to the target address is sent to the corresponding plane in the network application based on the second data interface, wherein the second data interface is pre-packaged locally and is the same as the receiving data interface of the network application.

[0025] Another aspect of the present application provides a network application data forwarding device, comprising:

[0026] A request interception module, used for intercepting a data request sent by the network application from outside the network application, wherein the data request includes the plane type to which it belongs in the network application;

[0027] A data forwarding module, used for forwarding the data request to a target protocol stack corresponding to the plane type to which the data request belongs;

[0028] The data sending module is used for forwarding the reply data to the corresponding plane in the network application according to the plane type to which the data request belongs, if reply data returned by the target protocol stack for the data request is received.

[0029] A third aspect of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the network application data forwarding method when executing the computer program.

[0030] A fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the network application data forwarding method when executed by a processor.

[0031] The network application data forwarding method provided by the present application intercepts a data request issued by the network application from outside the network application, wherein the data request includes the plane type to which it belongs in the network application; forwards the data request to a target protocol stack corresponding to the plane type to which the data request belongs; if reply data for the data request returned by the target protocol stack is received, the reply data is forwarded to the corresponding plane in the network application according to the plane type to which the data request belongs, which can effectively improve the efficiency and reliability of data processing by the network application without the need to develop the network application separately to adapt the protocol stack, can effectively save time and labor costs, and improve the convenience of later maintenance of the network application.

[0032] Additional advantages, purposes, and features of the present application will be partially described in the following description, and will become partially apparent to those skilled in the art after studying the following, or may be learned from the practice of the present application. The purposes and other advantages of the present application can be achieved and obtained by the structures specifically pointed out in the specification and the drawings.

[0033] Those skilled in the art will understand that the purposes and advantages that can be achieved by the present application are not limited to the above specific description, and the above and other purposes that can be achieved by the present application will be more clearly understood based on the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] The drawings described herein are used to provide a further understanding of the present application, constitute a part of the present application, and do not constitute a limitation of the present application. The components in the drawings are not drawn to scale, but are only for the purpose of illustrating the principles of the present application. In order to facilitate the illustration and description of some parts of the present application, the corresponding parts in the drawings may be enlarged, that is, they may become larger relative to other components in the exemplary device actually manufactured according to the present application. In the drawings:

[0035] Figure 1 The present invention is a schematic diagram of the overall process of a method for forwarding network application data in one embodiment of the present application.

[0036] Figure 2 A specific flow chart of a method for forwarding network application data in one embodiment of the present application.

[0037] Figure 3 This is a schematic diagram of the Envoy architecture used in an example of this application.

[0038] Figure 4 This is an example architecture diagram of adapting the DPDK protocol stack to the existing network application Envoy.

[0039] Figure 5 This is a preferred schematic diagram of the correspondence between each of the plane types and each of the protocol stacks in an embodiment of the present application.

[0040] Figure 6 Another specific flow chart of the network application data forwarding method in one embodiment of the present application.

[0041] Figure 7 It is a structural diagram of a network application data forwarding device in one embodiment of the present application.

[0042] Figure 8 This is a schematic diagram of the structure of a DCL library of an application example of the present application.

[0043] Fig. 9 A schematic diagram of the structural relationship between the DCL library, network application and protocol stack of an application example of the present application. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the implementation modes and the accompanying drawings. Here, the illustrative implementation modes and descriptions of the present application are used to explain the present application, but are not intended to limit the present application.

[0045] It should also be noted here that in order to avoid obscuring the present application due to unnecessary details, only the structures and / or processing steps closely related to the scheme according to the present application are shown in the accompanying drawings, while other details that are not very relevant to the present application are omitted.

[0046] It should be emphasized that the term “include / comprises” when used herein refers to the presence of features, elements, steps or components, but does not exclude the presence or addition of one or more other features, elements, steps or components.

[0047] It should also be noted that, unless otherwise specified, the term “connection” herein may refer not only to a direct connection but also to an indirect connection with an intermediate.

[0048] Hereinafter, embodiments of the present application will be described with reference to the accompanying drawings. In the accompanying drawings, the same reference numerals represent the same or similar components, or the same or similar steps.

[0049] In order to solve the problem that the existing network application data forwarding method adopts the method of modifying the code of the network application to adapt to the protocol stack such as DPDK, although it can ensure the efficiency and reliability of the upgraded network application to process data, it needs to modify a large amount of code to achieve hard compatibility, which consumes a lot of time and manpower costs, and is not convenient for the later maintenance of the network application. The embodiments of the present application respectively provide a network application data forwarding method, a network application data forwarding device for executing the network application data forwarding method, a physical device and a computer-readable storage medium. The scheduling of the protocol stack can be realized without changing any code, and it can be applicable to all network applications. It can avoid the problem that different network applications need to adapt and develop a set of adaptation protocol stacks separately. Moreover, by calling the design of interception processing operations, it can effectively avoid a large amount of modification of the network application code to adapt the protocol stack, thereby solving the problem of difficulty in later upgrade and maintenance, and saving a lot of manpower, that is, time cost.

[0050] The details are described in detail through the following examples.

[0051] Based on this, the embodiment of the present application provides a network application data forwarding method that can be implemented by a network application data forwarding device, see Figure 1 , the network application data forwarding method specifically includes the following contents:

[0052] Step 100: intercepting a data request sent by the network application from outside the network application, wherein the data request includes the plane type to which it belongs in the network application.

[0053] In step 100, the network application data forwarding device can use interceptors such as interfaces and filters to intercept data requests for network applications. It can be understood that the data requests mentioned in one or more embodiments of the present application refer to data calls, queries or storage requests sent by any one of the planes of the network application. The network application data forwarding device monitors and intercepts each plane in the network application in real time.

[0054] The plane type included in the data request in the network application refers to the type corresponding to the plane that issues the data request in the network application.

[0055] Since the network application data forwarding method provided in this application is a universal method that is independent of the network application and does not require code adaptation and modification of the network application, it is suitable for various network applications, such as Nginx, Envoy, Suricata, etc.

[0056] Based on this, the network application data forwarding method provided in the present application is also applicable to network applications divided in different plane types, that is, regardless of whether the network application is divided into two, three, four or even more than four types of planes, the network application data forwarding method provided in the present application is applicable.

[0057] Step 200: Forward the data request to a target protocol stack corresponding to the plane type to which the data request belongs.

[0058] In one or more embodiments of the present application, the protocol stack specifically refers to the sum of protocols at each layer in a network, and is used to reflect the process of file transmission in a network.

[0059] In step 200, the target protocol stack corresponding to the plane type to which the data request belongs may be a protocol stack that is pre-defined and changeable by the user, or may be a fixed protocol stack.

[0060] It should also be noted that the network application data forwarding device intercepts its data request outside the network application, and then forwards the data request to the protocol stack outside the network application. In other words, the protocol stack obviously does not need to be integrated with the network application, which can further improve the convenience and applicability of network application data forwarding.

[0061] After the network application data forwarding device executes step 200, two situations may occur according to the type of the data request currently forwarded:

[0062] Case 1 is: if the data request is a data storage or response request, etc., it is not necessary to obtain reply data from the protocol stack. Therefore, in this case, the network application data forwarding device will not receive reply data for the data request.

[0063] The second situation is the opposite: if the data is a data query or a call request, etc., the protocol stack needs to return reply data, then the network application data forwarding device may receive the reply data and then execute the following step 300.

[0064] Step 300: If reply data for the data request returned by the target protocol stack is received, the reply data is forwarded to a corresponding plane in the network application according to the plane type to which the data request belongs.

[0065] In step 300, the network application data forwarding device also forwards the reply data to the corresponding plane in the network application outside the network application. The specific forwarding may be carried out by means of an interface or the like.

[0066] From the above description, it can be seen that the network application data forwarding method provided in the embodiment of the present application can be applicable to various types of network applications, and can avoid the need for different network data processing applications to be individually adapted and developed to adapt to a set of DPDK. By calling the interception processing operation, it can avoid a large number of modifications to the code of the adapted network data processing application to adapt to DPDK, which can solve the problem of difficulty in subsequent upgrades and maintenance, can save a lot of manpower costs, and effectively improve the efficiency and reliability of data processing in network applications.

[0067] In order to further improve the flexibility and efficiency of network application data forwarding, in one embodiment of the network application data forwarding method provided in the present application, see Figure 2 , step 200 in the network application data forwarding method specifically includes the following contents:

[0068] Step 210: Based on the preset correspondence between each plane type and each protocol stack, determine the protocol stack corresponding to the plane type to which the data request belongs as the current target protocol stack, wherein each of the protocol stacks includes: a kernel protocol stack and the DPDK network protocol stack.

[0069] Before step 210, the corresponding relationship between each plane type and each protocol stack may be preset to improve the flexibility of selecting the target protocol stack.

[0070] In step 210, the network application data forwarding device pre-sets multiple protocol stacks and selects one, so that data requests from different types of planes can be processed from different protocol stacks, which can not only reduce the resource occupancy rate of the protocol stack for data processing, but also improve the efficiency of data forwarding and calling. The network application adapts the protocol stack, and multiple planes use the same protocol stack at the same time, avoiding the instability of the network data processing application configuration reception processing timeout due to large traffic in the later system.

[0071] It is understandable that the DPDK (Data Plane Development Kit) network protocol stack is an open source software development kit for accelerating the development of packet processing and packet forwarding applications. It provides a set of high-performance user-mode libraries and drivers that can enable network applications to run at very high speeds on general-purpose servers based on Intel x86 architecture.

[0072] In step 210, each of the protocol stacks may include at least a kernel protocol stack (ie, a Kernel stack) and the DPDK network protocol stack, and may also include other types of protocol stacks, which may be specifically configured according to actual application scenarios.

[0073] In order to further improve the flexibility and efficiency of network application data forwarding, in one embodiment of the network application data forwarding method provided in the present application, see Figure 2 , the network application data forwarding method specifically includes the following contents before step 200:

[0074] Step 010: receiving and storing the user-defined correspondence between each of the plane types and each of the protocol stacks, or automatically generating the correspondence between each of the plane types and each of the protocol stacks according to the acquired plane types in the network application.

[0075] Specifically, there are two ways to obtain the correspondence between each of the plane types and each of the protocol stacks:

[0076] One is: the network application data forwarding device directly receives and stores the correspondence between each plane type and each protocol stack defined by the user. The advantage of this method is that it can realize user customization. Users can customize the technology of the protocol stack of each plane of network data processing based on the needs of their own scenarios, and can choose DPDK protocol stack or Kernel stack.

[0077] The second is: the network application data forwarding device accepts various plane types in the network application to be forwarded, and then automatically generates the correspondence between these plane types and each of the protocol stacks. The advantage of this method is: even if the user does not understand the characteristics and advantages of different protocol stacks well, only the various plane types in the network application need to be given, and the configuration of the correspondence between the plane type and each of the protocol stacks can be realized.

[0078] On this basis, the network application data forwarding device can implement configuration based on a preset optimal configuration logic to improve the response efficiency of non-business requests, which will be described in detail in the next embodiment.

[0079] In order to further improve the flexibility and efficiency of network application data forwarding, in one embodiment of the network application data forwarding method provided in the present application, if the various plane types in the network application include a management plane, a control plane, and a data plane, then the corresponding relationship between each of the plane types and each of the protocol stacks includes: the management plane and the control plane correspond to the calling relationship between the kernel protocol stack, and the data plane corresponds to the calling relationship between the DPDK network protocol stack. Among them, for example, the data request sent by the management plane can be an information viewing request, which can view the specifications of the current sent traffic (current memory information) stored in the memory of the application program, and is used to search for statistical information in the memory through the kernel stack. The data request sent by the control plane can be a process configuration control request, which is used to control and manage configuration information through the kernel stack. The data request sent by the data plane is a business processing request, which is used to retrieve the reply data corresponding to the business processing request through the DPDK protocol stack.

[0080] Take Envoy as an example of a network application. Envoy is an open source, high-performance proxy that is usually used as the data plane of a service mesh and is responsible for actual request forwarding and processing. The Envoy architecture is divided into a data plane, a management plane, and a control plane. The control plane is used to manage policies and configurations related to traffic routing and forwarding. The management plane obtains the latest traffic configuration information through a standard API. Traffic forwarding on the data plane is based on the configuration rules issued by the control plane. Specifically, the control plane is used to manage policies and configurations related to traffic routing and forwarding. The management plane obtains the latest traffic configuration information through a standard API. Traffic forwarding on the data plane is based on the configuration rules issued by the control plane. For the Envoy architecture, see Figure 3 .

[0081] If the network application is adapted to DPDK, all services on the data plane, control plane, and management plane will use the DPDK protocol stack. Figure 4 , it will cause the DPDK protocol stack to cause the network data processing application to receive the management plane and control plane configuration slowly or even time out in scenarios with heavy business volume. This goes against the concept of independence of the data plane, control plane and management plane. This only improves the performance of the network data processing application system but reduces the reliability of the system.

[0082] Based on this, in an embodiment of the present application, when the framework of the network application is divided into three planes, the network application data forwarding device configures the correspondence between each plane type and each protocol stack as follows: the management plane and the control plane correspond to the calling relationship between the kernel protocol stack, and the calling relationship between the data plane and the DPDK network protocol stack corresponds to, such as Figure 5As shown, it is possible to avoid the phenomenon that the control plane and management plane use the DPDK protocol stack at the same time after the network data processing application is adapted to DPDK, and to avoid unstable problems such as large traffic in the later system causing the network data processing application configuration reception processing timeout.

[0083] In order to avoid the blocking caused by queue locking in data transmission through a lock-free method, improve the performance of the queue, and thus improve the overall performance of application business processing, in one embodiment of the network application data forwarding method provided in the present application, see Figure 2 , step 300 in the network application data forwarding method specifically includes the following contents:

[0084] Step 310: If the reply data returned by the DPDK network protocol stack for the data request is received, the target address corresponding to the restored data is added to the local lock-free communication queue to wait for uploading.

[0085] Step 320: Dequeue the target address in the lock-free communication queue, and send the reply data for the data request corresponding to the target address to the corresponding plane in the network application according to the plane type to which the data request belongs.

[0086] In order to avoid the consumption caused by dynamic memory application in data processing and improve the application reliability of lock-free queues, in one embodiment of the network application data forwarding method provided in this application, see Figure 2 , the network application data forwarding method further specifically includes the following contents before step 300:

[0087] Step 020: Receive memory pool specification configuration parameters.

[0088] Step 030: Apply for memory space based on the memory pool specification configuration parameters, and pre-allocate the content space based on the memory pool.

[0089] Step 040: encapsulate the communication queue according to the pre-allocated memory space, and perform lock-free processing on the communication queue based on atomic operations to obtain a lock-free communication queue.

[0090] In order to achieve imperceptible interception and forwarding, in one embodiment of the network application data forwarding method provided in this application, see Figure 6 , step 100 in the network application data forwarding method further specifically includes the following contents:

[0091] Step 110: intercepting a data request sent by the network application from outside the network application based on a first data interface, wherein the first data interface is an interface pre-encapsulated locally and is the same as a sending data interface of the network application.

[0092] For the corresponding Figure 6 , step 320 in the network application data forwarding method further specifically includes the following contents:

[0093] Step 321: Perform a dequeue operation on the target address in the lock-free communication queue, and send the reply data for the data request corresponding to the target address to the corresponding plane in the network application based on the second data interface, wherein the second data interface is pre-packaged locally and is the same as the receiving data interface of the network application.

[0094] Specifically, the network application data forwarding device encapsulates a set of processing interfaces that are completely consistent with the C library (libc) sockets used by the network application, and realizes the network application's unaware sending and receiving of data from the network application data forwarding device by calling the interface. That is, when the network application needs to receive and process data, it calls the data receiving interface of the network application data forwarding device, and when the network application sends data, it calls the data sending interface of the network application data forwarding device. In this way, the network application is unaware of the existence of the middleware, that is, the network application data forwarding device and the DPDK protocol stack, etc., so there is no need for any adaptation and modification of the network data processing application code, thereby improving the maintainability of the network data processing application system, which is suitable for business scenarios with novel technologies, frequent updates, and maintenance and upgrades, facilitating later upgrades and maintenance, saving upgrade and maintenance costs, and improving data processing efficiency.

[0095] From the software level, the present application also provides a network application data forwarding device for executing all or part of the network application data forwarding method, see Figure 7 , the network application data forwarding device specifically includes the following contents:

[0096] A request interception module 10, used for intercepting a data request sent by the network application from outside the network application, wherein the data request includes the plane type to which it belongs in the network application;

[0097] A data forwarding module 20, configured to forward the data request to a target protocol stack corresponding to the plane type to which the data request belongs;

[0098] The data sending module 30 is configured to, if reply data for the data request is received from the target protocol stack, forward the reply data to a corresponding plane in the network application according to the plane type to which the data request belongs.

[0099] The embodiment of the network application data forwarding device provided in the present application can be specifically used to execute the processing flow of the embodiment of the network application data forwarding method in the above-mentioned embodiment. Its functions will not be repeated here, and reference can be made to the detailed description of the above-mentioned network application data forwarding method embodiment.

[0100] The part of the network application data forwarding device that forwards the network application data can be executed in the server or completed in the client device. The specific selection can be based on the processing capability of the client device and the limitations of the user's usage scenario. This application does not limit this. If all operations are completed in the client device, the client device may also include a processor for specific processing of network application data forwarding.

[0101] The client device may have a communication module (i.e., a communication unit) that can communicate with a remote server to achieve data transmission with the server. The server may include a server on the task scheduling center side, and other implementation scenarios may also include a server on an intermediate platform, such as a server on a third-party server platform that has a communication link with the task scheduling center server. The server may include a single computer device, or a server cluster consisting of multiple servers, or a server structure of a distributed device.

[0102] The server and the client device may communicate with each other using any suitable network protocol, including network protocols that have not yet been developed on the date of filing this application. The network protocols may include, for example, TCP / IP, UDP / IP, HTTP, HTTPS, etc. Of course, the network protocols may also include, for example, RPC (Remote Procedure Call Protocol) and REST (Representational State Transfer) protocols used on top of the above protocols.

[0103] From the above description, it can be seen that the network application data forwarding device provided in the embodiment of the present application can effectively improve the efficiency and reliability of data processing of the network application without the need to develop the network application separately to adapt the protocol stack, can effectively save time and labor costs, and improve the convenience of the later maintenance of the network application.

[0104] On this basis, in order to further illustrate the network application data forwarding method provided by the above-mentioned embodiment of the present application, in view of the defects of low performance and poor maintainability of the above-mentioned network application, an application example of the present application also provides a process of configuring and forwarding network application data forwarding using the DCL (DPDK Connection Lib) library, which can be used to solve the problem of reduced maintainability of the application system due to the improvement of application performance, the problem of reduced reliability of the application system due to the improvement of application performance, and the problem that network applications need to be developed and adapted separately to be compatible with DPDK.

[0105] In this application example, the DCL library can be a specific implementation example of the aforementioned network application data forwarding device. The DCL library can at least implement the functions of each functional module in the network application data forwarding device. In order to further refine the functions of each functional module in the network application data forwarding device, see Figure 8 and Fig. 9 The DCL library specifically includes a configuration parsing module 1, a memory pool module 2, a communication queue module 3, a call interception module 4, a dual stack processing parsing module 5 and a data message transceiver module 6. The specific functions of each module are described as follows:

[0106] (1) Configuration parsing module 1: Responsible for user configuration parsing, parsing the stack configuration parameter items selected by the user to configure the control plane, data plane, and configuration plane of the network application, and parsing the memory pool specification configuration parameter items. Users can customize the selection of data processing stacks (Kernel, DPDK) in the form of configuration parameters based on scenario needs.

[0107] (2) Memory pool module 2: Initializes and applies for memory space of a certain specification in advance according to the parameters configured by the user, and maintains the dequeueing and enqueuing of the memory space. Pre-allocating memory in advance through the memory pool avoids the consumption caused by dynamic memory application in data processing, reduces the delay of business processing, and improves the overall performance.

[0108] (3) Communication Queue Module 3: Implements lock-free queues for message data transmission between network applications and DPDK. By using a lock-free approach, it avoids blockages caused by queue locking during data transmission, improves queue performance, and thus improves the overall performance of the service.

[0109] (4) Call interception module 4: Encapsulate a set of processing interfaces that are completely consistent with the Libc socket used by the network application, and intercept the calling interface of the network application data receiving and sending module by calling. This enables the network application to send and receive data from DCL without being aware of it. That is, when the network application needs to receive and process data, it calls the DCL data receiving interface, and when the network application sends data, it calls the DCL data sending interface. In this way, the network application is unaware of the existence of the middleware DCL and DPDK, so there is no need to adapt or modify the network application code, which improves the maintainability of the network application system. It is suitable for business scenarios with novel technologies, frequent updates, and maintenance and upgrades. It can facilitate later upgrades and maintenance, save upgrade and maintenance costs, and improve data processing efficiency.

[0110] (5) Dual stack processing analysis module 5: Combines user-defined configuration parameters to intercept the corresponding data processing stack. For example, the user can configure the data plane to use the DPDK protocol stack, while the management plane and control plane use the kernel stack: to ensure that the data plane reduces the performance consumption of operations such as message copying and interrupt processing, improve the CPU utilization of network applications, and prevent DPDK from affecting the traffic data of the network application management plane and control plane in large traffic scenarios, thereby improving the performance of the network application system while also improving the reliability of the system.

[0111] (6) Data message receiving and sending module 6: Responsible for receiving and sending data from DPDK and network applications. For example, it copies the address of the message data received from DPDK to the memory allocated in advance by the memory pool module, and then transmits the data to the network application through the lock-free mechanism of the communication queue module.

[0112] In this application example, the specific process of using the DCL library to perform the configuration and forwarding of network application data forwarding is as follows:

[0113] S1: Initialization phase

[0114] (1) The DCL library first calls the configuration parsing module 1 to parse the user configuration. The parsing parameters mainly include two parts. One part is the dual-stack related parameters, which are used to specify which sockets use the DPDK stack and which sockets use the kernel stack; the other part is the memory related parameters.

[0115] (2) The DCL library calls the memory pool module 2 to initialize the memory, and initializes the memory of the specified specification according to the memory parameters parsed in the above process (1). The memory serves the communication queue module 3.

[0116] (3) The DCL library then calls the communication queue module 3 to initialize the queue. This module encapsulates the queue entry and exit operations based on the memory requested in advance in the memory pool, and implements lock-free operation based on atomic operations.

[0117] S2: Dual stack configuration processing stage

[0118] (1) After completing the initialization phase, DCL enters the dual stack configuration phase. In this phase, DCL will first call a call interception module 4. The call interception module 4 will implement a unified libc socket processing interface for general network applications to use. In addition, the module provides a dynamic link library mechanism to ensure that general network applications are unaware of changes in the underlying interface, thereby achieving call interception without changing any code in the general network application.

[0119] (2) Calling and intercepting the function of the pre-configured dynamic link library: The unified libcsocket processing interface provided by the call interception module 4 will call the interface provided by the dual stack processing and analysis module 5. The dual stack processing and analysis module 5 will perform corresponding processing operations based on the dual stack parameters parsed in the previous initialization node. If the specified socket is to use the DPDK stack, the module will call the DPDK stack interface; on the contrary, if the kernel stack is specified, the module will call the kernel stack interface. In this way, the general network data uses the data plane interface, and the control plane and management plane use the kernel stack interface.

[0120] S4: Message sending and receiving processing stage

[0121] If the specified Socket uses the DPDK stack, the DCL library will call the data packet transceiver module 6, which will send the data mbuf address received from the DPDK interface to the enqueue operation provided by the communication queue module 3, while the other end of the queue is the dual stack processing and parsing module 5 to perform the dequeue operation, and finally send it to the specific general network application.

[0122] Based on this, the existing problem of network application data forwarding method is: modifying the network application code to adapt to DPDK leads to serious business coupling, and all functional codes of the network application need to be ported to DPDK. The characteristic is that the code modified by the network application and DPDK is highly invasive, which is not convenient for the subsequent maintenance and upgrade of the network application, especially in scenarios where the technology is relatively new and the community version is frequently updated and iterated. This only improves the performance of the network application but reduces the maintainability of the network application in the later stage. This solution is only suitable for technical fields with a complete technology stack and no need for subsequent iterations. It is not suitable for fields with frequent technology iterations. For example, Envoy is applied to service grid scenarios, and service grid technology is relatively new, frequently updated and iterated, and rapidly developing. After adapting to DPDK, whether it is upgrading or technical changes, a lot of manpower needs to be wasted on development adaptation and testing. The application example of the present application provides a DCL library and a method for configuring and forwarding network application data forwarding implemented by using the DCL library, which involves a general means of improving application business performance based on network applications while improving system reliability and maintainability, and can be applied to all network applications, avoiding the need for different network applications to be individually adapted and developed to adapt to a set of DPDKs; by calling interception processing operations, it is avoided that a large number of modifications to the code of the adapted network application are modified to adapt to DPDK, solving the problem of difficulty in subsequent upgrades and maintenance, and saving a lot of manpower costs; at the same time, by selecting processing operations through a custom data processing stack, it is avoided that after the network application is adapted to DPDK, the control plane and the management plane simultaneously use the DPDK stack, and it is avoided that the system has large traffic in the later stage, resulting in unstable problems such as timeout of network application configuration reception processing.

[0123] In other words, the application example of this application has at least the following beneficial effects:

[0124] (1) DPDK universal adaptation framework technology for network applications. All network applications can implement DPDK scheduling without changing any code after using the DCL library.

[0125] (2) For the non-intrusive call interception technology for network applications, the upper-level network application does not need to be aware of the underlying implementation and does not need to modify any code, which facilitates subsequent maintenance and upgrades.

[0126] (3) Users can customize the technology of network application control plane, data plane, and management plane data traffic processing stack based on the needs of their own scenarios. They can choose DPDK stack or Kernel stack.

[0127] (4) The memory pool technology that can reduce dynamic memory requests can reduce the performance consumption caused by dynamic memory requests during data transmission, thereby improving overall performance.

[0128] (5) Memory mapping technology can reduce the performance consumption caused by copying data messages, save CPU and memory resources, and thus improve the business performance of the service grid system.

[0129] In summary, the application example of this application ensures that network applications improve the performance of application services while also improving the maintainability and reliability of application services.

[0130] The embodiment of the present application also provides an electronic device, which may include a processor, a memory, a receiver and a transmitter, wherein the processor is used to execute the network application data forwarding method mentioned in the above embodiment, wherein the processor and the memory may be connected via a bus or other means, such as by bus connection. The receiver may be connected to the processor and the memory via wired or wireless means.

[0131] The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.

[0132] As a non-transient computer-readable storage medium, the memory can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the network application data forwarding method in the embodiment of the present application. The processor executes various functional applications and data processing of the processor by running the non-transient software programs, instructions and modules stored in the memory, that is, the network application data forwarding method in the above method embodiment is implemented.

[0133] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0134] The one or more modules are stored in the memory, and when executed by the processor, perform the network application data forwarding method in the embodiment.

[0135] In some embodiments of the present application, the user equipment may include a processor, a memory, and a transceiver unit, which may include a receiver and a transmitter. The processor, memory, receiver, and transmitter may be connected through a bus system. The memory is used to store computer instructions, and the processor is used to execute the computer instructions stored in the memory to control the transceiver unit to send and receive signals.

[0136] As an implementation method, the functions of the receiver and the transmitter in the present application can be considered to be implemented through a transceiver circuit or a dedicated chip for transceiver, and the processor can be considered to be implemented through a dedicated processing chip, a processing circuit or a general chip.

[0137] As another implementation method, it is possible to use a general-purpose computer to implement the server provided in the embodiment of the present application, that is, to store the program code for implementing the functions of the processor, receiver, and transmitter in a memory, and the general-purpose processor implements the functions of the processor, receiver, and transmitter by executing the code in the memory.

[0138] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the aforementioned network application data forwarding method are implemented. The computer-readable storage medium can be a tangible storage medium, such as a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a floppy disk, a hard disk, a removable storage disk, a CD-ROM, or any other form of storage medium known in the technical field.

[0139] It should be understood by those skilled in the art that the exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software or a combination of the two. Whether it is specifically 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. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier.

[0140] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0141] In this application, the features described and / or illustrated for one embodiment may be used in the same manner or in a similar manner in one or more other embodiments, and / or combined with or replace the features of other embodiments.

[0142] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the embodiments of the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A network application data forwarding method, characterized in that: include: Adopting an interceptor to intercept a data request sent by the network application from outside the network application, wherein the data request includes the plane type to which it belongs in the network application; Externally of the network application, forwarding the data request to a target protocol stack corresponding to the plane type to which the data request belongs; If reply data for the data request returned by the target protocol stack is received, forwarding the reply data to a corresponding plane in the network application according to the plane type to which the data request belongs; The step of forwarding the data request to a target protocol stack corresponding to the plane type to which the data request belongs includes: Based on the preset correspondence between each plane type and each protocol stack, determine the protocol stack corresponding to the plane type to which the data request belongs as the current target protocol stack, wherein each of the protocol stacks includes: a kernel protocol stack and a DPDK network protocol stack; Wherein, if the reply data returned by the target protocol stack for the data request is received, forwarding the reply data to the corresponding plane in the network application according to the plane type to which the data request belongs includes: If the reply data returned by the DPDK network protocol stack for the data request is received, the target address corresponding to the reply data is added to the local lock-free communication queue to wait for uploading; Performing a dequeue operation on the target address in the lock-free communication queue, and sending reply data corresponding to the target address for the data request to a corresponding plane in the network application according to the plane type to which the data request belongs; The step of intercepting a data request sent by the network application from outside the network application includes: intercepting a data request sent by the network application from outside the network application based on a first data interface, wherein the first data interface is an interface pre-encapsulated locally and is the same as a sending data interface of the network application; Correspondingly, sending the reply data corresponding to the target address for the data request to the corresponding plane in the network application includes: The reply data for the data request corresponding to the target address is sent to the corresponding plane in the network application based on the second data interface, wherein the second data interface is pre-packaged locally and is the same as the receiving data interface of the network application.

2. The network application data forwarding method according to claim 1, characterized in that: Before forwarding the data request to a target protocol stack corresponding to the plane type to which the data request belongs, the method further includes: The corresponding relationship between each of the plane types and each of the protocol stacks defined by a user is received and stored, or the corresponding relationship between each of the plane types and each of the protocol stacks is automatically generated according to each of the plane types in the acquired network application.

3. The network application data forwarding method according to claim 1 or 2, characterized in that: If the various plane types in the network application include a management plane, a control plane and a data plane, the corresponding relationship between the various plane types and the various protocol stacks includes: the management plane and the control plane respectively correspond to the calling relationship between the kernel protocol stack, and the data plane corresponds to the calling relationship between the DPDK network protocol stack.

4. The network application data forwarding method according to claim 1, characterized in that: Before adding the target address corresponding to the reply data to the local lock-free communication queue to wait for uploading, it also includes: Receive memory pool specification configuration parameters; Applying for memory space based on the memory pool specification configuration parameters, and pre-allocating the memory space based on the memory pool; The communication queue is encapsulated according to the pre-allocated memory space, and the communication queue is lock-free based on the atomic operation to obtain a lock-free communication queue.

5. A network application data forwarding device, characterized in that: include: A request interception module, used to intercept a data request sent by the network application from outside the network application by using an interceptor, wherein the data request includes the plane type to which it belongs in the network application; A data forwarding module, used for forwarding the data request to a target protocol stack corresponding to the plane type to which the data request belongs, outside the network application; a data sending module, configured to, if reply data for the data request is received from the target protocol stack, forward the reply data to a corresponding plane in the network application according to the plane type to which the data request belongs; The step of forwarding the data request to a target protocol stack corresponding to the plane type to which the data request belongs includes: Based on the preset correspondence between each plane type and each protocol stack, determine the protocol stack corresponding to the plane type to which the data request belongs as the current target protocol stack, wherein each of the protocol stacks includes: a kernel protocol stack and a DPDK network protocol stack; Wherein, if the reply data returned by the target protocol stack for the data request is received, forwarding the reply data to the corresponding plane in the network application according to the plane type to which the data request belongs includes: If the reply data returned by the DPDK network protocol stack for the data request is received, the target address corresponding to the reply data is added to the local lock-free communication queue to wait for uploading; Performing a dequeue operation on the target address in the lock-free communication queue, and sending reply data corresponding to the target address for the data request to a corresponding plane in the network application according to the plane type to which the data request belongs; The step of intercepting a data request sent by the network application from outside the network application includes: intercepting a data request sent by the network application from outside the network application based on a first data interface, wherein the first data interface is an interface pre-encapsulated locally and is the same as a sending data interface of the network application; Correspondingly, sending the reply data corresponding to the target address for the data request to the corresponding plane in the network application includes: The reply data for the data request corresponding to the target address is sent to the corresponding plane in the network application based on the second data interface, wherein the second data interface is pre-packaged locally and is the same as the receiving data interface of the network application.

6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the network application data forwarding method according to any one of claims 1 to 4 is implemented.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the network application data forwarding method as described in any one of claims 1 to 4 is implemented.