Communication method, device, equipment and storage medium

Through XDP technology, the reliability and congestion control algorithm in the network proxy is moved from the user state to the kernel state, and split it into the control plane and the data forwarding plane, solving the problem of frequent context switching of UDP protocol in the existing technology, achieving more efficient Improve resource utilization and transmission performance.

CN115801879BActive Publication Date: 2024-11-26CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211712748.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-29
Publication Date
2024-11-26
Estimated Expiration
2042-12-29

AI Technical Summary

Technical Problem

In existing network communications, when UDP protocol realizes reliability, congestion control and traffic control in user mode, it leads to frequent context switching between kernel mode and user mode, consumes a lot of resources, and the TCP protocol update cycle is long, making it difficult to quickly apply the new algorithm.

Method used

Using XDP technology, the reliability, congestion control and other algorithms in network agents are moved from user state to kernel state, and split into control surfaces and data forwarding surfaces, reducing the number of context switching times, shortening the packet processing path, and supporting reliable and non-reliable Reliable data transmission concurrently without the need to update the kernel version.

Benefits of technology

Reduce resource consumption and improve transmission performance, especially in weak network environments, algorithms can be adjusted according to needs to improve transmission performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115801879B_ABST
    Figure CN115801879B_ABST
Patent Text Reader

Abstract

The present application provides a communication method, apparatus, device and storage medium. The present application proposes to move the reliability, congestion control and other algorithms implemented in the network proxy from the user state to the kernel state based on the XDP technology, and split it into the control plane and the data forwarding plane. Reduce the number of up and down switching and shorten the data packet processing path. At the same time, support the concurrent transmission of reliable and unreliable data with fewer resources. There is no need to update the kernel version. The algorithm can be changed according to its own needs, such as improving the transmission performance in a weak network environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network technology, and in particular to a communication method, apparatus, device and storage medium. Background Art

[0002] In the existing network communication process, the client implements a set of transmission protocols in user mode, customizes reliability, congestion algorithms and flow control, etc. The transport layer is based on the UDP protocol. Users can use this custom protocol to transmit reliable UDP traffic, or transmit native unreliable UDP traffic. Both channels use the same socket resource.

[0003] For proxy service: the custom transport protocol appears in pair with the client. Both channels also use one socket resource. In the proxy service, because UDP is transmitted in the form of messages, not TCP streams, the context switches between kernel mode and user mode are more frequent, consuming more resources. This is more obvious in unreliable channels.

[0004] However, the original TCP-based protocol relies on kernel version updates, which has a long cycle and involves a wide range of areas. Some new transmission algorithms are difficult to be applied in the short term. The original UDP-based protocol implements reliability, congestion control, and flow control in user mode, which increases the consumption of context switching and the processing path of data packets.

[0005] The above information disclosed in the background section is only for enhancing understanding of the background of the present application and therefore it may contain information that does not form the prior art known to a person of ordinary skill in the art. Summary of the invention

[0006] The present application provides a communication method, apparatus, device and storage medium to solve the problems existing in the prior art.

[0007] In a first aspect, the present application provides a communication method, applied to a server, the server including a control plane and a forwarding plane, the method comprising:

[0008] S1, the control plane runs in user mode and handles the handshake process of the custom transport protocol;

[0009] S2. After the handshake succeeds, the control plane sends the forwarding data to the kernel;

[0010] S3. The forwarding plane runs in kernel state and determines a corresponding data processing strategy based on the forwarding data.

[0011] In some embodiments, in S1, the handshake process includes:

[0012] S11. The client generates a unique connection ID within the process, where the connection ID includes a first ID and a second ID, wherein the first ID is used to identify a reliable transmission queue, and the second ID is used to identify an unreliable transmission queue;

[0013] S12, the client sends a handshake request including the connection ID to the server;

[0014] S13. After receiving the handshake request, the server determines the corresponding cookie value according to the source IP, source port and current time of the client, and sends the cookie value to the client;

[0015] S14, the client returns the cookie value and network negotiation parameters to the server;

[0016] S15. The server verifies the cookie value, negotiates network parameters with the client, generates a unique third ID and a fourth ID, and determines that the handshake is successful, wherein the third ID is used to identify a reliable transmission queue, and the fourth ID is used to identify an unreliable transmission queue.

[0017] In some embodiments, in S2, the control plane sends the forwarding data to the kernel through the ebpf map technology.

[0018] In some embodiments, the forwarding data includes a key and a value;

[0019] Among them, the key includes: source IP, source port, destination IP, destination port, connection ID;

[0020] Value includes: flag, IP+PORT of backend service and routing information.

[0021] In some embodiments, S3 includes:

[0022] S31, read the forwarding database through the prog program on the xdp hook to find out whether there is a matching key;

[0023] S32. If it exists, determine the flag value in value and determine whether it is a reliable or unreliable UDP message;

[0024] S33. If it is a reliable UDP message, modify the protocol field in the IP header, change 17 to the custom transport protocol value, and return to the protocol stack to wait for the subsequent kernel module to process.

[0025] In some embodiments, it also includes:

[0026] If there is no matching key, XDP_PASS is returned to allow the protocol stack to continue processing.

[0027] In some embodiments, it also includes:

[0028] If it is an unreliable UDP message, modify the message header and checksum, and find a routing proxy to send it out.

[0029] In a second aspect, the present application provides a communication device, applied to a server, the server including a control plane and a forwarding plane, the device including:

[0030] The first running module is used to control the plane to run in user mode and process the handshake process of the custom transmission protocol; after the handshake is successful, the control plane sends the forwarding data to the kernel;

[0031] The second running module is used for the forwarding plane to run in the kernel state and determine the corresponding data processing strategy based on the forwarding data.

[0032] In a third aspect, the present application provides a terminal device, including a memory and a processor:

[0033] The memory is used to store computer programs; the processor is used to read the computer programs in the memory and execute the above communication method.

[0034] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to implement the above-mentioned communication method when executed by a processor.

[0035] The communication method, apparatus, device and storage medium provided by this application propose to move the reliability, congestion control and other algorithms implemented in the network proxy from the user state to the kernel state based on XDP technology, and split it into the control plane and the data forwarding plane. Reduce the number of up and down switching and shorten the data packet processing path. At the same time, support the concurrent transmission of reliable and unreliable data with fewer resources. There is no need to update the kernel version. The algorithm can be changed according to its own needs, such as improving the transmission performance in a weak network environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0037] Figure 1 A schematic diagram of an existing network communication process;

[0038] Figure 2 A schematic diagram of a communication method provided in an embodiment of the present application;

[0039] Figure 3 An example diagram of a communication method provided in an embodiment of the present application;

[0040] Figure 4 A schematic diagram of the handshake process of the custom transmission protocol provided in an embodiment of the present application;

[0041] Figure 5 A schematic diagram of determining a corresponding data processing strategy based on the forwarding data provided in an embodiment of the present application.

[0042] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0044] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms "a", "an" and "the" used in the embodiments of the present application are also intended to include plural forms, unless the context clearly indicates other meanings.

[0045] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, "multiple" and "several" mean two or more, unless otherwise clearly and specifically defined.

[0046] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0047] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0048] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a product or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such a product or system. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the product or system including the elements.

[0049] Figure 1 It is a schematic diagram of the existing network communication process, such as Figure 1 As shown, the client implements a set of transmission protocols in user mode, customizes reliability, congestion algorithms and flow control, etc. The transport layer is based on the UDP protocol. Users can use this custom protocol to transmit reliable UDP traffic, or transmit native unreliable UDP traffic. The two channels use the same socket resource. For proxy services: the custom transmission protocol appears in pairs with the client. The two channels also use a socket resource. In the proxy service, because UDP is transmitted in the form of messages, not TCP streams. Therefore, the context switching between kernel mode and user mode is more frequent, consuming more resources. It is more obvious in unreliable channels.

[0050] However, the original TCP-based protocol relies on kernel version updates, which has a long cycle and involves a wide range of areas. Some new transmission algorithms are difficult to be applied in the short term. The original UDP-based protocol implements reliability, congestion control, and flow control in user mode, which increases the consumption of context switching and the processing path of data packets.

[0051] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0052] Figure 2 A schematic diagram of a communication method provided in an embodiment of the present application, Figure 3 An example diagram of a communication method provided in an embodiment of the present application, such as Figure 2 as well as Figure 3 As shown, the present application provides a communication method, including:

[0053] S1, the control plane runs in user mode and handles the handshake process of the custom transport protocol;

[0054] S2. After the handshake succeeds, the control plane sends the forwarding data to the kernel;

[0055] S3. The forwarding plane runs in kernel state and determines a corresponding data processing strategy based on the forwarding data.

[0056] The overall idea of ​​this application includes: 1. Divided into control plane and forwarding plane; 2. Attch a prog program on the xdp hook to identify data packets and do simple processing; 3. Add a kernel module and use inet_add_protocol() to add a custom transmission protocol, run its reliability, congestion algorithm and flow control; 4. The forwarding database is stored in ebpfmap format.

[0057] This application proposes to move the reliability, congestion control and other algorithms implemented in the network proxy from the user state to the kernel state based on XDP technology, and split it into the control plane and the data forwarding plane. Reduce the number of up and down switching and shorten the data packet processing path. At the same time, support the concurrent transmission of reliable and unreliable data with fewer resources. There is no need to update the kernel version. The algorithm can be changed according to its own needs, such as improving the transmission performance in a weak network environment.

[0058] Figure 4 A schematic diagram of the handshake process of the custom transmission protocol provided in the embodiment of the present application, such as Figure 4 As shown, in some embodiments, in S1, the handshake process includes:

[0059] S11, the client generates a unique connection ID in the process, wherein the connection ID includes a first ID (connID1) and a second ID (connID2), wherein the first ID is used to identify a reliable transmission queue, and the second ID is used to identify an unreliable transmission queue;

[0060] S12, the client sends a handshake request including the connection ID to the server;

[0061] S13. After receiving the handshake request, the server determines the corresponding cookie value according to the source IP, source port and current time of the client, and sends the cookie value to the client;

[0062] S14, the client returns the cookie value and network negotiation parameters to the server;

[0063] S15. The server verifies the cookie value, negotiates network parameters with the client, generates a unique third ID (connID3) and a fourth ID (connID4), and determines that the handshake is successful, wherein the third ID is used to identify a reliable transmission queue, and the fourth ID is used to identify an unreliable transmission queue.

[0064] In this embodiment, based on UDP, the handshake process exchanges configurations of both ends and generates two unique connection IDs, connID1 and connID2, as connection identifiers.

[0065] In some embodiments, in S2, the control plane sends the forwarding data to the kernel through the ebpf map technology.

[0066] In some embodiments, the forwarding data includes a key and a value;

[0067] Among them, the key includes: source IP, source port, destination IP, destination port, connection ID;

[0068] Value includes: flag, IP+PORT of backend service and routing information.

[0069] Among them, the values ​​and meanings of flag include:

[0070] (1) 0-This connection is for transmitting reliable data and needs to be sent to the kernel module for processing;

[0071] (2) 1-This connection is used to transmit unreliable data. If the conditions are met, it can be directly redirected and sent out;

[0072] IP+PORT of the backend service: which backend service the data packet should be proxied to;

[0073] Routing information: The proxy process can first check if there is a route here. If there is no route, it will search in the kernel routing table and save it here after finding it. The kernel's routing updates can be synchronized to the forwarding database through netlink_notify.

[0074] In some embodiments, S3 includes:

[0075] S31, read the forwarding database through the prog program on the xdp hook to find out whether there is a matching key;

[0076] S32. If it exists, determine the flag value in value and determine whether it is a reliable or unreliable UDP message;

[0077] S33. If it is a reliable UDP message, modify the protocol field in the IP header, change 17 to the custom transport protocol value, and return to the protocol stack to wait for the subsequent kernel module to process.

[0078] In some embodiments, it also includes: if there is no matching key, returning XDP_PASS to allow the protocol stack to continue processing.

[0079] In some embodiments, it also includes: if it is an unreliable UDP message, modify the message header and checksum, and find a routing agent to send it out.

[0080] Specifically, the forwarding plane runs in kernel mode and mainly includes two parts: one is UDP message recognition and simple processing based on XDP, and the other is the kernel module of the custom transport protocol to implement reliability, congestion algorithm and flow control. The forwarding plane is responsible for processing three types of UDP messages: UDP messages that require reliability; UDP messages that do not require reliability; and handshake messages (UDP messages) of custom transport protocols.

[0081] Figure 5 A schematic diagram of determining a corresponding data processing strategy based on the forwarding data provided in an embodiment of the present application, such as Figure 5 As shown, the processing mainly includes the following steps:

[0082] 1. The xdp program first reads the forwarding database to find out if there is a matching key. If not, it returns XDP_PASS to let the protocol stack continue processing. The message is either a handshake message or a UDP message from another application. The handshake message will eventually be handed over to the control plane for processing.

[0083] 2. If a matching key is found, the flag value in the value is determined to determine whether it is a reliable or unreliable UDP message.

[0084] 3. If it is an unreliable UDP message, modify the message header, checksum, etc., and find the routing proxy.

[0085] 4. If it is a reliable UDP message, modify the protocol field in the IP header and change 17 (UDP) to the custom transport protocol value. Then return to the protocol stack and wait for the subsequent kernel module to process.

[0086] The main idea of ​​this application is to separate the control plane and the forwarding plane. For the forwarding plane, a kernel module for a custom transmission protocol is used to implement reliability, congestion algorithms, and flow control. Users of this module can implement their own transmission algorithms according to their needs, such as improving weak network transmission performance. 1. The kernel module registers the custom transmission protocol processing function to the kernel through the inet_add_protocol function. 2. For UDP messages that require reliability, the protocol field is modified in the xdp program, so the message will be processed by this kernel module. 3. This kernel module can implement the sending and receiving logic through kernel threads.

[0087] Compared with the existing technology, the main advantages of this application are: 1. The kernel can define the reliability, congestion control, flow control and other algorithms of the transport layer; 2. Reduce the context switching of the network agent; 3. Separate the control plane and the data forwarding plane to improve the forwarding performance; 4. Support reliable and unreliable concurrent transmission with fewer resources;

[0088] The possible application scenarios of this application in the future include: 1. If the optimization of weak networks needs to be improved, it can be achieved through a custom transmission protocol. 2. If the proxy forwarding performance needs to be improved, it can be achieved by separating the control plane and the data forwarding plane. 3. Supporting the same data stream with both reliable and unreliable transmission requirements.

[0089] Possible value: 1. The kernel-mode network proxy greatly reduces process context switching and releases CPU load; 2. Users can customize the transport layer algorithm to implement different transmission schemes;

[0090] The present application provides a communication device, which is applied to a server, wherein the server includes a control plane and a forwarding plane, and the device includes:

[0091] The first operation module is used to control the plane to run in user mode and process the handshake process of the custom transmission protocol; after the handshake is successful, the control plane sends the forwarding data to the kernel;

[0092] The second running module is used for the forwarding plane to run in the kernel state and determine the corresponding data processing strategy based on the forwarding data.

[0093] In some embodiments, the present application provides a terminal device, including a memory and a processor:

[0094] The memory is used to store computer programs; the processor is used to read the computer programs in the memory and execute the above communication method.

[0095] In some embodiments, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the above-mentioned communication method.

[0096] It should be understood that, although the various steps in the flowcharts in the above-described embodiments are sequentially displayed according to the indications of the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and they can be executed in other orders. Moreover, at least a portion of the steps in the figure may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily to be carried out sequentially, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.

[0097] In some embodiments, the present application provides a terminal device, including a memory and a processor:

[0098] The memory is used to store computer programs; the processor is used to read the computer programs in the memory and execute the above communication method.

[0099] In some embodiments, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the above-mentioned communication method.

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

[0101] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the application disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0102] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A communication method, characterized in that: Applied to a server, the server includes a control plane and a forwarding plane, the forwarding plane is configured with a kernel module of a custom transmission protocol, and the kernel module is registered in the kernel through an int_add_protocol function; the method includes: S1, the control plane runs in user mode and handles the handshake process of the custom transport protocol; S2. After the handshake succeeds, the control plane sends the forwarding data to the kernel; S3, the forwarding plane runs in kernel state and determines the corresponding data processing strategy based on the forwarding data; the forwarding data includes key and value; wherein the key includes: source IP, source port, destination IP, destination port, connection ID; the value includes: flag, IP+PORT of the backend service and routing information; S3, includes: S31, read the forwarding database through the prog program on the xdp hook to find out whether there is a matching key; S32. If it exists, determine the flag value in value and determine whether it is a reliable or unreliable UDP message; S33, if it is a reliable UDP message, modify the protocol field in the IP header, change 17 to the custom transport protocol value, and return to the protocol stack to wait for the subsequent kernel module to process; if it is an unreliable UDP message, modify the message header and checksum, and find the routing agent to go out; S3 also includes: if there is no matching key, return XDP_PASS to allow the protocol stack to continue processing.

2. The communication method according to claim 1, characterized in that: In S1, the handshake process includes: S11. The client generates a unique connection ID within the process, where the connection ID includes a first ID and a second ID, wherein the first ID is used to identify a reliable transmission queue, and the second ID is used to identify an unreliable transmission queue; S12, the client sends a handshake request including the connection ID to the server; S13. After receiving the handshake request, the server determines the corresponding cookie value according to the source IP, source port and current time of the client, and sends the cookie value to the client; S14, the client returns the cookie value and network negotiation parameters to the server; S15. The server verifies the cookie value, negotiates network parameters with the client, generates a unique third ID and a fourth ID, and determines that the handshake is successful, wherein the third ID is used to identify a reliable transmission queue, and the fourth ID is used to identify an unreliable transmission queue.

3. The communication method according to claim 2, characterized in that: In S2, the control plane sends the forwarding data to the kernel through the ebpf map technology.

4. A communication device, characterized in that: Applied to a server, the server includes a control plane and a forwarding plane, the forwarding plane is configured with a kernel module of a custom transmission protocol, and the kernel module is registered in the kernel through the int_add_protocol function; the device includes: The first running module is used to control the plane to run in user mode and process the handshake process of the custom transmission protocol; after the handshake is successful, the control plane sends the forwarding data to the kernel; The second operation module is used for the forwarding plane to run in the kernel state and determine the corresponding data processing strategy based on the forwarding data; the forwarding data includes key and value; wherein, key includes: source IP, source port, destination IP, destination port, connection ID; Value includes: flag, IP+PORT of backend service and routing information; the second operation module includes: reading the forwarding database through the prog program attch on the xdp hook to find out whether there is a matching key; if there is no matching key, return XDP_PASS to let the protocol stack continue processing; if there is, judge the flag value in value, and judge whether it is a reliable or unreliable udp message; if it is a reliable udp message, modify the protocol field in the ip header, modify 17 to a custom transport protocol value, and return to the protocol stack to wait for the subsequent kernel module to process; if it is an unreliable udp message, modify the message header and checksum, and find the routing agent out.

5. A terminal device, characterized in that: Including memory, processor: A memory for storing a computer program; a processor for reading the computer program in the memory and executing the communication method according to any one of claims 1 to 3.

6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the communication method according to any one of claims 1 to 3.