Communication method, system, device, and storage medium
By introducing proxy processes on the client and server, RDMA connection between the application and the target application is realized, which solves the problem that applications written based on the TCP protocol in the prior art are difficult to support the RDMA protocol, and efficient RDMA communication is achieved and cost is reduced.
Patent Information
- Application Number
- PCT/CN2024/112454
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-09-06
- Filing Date
- 2024-08-15
- Publication Date
- 2025-03-13
AI Technical Summary
In the prior art, applications written based on the TCP protocol are difficult to support the RDMA protocol, and it is costly to enable these applications to support RDMA communication, and it is necessary to modify the application code and operating system kernel.
The proxy process is introduced on the client device and the server device respectively. Through the proxy communication connection between the proxy processes, a preset protocol connection between the application and the target application is realized, such as RDMA connection, to avoid modifying the operating system kernel.
Without modifying the operating system kernel, the application can achieve the purpose of communication based on preset protocols, improve the system's concurrency capabilities, and reduce the cost of supporting RDMA communication.
Smart Images

Figure CN2024112454_13032025_PF_FP_ABST
Abstract
Description
Communication method, system, device and storage medium
[0001] Cross-reference
[0002] This disclosure claims priority to the Chinese patent application filed with the China Patent Office on September 6, 2023, with application number 2023111510384 and invention name “Communication Method, System, Device and Storage Medium,” the entire contents of which are incorporated by reference into this disclosure. Technical Field
[0003] The present disclosure relates to the field of communication technologies, and in particular to a communication method, system, device, and storage medium. Background Art
[0004] The Remote Direct Memory Access (RDMA) protocol, with its kernel-bypass feature, allows direct data reading and writing between applications and network cards. It can transfer data directly from the memory of one computer to another without the intervention of either computer's operating system, circumventing the limitations of the Transmission Control Protocol / Internet Protocol (TCP / IP). It can effectively reduce communication latency and central processing unit (CPU) utilization, and is widely used in in-memory databases, distributed storage, and high-performance computing.
[0005] However, in the prior art, many existing applications are written based on the TCP protocol and the operating systems of many servers only support the TCP protocol but cannot support the RDMA protocol.
[0006] In the prior art, in order to enable these applications to use RDMA for communication, not only the application code needs to be modified, but also the server's operating system kernel needs to be modified. Obviously, in the prior art, it is costly to enable applications written based on the TCP protocol to support RDMA communication.
[0007] Summary of the Invention
[0008] In view of the above problems, the present disclosure is proposed to provide a communication method, system, device and storage medium that solve the above problems or at least partially solve the above problems.
[0009] Therefore, in one embodiment of the present disclosure, a communication method is provided, which is applied to a first agent process; the first agent process runs on a client device; and a first application process also runs on the client device;
[0010] Obtaining a first connection establishment request initiated by the first application process, wherein the first connection establishment request carries the port number of the first port of the server device and first connection establishment information required to establish a preset protocol connection;
[0011] sending the first connection establishment request to the second proxy process via a proxy communication connection between the first proxy process and the second proxy process on the server device;
[0012] Receiving a response message through the proxy communication connection, wherein the response message carries second connection establishment information required to establish the preset protocol connection;
[0013] The response information is sent to the first application process to establish the preset protocol connection between the first application process and the target application process on the server device that listens to the first port.
[0014] In another embodiment of the present disclosure, a communication method is provided.
[0015] Applied to a second agent process; the second agent process runs on a server device;
[0016] Receiving a first connection establishment request sent by a first proxy process on a client device through a proxy communication connection, wherein the proxy communication connection is connected between the first proxy process and the second proxy process, and the first connection establishment request carries the port number of the first port and first connection establishment information required to establish a preset protocol connection;
[0017] A response message is sent through the proxy communication connection to establish the preset protocol connection between the first application process and the target application process listening to the first port on the server device, wherein the response message carries the second connection information required to establish the preset protocol connection.
[0018] In another embodiment of the present disclosure, a communication system is provided, including:
[0019] A client device and a server device, wherein a first proxy process and a first application process are running on the client device, and a second proxy process and a target application process monitoring a first port are running on the server device;
[0020] The first proxy process is configured to obtain a first connection request initiated by the first application process, wherein the first connection request carries the port number of the first port and first connection information required to establish a connection with a preset protocol; and send the first connection request to the second proxy process on the server device through a proxy communication connection between the first proxy process and the second proxy process;
[0021] The second proxy process is configured to receive the first connection establishment request sent via the proxy communication connection; and send a response message via the proxy communication connection, wherein the response message carries the second connection establishment information required to establish the preset protocol connection;
[0022] The first proxy process is further configured to receive the response information through the proxy communication connection; and send the response information to the first application process to establish the preset protocol connection between the first application process and the target application process.
[0023] In another embodiment of the present disclosure, an electronic device is provided. The electronic device includes: a memory and a processor, wherein:
[0024] The memory is used to store programs;
[0025] The processor is coupled to the memory and is configured to execute the program stored in the memory to implement any one of the above communication methods.
[0026] In yet another embodiment of the present disclosure, the present disclosure provides a computer program product, comprising a computer program, which implements any of the above methods when executed by a processor.
[0027] In another embodiment of the present disclosure, the present disclosure provides a computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements any of the above methods.
[0028] In another embodiment of the present disclosure, the present disclosure provides a computer program, which implements any of the above methods when executed by a processor.
[0029] In yet another embodiment of the present disclosure, a computer-readable storage medium storing a computer program is provided. When the computer program is executed by a computer, it can implement any of the above-mentioned communication methods.
[0030] In the technical solution provided by the embodiment of the present disclosure, proxy processes are introduced on the client device and the server device respectively; when the application process on the client device needs to establish a preset protocol connection with the application process on the server device, such as an RDMA connection, the application process on the client device sends a connection request through the proxy communication connection between the two proxy processes; after receiving the connection request, the proxy process on the server device returns a response message carrying the second connection information required to establish the preset protocol connection through the proxy communication connection, thereby establishing a preset protocol connection between the application process on the client device and the application process on the server device. It can be seen that this solution allows the application to achieve the purpose of communication based on the preset protocol by introducing the proxy process without modifying the operating system kernel. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0032] FIG1 is a schematic structural diagram of a communication system provided by an embodiment of the present disclosure;
[0033] FIG2 is a flow chart of a communication method according to an embodiment of the present disclosure;
[0034] FIG3 is a flow chart of a communication method provided by another embodiment of the present disclosure;
[0035] FIG4 is a diagram illustrating an example of a connection between a parent-child process and a second agent process according to an embodiment of the present disclosure;
[0036] FIG5 is a schematic diagram of a connection between a non-parent-child process and a second proxy process according to an embodiment of the present disclosure;
[0037] FIG6 is a signaling diagram of a communication method provided in an embodiment of the present disclosure;
[0038] FIG7 is a structural block diagram of an electronic device provided by an embodiment of the present disclosure;
[0039] FIG8 is a structural block diagram of a processor provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0040] Currently, most applications are written based on TCP, such as the reverse proxy service Nginx, the Remote Dictionary Server (Redis), and the relational database management system MySQL. These TCP applications and the servers that host them are widely used, but these applications and their servers do not support the Remote Direct Access (RDMA) protocol, making it very expensive to enable RDMA support within the server operating system kernel.
[0041] Therefore, the present disclosure provides a new communication method, which enables these applications to realize the RDMA communication function of the application without modifying the kernel. Specifically, in the technical solution provided by the embodiment of the present disclosure, proxy processes are introduced on the client device and the server device respectively; when the application process on the client device needs to establish a preset protocol connection with the application process on the server device, such as an RDMA connection, the application process on the client device sends a connection request through the proxy communication connection between the two proxy processes; after the proxy process on the server device receives the connection request, it returns a response message carrying the second connection information required to establish the preset protocol connection through the proxy communication connection, and then establishes a preset protocol connection between the application process on the client device and the application process on the server device. It can be seen that this solution allows the application to achieve the purpose of communication based on the preset protocol by introducing a proxy process without modifying the kernel of the operating system.
[0042] In addition, in real-world applications, such as Nginx, which uses a multi-process architecture, relies on multiple processes listening on the same port. However, RDMA itself does not involve multiple processes listening on the same port. In other words, existing technologies cannot meet the requirements of applications such as Nginx for multiple processes to listen on the same port.
[0043] To partially resolve the aforementioned issues, the disclosed embodiments further propose that, upon receiving a connection request, the proxy process on the server device distributes the connection request to multiple application processes listening on the server device's first port, based on the port number of the server device's first port carried in the connection request. The application process on the server device that receives the connection request is the target application process selected to establish a connection with the application process on the client device using a preset protocol. This solution, while enabling communication using a preset protocol connection, such as an RDMA connection, enables multiple processes to listen on the same port to improve system concurrency.
[0044] In order to enable those skilled in the art to better understand the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below based on the accompanying drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making any creative efforts shall fall within the scope of protection of the present disclosure.
[0045] In addition, some of the processes described in the specification, claims and the above-mentioned figures of the present disclosure include multiple operations that appear in a specific order, and these operations may not be executed in the order in which they appear in this document or may be executed in parallel. The serial numbers of the operations, such as 101, 102, etc., are only used to distinguish between different operations, and the serial numbers themselves do not represent any order of execution. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this document are used to distinguish different messages, devices, modules, etc., and do not represent the order of precedence, nor do they limit "first" and "second" to be different types.
[0046] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0047] Before introducing the communication method provided by the embodiment of the present disclosure, the system architecture involved in the communication method provided by the embodiment of the present disclosure is introduced. As shown in Figure 1, the communication system includes: a client device 1 and a server device 2; the client device 1 runs a first agent process 11 and a first application process 12; the server device 2 runs a second agent process 21 and a target application process that monitors a first port;
[0048] The first proxy process 11 is configured to obtain a first connection establishment request initiated by the first application process 12, wherein the first connection establishment request carries the port number of the first port and first connection establishment information required to establish a connection with a preset protocol; and send the first connection establishment request to the second proxy process 21 on the server device 2 through a proxy communication connection between the first proxy process 11 and the second proxy process 21 on the server device 2;
[0049] The second proxy process 21 is configured to receive a first connection establishment request sent via the proxy communication connection; and send a response message via the proxy communication connection, wherein the response message carries second connection establishment information required to establish the preset protocol connection;
[0050] The first agent process 11 is further configured to receive the response information through the agent communication connection; and send the response information to the first application process 12 to establish the preset protocol connection between the first application process 12 and the target application process.
[0051] In one example, the server device and the client device may be two different servers in the cloud.
[0052] The specific implementation of the server device and the client device in the above communication system will be described in detail in the following embodiments.
[0053] The present disclosure provides a communication method. The method may be executed by a first agent process running on a client device in the communication system described above; the client device also has a first application process running. The method includes:
[0054] 101. Obtain a first connection establishment request initiated by the first application process.
[0055] The first connection establishment request carries the port number of the first port of the server device and first connection establishment information required to establish a preset protocol connection.
[0056] 102. Send the first connection establishment request to the second agent process on the server device through the agent communication connection between the first agent process and the second agent process.
[0057] 103. Receive response information through the proxy communication connection.
[0058] The response information carries the second connection establishment information required to establish the preset protocol connection.
[0059] 104. Send the response information to the first application process to establish the preset protocol connection between the first application process and the target application process on the server device that monitors the first port.
[0060] In the above 101, the server device may provide multiple ports, and different ports provide different network services. The first port is one of the multiple ports. The first port refers to the port that the first application process needs to access or the port corresponding to the network service that the first application process needs to access.
[0061] The pre-set protocol connection refers to a connection established based on a pre-set protocol; the pre-set protocol is distinct from a communication protocol supported by the client device's operating system and the server device's operating system, such as TCP. This can be understood as meaning that the pre-set protocol is a communication protocol not supported by the client device's operating system and the server device's operating system. In one example, the pre-set protocol is RDMA, and the pre-set protocol connection is an RDMA connection.
[0062] The first connection establishment information refers to the information required to establish a connection using a preset protocol. Taking an RDMA connection as an example, the first connection establishment information generally includes: queue pair (QP) information of the first application process.
[0063] The first application process sends the first connection establishment request initiated by it to the first agent process through the communication connection between it and the first agent process. In one example, the communication connection between the first application process and the first agent process on the client device can be established based on a communication protocol supported by the operating system of the client device.
[0064] In the above 102, a proxy communication connection is established between the first proxy process and the second proxy process on the server device. The proxy communication connection can be established based on a communication protocol supported by the operating system of the client device. In one example, the proxy communication connection can be a TCP connection.
[0065] The first proxy process sends the first connection establishment request to the second proxy process through the proxy communication connection.
[0066] In the above 103, in one example, the response information may be generated by the target application process. Specifically, after receiving the first connection establishment request, the second proxy process sends the first connection establishment request to the target application process. The target application process generates a response message carrying the second connection establishment information required to establish the preset protocol connection in response to the first connection establishment request, and sends the response message to the second proxy process. The second proxy process sends the response message via the proxy communication connection, that is, sends the response message to the first proxy process via the proxy communication connection.
[0067] In step 104 above, the first proxy process sends a response message to the first application process to establish the preset protocol connection between the first application process and the target application process. This allows subsequent communication between the first application process and the target application process via the preset protocol connection. The second connection establishment information refers to the information required to establish the preset protocol connection. For example, using an RDMA connection, the second connection establishment information includes the QP information of the second application process.
[0068] The connection method used in the embodiments of this disclosure can be called an out-of-band (OOB) connection method. This method requires exchanging connection information "out-of-band," which is then used to establish a connection using a predefined protocol, such as RDMA. "Out-of-band" here refers to information exchange methods not natively provided by predefined protocols, such as RDMA, requiring developers to exchange the required connection information through other methods.
[0069] In the technical solution provided by the embodiment of the present disclosure, proxy processes are introduced on the client device and the server device respectively; when the application process on the client device needs to establish a preset protocol connection with the application process on the server device, such as an RDMA connection, the application process on the client device sends a connection request through the proxy communication connection between the two proxy processes; after receiving the connection request, the proxy process on the server device returns a response message carrying the second connection information required to establish the preset protocol connection through the proxy communication connection, thereby establishing a preset protocol connection between the application process on the client device and the application process on the server device. It can be seen that this solution allows the application to achieve the purpose of communication based on the preset protocol without modifying the operating system kernel.
[0070] FIG2 is a flow chart illustrating a communication method according to an embodiment of the present disclosure. The method may be executed by a first agent process running on a client device in the communication system described above; the client device may also have a first application process running. As shown in FIG2 , the method may include the following steps:
[0071] 201. Obtain a first connection establishment request initiated by the first application process.
[0072] The first connection establishment request carries the port number of the first port of the server device and first connection establishment information required to establish a preset protocol connection.
[0073] 202. Send the first connection establishment request to the second proxy process through proxy communication between the first proxy process and the second proxy process on the server device.
[0074] 203. Receive response information through the proxy communication connection.
[0075] In which, the response information carries the second connection information required to establish the preset protocol connection; the response information is generated by the target application process; the target application process is the process among multiple second application processes that obtains the first connection request after the second agent process distributes the first connection request to the multiple second application processes; the multiple second application processes run on the server device and listen to the first port together.
[0076] 204. Send the response information to the first application process to establish the preset protocol connection between the first application process and the target application process.
[0077] The second proxy process distributes the first connection request to a plurality of second application processes on the server device that monitor the first port according to the port number of the first port.
[0078] In the above 201, the server device may provide multiple ports, and different ports provide different network services. The first port is one of the multiple ports. The first port refers to the port that the first application process needs to access or the port corresponding to the network service that the first application process needs to access.
[0079] The pre-set protocol connection refers to a connection established based on a pre-set protocol; the pre-set protocol is distinct from a communication protocol supported by the client device's operating system and the server device's operating system, such as TCP. This can be understood as meaning that the pre-set protocol is a communication protocol not supported by the client device's operating system and the server device's operating system. In one example, the pre-set protocol is RDMA, and the pre-set protocol connection is an RDMA connection.
[0080] The first connection establishment information refers to the information required to establish a connection using a preset protocol. Taking an RDMA connection as an example, the first connection establishment information generally includes: queue pair (QP) information of the first application process.
[0081] The first application process sends the first connection establishment request initiated by it to the first proxy process through the communication connection between it and the first proxy process. In one example, the communication connection between the first application process and the first proxy process on the client device can be established based on a communication protocol supported by the operating system of the client device.
[0082] In the above 202, a proxy communication connection is established between the first proxy process and the second proxy process on the server device. The proxy communication connection can be established based on a communication protocol supported by the operating system of the client device. In one example, the proxy communication connection can be a TCP connection.
[0083] The first proxy process sends the first connection request to the second proxy process through the proxy communication connection. After receiving the first connection request, the second proxy process distributes the first connection request to multiple second application processes listening to the first port on the server device based on the port number of the first port carried in the first connection request. After distribution, only one application process among the multiple second application processes can obtain the first connection request. The target application process that obtains the first connection request among the multiple second application processes generates a response message, wherein the response message carries the second connection information required to establish the preset protocol connection. The target application process can send the response message to the second proxy process; the second proxy process sends the response message through the proxy communication connection.
[0084] In the above 203, the first agent process receives the response information through the agent communication connection.
[0085] In step 204 above, the first proxy process sends the response information to the first application process to establish the preset protocol connection between the first application process and the target application process. This allows subsequent communication between the first application process and the target application process via the preset protocol connection. The second connection establishment information refers to the information required to establish the preset protocol connection. For example, using an RDMA connection, the second connection establishment information includes the QP information of the second application process.
[0086] The connection method used in the embodiments of this disclosure can be called an out-of-band (OOB) connection method. This method requires exchanging connection information "out-of-band," which is then used to establish a connection using a predefined protocol, such as RDMA. "Out-of-band" here refers to information exchange methods not natively provided by predefined protocols, such as RDMA, requiring developers to exchange the required connection information through other methods.
[0087] In the technical solution provided by the embodiment of the present disclosure, proxy processes are introduced on the client device and the server device respectively; when the application process on the client device needs to establish a preset protocol connection, such as an RDMA connection, with the application process on the server device, the application process on the client device sends a connection request through the proxy communication connection between the two proxy processes; after the proxy process on the server device receives the connection request, it distributes the connection request to multiple application processes listening on the first port according to the port number of the first port of the server device carried in the connection request; the application process on the server device that obtains the connection request is the target application process that is selected this time and needs to establish a preset protocol connection with the application process on the client device. It can be seen that this solution realizes the ability of multiple processes listening on the same port to improve the concurrency of the system on the basis of communicating with a preset protocol connection, such as an RDMA connection.
[0088] In actual applications, many applications are not written based on RDMA. In order to enable these applications to communicate using RDMA, a user-mode link library can be added to the application, such as a user-mode dynamic link library (DLL). Specifically, the first application process can run a first application and a first user-mode link library for implementing the RDMA communication function; the first connection information is added to the first connection request by the first user-mode link library in user mode. The first application loads the first user-mode link library when it runs, and then obtains the first application process. Specifically, the first user-mode link library intercepts the first connection request issued by the first application, and the first connection request carries the network address of the server device and the port number of the first port of the server device. After adding the first connection information to the first connection request, the first user-mode link library sends it to the first proxy process.
[0089] In addition, a second application and a second user-state link library for implementing the RDMA communication function may be running in the target application process; the second connection information is added to the response information by the second user-state link library in the user state. The second user-state link library may be a user-state dynamic link library. The second application loads the second user-state link library when it runs, thereby obtaining the second application process. The content of the first user-state link library and the content of the second user-state link library may be the same. Specifically, after the second user-state link library receives the first connection request sent by the second agent process, it obtains the first connection information from the first connection request; the second user-state link library records the first connection information to facilitate the subsequent establishment of an RDMA connection; after the second user-state link library deletes the first connection information carried in the first connection request, it sends the first connection request to the second application. The second application generates corresponding response information for the first connection request; the second user-state link library intercepts the response information; after the second user-state link library adds the second connection information to the response information in user mode, the response information is sent to the second agent process, so that the second agent process sends it to the first agent process through the above-mentioned agent communication connection, and the first agent process sends it to the first application process; the first user-state link library in the first application process obtains the second connection information from the response information and records it to facilitate the subsequent establishment of the RDMA connection. After the first user-state link library deletes the second connection information in the response information, the response information is sent to the first application.
[0090] In one example, the first and second user-mode libraries are referred to as user-mode network acceleration libraries, which are loaded and used via preload (LD_PRELOAD) without modifying the application code. The user-mode network acceleration libraries leverage eRDMA's advantages of low latency, high throughput, kernel bypass, and protocol stack offload, accelerating existing TCP applications through a compatible socket interface.
[0091] It should be noted that after the RDMA connection is established between the target application process and the first application process, the first user state link library and the second user state link library are used to assist the second application in the target application process and the first application in the first application process to implement RDMA communication.
[0092] In this embodiment, there is no need to modify the application program and the kernel. Instead, an additional user-mode link library needs to be introduced to enable the application program to implement RDMA communication in the user mode.
[0093] In one example, the first connection request may also carry the network address of the server device. The above method may also include:
[0094] 205. According to the network address of the server device, search for a proxy communication connection between the first proxy process and the second proxy process from existing proxy communication connections of the first proxy process.
[0095] In the above 205, each existing proxy communication connection of the first proxy process is uniquely identified by a local network address, a local port number, a remote network address, and a remote port number. The local network address refers to the IP address of the client device, and the local port number refers to the port number of the proxy port monitored by the first proxy process; the remote network address refers to the IP address of the network device where the proxy process at the other end of the existing proxy communication connection is located, and the remote port number refers to the port number of the proxy port monitored by the proxy process at the other end of the existing proxy communication connection. It should be noted that the local network address and local port number are used to identify the local proxy process; the remote network address and remote port number are used to uniquely identify the remote proxy process.
[0096] Therefore, in one example, an existing proxy communication connection whose remote network address is the network address of the server device can be searched from at least one existing proxy communication connection of the first proxy process. Therefore, the existing proxy communication connection whose remote network address is the network address of the server device is the proxy communication connection between the first proxy process and the second proxy process on the server device. In this embodiment, the proxy communication connection between the first and second proxy processes can be reused after it is established, thereby improving the efficiency of establishing connections with the preset protocol.
[0097] If, in response to finding the proxy communication connection between the first proxy process and the second proxy process from the existing proxy communication connections of the first proxy process, the first connection establishment request may be sent through the proxy communication connection.
[0098] If no proxy communication connection between the first proxy process and the second proxy process is found from the existing proxy communication connections of the first proxy process, the following steps are performed:
[0099] 206. Establish a proxy communication connection between the first proxy process and the second proxy process according to the network address of the server device and the port number of the proxy port monitored by the second proxy process on the server device.
[0100] In one example, the port number of the proxy port monitored by the proxy process on each device defaults to a designated port number. For example, the designated port number is 9000. In this way, the first proxy process on the client device can directly determine the port number of the proxy port monitored by the second proxy process on the server device.
[0101] According to the network address of the server device and the port number of the proxy port monitored by the second proxy process, a proxy communication connection between the first proxy process and the second proxy process can be established.
[0102] In another example, the client device may have a correspondence between the network address and the port number stored in advance. According to the network address of the server device, the correspondence is searched to determine the port number corresponding to the network address of the server device, and the port number corresponding to the network address of the server device is determined as the port number of the proxy port listened to by the second proxy process.
[0103] After establishing the proxy communication connection between the first proxy process and the second proxy process, the first connection establishment request is sent to the second proxy process through the proxy communication connection.
[0104] Another embodiment of the present disclosure provides a communication method applicable to a second agent process running on a server device. The method includes:
[0105] A. receiving a first connection establishment request sent by a first proxy process on a client device through a proxy communication connection, wherein the proxy communication connection is connected between the first proxy process and the second proxy process, and the first connection establishment request carries the port number of the first port and first connection establishment information required for establishing a preset protocol connection;
[0106] B. Send a response message through the proxy communication connection to establish the preset protocol connection between the first application process and the target application process listening on the first port on the server device, wherein the response message carries the second connection establishment information required to establish the preset protocol connection.
[0107] The specific implementation of the above steps A and B can be found in the corresponding contents of the above embodiments, which will not be repeated here.
[0108] In the technical solution provided by the embodiment of the present disclosure, proxy processes are introduced on the client device and the server device respectively; when the application process on the client device needs to establish a preset protocol connection, such as an RDMA connection, with the application process on the server device, the application process on the client device sends a connection request through the proxy communication connection between the two proxy processes; after receiving the connection request, the proxy process on the server device returns a response message carrying the second connection information required to establish the preset protocol connection through the proxy communication connection, thereby establishing a preset protocol connection between the application process on the client device and the application process on the server device. It can be seen that this solution allows the application to achieve the purpose of communication based on the preset protocol without modifying the operating system kernel.
[0109] It should be noted that for any steps not fully described in detail in the methods provided in the embodiments of the present disclosure, reference may be made to the corresponding contents in the aforementioned embodiments, and no further elaboration is required here. Furthermore, in addition to the aforementioned steps, the methods provided in the embodiments of the present disclosure may also include some or all of the other steps in the aforementioned embodiments, for which reference may be made to the corresponding contents in the aforementioned embodiments, and no further elaboration is required here.
[0110] FIG3 is a flow chart of a communication method provided by an embodiment of the present disclosure. This method is applicable to a second agent process running on a server device. The server device also has multiple second application processes running; the ports on the server device and the multiple second application processes jointly monitor the first port on the server device. As shown in FIG3 , the method includes:
[0111] 301: Receive a first connection establishment request sent by a first proxy process on a client device through a proxy communication connection.
[0112] The proxy communication connection is connected between the first proxy process and the second proxy process; the first connection request carries the port number of the first port and first connection information required to establish a preset protocol connection.
[0113] 302. Distribute the first connection establishment request to the multiple second application processes.
[0114] 303. Send response information through the proxy communication connection to establish the preset protocol connection between the first application process and the target application process.
[0115] The response information carries the second connection information required to establish the preset protocol connection; the response information is generated by the target application process; and the target application process is the process that obtains the first connection request among the multiple second application processes.
[0116] The specific implementation of the above steps 301 and 302 can refer to the corresponding content in the above embodiments, which will not be repeated here. In the technical solution provided by the embodiment of the present disclosure, proxy processes are introduced on the client device and the server device respectively; when the application process on the client device needs to establish a preset protocol connection, such as an RDMA connection, with the application process on the server device, the application process on the client device sends a connection request through the proxy communication connection between the two proxy processes; after the proxy process on the server device receives the connection request, it distributes the connection request to the multiple application processes listening on the first port according to the port number of the first port of the server device carried in the connection request; the application process on the server device that obtains the connection request is the target application process that needs to establish a preset protocol connection with the application process on the client device selected this time. It can be seen that this solution realizes the ability of multiple processes listening on the same port to improve the concurrency of the system on the basis of communicating with a preset protocol connection, such as an RDMA connection.
[0117] In one example, the preset protocol connection is an RDMA protocol connection.
[0118] In one example, a second application program and a second user-mode link library for implementing RDMA communication functions are running in the target application process; the second connection information is added to the response information by the second user-mode link library in user mode.
[0119] In this embodiment, there is no need to modify the application and kernel. Just introduce an additional user-mode link library to enable the application to implement RDMA communication in user mode. In actual applications, for TCP applications, there are generally two ways for multiple processes to listen to the same port:
[0120] The first way: the parent process listens to the port, and then creates (fork) the child process, so that the parent and child processes can listen to the same port.
[0121] The second way is to set the port reusability attribute (SO_REUSEPORT) for a port through the setsockopt interface, which can also support multiple processes listening on the same port. The setsockopt interface is used to set option values for network sockets.
[0122] Both of the above methods can monitor the same port, but the effects are slightly different:
[0123] In the first approach, the parent and child processes essentially use the same receive queue for new connection requests. When a new connection request arrives, the parent and child processes compete to create the corresponding TCP connection.
[0124] In the second method, any process can listen to the same port independently of the parent-child process relationship. The operating system kernel creates a receive queue for each process, and there is no competition between different processes.
[0125] In one example, if the plurality of second application processes are in a parent-child process relationship, the step of "distributing the first connection establishment request to the plurality of second application processes" in step 302 may be implemented by the following steps:
[0126] 3021a. Determine a parent process that monitors the first port according to the port number of the first port.
[0127] 3022a. Send the first connection establishment request through the communication connection between the second agent process and the parent process.
[0128] The sub-processes in the plurality of second application processes inherit the communication connection; and the plurality of second application processes obtain the first connection establishment request sent through the communication connection in a competitive manner.
[0129] The child process is created by the parent process. The communication connection already exists before the child process is created, so the child process can inherit the communication connection. This is equivalent to the second proxy process being connected to both the parent process and the child process via a single TCP connection, as shown in Figure 4.
[0130] After the second proxy process sends the first connection request through the communication connection between the second proxy process and the parent process, the child process inherits the communication connection. Therefore, both the parent process and the child process have the right to receive the first connection request, but they need to compete for the first connection request. If the parent process competes for the first connection request, the parent process becomes the target application process; if the child process competes for the second connection request, the child process becomes the target application process.
[0131] In one feasible solution, the above method may further include:
[0132] 303. Receive a second connection establishment request sent by the parent process.
[0133] 304. Establish a communication connection between the second agent process and the parent process according to the second connection establishment request.
[0134] In the above 303, the parent process may send a second connection establishment request to the second agent process when the parent process is started or when the parent process detects that the communication connection between the parent process and the second agent process is disconnected.
[0135] In a specific example, when the parent process starts, it sends a second connection request to the second agent process to establish a communication connection between the parent process and the second agent process; and registers the port it needs to listen to with the second agent process through the communication connection.
[0136] In the above 304, the communication connection between the second agent process and the parent process can be established based on a communication protocol supported by the operating system of the server device. In one example, the communication connection between the second agent process and the parent process is a TCP connection.
[0137] The technical solution provided in this embodiment enables parent and child processes to jointly monitor the same port under RDMA communication. In another example, if the multiple second application processes are not in a parent-child relationship, then the "distributing the first connection establishment request to the multiple second application processes" in 302 above can be implemented using the following steps:
[0138] 3021b. Determine the multiple second application processes that monitor the first port according to the port number of the first port.
[0139] 3022b. Select the target application process from the multiple second application processes.
[0140] 3023b. Send the first connection establishment request through the communication connection between the second proxy process and the target application process.
[0141] In the above 3022b, the target application process can be randomly selected from the multiple second application processes, or the target application process can be selected from the multiple second application processes according to a preset load balancing strategy. The above preset load balancing strategy can be set according to actual needs and is not specifically limited in this embodiment of the present disclosure.
[0142] The technical solution provided in this embodiment enables multiple application processes to jointly monitor the same reusable port under RDMA communication.
[0143] In order to improve the forwarding efficiency of the first connection establishment request, the communication connection between the second proxy process and the second application process may be established when the second application process is started.
[0144] Specifically, the above method may further include:
[0145] 305. Receive a third connection establishment request sent by the second application process.
[0146] 306. Establish a communication connection between the second agent process and the second application process according to the third connection establishment request.
[0147] In the above 305 , the second application process may send a third connection establishment request to the second agent process when the second application process is started or when the second application process detects that the communication connection between the second application process and the second agent process is disconnected.
[0148] In the above 306, the communication connection between the second agent process and the second application process can be selected according to actual needs. In one example, the communication connection between the second agent process and the second application process is a TCP connection.
[0149] In this embodiment, each of the plurality of second application processes is connected to the second proxy process via a different communication connection (eg, TCP connection), as shown in FIG5 .
[0150] In this embodiment, the attribute of the first port is a port reusable attribute (SO_REUSEPORT).
[0151] In summary, by introducing a proxy process and taking advantage of the fact that child processes can inherit the resource characteristics of the parent process and the reusable properties of the port, the RDMA multi-process listening effect on the same port, which is consistent with the TCP effect, is achieved in user mode without modifying the kernel.
[0152] It should be noted that for any steps not fully described in detail in the methods provided in the embodiments of the present disclosure, reference may be made to the corresponding contents in the aforementioned embodiments, and no further elaboration is required here. Furthermore, in addition to the aforementioned steps, the methods provided in the embodiments of the present disclosure may also include some or all of the other steps in the aforementioned embodiments, for which reference may be made to the corresponding contents in the aforementioned embodiments, and no further elaboration is required here.
[0153] The communication method provided by the embodiment of the present disclosure will be introduced below with reference to the signaling diagram shown in FIG6 .
[0154] A first application program and a first user-mode link library are running in the first application process; a second application program and a second user-mode link library are running in the target application process.
[0155] Step 1: A first application initiates a first connection establishment request based on the TCP protocol.
[0156] The first connection establishment request carries the IP address of the server device and the port number of the first port of the server device.
[0157] Step 2: The first user-mode link library intercepts the first connection establishment request.
[0158] Step 3: The first user-mode link library adds the first RDMA connection establishment information to the first connection establishment request.
[0159] Step 4: The first user-mode link library sends a first connection establishment request to the first proxy process.
[0160] Step 5: The first proxy process sends a first connection establishment request to the second proxy process.
[0161] Among them, after the first proxy process receives the first connection request, it determines the TCP connection between the first proxy process and the second proxy process based on the IP address of the server device carried in the first connection request and the port number of the proxy port listened by the second proxy process on the server device, and sends the first connection request to the second proxy process through the TCP connection.
[0162] Step 6: The second proxy process distributes the first connection establishment request to the plurality of second application processes that monitor the first port.
[0163] For the specific distribution process, please refer to the corresponding content in the above embodiments.
[0164] Step 7: After the target application process obtains the first connection establishment request, the second user-mode link library in the target application process obtains and records the first RDMA information from the first connection establishment request.
[0165] Step 8: After deleting the first RDMA information in the first connection request, the second user-mode link library sends the first connection request to the second application process.
[0166] Step 9: The second application process processes the first connection establishment request to generate response information.
[0167] Step 10: The second user-mode link library intercepts the response information.
[0168] Step 11: The second user-mode link library adds the second RDMA information to the response information and sends the response information to the second agent process.
[0169] Step 12: The second agent process sends a response message to the first agent process.
[0170] Step 13: The first agent process sends a response message to the first application process.
[0171] Step 14: The first user-mode link library in the first application process obtains and records the second RDMA information from the response information.
[0172] Step 15: After deleting the second RDMA information in the response information, the first user-mode link library sends the response information to the first application.
[0173] Step 16: The first user-mode link library requests the second user-mode link library to establish an RDMA connection between the first application process and the target application process.
[0174] Subsequently, with the assistance of the first user-mode link library and the second user-mode link library, the first application program and the second application program communicate via an RDMA connection.
[0175] FIG7 shows a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. As shown in FIG7 , the electronic device includes a memory 1101 and a processor 1102. The memory 1101 can be configured to store various other data to support operations on the electronic device. Examples of such data include instructions for any application or method operating on the electronic device. The memory 1101 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read only memory (EEPROM), an erasable programmable read only memory (EPROM), a programmable read only memory (PROM), a read only memory (ROM), a magnetic memory, a flash memory, a magnetic disk or an optical disk.
[0176] The memory 1101 is used to store programs;
[0177] The processor 1102 is coupled to the memory 1101 and is configured to execute the program stored in the memory 1101 to implement the communication methods provided by the above-mentioned method embodiments.
[0178] 7 , the electronic device further includes other components such as a communication component 1103, a display 1104, a power supply component 1105, and an audio component 1106. FIG7 only schematically illustrates some components, which does not mean that the electronic device only includes the components shown in FIG7 .
[0179] The present disclosure also provides a processor. Figure 8 shows a schematic diagram of the structure of a processor for implementing the present disclosure. As shown in Figure 8, the processor 800 is configured to run a program, wherein the program, when executed by the processor, executes the method in the above embodiment.
[0180] In the embodiment of the present disclosure, the processor 800 may execute an operating program for a communication method.
[0181] Optionally, the processor 800 can be configured to perform the following steps: obtaining a first connection request initiated by the first application process, wherein the first connection request carries the port number of the first port of the server device and the first connection information required to establish a preset protocol connection; sending the first connection request to the second agent process through the proxy communication connection between the first agent process and the second agent process on the server device; receiving a response message through the proxy communication connection, wherein the response message carries the second connection information required to establish the preset protocol connection; sending the response message to the first application process to establish the preset protocol connection between the first application process and the target application process listening on the first port on the server device.
[0182] Optionally, the processor 800 can be configured to perform the following steps: receiving a first connection request sent by a first proxy process on a client device through a proxy communication connection, wherein the proxy communication connection is connected between the first proxy process and the second proxy process, and the first connection request carries the port number of the first port and the first connection information required to establish a preset protocol connection; sending a response message through the proxy communication connection to establish the preset protocol connection between the first application process and the target application process listening on the first port on the server device, wherein the response message carries the second connection information required to establish the preset protocol connection.
[0183] Accordingly, an embodiment of the present disclosure further provides a computer-readable storage medium storing a computer program, which, when executed by a computer, can implement the steps or functions of the communication methods provided in the above-mentioned method embodiments.
[0184] Computer-readable storage media may also be referred to as computer storage media. They may include data signals transmitted in baseband or as part of a carrier wave, carrying readable program code. Such transmitted data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable storage media may transmit, propagate, or transfer programs for use by or in conjunction with an instruction execution system, apparatus, or device.
[0185] The program code contained in the computer-readable storage medium can be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, radio frequency, etc., or any suitable combination of the foregoing.
[0186] The embodiments of the present disclosure further provide a computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method provided in the embodiments of the present disclosure is implemented.
[0187] The embodiments of the present disclosure further provide a computer program, which, when executed by a processor, implements the method provided in the embodiments of the present disclosure.
[0188] Optionally, the above-mentioned computer program implements program code for the following steps when executed by the processor: obtaining a first connection request initiated by the first application process, wherein the first connection request carries the port number of the first port of the server device and the first connection information required to establish a preset protocol connection; sending the first connection request to the second agent process through the proxy communication connection between the first agent process and the second agent process on the server device; receiving a response message through the proxy communication connection, wherein the response message carries the second connection information required to establish the preset protocol connection; sending the response message to the first application process to establish the preset protocol connection between the first application process and the target application process listening on the first port on the server device.
[0189] Optionally, the above-mentioned computer program implements the program code of the following steps when executed by the processor: receiving a first connection request sent by the first proxy process on the client device through a proxy communication connection, wherein the proxy communication connection is connected between the first proxy process and the second proxy process, and the first connection request carries the port number of the first port and the first connection information required to establish a preset protocol connection; sending a response message through the proxy communication connection to establish the preset protocol connection between the first application process and the target application process listening on the first port on the server device, wherein the response message carries the second connection information required to establish the preset protocol connection.
[0190] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0191] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the above technical solution, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as a read-only memory (ROM) / random access memory (RAM), a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.
[0192] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present disclosure. Industrial Applicability
[0193] The solution provided by the embodiment of the present disclosure can be applied to the communication process, obtaining a first connection request initiated by a first application process, wherein the first connection request carries the port number of the first port of the server device and the first connection information required to establish a preset protocol connection; sending the first connection request to the second agent process through the proxy communication connection between the first agent process and the second agent process on the server device; receiving response information through the proxy communication connection, wherein the response information carries the second connection information required to establish a preset protocol connection; sending the response information to the first application process to establish a preset protocol connection between the first application process and the target application process listening on the first port on the server device, thereby solving the technical problem of needing to modify the operating system kernel based on preset protocol communication.
Claims
1. A communication method, applied to a first agent process; the first agent process runs on a client device; a first application process also runs on the client device; A first connection establishment request initiated by the first application process is obtained, wherein: The first connection establishment request carries the port number of the first port of the server device and the first connection establishment information required to establish the preset protocol connection; Sending the first connection establishment request to the second proxy process through a proxy communication connection between the first proxy process and the second proxy process on the server device; Receiving a response message through the proxy communication connection, wherein the response message carries the second connection establishment information required to establish the preset protocol connection; The response information is sent to the first application process to establish the preset protocol connection between the first application process and a target application process on the server device that listens to the first port.
2. The method according to claim 1, wherein: The response information is generated by the target application process; the target application process is a process among multiple second application processes that obtains the first connection request after the second proxy process distributes the first connection request to the multiple second application processes; the multiple second application processes run on the server device and listen to the first port together.
3. The method according to claim 1 or 2, wherein: The preset protocol connection is a Remote Direct Memory Access (RDMA) protocol connection.
4. The method according to claim 3, wherein: The first application process runs a first application program and a first user-mode link library for implementing an RDMA communication function; the first connection establishment information is added to the first connection establishment request by the first user-mode link library in user mode.
5. The method according to claim 1 or 2, wherein: The first connection establishment request also carries the network address of the server device, and the method further includes: According to the network address of the server device, the proxy communication connection between the first proxy process and the second proxy process is searched from the existing proxy communication connections of the first proxy process.
6. The method according to claim 5, wherein: The method further comprises: If, in response to not finding the proxy communication connection between the first agent process and the second agent process from the existing proxy communication connections of the first agent process, a proxy communication connection is established between the first agent process and the second agent process based on the network address and the port number of the proxy port listened by the second agent process.
7. A communication method, applied to a second agent process; the second agent process runs on a server device; A first connection establishment request is received from a first proxy process on a client device through a proxy communication connection, wherein: The proxy communication connection is connected between the first proxy process and the second proxy process, and the first connection establishment request carries the port number of the first port and first connection establishment information required to establish a preset protocol connection; A response message is sent through the proxy communication connection to establish the preset protocol connection between the first application process and the target application process listening on the first port on the server device, wherein the response message carries second connection establishment information required to establish the preset protocol connection.
8. The method according to claim 7, wherein: A plurality of second application processes are running on the server device; The multiple second application processes jointly monitor the first port on the server device; The method further comprises: Distributing the first connection establishment request to the plurality of second application processes according to the port number of the first port; The response information is generated by the target application process; the target application process is a process among the multiple second application processes that obtains the first connection request after the second proxy process distributes the first connection request to the multiple second application processes.
9. The method according to claim 8, characterized in that The multiple second application processes are in a parent-child process relationship; Distributing the first connection establishment request to the plurality of second application processes according to the port number of the first port includes: Determine, according to the port number of the first port, a parent process that monitors the first port; Sending the first connection establishment request through the communication connection between the second proxy process and the parent process; The sub-processes in the plurality of second application processes inherit the communication connection; and the plurality of second application processes obtain the first connection establishment request sent through the communication connection in a competitive manner.
10. The method according to claim 8, characterized in that The multiple second application processes are not in a parent-child process relationship; Distributing the first connection establishment request to the plurality of second application processes according to the port number of the first port includes: Determining the plurality of second application processes that monitor the first port according to the port number of the first port; Selecting the target application process from the multiple second application processes; The first connection establishment request is sent through the communication connection between the second proxy process and the target application process.
11. The method according to claim 8, wherein: The first connection establishment request also carries the network address of the server device, and the method further includes: According to the network address of the server device and the existing proxy communication connection of the first proxy process, the proxy communication connection between the first proxy process and the second proxy process is searched.
12. The method according to any one of claims 7 to 11, characterized in that: The preset protocol connection is a Remote Direct Memory Access (RDMA) protocol connection.
13. The method according to claim 12, wherein: The first application process runs a first application program and a first user-mode link library for implementing an RDMA communication function; the first connection establishment information is added to the first connection establishment request by the first user-mode link library in user mode.
14. The method according to claim 12, characterized in that A second application program and a second user-mode link library for implementing the RDMA communication function are running in the target application process; the second connection establishment information is added to the response information by the second user-mode link library in the user mode.
15. A communication system comprising: A client device and a server device, wherein a first proxy process and a first application process are running on the client device, and a second proxy process and a target application process that monitors a first port are running on the server device; The first proxy process is used to obtain a first connection request initiated by the first application process, wherein the first connection request carries the port number of the first port and first connection information required to establish a preset protocol connection; and send the first connection request to the second proxy process on the server device through a proxy communication connection between the first proxy process and the second proxy process on the server device; The second proxy process is used to receive the first connection establishment request sent through the proxy communication connection; send a response message through the proxy communication connection, wherein the response message carries the second connection establishment information required to establish the preset protocol connection; The first proxy process is further configured to receive the response information through the proxy communication connection; and send the response information to the first application process to establish the preset protocol connection between the first application process and the target application process.
16. An electronic device, characterized in that: include: A memory and a processor, wherein The memory is used to store programs; The processor is coupled to the memory, and is configured to execute the program stored in the memory to implement the communication method according to any one of claims 1 to 14.
17. A computer program product, wherein: The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 14.
18. A computer program product, wherein: The invention comprises a non-volatile computer-readable storage medium storing a computer program, wherein the computer program implements the method according to any one of claims 1 to 14 when executed by a processor.
19. A computer program, wherein When the computer program is executed by a processor, the method according to any one of claims 1 to 14 is implemented.
20. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a computer, the communication method according to any one of claims 1 to 14 can be implemented.
Citation Information
Patent Citations
Data acquisition system, method and device
CN113297110A
Method and device for creating sharable remote direct data access link
CN114780465A
Message processing method, gateway equipment and storage system
CN116566933A
Proxy based data transfer utilizing direct memory access
US9397788B1