RDMA-based data transmission method and apparatus, and electronic device and medium

By establishing an RDMA data plane event loop and memory registration mechanism in TCP applications, the problems of high latency and low throughput in TCP/IP transmission are solved, achieving efficient data transmission based on RDMA and improving network performance.

WO2026124119A1PCT designated stage Publication Date: 2026-06-18CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PTE LTD +1

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PTE LTD
Filing Date
2025-11-14
Publication Date
2026-06-18

AI Technical Summary

Technical Problem

Existing TCP applications suffer from high latency, low throughput, and high CPU utilization due to frequent data copying and context switching when transmitting data based on TCP/IP, making it difficult to adapt to RDMA for efficient data transmission.

Method used

By establishing an RDMA data plane event loop between the receiver and the transmitter, the receiver pre-allocates an appropriate amount of user-space memory and achieves direct data transmission through RDMA memory registration and message exchange, avoiding frequent memory allocation and data copying.

🎯Benefits of technology

It enables efficient data transmission of TCP applications on RDMA, reduces latency and CPU utilization, and improves network transmission performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025135108_18062026_PF_FP_ABST
    Figure CN2025135108_18062026_PF_FP_ABST
Patent Text Reader

Abstract

The present disclosure belongs to the field of cloud computing. Provided are an RDMA-based data transmission method and apparatus, and an electronic device and a medium. The method comprises: receiving a first RDMA message sent by a sending end, wherein the first RDMA message is sent by the sending end when a first data length is less than a second data length, the first data length is the maximum data length of data capable of being stored in a first receiving memory that is applied for by a receiving end from a user-mode memory pool, and the first RDMA message comprises the second data length of target data; applying for a second receiving memory, the minimum data length of which is the second data length, from the user-mode memory pool; after the second receiving memory is successfully applied for, sending a second RDMA message to the sending end, wherein the second RDMA message comprises target memory information of the second receiving memory; and when the target data has been received, writing the target data into the second receiving memory. The present disclosure enables a TCP application program to adapt to RDMA, thereby performing data transmission on the basis of the RDMA.
Need to check novelty before this filing date? Find Prior Art

Description

Data transmission methods, devices, electronic equipment, and media based on RDMA

[0001] This disclosure claims priority to Chinese Patent Application No. 202411823360.1, filed with the China Patent Office on December 10, 2024, entitled “RDMA-based data transmission method, apparatus, electronic device and medium”, the entire contents of which are incorporated herein by reference. Technical Field

[0002] This disclosure relates to the field of cloud computing technology, and in particular to a data transmission method, apparatus, electronic device and medium based on RDMA. Background Technology

[0003] Currently, most applications are TCP applications developed based on TCP / IP (Transmission Control Protocol / Internet Protocol). With the development of data centers, distributed systems, and cloud computing technologies, TCP applications place increasingly higher demands on the transmission performance of electronic devices. However, due to the inherent limitations of TCP / IP, data transmission over TCP / IP requires frequent data copying and context switching between user mode and kernel mode. This results in higher latency, lower throughput, and higher CPU (Central Processing Unit) utilization for TCP applications, severely limiting performance improvements.

[0004] RDMA (Remote Direct Memory Access), as a direct memory access technology, enables TCP applications to bypass the operating system kernel and CPU, communicating directly with RDMA modules (such as network interface cards), thereby transferring TCP application data directly from the user-space memory of one electronic device to the user-space memory of another. Because it bypasses the operating system kernel and CPU, it avoids the overhead of frequent data copying and context switching, truly achieving low latency, high throughput, and low CPU utilization.

[0005] However, TCP / IP is a byte-stream-based data transmission protocol, while RDMA is a message-based data transmission protocol. This means that TCP application clients have no limit on the length of data sent each time, while RDMA modules have requirements on the length of data transmitted each time. Therefore, how to adapt TCP applications to RDMA and thus perform data transmission based on RDMA has become an urgent problem to be solved. Summary of the Invention

[0006] This disclosure provides a data transmission method, apparatus, electronic device, and medium based on RDMA, enabling TCP applications to adapt to RDMA and thus perform data transmission based on RDMA. The technical solution is as follows.

[0007] Firstly, a data transmission method based on RDMA is provided, the method being applied at a receiving end, the method comprising:

[0008] The receiver receives a first RDMA message sent by the sending end. The first RDMA message is sent by the sending end when the first data length is less than the second data length. The first data length is the maximum data length that the first receiving memory requested by the receiving end from the user space memory pool can store. The first RDMA message includes the second data length of the target data to be sent by the sending end this time.

[0009] The second receiving memory is requested from the user-mode memory pool, and the minimum data length that the second receiving memory can store is the second data length.

[0010] After the second receiving memory application is successful, a second RDMA message is sent to the sending end. The second RDMA message includes the target memory information of the second receiving memory. The second RDMA message is used to notify the sending end to send the target data to the receiving end through an RDMA write operation based on the target memory information.

[0011] When the target data is received, the target data is written into the second receiving memory.

[0012] Secondly, a data transmission method based on RDMA is provided, the method being applied at the transmitting end, the method comprising:

[0013] Determine whether the second data length of the target data is greater than the first data length, where the first data length is the maximum data length that the first receiving memory requested by the receiving end from the user-mode memory pool can store;

[0014] When the second data length is greater than the first data length, a first RDMA message is sent to the receiving end. The first RDMA message includes the second data length. The first RDMA message is used to notify the receiving end to request a second receiving memory from the user space memory pool. The minimum data length that the second receiving memory can store is the second data length. After the request is successful, a second RDMA message is sent to the sending end. The second RDMA message includes the target memory information of the second receiving memory.

[0015] Upon receiving the second RDMA message, the target data is sent to the receiving end via an RDMA write operation based on the target memory information.

[0016] Thirdly, a data transmission device based on Remote Direct Memory Access (RDMA) is provided, wherein the device is a receiving end, and the device includes:

[0017] The receiving module is used to receive a first RDMA message sent by the sending end. The first RDMA message is sent by the sending end when the first data length is less than the second data length. The first data length is the maximum data length that the receiving end can store in the first receiving memory requested from the user space memory pool. The first RDMA message includes the second data length of the target data to be sent by the sending end this time.

[0018] The application module is used to apply for a second receiving memory from the user-mode memory pool, wherein the minimum data length that the second receiving memory can store is the second data length;

[0019] The sending module is used to send a second RDMA message to the sending end after the second receiving memory application is successful. The second RDMA message includes the target memory information of the second receiving memory. The second RDMA message is used to notify the sending end to send the target data to the receiving end through an RDMA write operation based on the target memory information.

[0020] The writing module is used to write the target data into the second receiving memory when the target data is received.

[0021] Fourthly, a data transmission device based on Remote Direct Memory Access (RDMA) is provided, the device being a transmitting end, the device comprising:

[0022] The judgment module is used to determine whether the second data length of the target data is greater than the first data length, wherein the first data length is the maximum data length that the receiving end can store in the first receiving memory requested from the user-mode memory pool;

[0023] The sending module is configured to send a first RDMA message to the receiving end when the second data length is greater than the first data length. The first RDMA message includes the second data length and is used to notify the receiving end to request a second receiving memory from the user-mode memory pool. The minimum data length that the second receiving memory can store is the second data length. After the request is successful, the sending module sends a second RDMA message to the sending end. The second RDMA message includes the target memory information of the second receiving memory.

[0024] The sending module is further configured to, upon receiving the second RDMA message, send the target data to the receiving end via an RDMA write operation based on the target memory information.

[0025] Fifthly, an electronic device is provided, including a processor and a memory; the memory stores at least one piece of program code; the at least one piece of program code is used to be called and executed by the processor to implement the RDMA-based data transmission method of the first aspect, or the RDMA-based data transmission method of the second aspect.

[0026] In a sixth aspect, a computer-readable storage medium is provided, wherein at least one computer program is stored therein, and when executed by a processor, the at least one computer program is capable of implementing the RDMA-based data transmission method described in the first aspect, or the RDMA-based data transmission method described in the second aspect.

[0027] In a seventh aspect, a computer program product is provided, the computer program product comprising a computer program, which, when executed by a processor, is capable of implementing the RDMA-based data transmission method described in the first aspect, or the RDMA-based data transmission method described in the second aspect.

[0028] The beneficial effects of the technical solutions provided in this disclosure are:

[0029] Because the TCP protocol doesn't concern itself with the length of each data transmission, the length of data sent by a TCP application client to the receiver each time is not fixed. However, the RDMA protocol requires the receiver to prepare pre-allocated receive memory, the size of which is fixed. Therefore, the length of data sent by the sender each time may be greater than or less than the maximum data length of the receiver's pre-allocated receive memory. To enable the TCP application to adapt to RDMA, before sending data to the receiver based on RDMA, the sender needs to determine whether the second data length of the target data to be sent is greater than the first data length that the receiver's pre-allocated first receive memory can store. If the second data length does not exceed the first data length, meaning the first receive memory can store the target data, then... The target data can be sent to the receiving end via RDMA transmit operation. After receiving the target data, the receiving end writes the target data into the first receiving memory, thereby realizing RDMA-based data transmission. If the second data length exceeds the first data length, that is, the first receiving memory cannot store the target data, the sending end sends a first RDMA message to the receiving end to notify the receiving end to request a new memory block from the user-space memory pool, namely the second receiving memory. After the receiving end successfully requests the memory, it sends a second RDMA message to the sending end carrying the target memory information of the second receiving memory. After receiving the second RDMA message, the sending end sends the target data to the receiving end through RDMA write operation based on the target memory information. After receiving the target data, the receiving end writes the target data into the second receiving memory, thereby realizing RDMA-based data transmission. Attached Figure Description

[0030] To more clearly illustrate the technical solutions in the embodiments of this disclosure, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0031] Figure 1 is a system architecture diagram of SMC-R provided by related technologies;

[0032] Figure 2 is a flowchart of a data transmission method based on RDMA provided in an embodiment of this disclosure;

[0033] Figure 3 is a schematic diagram of an RDMA data plane event loop establishment process between a transmitter and a receiver provided in an embodiment of this disclosure;

[0034] Figure 4 is a schematic diagram of the working process of a data plane event loop thread and a control plane event loop thread provided in an embodiment of this disclosure;

[0035] Figure 5 is a flowchart of an RDMA memory registration process provided in an embodiment of this disclosure;

[0036] Figure 6 is a flowchart of another RDMA-based data transmission method provided in an embodiment of this disclosure;

[0037] Figure 7 is a schematic diagram of the structure of a data transmission device based on RDMA provided in an embodiment of this disclosure;

[0038] Figure 8 is a schematic diagram of another RDMA-based data transmission device provided in an embodiment of this disclosure;

[0039] Figure 9 is a structural block diagram of an electronic device provided in an exemplary embodiment of this disclosure. Detailed Implementation

[0040] To make the objectives, technical solutions, and advantages of this disclosure clearer, the embodiments of this disclosure will be described in further detail below with reference to the accompanying drawings.

[0041] It is understood that the terms "each," "multiple," and "any," etc., used in the embodiments of this disclosure, include "multiple" (two or more), "each" (each of the corresponding multiples), and "any" (any one of the corresponding multiples). For example, multiple words include 10 words, and "each word" refers to each of the 10 words, while "any word" refers to any one of the 10 words.

[0042] 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, data stored, data displayed, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.

[0043] Before implementing the embodiments of this disclosure, the terms used in this disclosure will first be explained.

[0044] RDMA was developed to address the latency issues in server-side (i.e., receiver-side) data processing during network transmission. RDMA directly writes TCP application data to the electronic device's memory over the network, then quickly moves the data from one system to a remote system's memory without affecting the operating system. RDMA eliminates the overhead of external memory copying and context switching, thus freeing up memory bandwidth and CPU cycles, and improving system performance.

[0045] RDMA Memory Registration: Before receiving data, the receiving end needs to register the memory (Memory Register, MR). Each memory registration generates a remote key and a local key (r_key, l_key). The local key is used by the local Host Channel Adapter (HCA) to access local memory. The remote key is provided to the remote HCA to allow remote processes to access local system memory during RDMA operations.

[0046] IB verbs are the RDMA programming API (Application Programming Interface) specification defined in the InfiniBand standard. They provide TCP applications with the ability to directly access network hardware, thereby enabling efficient, low-latency data transmission. Methods disclosed herein, such as ibv_post_recv(), ibv_post_send(), ibv_poll_cq(), ibv_get_cq_event(), and rdma_get_cm_event(), all originate from the API definitions in this specification.

[0047] RDMA send / recv: These are two-way operations in RDMA, requiring the participation of both CPUs to complete a single communication process. The receiving end first prepares the receive memory using ibv_post_recv(), and then the sending end sends the data using ibv_post_send().

[0048] RDMA write: The receiving end prepares a block of memory in advance and registers the memory using RDMA to obtain a key (i.e., remote key). Then, it returns the key and memory information to the sending end. The sending end can carry the key to perform write operations on the memory without the participation of the receiving end's CPU.

[0049] With the rapid development of data centers, distributed systems, and high-performance computing, network equipment performance has significantly improved. However, while network equipment performance has improved, the mismatch between network performance and CPU computing power has gradually become apparent. In traditional TCP / IP networks, the CPU is not only responsible for encapsulating and parsing network packets, but also for transferring data between user space and kernel space. As network bandwidth increases, the CPU's computing power faces increasing pressure. Taking a single data transmission and reception process in a TCP / IP network as an example, the sending CPU first copies data from user space memory to kernel space memory, completes packet encapsulation in the kernel protocol stack, and then the DMA (Direct Memory Access) controller transfers the encapsulated packet to the NIC (Network Interface Card) for transmission to the receiving NIC. After receiving the packet, the receiving NIC uses the DMA controller to transfer the packet to kernel space memory, where the kernel protocol stack parses it, stripping the frame header or packet header layer by layer. Finally, the CPU copies the payload to user space memory, completing a data transmission.

[0050] During a data transmission, the CPU is responsible for copying data between user space and kernel space, as well as encapsulating and parsing network packets. These tasks consume significant CPU resources, preventing the CPU from allocating its computing power more effectively in data-intensive scenarios. Therefore, addressing the mismatch between network performance and CPU computing power has become crucial for the development of high-performance networks. Considering the gradual obsolescence of Moore's Law and the slow pace of CPU performance development, offloading network data processing tasks from the CPU to hardware devices has become the mainstream solution.

[0051] In an RDMA network, a network interface card (RNIC) with RDMA capability can directly retrieve data from the sender's user-space memory, encapsulate the data, and then transmit it to the receiver. Upon receiving the data, the receiving RNIC parses and extracts the payload, placing it directly into the user-space memory to complete the data transmission. During this process, the CPU, aside from necessary control plane functions, hardly participates in data transmission; the data is essentially written directly to the remote node's memory via the RNIC. Therefore, compared to traditional networks, RDMA frees the CPU from network transmission, making network transmission as convenient and fast as direct access to remote memory.

[0052] Currently, the industry offers SMC-R (Shared Memory Communication over RDMA) as a non-intrusive technology. Referring to Figure 1, SMC-R operates in kernel space, supporting network behavior described by user-mode programs through the Socket interface and using the IBverbs interface. The use, management, and maintenance of RDMA resources can all be completed by the SMC-R protocol stack. TCP applications are unaware of the RDMA entities in the kernel, making RDMA network transmission a transparent and non-intrusive replacement for TCP applications, providing a high-performance hardware-software co-working network. However, SMC-R operates in kernel space, which cannot fully utilize the kernel bypass feature of RDMA, and SMC-R cannot achieve zero-copy due to its compatibility with the socket interface.

[0053] To truly achieve kernel bypass and zero-copy data transfer, this disclosure modifies the communication layer code of the TCP application, abandoning the TCP Socket interface and directly using the RDMA IBverbs interface. Since there is no need to pay the price for Socket compatibility, resource consumption is reduced. Furthermore, the data plane methods in the IBverbs interface operate in user space, enabling true kernel bypass and significantly reducing context switching. Additionally, by registering RDMA memory in the user-space memory pool of the TCP application, it is possible to directly read and write memory registered in the user-space memory pool during RDMA data transfer. This non-intrusive RDMA memory pool enhancement not only achieves zero-copy data transfer but also eliminates the need for repetitive development, reducing development costs.

[0054] This disclosure provides a data transmission method based on RDMA. Taking the execution of this disclosure embodiment by the sending end and the receiving end as an example, referring to Figure 2, the method flow provided by this disclosure embodiment includes:

[0055] 201. Establish an RDMA data plane event loop between the sending and receiving ends.

[0056] In this system, both the sending and receiving ends are clients of a TCP application. To achieve RDMA-based communication, both the sending and receiving ends are configured with an RDMA module. This RDMA module implements the interfaces related to the RDMA protocol and can be either RDMA hardware or RDMA software. The RDMA hardware can be a network interface card (NIC) with RDMA functionality (such as an RNIC), and the RDMA software can be software code with RDMA functionality. To easily distinguish between the RDMA module configured in the sending electronic device and the RDMA module configured in the receiving electronic device, the RDMA module corresponding to the receiving end can be referred to as the first RDMA module, and the RDMA module corresponding to the sending end can be referred to as the second RDMA module.

[0057] When the electronic device hosting the sending end powers on, it configures multiple threads during the initialization phase to facilitate subsequent data transmission. These threads include a selector thread and a service thread. Similarly, when the electronic device hosting the receiving end starts up, it also configures multiple threads during the initialization phase to facilitate subsequent data reception. These threads include an acceptor thread, a selector thread, and a service thread. When the sending end wants to send data to the receiving end via RDMA, it can send a connection request through a second RDMA module. Since RDMA is message-based, to better monitor events received by the receiving end from the sending end via the first RDMA module and to promptly read and write the received data, the receiving end needs to establish an RDMA data plane event loop between the sending and receiving ends after receiving the connection request. (An event loop is established because the connection between the sending and receiving ends is a long-lived connection, allowing for multiple data transmissions and receptions after establishment.) The receiving end can establish the RDMA data plane event loop with the sending end using the acceptor and selector threads configured during the initialization phase.

[0058] In this design, the receiving thread at the receiving end can receive and process multiple connection requests sent by the sending end. Compared to existing solutions where the receiving thread at the receiving end can only receive and process one connection request, the utilization rate of the receiving thread is higher. The selection thread at the receiving end can be a thread pool, which includes multiple selection threads, such as the multiple RdmaEventLoops shown in Figure 3. Each selection thread can correspond to a unique data plane event channel, which is a data channel through which the receiving end receives data from the sending end via the first RDMA module. A data plane event refers to an event in which the receiving end receives data sent by the sending end via the first RDMA module. Specifically, the receiving thread is used to receive connection requests sent by the sending end. In response to the connection request, it initializes the RDMA resources (such as queue resources) related to the first RDMA module. After completing the initialization, it creates an RDMA data channel instance for the sending end, and then selects an idle, unregistered selection thread from the selection thread pool. The RDMA data channel instance is then registered to this selection thread. During the registration process, the created RDMA data channel instance can be bound to the data plane event channel corresponding to the selection thread. The selected thread is used to listen to the bound data plane event channel in order to obtain the data plane events of the RDMA data channel instance.

[0059] Figure 3 illustrates the RDMA data plane event loop establishment process between the sender and receiver. Referring to Figure 3, multiple clients (i.e., senders) can send connection requests to the server (i.e., receiver). The server's RdmaEventLoop (receiver thread) receives connection requests from multiple clients and initializes the RDMA resources corresponding to each client. After completing the initialization operation, an RdmaChannel (RDMA data channel instance) is created for each client. Then, an idle, unregistered RdmaEventLoop (selection thread) is selected for each client from the selection thread pool. The RdmaChannel created for each client is then registered to the selected RdmaEventLoop (selection thread). During the registration process, the RdmaChannel corresponding to each client is bound to the data plane event channel corresponding to the registered RdmaEventLoop (selection thread). Thus, by listening to each data plane event channel, the data plane events of the bound RDMA data channel instance can be obtained. After obtaining the data plane events of the bound RDMA data channel instance, the corresponding event handler in the service thread is called to process the obtained events.

[0060] In this disclosure, each selection thread is associated with two threads: a data plane event loop thread, denoted as `cq_thread`, which handles the data plane event loop; and a control plane event loop thread, denoted as `cm_thread`, which handles the control plane event loop. The control plane event loop thread does not process control plane events upon acquisition; instead, it submits them to the data plane event loop thread for processing. This provides a single-threaded, enclosed environment, ensuring thread safety and lock-free processing. Based on the data plane and control plane event loop threads, the RDMA data plane event loop and RDMA control plane event loop can be implemented respectively. These two loops will be described in detail below.

[0061] RDMA Data Plane Event Loop

[0062] After starting a data plane event loop, the receiving end can access the first RDMA module through a first method to non-block the acquisition of data plane events from the sending end. This first method can be, for example, the `ibv_poll_cq` method. If the number of data plane events acquired by the receiving end through the first method is 0, it checks whether the task queue (a queue owned by the data plane event loop thread for handling non-input / output tasks) is empty. If the task queue is empty, it blocks and waits for a data plane event notification. While blocking and waiting for a data plane event notification, a third method can be used to acquire the event, such as `ibv_get_cq_event`. Upon receiving a data plane event notification, the data plane event loop thread is awakened, and then the thread is called to process the data plane event. After processing the data plane event, the tasks in the task queue are processed. After processing the tasks in the task queue, a new data plane event loop begins. If the receiving end obtains a non-zero number of data plane events by accessing the first RDMA module through the first method, and the task queue is not empty, the data plane event loop thread is in a working state. The data plane event loop thread can be called to process the data plane events. After processing the data plane events, the tasks in the task queue are processed. After processing the tasks in the task queue, a new round of data plane event loop begins.

[0063] Figure 4 illustrates the working process of the data plane event loop thread. Referring to Figure 4, after starting a round of data plane event loop, the receiving end obtains data plane events non-blockingly through the ibv_poll_cq method and obtains the number of data plane events, pollNum. If pollNum == 0 and the task queue is empty, it blocks and waits for data plane event notification through the ibv_get_cq_event method. After receiving the data plane event notification, it wakes up the cq_thread thread and then starts a new round of data plane event loop to process the tasks in the task queue through the cq_thread thread. If the condition pollNum is not equal to 0 and the task queue is not empty, it processes the data plane events (if any) first, then processes the tasks in the task queue (if any), and then starts a new round of data plane event loop.

[0064] RDMA Control Plane Event Loop

[0065] After starting a round of the control plane event loop, the control plane event loop thread blocks to acquire control plane events using a second method, such as rdma_get_cm_event(). Once acquired, the control plane event loop thread encapsulates the acquired control plane event into a task and submits the encapsulated task to the task queue corresponding to the data plane event loop thread. It then wakes up the data plane event loop thread to process the data plane event. After processing the data plane event, it processes the tasks in the task queue, and after processing all tasks in the task queue, a new round of the control plane event loop begins.

[0066] Figure 4 illustrates the working process of the control plane event loop thread. Referring to Figure 4, after starting a round of data plane event loop, cm_thread obtains control plane events by blocking through rdma_get_cm_event(). After obtaining the control plane events, it encapsulates the control plane event processing into tasks and submits the encapsulated tasks to the task queue corresponding to cq_thread. Then, it wakes up cq_thread so that cq_thread can process the data plane events in a timely manner. After processing the data plane events, it processes the tasks in the task queue and then starts a new round of control plane event loop.

[0067] By establishing an RDMA data plane event loop between the sender and receiver, events of data transmission from the receiver can be monitored, allowing for real-time processing of the received data.

[0068] 202. The receiving end requests the first receiving memory in the user-space memory pool.

[0069] Typically, TCP applications are configured with a user-space memory pool. When memory is needed, the TCP application requests a block of memory (also called a chunk) from the operating system, and the requested memory block can be managed by the user-space memory pool itself. RDMA modules differ from TCP applications in their memory usage and cannot directly use the TCP user-space memory pool. Related technologies enable RDMA to use memory by intrusively modifying the TCP user-space memory pool or customizing a user-space memory pool for RDMA. However, these methods not only increase the maintenance cost of subsequent code but also increase overall costs. Therefore, this disclosure provides a non-intrusive RDMA memory pool enhancement component. Based on this component, through RDMA memory registration, the TCP user-space memory pool can be reused for RDMA without redundant development. Specifically, RDMA memory registration requires specifying the starting address (addr) and length (len) of the memory. After successful registration, a unique key is assigned to the requested memory. The RDMA module must carry this key to perform read / write operations on this memory.

[0070] Since the length of data sent by the sending end is uncertain each time, to avoid wasting memory resources, the receiving end can pre-allocate a first receiving memory with a data length of the second data length before the sending end sends data. The process of the receiving end allocating the first receiving memory from the user-space memory pool specifically includes: the receiving end allocating user-space memory with a data length of the second data length from the user-space memory pool (the receiving end can write data to this user-space memory before submitting it to the first RDMA module), and then registering the memory block to which this user-space memory belongs as the smallest unit of RDMA memory registration. During registration, the starting address of the memory block to which the user-mode memory belongs is obtained. Then, it is checked whether this starting address is in the RDMA memory registry. The RDMA memory registry stores the correspondence between the starting addresses and key values ​​of memory blocks that have been registered with RDMA memory. If the starting address is in the RDMA memory registry, the key value corresponding to the starting address is returned, and the memory information of the first receiving memory is provided to the first RDMA module through the ibv_post_recv method, so that the first RDMA module can read and write to the memory block. The memory information of the first receiving memory includes the starting address of the memory block, the length of the memory block, and the key value. If the starting address is not in the RDMA memory registry, the starting address is registered in the first RDMA module, and the registered key value and the starting address are written to the RDMA memory registry. Then, the memory information of the first receiving memory is provided to the first RDMA module through the ibv_post_recv method, so that the first RDMA module can read and write to the memory block.

[0071] It should be noted here that the receiving end and the sending end only need to agree on the first data length of the first receiving memory in advance, and do not need to agree on memory address or other information. After agreeing on the first data length of the first receiving memory, before sending data, the sending end determines that the first data length of the first receiving memory prepared by the receiving end is greater than the second data length of the target data to be sent. Then, the sending end sends the target data to the first RDMA module of the receiving end through the second RDMA module. The first RDMA module directly writes the target data into the first receiving memory.

[0072] 203. The sending end determines whether the second data length of the target data is greater than the first data length.

[0073] Wherein, the first data length is the maximum data length that the receiving end can store in the first receiving memory requested from the user-space memory pool. Before sending the target data to the receiving end, the sending end can determine whether the second data length of the target data is greater than the first data length. If the second data length is greater than the first data length, then step 204 is executed; if the second data length is not greater than the first data length, then the receiving end can send the target data to the receiving end through the send operation (RDMA send operation) of the second RDMA module.

[0074] 204. When the second data length is greater than the first data length, the sending end sends the first RDMA message to the receiving end.

[0075] The first RDMA message includes the second data length, etc.

[0076] 205. The receiving end receives the first RDMA message sent by the sending end and requests the second receiving memory from the user-space memory pool.

[0077] The minimum data length that the second receiving memory can store is the second data length. When the receiving end requests the second receiving memory from the user-space memory pool, the specific steps include: the receiving end requests target user-space memory with a minimum data length of the second data length from the user-space memory pool, then obtains the starting address of the memory block to which the target user-space memory belongs, and then checks whether the starting address is in the RDMA memory registry. If the starting address is in the RDMA memory registry, the receiving end obtains the target key value corresponding to the starting address from the RDMA memory registry, and then uses the target user-space memory as the second receiving memory, providing the starting address and target key value as target memory information to the first RDMA module to complete the request for the second receiving memory; if the starting address is not in the RDMA memory registry, the receiving end performs RDMA memory registration for the starting address, writes the registered target key value and starting address into the RDMA memory registry, and then uses the target user-space memory as the second receiving memory, providing the starting address and target key value as target memory information to the first RDMA module to complete the request for the second receiving memory.

[0078] Figure 5 illustrates the process by which the receiving end requests receive memory from user-space memory. Referring to Figure 5, the receiving end requests a memory block `buf` from the TCP memory pool (i.e., TCP user-space memory), then obtains the starting address `addr` of the memory block to which `buf` belongs. It then checks whether the starting address `addr` is stored in the RDMA registry. If the starting address `addr` is stored in the RDMA registry, it returns the key corresponding to the starting address `addr`, and then submits the memory information, including the memory block `buf` and the key, to the RDMA module so that the RDMA module can read and write to the memory. If the starting address `addr` is not stored in the RDMA registry, it registers the starting address `addr` with RDMA memory, returns the key after registration, writes the starting address `addr` and the key to the RDMA registry, and then submits the memory information, including the memory block `buf` and the key, to the RDMA module so that the RDMA module can read and write to the memory.

[0079] Furthermore, this disclosure provides a replacement mechanism for deregistering registered memory blocks using RDMA memory, thereby removing them from the RDMA memory registry and improving the success rate of memory registration and the utilization rate of memory resources. This replacement mechanism includes, but is not limited to, the following two scenarios:

[0080] In the first scenario, considering that the RDMA module has a limit on the number of memory blocks that can be registered, if the number of memory blocks registered by the receiving end exceeds the limit, the memory registration will fail. Therefore, when RDMA memory registration at the starting address fails, the receiving end can sort the registered memory blocks in the RDMA memory registry in ascending order of access time. Then, it can discard a preset percentage of memory blocks that are ranked higher in the sorting results, and then re-register RDMA memory at the starting address. The preset percentage can be 2%, 5%, etc.

[0081] In the second scenario, the receiving end can check the RDMA memory registry at preset intervals. If any memory block in the RDMA memory registry has not been accessed within the preset time period, then that memory block will be evicted. The preset time period can be 5 minutes, 10 minutes, etc.

[0082] 206. After the second receiving memory is successfully requested, the receiving end sends a second RDMA message to the sending end.

[0083] The second RDMA message includes target memory information of the second received memory, such as the starting address of the second received memory, the data length of the second received memory, and the target key value.

[0084] 207. After receiving the second RDMA message, the sending end sends the target data to the receiving end through an RDMA write operation based on the target memory information.

[0085] Upon receiving the second RDMA message, the sending end compares the second data length with the data length that the second receiving memory can store. Since the minimum data length that the second receiving memory can store is the second data length, the second data length is less than the data length that the second receiving memory can store. Based on the target memory information, the sending end sends the target data to the receiving end through the write operation (RDMA write operation) of the second RDMA module.

[0086] The RDMA send / recv and RDMA write operations disclosed herein are applicable to different scenarios. For small amounts of data, the RDMA send / recv operation, although requiring pre-allocation of memory and having low memory utilization, can reduce transmission latency. For large amounts of data, the RDMA write operation involves two additional communication processes to negotiate the memory reception compared to the RDMA send / recv operation. Although the transmission latency is larger, the amount of data transmitted is large and memory utilization is high.

[0087] 208. When the target data is received, the receiving end writes the target data into the second receiving memory.

[0088] In this embodiment, both the control plane event loop thread and the data plane event loop thread can listen to the events of the first RDMA module receiving data sent by the transmitter. The listening process for the two different listening methods will be described below.

[0089] In one possible implementation, the receiving end listens for events related to the first RDMA module receiving data using a second method. When the second method detects that the first RDMA module has received the target data, the receiving end determines that it has acquired the data plane event of the RDMA data channel instance. Then, based on the control plane event loop thread, it encapsulates the acquired data plane event of the RDMA data channel instance into a task and adds the task to the task queue. The receiving end then wakes up the data plane event loop thread and executes it to control the first RDMA module to process the data plane event. After processing the data plane event, the receiving end processes the tasks in the task queue to write the target data into the second receiving memory.

[0090] In another possible implementation, the receiving end listens for events of the first RDMA module receiving data through a first method. When the first method detects that the first RDMA module has received the target data, it determines that the data plane event of the RDMA data channel instance has been obtained. If the number of data plane events of the RDMA data channel instance is not 0 and the task queue is not empty, the data plane event loop thread is executed to control the first RDMA module to process the data plane events. After processing the data plane events, the task in the task queue is processed, and the target data is written to the second receiving memory.

[0091] Figure 6 illustrates a data transmission method based on RDMA. Referring to Figure 6, the receiving end prepares a receiving memory block recvBuf with a data length of N in advance. Before sending data with a data length of M, the sending end determines whether the data length M is greater than N. If the data length M is less than N, it writes data to recvBuf through an RDMA send operation. If the data length M is greater than N, it notifies the receiving end to prepare a memory block of length M. After receiving the notification message, the receiving end requests a memory block writeBuf of length M from the memory pool (user-space memory pool) and then returns the writeBuf information. After receiving the writeBuf information, the receiving end writes data to writeBuf through an RDMA write operation.

[0092] All of the above-mentioned optional technical solutions can be combined in any way to form optional embodiments of this disclosure, and will not be described in detail here.

[0093] Please refer to Figure 7, which shows a schematic diagram of a data transmission device based on RDMA provided in an embodiment of this disclosure. This device is a receiving end and can be implemented by software, hardware, or a combination of both, becoming all or part of an electronic device. The device includes:

[0094] The receiving module 701 is used to receive a first RDMA message sent by the sending end. The first RDMA message is sent by the sending end when the first data length is less than the second data length. The first data length is the maximum data length that the receiving end can store in the first receiving memory requested from the user space memory pool. The first RDMA message includes the second data length of the target data to be sent by the sending end this time.

[0095] Application module 702 is used to apply for a second receiving memory from the user-mode memory pool. The minimum data length that the second receiving memory can store is the second data length.

[0096] The sending module 703 is used to send a second RDMA message to the sending end after the second receiving memory application is successful. The second RDMA message includes target memory information of the second receiving memory. The second RDMA message is used to notify the sending end to send the target data to the receiving end through an RDMA write operation based on the target memory information.

[0097] The write module 704 is used to write the target data into the second receiving memory when the target data is received.

[0098] In another embodiment of this disclosure, the receiving end is configured with a receiving thread and a selection thread, and the selection thread corresponds to a data plane event channel;

[0099] The receiving thread is used to receive connection requests sent by the sending end, initialize RDMA resources, and create an RDMA data channel instance for the sending end after completing the initialization.

[0100] The receiving thread is also used to register the RDMA data channel instance to the selection thread, and during the registration process, bind the RDMA data channel instance to the data plane event channel corresponding to the selection thread;

[0101] The selected thread is used to listen to the data plane event channel in order to obtain the data plane events of the RDMA data channel instance. The data plane event refers to the event that the receiver receives data sent by the sender.

[0102] In another embodiment of this disclosure, a selected thread is associated with a data plane event loop thread, which is used to perform the following operations:

[0103] After starting a data plane event loop, if the number of data plane events obtained by the receiving end through the first method is 0 and the task queue is empty, it will block and wait for data plane event notification.

[0104] It is awakened after receiving a data plane event notification and then processes the data plane event;

[0105] After processing the data plane events, process the tasks in the task queue;

[0106] After processing all the tasks in the task queue, a new round of data surface event loop begins.

[0107] In another embodiment of this disclosure, the data plane event loop thread is also configured to perform the following operations:

[0108] If the number of data plane events obtained by the receiving end through the first method is not 0 and the task queue is not empty, process the data plane events;

[0109] After processing the data plane events, process the tasks in the task queue;

[0110] After processing all the tasks in the task queue, a new round of data surface event loop begins.

[0111] In another embodiment of this disclosure, the selection thread is also associated with a control plane event loop thread, which is used to perform the following operations:

[0112] After starting a round of control plane event loop, the second method is used to block the acquisition of control plane events;

[0113] After obtaining the control plane event, the obtained control plane event is encapsulated into a task, and the encapsulated task is submitted to the task queue;

[0114] Wake up the data plane event loop thread so that it can process data plane events and, after processing the data plane events, process the tasks in the task queue.

[0115] After processing all the tasks in the task queue, a new round of control plane event loop begins.

[0116] In another embodiment of this disclosure, the writing module 704 is configured to: when the target data is received by listening through the second method, determine that a data plane event of an RDMA data channel instance has been acquired; encapsulate the acquired data plane event of the RDMA data channel instance into a task based on the control plane event loop thread, add the task to the task queue, and then wake up the data plane event loop thread; process the data plane event by executing the data plane event loop thread; and after processing the data plane event, process the tasks in the task queue to write the target data into the second receiving memory.

[0117] In another embodiment of this disclosure, the writing module 704 is configured to: when the target data is received by listening through the first method, determine that the data plane event of the RDMA data channel instance has been obtained; if the number of data plane events of the RDMA data channel instance is not 0 and the task queue is not empty, process the data plane events through the data plane event loop thread; after processing the data plane events, process the tasks in the task queue to write the target data into the second receiving memory.

[0118] In another embodiment of this disclosure, the application module 702 is used to apply for target user-space memory with a minimum data length of a second data length from the user-space memory pool; obtain the starting address of the memory block to which the target user-space memory belongs; check whether the starting address is in the RDMA memory registry, which stores the correspondence between the starting address and key value of memory blocks that have been registered with RDMA memory; when the starting address is in the RDMA memory registry, obtain the target key value corresponding to the starting address from the RDMA memory registry; use the target user-space memory as the second receiving memory, and use the starting address and target key value as target memory information to complete the application for the second receiving memory.

[0119] In another embodiment of this disclosure, the device further includes:

[0120] The registration module is used to register the starting address in the RDMA memory registry when the starting address is not present in the RDMA memory registry, and write the registered target key value and the starting address into the RDMA memory registry.

[0121] The determination module is used to use the target user-space memory as the second receiving memory;

[0122] The determination module is also used to use the starting address and target key value as target memory information to complete the request for the second receiving memory.

[0123] In another embodiment of this disclosure, the device further includes:

[0124] The sorting module is used to sort the registered memory blocks in the RDMA memory registry in order of access time from oldest to newest if RDMA memory registration at the starting address fails.

[0125] The registration module is used to eliminate memory blocks that are located at a preset proportion before the sorting results in the RDMA memory registry, and then re-register the RDMA memory at the starting address.

[0126] In another embodiment of this disclosure, the device further includes:

[0127] The inspection module is used to check the RDMA memory registry at preset intervals;

[0128] The eviction module is used to evict memory blocks if any memory block in the RDMA memory registry has not been accessed within a preset time period.

[0129] Please refer to Figure 8, which shows a schematic diagram of a data transmission device based on RDMA provided in an embodiment of this disclosure. This device is a transmitter and can be implemented by software, hardware, or a combination of both, becoming all or part of an electronic device. The device includes:

[0130] The judgment module 801 is used to determine whether the second data length of the target data is greater than the first data length. The first data length is the maximum data length that the receiving end can store in the first receiving memory requested from the user-mode memory pool.

[0131] The sending module 802 is used to send a first RDMA message to the receiving end when the second data length is greater than the first data length. The first RDMA message includes the second data length. The first RDMA message is used to notify the receiving end to request a second receiving memory from the user space memory pool. The minimum data length that the second receiving memory can store is the second data length. After the request is successful, the sending module 802 sends a second RDMA message to the sending end. The second RDMA message includes the target memory information of the second receiving memory.

[0132] The sending module 802 is also used to send target data to the receiving end through RDMA write operation based on the target memory information after receiving the second RDMA message.

[0133] In another embodiment of this disclosure, the device further includes:

[0134] The transmitting module is also used to transmit target data to the receiving end via RDMA transmission operation when the second data length is not greater than the first data length.

[0135] Figure 9 shows a structural block diagram of an electronic device 900 provided in an exemplary embodiment of the present disclosure. Typically, the electronic device 900 includes a processor 901 and a memory 902.

[0136] The processor 901 can be implemented using at least one of the following hardware forms: DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 901 may also include a main processor and a coprocessor; the main processor is a processor for processing data in the wake-up state, and the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 901 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 901 may also include an artificial intelligence processor for handling computational operations related to machine learning.

[0137] The memory 902 may include one or more computer-readable storage media, which may be non-transitory computer-readable storage media, such as CD-ROM (Compact Disc Read-Only Memory), ROM, RAM (Random Access Memory), magnetic tape, floppy disk, and optical data storage devices. The computer-readable storage medium stores at least one computer program, which, when executed, can implement the aforementioned RDMA-based data transfer method.

[0138] Of course, the aforementioned electronic device may also include other components, such as input / output interfaces and communication components. Input / output interfaces provide an interface between the processor and peripheral interface modules, which can be output devices, input devices, etc. Communication components are configured to facilitate wired or wireless communication between the electronic device and other devices.

[0139] Those skilled in the art will understand that the structure shown in FIG9 does not constitute a limitation on the electronic device 900, and may include more or fewer components than shown, or combine certain components, or employ different component arrangements.

[0140] This disclosure provides a computer-readable storage medium storing at least one computer program, which, when executed by a processor, can implement the above-described RDMA-based data transmission method.

[0141] This disclosure provides a computer program product, which includes a computer program that, when executed by a processor, can implement the aforementioned RDMA-based data transmission method.

[0142] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0143] The above embodiments are only used to illustrate the technical solutions of this disclosure, and are not intended to limit it. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure.

Claims

1. A data transfer method based on Remote Direct Memory Access (RDMA), wherein, The method is applied at the receiving end, and the method includes: The receiver receives a first RDMA message sent by the sending end. The first RDMA message is sent by the sending end when the first data length is less than the second data length. The first data length is the maximum data length that the first receiving memory requested by the receiving end from the user space memory pool can store. The first RDMA message includes the second data length of the target data to be sent by the sending end this time. The second receiving memory is requested from the user-mode memory pool, and the minimum data length that the second receiving memory can store is the second data length. After the second receiving memory application is successful, a second RDMA message is sent to the sending end. The second RDMA message includes the target memory information of the second receiving memory. The second RDMA message is used to notify the sending end to send the target data to the receiving end through an RDMA write operation based on the target memory information. When the target data is received, the target data is written into the second receiving memory.

2. The method according to claim 1, wherein, The receiving end is configured with a receiving thread and a selection thread, and the selection thread corresponds to a data plane event channel; The receiving thread is used to receive the connection request sent by the sending end, perform RDMA resource initialization operations, and create an RDMA data channel instance for the sending end after completing the initialization operations. The receiving thread is also used to register the RDMA data channel instance to the selection thread, and during the registration process, bind the RDMA data channel instance to the data plane event channel corresponding to the selection thread; The selected thread is used to listen to the data plane event channel to obtain the data plane events of the RDMA data channel instance. The data plane event refers to the event in which the receiver receives data sent by the sender.

3. The method according to claim 2, wherein, The selection thread is associated with the data plane event loop thread, which is used to perform the following operations: After starting a data plane event loop, if the number of data plane events obtained by the receiving end through the first method is 0 and the task queue is empty, it will block and wait for data plane event notification. It is awakened upon receiving a data plane event notification and processes the data plane event; After processing the data plane events, process the tasks in the task queue; After processing all the tasks in the task queue, a new round of data plane event loop begins.

4. The method according to claim 3, wherein, The data plane event loop thread is also used to perform the following operations: If the number of data plane events obtained by the receiving end through the first method is not 0, and the task queue is not empty, the data plane events are processed. After processing the data plane events, process the tasks in the task queue; After processing all the tasks in the task queue, a new round of data plane event loop begins.

5. The method according to any one of claims 3 to 4, wherein, The selection thread is also associated with a control plane event loop thread, which is used to perform the following operations: After starting a round of control plane event loop, the second method is used to block the acquisition of control plane events; After obtaining the control plane event, the obtained control plane event is encapsulated into a task, and the encapsulated task is submitted to the task queue; The data plane event loop thread is awakened so that it can process data plane events and, after processing the data plane events, process the tasks in the task queue. After processing all the tasks in the task queue, a new round of control plane event loop begins.

6. The method according to claim 5, wherein, The step of writing the target data into the second receiving memory upon receiving the target data includes: When the target data is received by listening through the second method, it is determined that the data plane event of the RDMA data channel instance has been obtained; The control plane event loop thread encapsulates the data plane events of the acquired RDMA data channel instance into tasks, adds the tasks to the task queue, and then wakes up the data plane event loop thread. The data plane events are processed by executing the data plane event loop thread; After processing the data plane events, the tasks in the task queue are processed to write the target data into the second receiving memory.

7. The method according to any one of claims 3 to 5, wherein, The step of writing the target data into the second receiving memory upon receiving the target data includes: When the target data is received by listening through the first method, it is determined that the data plane event of the RDMA data channel instance has been obtained; If the number of data plane events in the RDMA data channel instance is not 0 and the task queue is not empty, the data plane events are processed by executing the data plane event loop thread; After processing the data plane events, the tasks in the task queue are processed to write the target data into the second receiving memory.

8. The method according to any one of claims 1 to 7, wherein, The step of requesting a second receiving memory from the user-mode memory pool includes: Request target user-space memory from the user-space memory pool with a minimum data length of the second data length; Obtain the starting address of the memory block to which the target user-mode memory belongs; Check whether the starting address is in the RDMA memory registry, which stores the correspondence between the starting addresses and key values ​​of memory blocks that have been registered for RDMA memory. When the starting address is located in the RDMA memory registry, the target key value corresponding to the starting address is obtained from the RDMA memory registry; The target user-space memory is used as the second receiving memory, and the starting address and target key value are used as the target memory information to complete the application for the second receiving memory.

9. The method according to claim 8, wherein, The method further includes: If the starting address is not in the RDMA memory registry, perform RDMA memory registration on the starting address, and write the registered target key value and the starting address into the RDMA memory registry; The target user-space memory is used as the second receiving memory, and the starting address and the target key value are used as the target memory information to complete the application for the second receiving memory.

10. The method according to claim 8 or 9, wherein, The method further includes: If RDMA memory registration at the starting address fails, the registered memory blocks in the RDMA memory registry are sorted in order of access time from oldest to newest. Eliminate memory blocks that are a predetermined proportion of the sorted results in the RDMA memory registry, and then re-register the RDMA memory at the starting address.

11. The method according to any one of claims 8 to 10, wherein, The method further includes: The RDMA memory registry is checked at preset intervals. If any memory block in the RDMA memory registry is not accessed within a preset time period, the memory block will be discarded.

12. The method according to any one of claims 2 to 11, further comprising: After the receiving end and the transmitting end establish an RDMA data plane event loop, the first RDMA module of the receiving end is initialized with resources. The resource initialization operation includes: allocating queue resources to the first RDMA module and creating at least one instance of the RDMA data channel; Each RDMA data channel instance is bound to the data plane event channel corresponding to the selected thread.

13. The method according to any one of claims 1 to 12, wherein when requesting second receiving memory from the user-space memory pool, the method further comprises: If the length of the second data exceeds the maximum contiguous block length of the remaining available memory in the user-mode memory pool, a memory defragmentation operation is triggered. The memory defragmentation operation includes merging adjacent free memory blocks or releasing some allocated but unused memory blocks.

14. A data transfer method based on Remote Direct Memory Access (RDMA), wherein, The method is applied at the sending end, and the method includes: Determine whether the second data length of the target data is greater than the first data length, where the first data length is the maximum data length that the first receiving memory requested by the receiving end from the user-mode memory pool can store; When the second data length is greater than the first data length, a first RDMA message is sent to the receiving end. The first RDMA message includes the second data length. The first RDMA message is used to notify the receiving end to request a second receiving memory from the user space memory pool. The minimum data length that the second receiving memory can store is the second data length. After the request is successful, a second RDMA message is sent to the sending end. The second RDMA message includes the target memory information of the second receiving memory. Upon receiving the second RDMA message, the target data is sent to the receiving end via an RDMA write operation based on the target memory information.

15. The method according to claim 14, wherein, The method further includes: When the second data length is not greater than the first data length, the target data is sent to the receiving end through the RDMA transmit operation.

16. A data transmission apparatus based on Remote Direct Memory Access (RDMA), wherein, The device is a receiving end, and the device includes: The receiving module is used to receive a first RDMA message sent by the sending end. The first RDMA message is sent by the sending end when the first data length is less than the second data length. The first data length is the maximum data length that the receiving end can store in the first receiving memory requested from the user space memory pool. The first RDMA message includes the second data length of the target data to be sent by the sending end this time. The application module is used to apply for a second receiving memory from the user-mode memory pool, wherein the minimum data length that the second receiving memory can store is the second data length; The sending module is used to send a second RDMA message to the sending end after the second receiving memory application is successful. The second RDMA message includes the target memory information of the second receiving memory. The second RDMA message is used to notify the sending end to send the target data to the receiving end through an RDMA write operation based on the target memory information. The writing module is used to write the target data into the second receiving memory when the target data is received.

17. A data transmission apparatus based on Remote Direct Memory Access (RDMA), wherein, The device is a transmitting end, and the device includes: The judgment module is used to determine whether the second data length of the target data is greater than the first data length, wherein the first data length is the maximum data length that the receiving end can store in the first receiving memory requested from the user-mode memory pool; The sending module is configured to send a first RDMA message to the receiving end when the second data length is greater than the first data length. The first RDMA message includes the second data length and is used to notify the receiving end to request a second receiving memory from the user-mode memory pool. The minimum data length that the second receiving memory can store is the second data length. After the request is successful, the sending module sends a second RDMA message to the sending end. The second RDMA message includes the target memory information of the second receiving memory. The sending module is further configured to, upon receiving the second RDMA message, send the target data to the receiving end via an RDMA write operation based on the target memory information.

18. An electronic device, wherein, It includes a processor and a memory; the memory stores at least one piece of program code; the at least one piece of program code is called and executed by the processor to implement the data transfer method based on Remote Direct Memory Access (RDMA) as described in any one of claims 1 to 11, or the RDMA-based data transfer method as described in claim 12 or 13.

19. A computer-readable storage medium, wherein, The computer-readable storage medium stores at least one computer program, which, when executed by a processor, is capable of implementing the data transmission method based on Remote Direct Memory Access (RDMA) as described in any one of claims 1 to 13, or the RDMA-based data transmission method as described in claim 14 or 15.

20. A computer program product, wherein, The computer program product includes a computer program that, when executed by a processor, can implement the data transfer method based on Remote Direct Memory Access (RDMA) as described in any one of claims 1 to 13, or the RDMA-based data transfer method as described in claim 14 or 15.