Data transmission method, device, electronic device and medium based on RDMA

By introducing RDMA data plane event loop and user-state memory pool management in TCP applications, the problems of high latency and low throughput when transmitting data are solved, and efficient adaptation and data transmission with RDMA are achieved.

CN119299518BActive Publication Date: 2025-05-02ALIBABA CLOUD COMPUTING CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411823360.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-05-02
Estimated Expiration
2044-12-10

AI Technical Summary

Technical Problem

When TCP applications transmit data based on TCP/IP, they have large latency, low throughput, and high CPU occupancy, and cannot effectively adapt to RDMA's data transmission requirements.

Method used

By establishing an RDMA data plane event loop between the receiver and the transmitting end, and applying for an appropriate size of the receiving memory in the user-state memory pool, the transmitting end judges the data length, and notifying the receiver through the RDMA message to adjust the memory application, realizing zero copy transmission of data.

Benefits of technology

Reduces data transmission latency, improves throughput and CPU utilization, and achieves efficient adaptation of TCP applications and RDMA.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119299518B_ABST
    Figure CN119299518B_ABST
Patent Text Reader

Abstract

The present application provides a data transmission method, device, electronic device and medium based on RDMA, which belongs to the field of cloud computing. The method includes: receiving a first RDMA message sent by a 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 of the data that can be stored in the first receiving memory applied by the receiving end from the user-mode memory pool, and the first RDMA message includes the second data length of the target data; applying for a second receiving memory with a minimum data length of the second data length from the user-mode memory pool; after the second receiving memory application is successful, sending a second RDMA message to the sending end, the second RDMA message includes the target memory information of the second receiving memory; when the target data is received, writing the target data into the second receiving memory. The present application enables TCP applications to adapt to RDMA, thereby performing data transmission based on RDMA.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cloud computing technology, and in particular to a data transmission method, device, electronic device and medium based on RDMA. Background Art

[0002] At present, 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 have higher and higher requirements for the transmission performance of electronic devices. However, due to the limitations of TCP / IP itself, when transmitting data based on TCP / IP, it is necessary to frequently copy data and switch contexts between user mode and kernel mode, resulting in large TCP application delays, low throughput, and high CPU (Central Processing Unit) occupancy, which seriously limits the improvement of TCP application performance.

[0003] As a direct memory access technology, RDMA (Remote Direct Memory Access) enables TCP applications to bypass the operating system kernel and CPU and communicate directly with the RDMA module (such as a network card), thereby transferring the data of the TCP application from the user state memory of one electronic device directly to the user state memory of another electronic device. By bypassing the operating system kernel and CPU, it can avoid the overhead caused by frequent data copying and context switching, and truly achieve low latency, high throughput and low CPU usage.

[0004] However, TCP / IP is a data transmission protocol based on byte streams, while RDMA is a data transmission protocol based on messages. This means that the TCP application client has no restrictions on the length of data sent each time, while the RDMA module has requirements on the length of data transmitted each time. Therefore, how to make the TCP application adapt to RDMA and perform data transmission based on RDMA has become a problem that needs to be solved urgently. Summary of the invention

[0005] The embodiment of the present application provides a data transmission method, device, electronic device and medium based on RDMA, which can enable TCP applications to adapt to RDMA, thereby performing data transmission based on RDMA. The technical solution is as follows:

[0006] In a first aspect, a data transmission method based on RDMA is provided, the method being applied to a receiving end, the method comprising:

[0007] receiving a first RDMA message sent by a sending end, the first RDMA message being sent by the sending end when a first data length is less than a second data length, the first data length being a maximum data length of data that can be stored in a first receiving memory applied for by the receiving end from a user-mode memory pool, and the first RDMA message including a second data length of target data to be sent by the sending end this time;

[0008] Applying for a second receiving memory from the user state memory pool, wherein the minimum data length of data that can be stored in the second receiving memory is the second data length;

[0009] After the second receiving memory application is successful, sending a second RDMA message to the sending end, the second RDMA message including target memory information of the second receiving memory, and 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;

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

[0011] In a second aspect, a data transmission method based on RDMA is provided, the method being applied to a sending end, the method comprising:

[0012] Determine whether a second data length of the target data is greater than a first data length, where the first data length is a maximum data length of data that can be stored in a first receiving memory applied by the receiving end from a user-mode memory pool;

[0013] When the second data length is greater than the first data length, sending a first RDMA message to the receiving end, the first RDMA message including the second data length, the first RDMA message being used to notify the receiving end to apply for a second receiving memory from the user-mode memory pool, the minimum data length of data that can be stored in the second receiving memory being the second data length, and after the application is successful, sending a second RDMA message to the sending end, the second RDMA message including target memory information of the second receiving memory;

[0014] After receiving the second RDMA message, the target data is sent to the receiving end through an RDMA write operation based on the target memory information.

[0015] In a third aspect, a data transmission device based on remote direct memory access (RDMA) is provided, wherein the device is a receiving end and comprises:

[0016] a receiving module, configured to receive a first RDMA message sent by a sending end, wherein 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 of data that can be stored in the first receiving memory applied by the receiving end from the user-mode memory pool, and the first RDMA message includes the second data length of the target data to be sent by the sending end this time;

[0017] An application module, used for applying for a second receiving memory from the user state memory pool, wherein the minimum data length of data that can be stored in the second receiving memory is the second data length;

[0018] A sending module, configured to send a second RDMA message to the sending end after the second receiving memory application is successful, wherein the second RDMA message includes target memory information of the second receiving memory, and 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;

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

[0020] In a fourth aspect, a data transmission device based on remote direct memory access (RDMA) is provided, wherein the device is a sending end, and the device includes:

[0021] A judging module, used for judging whether a second data length of the target data is greater than a first data length, wherein the first data length is a maximum data length of data that can be stored in a first receiving memory applied by the receiving end from a user-mode memory pool;

[0022] A sending module, 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 including the second data length, the first RDMA message being used to notify the receiving end to apply for a second receiving memory from the user state memory pool, the minimum data length of data that can be stored in the second receiving memory being the second data length, and after the application is successful, send a second RDMA message to the sending end, the second RDMA message including target memory information of the second receiving memory;

[0023] The sending module is further configured to send the target data to the receiving end through an RDMA write operation based on the target memory information after receiving the second RDMA message.

[0024] In a fifth aspect, an electronic device is provided, comprising a processor and a memory; the memory stores at least one program code; the at least one program code is used to be called and executed by the processor to implement the RDMA-based data transmission method described in the first aspect, or the RDMA-based data transmission method described in the second aspect.

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

[0026] In a seventh aspect, a computer program product is provided, the computer program product comprising a computer program, and when the computer program is executed by a processor, the RDMA-based data transmission method described in the first aspect, or the RDMA-based data transmission method described in the second aspect can be implemented.

[0027] The beneficial effects of the technical solution provided by the embodiment of the present application are:

[0028] Since the TCP protocol does not pay attention to the data length of each data transmission, the length of data sent by the TCP application client as the sender to the receiver each time is not fixed, while the RDMA protocol requires the receiver to prepare the receiving memory in advance, and the size of the receiving memory is fixed. In this way, the data length of the data sent by the sender each time may be greater than the maximum data length of the receiving memory prepared in advance by the receiver, or it may be less than the maximum data length of the receiving memory prepared in advance by the receiver. In order to enable the TCP application to adapt to RDMA, the sender needs to determine whether the second data length of the target data to be sent this time is greater than the first data length of the data that can be stored in the first receiving memory pre-applied by the receiver before sending data to the receiver based on RDMA. If the second data length does not exceed the first data length, that is, the first receiving memory can store the target data, then The target data can be sent to the receiving end through the RDMA sending operation. After receiving the target data, the receiving end writes the target data into the first receiving memory, thereby realizing data transmission based on RDMA; 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 re-apply for a new memory from the user-mode memory pool, that is, the second receiving memory. After the receiving end successfully applies, the second RDMA message carrying the target memory information of the second receiving memory is sent to the sending end. After receiving the second RDMA message, the sending end sends the target data to the receiving end through the 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 data transmission based on RDMA. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0030] Figure 1 It is a system architecture diagram of SMC-R provided by related technology;

[0031] Figure 2 is a flow chart of a data transmission method based on RDMA provided in an embodiment of the present application;

[0032] Figure 3 It is a schematic diagram of a process of establishing an RDMA data plane event loop between a sending end and a receiving end provided by an embodiment of the present application;

[0033] Figure 4It 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 the present application;

[0034] Figure 5 is a flowchart of an RDMA memory registration process provided by an embodiment of the present application;

[0035] Figure 6 is a flowchart of another RDMA-based data transmission method provided in an embodiment of the present application;

[0036] Figure 7 It is a structural diagram of a data transmission device based on RDMA provided in an embodiment of the present application;

[0037] Figure 8 is a structural diagram of another RDMA-based data transmission device provided in an embodiment of the present application;

[0038] Fig. 9 A structural block diagram of an electronic device provided by an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION

[0039] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0040] It can be understood that the terms "each", "multiple", and "any" used in the embodiments of the present application include two or more, each refers to each of the corresponding multiple, and any refers to any one of the corresponding multiple. For example, the multiple words include 10 words, and each word refers to each of the 10 words, and any word refers to any one of the 10 words.

[0041] 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 application 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.

[0042] Before executing the embodiments of the present application, the terms involved in the present application are first explained.

[0043] RDMA was created to solve the delay of data processing on the server side (i.e., the receiving side) during network transmission. RDMA writes the data of TCP applications directly to the storage area of ​​electronic devices through the network, and then quickly moves the data from one system to the remote system memory without any impact on the operating system. RDMA eliminates the overhead of external memory copying and context switching, thereby freeing up memory bandwidth and CPU cycles, and improving system performance.

[0044] RDMA Memory Registration: Before receiving data, the receiver needs to perform a memory registration (Memory Register, MR). Each memory registration will get a remote key and a local key (r_key, l_key). The local key is used by the local host channel adapter (Host Channel Adapter, HCA) to access local memory. The remote key is provided to the remote HCA to allow the remote process to access the local system memory during the RDMA operation.

[0045] IB verbs is the RDMA programming API (Application Programming Interface, TCP application programming interface) specification defined in the InfiniBand standard, which provides TCP applications with the ability to directly access network hardware, thereby achieving efficient and low-latency data transmission. The methods involved in this application, such as ibv_post_recv(), ibv_post_send(), ibv_poll_cq(), ibv_get_cq_event(), rdma_get_cm_event(), etc., are all from the API definition in this specification.

[0046] RDMA send / recv: It is a two-end operation in RDMA. The CPUs at both ends need to participate in completing a communication process. The receiving end first prepares the receiving memory through ibv_post_recv(), and then the sending end sends data through ibv_post_send().

[0047] RDMA write: The receiving end prepares a piece of memory in advance and registers the RDMA memory to obtain a key (i.e., remote key). Then, the key and memory information are returned to the sending end. The sending end can write to the memory with the key without the participation of the receiving end's CPU.

[0048] With the rapid development of data centers, distributed systems, and high-performance computing, the performance of network equipment has been significantly improved. However, while the performance of network equipment has been improved, the mismatch between network performance and CPU computing power has gradually emerged. In traditional TCP / IP networks, the CPU is not only responsible for encapsulating and parsing network messages, but also for moving data between user mode and kernel mode. As network bandwidth increases, the CPU's computing power faces increasing pressure. Taking a data transmission and reception process of a TCP / IP network as an example, the CPU at the sending end first copies the data from the user-mode memory to the kernel-mode memory, completes the data packet encapsulation in the kernel-mode protocol stack, and then the DMA (Direct Memory Access) controller moves the encapsulated data packet to the NIC (Network Interface Card) and sends it to the NIC at the receiving end. After the NIC at the receiving end receives the data packet, it moves the data packet to the kernel-mode memory through the DMA controller, which is parsed by the kernel protocol stack, and the frame header or packet header is stripped layer by layer. Then, the CPU copies the payload to the user-mode memory to complete a data transmission.

[0049] During a data transmission process, the CPU is responsible for copying data between user mode and kernel mode, as well as encapsulating and parsing network messages. These tasks take up a lot of CPU resources, making it impossible for the CPU to use its computing power in more beneficial places in data-intensive scenarios. Therefore, solving the mismatch between network performance and CPU computing power has become the key to the development of high-performance networks. Considering that Moore's Law is gradually failing and CPU performance is developing slowly in a short period of time, offloading network data processing from the CPU to hardware devices has become a mainstream solution.

[0050] In an RDMA network, an RDMA-capable network card (RNIC) can directly obtain data from the user-state memory of the sender, complete the data encapsulation, and then transmit it to the receiver. After receiving the data, the RNIC on the receiver parses and strips the received data, and directly puts the payload into the user-state memory to complete the data transmission. In this process, the CPU hardly needs to participate in data transmission except for the necessary control plane functions. The data is just like being written directly to the memory of the remote node through the RNIC. Therefore, compared with traditional networks, RDMA frees the CPU from network transmission, making network transmission as convenient and fast as direct access to remote memory.

[0051] Currently, the industry provides non-intrusive technology SMC-R (Shared Memory Communication over RDMA). Figure 1, SMC-R works in kernel space, supports user-mode programs to describe network behaviors through the Socket interface, and uses the IBverbs interface. The use, management, and maintenance of RDMA resources can all be completed by the SMC-R protocol stack. TCP applications will not perceive the RDMA entity in the kernel, making RDMA network transmission a transparent and non-invasive replacement for TCP applications, providing a high-performance software and hardware collaborative network. However, SMC-R works in kernel mode and cannot give full play to the characteristics of RDMA kernel bypass. In addition, SMR-R cannot achieve zero copy in order to be compatible with the socket interface.

[0052] In order to truly achieve kernel bypass and zero data copy, this application modifies the communication layer code of the TCP application, abandons the TCP Socket interface, and directly uses the RDMA IBverbs interface. Since there is no need to pay a price for Socket compatibility, resource consumption is reduced. In addition, the data plane method in the IBverbs interface works in user mode, which can truly achieve kernel bypass and greatly reduce context switching. In addition, by registering the RDMA memory of the user mode memory pool of the TCP application, it is possible to directly read and write the memory registered in the user mode memory pool when transmitting data based on RDMA. Through the non-intrusive RDMA memory pool enhancement, not only the zero copy of the data transmission process is achieved, but also there is no need for repeated development, reducing development costs.

[0053] The present application embodiment provides a data transmission method based on RDMA. Taking the sending end and the receiving end executing the present application embodiment as an example, see Figure 2 , the method flow provided in the embodiment of the present application includes:

[0054] 201. An RDMA data plane event loop is established between the sending end and the receiving end.

[0055] Among them, the sending end and the receiving end are both clients of the TCP application. In order to realize RDMA-based communication, the sending end and the receiving end are both configured with an RDMA module, and the RDMA module can realize the interface related to the RDMA protocol, which can be RDMA hardware or RDMA software. The RDMA hardware can be a network card with RDMA function (such as RNIC), and the RDMA software can be a software code with RDMA function. In order to facilitate the distinction between the RDMA module configured in the electronic device where the sending end is located and the RDMA module configured in the electronic device where the receiving end is located, the RDMA module corresponding to the receiving end can be called the first RDMA module, and the RDMA module corresponding to the sending end can be called the second RDMA module.

[0056] When the electronic device where the sender is located is turned on, multiple threads will be configured for the sender in the initialization phase to facilitate the subsequent sending of data by the sender. The multiple threads include a selection thread (selector thread) and a service thread, etc. When the electronic device where the receiver is located starts, multiple threads will also be configured for the receiver in the initialization phase to facilitate the subsequent receiving of data by the receiver. The multiple threads include a receiving thread (acceptor thread), a selection thread and a service thread, etc. When the sender wants to send data to the receiver based on RDMA, the sender can send a connection request to the receiver through the second RDMA module. Since RDMA is based on message communication, in order to better monitor the event of the sender sending data received by the receiver through the first RDMA module, so as to read and write the received data in time, after receiving the connection request sent by the sender, the receiver needs to establish an RDMA data plane event loop between the sender and the receiver (the reason why the event loop is established is that the link established between the sender and the receiver is a long link, and data can be sent and received multiple times after establishment). When the receiver establishes the RDMA data plane event loop with the sender, it can use the receiving thread and the selection thread configured in the initialization phase to establish it.

[0057] The receiving thread of the receiving end can receive and process connection requests sent by multiple sending ends. Compared with the receiving thread of the receiving end in the existing solution that can only receive and process one connection request, the utilization rate of the receiving thread is higher. The selection thread of the receiving end can be a thread pool, which includes multiple selection threads, such as Figure 3 The multiple RdmaEventLoops shown in . Each selection thread can correspond to a unique data plane event channel, and the data plane event channel is a data channel for the receiving end to receive data through the first RDMA module. The data plane event refers to an event in which the receiving end receives data sent by the sending end through the first RDMA module. Specifically, the receiving thread is used to receive a connection request sent by the sending end, and in response to the connection request, initialize the RDMA resources (such as queue resources) related to the first RDMA module. After completing the initialization operation, create an RDMA data channel instance for the sending end, and then select an idle and unregistered selection thread from the selection thread pool, and then register the RDMA data channel instance to the 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 selection thread is used to monitor the bound data plane event channel to obtain the data plane event of the RDMA data channel instance.

[0058] Figure 3 The RDMA data plane event loop establishment process between the sender and the receiver is shown in Figure 3, multiple clients (i.e., senders) can send connection requests to the server (i.e., receiver). The RdmaEventLoop (receiving thread) of the server receives the connection requests sent by 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, and then an idle and unregistered RdmaEventLoop (selection thread) is selected for each client from the selection thread pool, and then the RdmaChannel created for each client is registered with the RdmaEventLoop (selection thread) selected for it. 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), so that the data plane events of the bound RDMA data channel instance can be obtained by monitoring each data plane event channel, and after obtaining the data plane events of the bound RDMA data channel instance, the corresponding event processor in the service thread is called to process the obtained events.

[0059] In this application, each selection thread is associated with two threads, one thread is the data plane event loop thread, which can be represented as cq_thread, and the cq_thread is responsible for the data plane event loop; the other thread is the control plane event loop thread, which can be represented as cm_thread, and the cm_thread is responsible for the control plane event loop. After obtaining the control plane event, the control plane event loop thread does not process it, but submits it to the data plane event loop thread for processing, thereby providing a single-threaded closed environment, ensuring the safety of the thread, and the processing process is lock-free. Based on the data plane event loop thread and the control plane event loop thread, the RDMA data plane event loop and the RDMA control plane event loop can be implemented respectively. These two loops will be introduced separately below.

[0060] RDMA data plane event loop

[0061] After starting a round of data plane event loop, the receiving end can access the first RDMA module through the first method, so as to obtain the data plane event of the first RDMA module receiving the data sent by the sending end in a non-blocking manner. The first method can be the ibv_poll_cq method, etc. If the number of data plane events obtained by the receiving end through accessing the first RDMA module through the first method is 0, it is detected whether the task queue (the task queue is a queue owned by the data plane event loop thread, used to process non-input and output tasks) is empty. If the task queue is empty, it is blocked to wait for the data plane event notification. When blocking to wait for the data plane event notification, the third method can be used to obtain it. The third method can be ibv_get_cq_event, etc. After receiving the data plane event notification, the data plane event loop thread is awakened, and then the data plane event loop thread is called to process the data plane event, and after processing the data plane event, the tasks in the task queue are processed. After processing the tasks in the task queue, a new round of data plane event loop is started. If the number of data plane events obtained by the receiving end through accessing the first RDMA module through the first method is not 0, and the task queue is not empty, the data plane event loop thread is in a working state, and the data plane event loop thread can be called to process the data plane events, and after processing the data plane events, process the tasks in the task queue, and after processing the tasks in the task queue, start a new round of data plane event loop.

[0062] Figure 4 The working process of the data plane event loop thread is shown in 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, the ibv_get_cq_event method is used to block and wait for data plane event notification. After receiving the data plane event notification, the cq_thread thread is awakened, and then a new round of data plane event loop is started 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, the data plane events (if any) are processed first, and then the tasks in the task queue (if any) are processed, and then a new round of data plane event loop is started.

[0063] RDMA control plane event loop

[0064] After starting a round of control plane event loop, the control plane event loop thread blocks and obtains the control plane event through the second method, and the second method may be rdma_get_cm_event(), etc. After obtaining the control plane event, the control plane event loop thread encapsulates the obtained control plane event into a task, and submits the encapsulated task to the task queue corresponding to the data plane event loop thread, and then wakes up the data plane event loop thread to make the data plane event loop thread process the data plane event, and after processing the data plane event, processes the tasks in the task queue, and after processing the tasks in the task queue, starts a new round of control plane event loop.

[0065] Figure 4 The working process of the control plane event loop thread is shown in Figure 4 After starting a round of data plane event loop, cm_thread obtains control plane events through rdma_get_cm_event() blocking. After obtaining the control plane events, the control plane event processing is encapsulated into tasks, and the encapsulated tasks are submitted to the task queue corresponding to cq_thread. Then cq_thread is woken up so that cq_thread can process data plane events in time. 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.

[0066] By building an RDMA data plane event loop between the sending end and the receiving end, the events of data sent by the receiving end can be monitored, so that the received data can be processed immediately.

[0067] 202. The receiving end applies for a first receiving memory in the user state memory pool.

[0068] Typically, a TCP application is configured with a user-state memory pool. When memory is needed, the TCP application will apply for a piece of memory (also called a chunk) from the operating system. The applied memory block can be managed by the user-state memory pool. The RDMA module is different from the TCP application in memory usage and cannot directly use the TCP user-state memory pool. The related technology enables RDMA to use memory by intrusively modifying the TCP user-state memory pool or customizing a user-state memory pool for RDMA. However, these methods will not only increase the maintenance cost of subsequent codes, but also increase costs. To this end, an embodiment of the present application provides a non-intrusive RDMA memory pool enhancement component. Based on this component, through RDMA memory registration, the TCP user-state memory pool can be reused for RDMA without repeated development. Among them, the starting address addr and length len of the memory need to be specified when registering the RDMA memory. After successful registration, a unique Key is allocated to the applied memory. The subsequent RDMA module carries the Key to perform read / write operations on this memory.

[0069] Since the data length of the data sent by the sending end each time is uncertain, in order to avoid wasting memory resources, the receiving end can pre-apply for 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 applying for the first receiving memory from the user state memory pool specifically includes: the receiving end applies for a user state memory with a data length of the second data length from the user state memory pool (before submitting the user state memory to the first RDMA module, the receiving end can write data to the user state memory), and then registers the memory block to which the user state memory belongs as the minimum unit of RDMA memory registration. When registering, the starting address of the memory block to which the user-mode memory belongs is obtained, and then, it is checked whether the starting address is in the RDMA memory registration table, in which the corresponding relationship between the starting address and the key value of the memory block that has been registered with the RDMA memory is stored. If the starting address is in the RDMA memory registration table, the key value corresponding to the starting address is returned, and 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 the memory block, wherein the memory information of the first receiving memory includes the starting address of the memory block, the length of the memory block, the key value, etc.; if the starting address is not in the RDMA memory registration table, the starting address is registered in the first RDMA module, and the registered key value and the starting address are written into the RDMA memory registration table, and 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 the memory block.

[0070] One thing that needs to be explained here is that the receiving end and the sending end only need to agree in advance on the first data length of the first receiving memory, and do not need to agree on information such as the memory address. After agreeing on the first data length of the first receiving memory, before sending the data, the sending end determines that the first data length of the first receiving memory prepared in advance by the receiving end is greater than the second data length of the target data to be sent, and then sends the target data to the first RDMA module of the receiving end through the second RDMA module, and the first RDMA module directly writes the target data into the first receiving memory.

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

[0072] The first data length is the maximum data length of data that can be stored in the first receiving memory applied by the receiving end from the user-mode 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, step 204 is executed; if the second data length is not greater than the first data length, the receiving end can send the target data to the receiving end through the sending operation (RDMA send operation) of the second RDMA module.

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

[0074] The first RDMA message includes the second data length and the like.

[0075] 205. The receiving end receives the first RDMA message sent by the sending end, and applies for a second receiving memory from the user state memory pool.

[0076] Among them, the minimum data length of data that can be stored in the second receiving memory is the second data length. When the receiving end applies for the second receiving memory from the user state memory pool, it specifically includes: the receiving end applies for the target user state memory with the minimum data length of the second data length from the user state memory pool, and then obtains the starting address of the memory block to which the target user state memory belongs, and then checks whether the starting address is in the RDMA memory registry. When the starting address is in the RDMA memory registry, obtains the target key value corresponding to the starting address from the RDMA memory registry, and then uses the target user state memory as the second receiving memory, and provides the starting address and the target key value as the target memory information to the first RDMA module to complete the application of the second receiving memory; when the starting address is not in the RDMA memory registry, the starting address is registered with the RDMA memory, and the registered target key value and the starting address are written into the RDMA memory registry, and then the target user state memory is used as the second receiving memory, and the starting address and the target key value are provided as the target memory information to the first RDMA module to complete the application of the second receiving memory.

[0077] Figure 5 This shows the process of the receiving end applying for receiving memory from user-mode memory, see Figure 5The receiving end applies for a memory buf from the TCP memory pool (that is, the user-mode memory of TCP), and then obtains the starting address addr of the memory block to which the memory buf belongs, and then checks whether the starting address addr is stored in the RDMA registry. If the starting address addr is stored in the RDMA registry, the key corresponding to the starting address addr is returned, and then the memory buf, key and other memory information are submitted to the RDMA module so that the RDMA module can read and write the memory; if the starting address addr is not stored in the RDMA registry, the starting address addr is registered with the RDMA memory, and the key is returned after registration, and then the starting address addr and the key are written to the RDMA registry, and then the memory buf, key and other memory information are submitted to the RDMA module so that the RDMA module can read and write the memory.

[0078] Furthermore, the present application provides an elimination mechanism, based on which the registered memory block is deregistered from the RDMA memory, thereby deleting it from the RDMA memory registration table, so as to improve the success rate of memory registration and the utilization rate of memory resources. The elimination mechanism includes but is not limited to the following two situations:

[0079] In the first case, considering that the RDMA module has a limit on the number of memory blocks for memory registration, if the number of memory blocks registered by the receiving end exceeds the limit, the memory registration will fail. Therefore, when the RDMA memory registration of the starting address fails, the receiving end can sort the registered memory blocks in the RDMA memory registration table in the order of access time from far to near, and then eliminate the memory blocks in the RDMA memory registration table that are located before the sorting result in a preset ratio, and then re-register the RDMA memory for the starting address. The preset ratio can be 2%, 5%, etc.

[0080] In the second case, the receiving end can check the RDMA memory registry at a preset time interval, and if any memory block in the RDMA memory registry has not been accessed within a preset time, the memory block will be eliminated. The preset time can be 5 minutes, 10 minutes, etc.

[0081] 206. After the second receiving memory application is successful, the receiving end sends a second RDMA message to the sending end.

[0082] The second RDMA message includes target memory information of the second receiving memory, and the target memory information includes the start address of the second receiving memory, the data length of the second receiving memory, the target key value, and the like.

[0083] 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.

[0084] After receiving the second RDMA message, the sending end compares the second data length with the data length of the data that can be stored in the second receiving memory. Since the minimum data length of the data that can be stored in the second receiving memory is the second data length, the second data length is smaller than the data length of the data that can be stored in the second receiving memory. 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.

[0085] The RDMA send / recv operation and RDMA write operation of the present application are applicable to different scenarios. For a small amount of data, the RDMA send / recv operation is used. Although it is necessary to allocate memory in advance and the memory utilization rate is low, the transmission delay can be reduced. For a large amount of data, the RDMA write operation has two more communication processes for negotiating the receiving memory than the RDMA send / recv operation. Although the transmission delay is large, the amount of data transmitted is large and the memory utilization rate is high.

[0086] 208. When receiving the target data, the receiving end writes the target data into the second receiving memory.

[0087] In an embodiment of the present application, both the control plane event loop thread and the data plane event loop thread can monitor the event that the first RDMA module receives data sent by the sender. The monitoring processes of the two different monitoring methods will be introduced respectively below.

[0088] In a possible implementation, the receiving end monitors the event of the first RDMA module receiving data through the second method. When the first RDMA module is monitored through the second method to have received the target data, the receiving end determines to obtain the data plane event of the RDMA data channel instance, and then based on the control plane event loop thread, encapsulates the obtained data plane event of the RDMA data channel instance into a task, adds the task to the task queue, and then wakes up the data plane event loop thread, executes the data plane event loop thread to control the first RDMA module to process the data plane event, and after processing the data plane event, processes the tasks in the task queue to write the target data to the second receiving memory.

[0089] In another possible implementation, the receiving end monitors the event of the first RDMA module receiving data through the first method, and when it is monitored through the first method that the first RDMA module has received the target data, it is determined that the data plane event of the RDMA data channel instance is 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, and after processing the data plane events, the tasks in the task queue are processed to write the target data to the second receiving memory.

[0090] Figure 6 A data transmission method based on RDMA is shown, see Figure 6 The receiving end prepares a receiving memory 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, the data is written to recvBuf through the RDMA send operation; if the data length M is greater than N, the receiving end is notified to prepare a memory block with a length of M. After receiving the notification message, the receiving end applies for a memory block writeBuf with a length of M from the memory pool (user-mode memory pool), and then returns the writeBuf information. After receiving the writeBuf information, the receiving end writes data to writeBuf through the RDMA write operation.

[0091] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.

[0092] Please refer to Figure 7 , which shows a schematic diagram of the structure of a data transmission device based on RDMA provided in an embodiment of the present application, the device is a receiving end, the device can be implemented by software, hardware or a combination of both, and becomes the whole or part of an electronic device, the device includes:

[0093] A receiving module 701 is used for receiving a first RDMA message sent by a sending end, wherein 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 of data that can be stored in the first receiving memory applied by the receiving end from the user-mode memory pool, and the first RDMA message includes the second data length of the target data to be sent by the sending end this time;

[0094] An application module 702 is used to apply for a second receiving memory from a user state memory pool, wherein the minimum data length of data that can be stored in the second receiving memory is a second data length;

[0095] A sending module 703 is used to send a second RDMA message to the sending end after the second receiving memory application is successful, wherein the second RDMA message includes target memory information of the second receiving memory, and 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;

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

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

[0098] The receiving thread is used to receive the connection request sent by the sender, initialize the RDMA resources, and after completing the initialization operation, create an RDMA data channel instance for the sender;

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

[0100] The selection thread is used to monitor the data plane event channel to obtain the data plane event of the RDMA data channel instance. The data plane event refers to the event that the receiving end receives the data sent by the sending end.

[0101] In another embodiment of the present application, a thread is selected to associate with a data plane event loop thread, and the data plane event loop thread is used to perform the following operations:

[0102] After starting a round of 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 blocks and waits for data plane event notification;

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

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

[0105] After processing the tasks in the task queue, a new round of data plane event loop begins.

[0106] In another embodiment of the present application, the data plane event loop thread is further used to perform the following operations:

[0107] 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;

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

[0109] After processing the tasks in the task queue, a new round of data plane event loop begins.

[0110] In another embodiment of the present application, the selection thread is further associated with a control plane event loop thread, and the control plane event loop thread is used to perform the following operations:

[0111] After starting a round of control plane event loop, the control plane event is obtained by blocking through the second method;

[0112] After obtaining the control plane event, encapsulate the obtained control plane event into a task, and submit the encapsulated task to the task queue;

[0113] Wake up the data plane event loop thread to enable the data plane event loop thread to process data plane events, and after processing the data plane events, process the tasks in the task queue;

[0114] After processing the tasks in the task queue, a new round of control surface event loop begins.

[0115] In another embodiment of the present application, the write module 704 is used to determine that a data plane event of the RDMA data channel instance is obtained when the target data is received through the second method; encapsulate the obtained 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; after processing the data plane event, process the tasks in the task queue to write the target data to the second receiving memory.

[0116] In another embodiment of the present application, the write module 704 is used to determine that a data plane event of the RDMA data channel instance is obtained when the target data is received through the first method; 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 event through the data plane event loop thread; after processing the data plane event, process the tasks in the task queue to write the target data to the second receiving memory.

[0117] In another embodiment of the present application, the application module 702 is used to apply for a target user state memory with a minimum data length of a second data length from a user state memory pool; obtain the starting address of a memory block to which the target user state memory belongs; check whether the starting address is in an RDMA memory registry, in which the RDMA memory registry stores a correspondence between the starting address and the key value of the memory block that has been registered with the 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 state memory as the second receiving memory, and use the starting address and the target key value as the target memory information to complete the application for the second receiving memory.

[0118] In another embodiment of the present application, the device further comprises:

[0119] A registration module, used for performing RDMA memory registration on the starting address when the starting address is not located in the RDMA memory registration table, and writing the registered target key value and the starting address into the RDMA memory registration table;

[0120] A determination module, configured to use a target user state memory as a second receiving memory;

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

[0122] In another embodiment of the present application, the device further comprises:

[0123] A sorting module is used to sort the registered memory blocks in the RDMA memory registration table in the order of access time from far to near if the RDMA memory registration of the starting address fails;

[0124] The registration module is used to eliminate the memory blocks of a preset proportion located before the sorting result in the RDMA memory registration table, and then re-register the RDMA memory for the starting address.

[0125] In another embodiment of the present application, the device further comprises:

[0126] A checking module, used for checking the RDMA memory registry at preset intervals;

[0127] The elimination module is used to eliminate a memory block if any memory block in the RDMA memory registry has not been accessed within a preset time period.

[0128] Please refer to Figure 8, which shows a schematic diagram of the structure of a data transmission device based on RDMA provided in an embodiment of the present application, the device is a sending end, the device can be implemented by software, hardware or a combination of both, and becomes the whole or part of an electronic device, the device includes:

[0129] A judging module 801 is used to judge whether a second data length of target data is greater than a first data length, where the first data length is a maximum data length of data that can be stored in a first receiving memory applied by a receiving end from a user-mode memory pool;

[0130] 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 apply for a second receiving memory from the user state memory pool, the minimum data length of data that can be stored in the second receiving memory is the second data length, and after the application is successful, send a second RDMA message to the sending end, the second RDMA message includes target memory information of the second receiving memory;

[0131] The sending module 802 is further configured to send the target data to the receiving end through an RDMA write operation based on the target memory information after receiving the second RDMA message.

[0132] In another embodiment of the present application, the device further comprises:

[0133] The sending module is further used to send the target data to the receiving end through the RDMA sending operation when the second data length is not greater than the first data length.

[0134] Fig. 9 The structure block diagram of an electronic device 900 provided by an exemplary embodiment of the present application is shown. Generally, the electronic device 900 includes: a processor 901 and a memory 902 .

[0135] The processor 901 can be implemented in 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, wherein the main processor is a processor for processing data in an awake state; and the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 901 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 901 may also include an artificial intelligence processor, which is used to process computing operations related to machine learning.

[0136] The memory 902 may include one or more computer-readable storage media, which may be non-temporary computer-readable storage media, for example, the non-temporary computer-readable storage media may be CD-ROM (Compact Disc Read-Only Memory), ROM, RAM (Random Access Memory), magnetic tape, floppy disk, optical data storage device, etc. The computer-readable storage medium stores at least one computer program, which can implement the above-mentioned RDMA-based data transmission method when executed.

[0137] Of course, the above electronic device may also include other components, such as input / output interface, communication component, etc. The input / output interface provides an interface between the processor and the peripheral interface module, and the above peripheral interface module may be an output device, an input device, etc. The communication component is configured to facilitate wired or wireless communication between the electronic device and other devices.

[0138] Those skilled in the art will understand that Fig. 9 The structure shown in the figure does not constitute a limitation on the electronic device 900, and may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.

[0139] An embodiment of the present application provides a computer-readable storage medium, in which at least one computer program is stored. When the at least one computer program is executed by a processor, the above-mentioned RDMA-based data transmission method can be implemented.

[0140] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the above-mentioned RDMA-based data transmission method can be implemented.

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

[0142] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application 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 embodiments of the present application.

Claims

1. A data transmission method based on remote direct memory access RDMA, characterized in that: The method is applied to a receiving end, the receiving end is configured with a receiving thread and a selection thread, the receiving thread is used to receive and process connection requests sent by multiple sending ends, the selection thread is associated with a data plane event loop thread and a control plane event loop thread, the data plane event loop thread and the control plane event loop thread are used for the receiving end to monitor events of data sent by the sending end, the method includes: receiving a first RDMA message sent by the sending end, the first RDMA message being sent by the sending end when the first data length is less than the second data length, the first data length being the maximum data length of data that can be stored in the first receiving memory applied by the receiving end from the user-mode memory pool, and the first RDMA message including the second data length of the target data to be sent by the sending end this time; Applying for a second receiving memory from the user state memory pool, wherein the minimum data length of data that can be stored in the second receiving memory is the second data length; After the second receiving memory application is successful, sending a second RDMA message to the sending end, the second RDMA message including target memory information of the second receiving memory, and 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, characterized in that 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 an initialization operation on the RDMA resources, and after completing the initialization operation, create an RDMA data channel instance for the sending end; The receiving thread is further used to register the RDMA data channel instance with the selecting thread, and bind the RDMA data channel instance with the data plane event channel corresponding to the selecting thread during the registration process; The selection thread is used to monitor the data plane event channel to obtain the data plane event of the RDMA data channel instance, and the data plane event refers to the event that the receiving end receives the data sent by the sending end.

3. The method according to claim 1, characterized in that The data plane event loop thread is used to perform the following operations: After starting a round of 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, blocking and waiting for data plane event notification; After receiving a data plane event notification, the device is awakened to process the data plane event; After processing the data plane event, processing the tasks in the task queue; After processing the tasks in the task queue, a new round of data plane event loop begins.

4. The method according to claim 3, characterized in that 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, process the data plane events; After processing the data plane event, processing the tasks in the task queue; After processing the tasks in the task queue, a new round of data plane event loop begins.

5. The method according to claim 3, characterized in that: The control plane event loop thread is used to perform the following operations: After starting a round of control plane event loop, the control plane event is obtained by blocking through the second method; After obtaining the control plane event, encapsulating the obtained control plane event into a task, and submitting the encapsulated task to the task queue; Waking up the data plane event loop thread so that the data plane event loop thread processes the data plane event, and after processing the data plane event, processes the task in the task queue; After processing the tasks in the task queue, a new round of control plane event loop begins.

6. The method according to claim 5, characterized in that When the target data is received, writing the target data into the second receiving memory comprises: When the target data is received through the second method, determining that a data plane event of the RDMA data channel instance is obtained; Based on the control plane event loop thread, encapsulate the acquired data plane event of the RDMA data channel instance into a task, add the task to the task queue, and then wake up the data plane event loop thread; Processing the data plane event by executing the data plane event loop thread; After processing the data plane event, processing the tasks in the task queue to write the target data into the second receiving memory.

7. The method according to claim 5, characterized in that When the target data is received, writing the target data into the second receiving memory comprises: When the target data is received through the first method, determining that a data plane event of the RDMA data channel instance is obtained; If the number of data plane events of the RDMA data channel instance is not 0 and the task queue is not empty, processing the data plane events by executing the data plane event loop thread; After processing the data plane event, processing the tasks in the task queue to write the target data into the second receiving memory.

8. The method according to claim 1, characterized in that The applying for a second receiving memory from the user state memory pool includes: Applying for a target user-state memory having a minimum data length of the second data length from the user-state memory pool; Obtaining the starting address of the memory block to which the target user state memory belongs; Check whether the starting address is in an RDMA memory registration table, wherein the RDMA memory registration table stores a correspondence between a starting address of a memory block that has been RDMA memory registered and a key value; When the starting address is located in the RDMA memory registry, obtaining a target key value corresponding to the starting address from the RDMA memory registry; The target user state memory is used as the second receiving memory, and the start address and the target key value are used as the target memory information to complete the application of the second receiving memory.

9. The method according to claim 8, characterized in that The method further comprises: When the starting address is not located in the RDMA memory registration table, performing RDMA memory registration on the starting address, and writing the registered target key value and the starting address into the RDMA memory registration table; The target user state memory is used as the second receiving memory, and the start address and the target key value are used as the target memory information to complete the application of the second receiving memory.

10. The method according to claim 9, characterized in that The method further comprises: If the RDMA memory registration of the start address fails, sorting the memory blocks registered in the RDMA memory registration table in order of access time from far to near; Memory blocks of a preset proportion in the RDMA memory registration table that are located before the sorting result are eliminated, and then the RDMA memory registration is performed again on the starting address.

11. The method according to any one of claims 9 to 10, characterized in that The method further comprises: Checking the RDMA memory register at preset intervals; If any memory block in the RDMA memory registration table is not accessed within a preset time period, the memory block is eliminated.

12. A data transmission method based on remote direct memory access RDMA, characterized in that: The method is applied to a transmitting end, and the method comprises: 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 of data that can be stored in the first receiving memory applied by the receiving end from the user-mode memory pool, the receiving end is configured with a receiving thread and a selecting thread, the receiving thread is used to receive and process connection requests sent by multiple sending ends, the selecting thread is associated with a data plane event loop thread and a control plane event loop thread, the data plane event loop thread and the control plane event loop thread are used by the receiving end to monitor events of data sent by the sending end; When the second data length is greater than the first data length, sending a first RDMA message to the receiving end, the first RDMA message including the second data length, the first RDMA message being used to notify the receiving end to apply for a second receiving memory from the user-mode memory pool, the minimum data length of data that can be stored in the second receiving memory being the second data length, and after the application is successful, sending a second RDMA message to the sending end, the second RDMA message including target memory information of the second receiving memory; After receiving the second RDMA message, the target data is sent to the receiving end through an RDMA write operation based on the target memory information.

13. The method according to claim 12, characterized in that The method further comprises: When the second data length is not greater than the first data length, the target data is sent to the receiving end through an RDMA sending operation.

14. A data transmission device based on remote direct memory access (RDMA), characterized in that: The device is a receiving end, the receiving end is configured with a receiving thread and a selection thread, the receiving thread is used to receive and process connection requests sent by multiple sending ends, the selection thread is associated with a data plane event loop thread and a control plane event loop thread, the data plane event loop thread and the control plane event loop thread are used for the receiving end to monitor the event of the sending end sending data, the device includes: a receiving module, configured to receive a first RDMA message sent by a sending end, wherein 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 of data that can be stored in the first receiving memory applied by the receiving end from the user-mode memory pool, and the first RDMA message includes the second data length of the target data to be sent by the sending end this time; An application module, used for applying for a second receiving memory from the user state memory pool, wherein the minimum data length of data that can be stored in the second receiving memory is the second data length; A sending module, configured to send a second RDMA message to the sending end after the second receiving memory application is successful, wherein the second RDMA message includes target memory information of the second receiving memory, and 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; A writing module is used to write the target data into the second receiving memory when the target data is received.

15. A data transmission device based on remote direct memory access (RDMA), characterized in that: The device is a transmitting end, and the device includes: A judging module, used for judging whether a second data length of target data is greater than a first data length, wherein the first data length is a maximum data length of data that can be stored in a first receiving memory applied for by a receiving end from a user-mode memory pool, wherein the receiving end is configured with a receiving thread and a selecting thread, wherein the receiving thread is used for receiving and processing connection requests sent by a plurality of sending ends, wherein the selecting thread is associated with a data plane event loop thread and a control plane event loop thread, wherein the data plane event loop thread and the control plane event loop thread are used for the receiving end to monitor an event of data being sent by a sending end; A sending module, 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 including the second data length, the first RDMA message being used to notify the receiving end to apply for a second receiving memory from the user state memory pool, the minimum data length of data that can be stored in the second receiving memory being the second data length, and after the application is successful, send a second RDMA message to the sending end, the second RDMA message including target memory information of the second receiving memory; The sending module is further configured to send the target data to the receiving end through an RDMA write operation based on the target memory information after receiving the second RDMA message.

16. An electronic device, characterized in that: It comprises a processor and a memory; the memory stores at least one program code; the at least one program code is used to be called and executed by the processor to implement the data transmission method based on remote direct memory access (RDMA) as described in any one of claims 1 to 11, or the data transmission method based on RDMA as described in claim 12 or 13.

17. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer program, and when the at least one computer program is executed by the processor, it can implement the data transmission method based on remote direct memory access (RDMA) as described in any one of claims 1 to 11, or the data transmission method based on RDMA as described in claim 12 or 13.

18. A computer program product, characterized in that The computer program product includes a computer program, which, when executed by a processor, can implement the data transmission method based on remote direct memory access (RDMA) as described in any one of claims 1 to 11, or the data transmission method based on RDMA as described in claim 12 or 13.

Citation Information

Patent Citations

  • Message receiving and sending method, device and system

    CN107241404A