Communication method based on RDMA technology and related product
By obtaining the writable offset position and remaining space size of the data buffer of the peer device in the unilateral writing operation of RDMA technology, the problem that writing data may cover unprocessed data is solved, and the reliability of data processing is improved .
Patent Information
- Application Number
- CN202411596193.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-08
- Publication Date
- 2025-02-14
AI Technical Summary
When performing a one-sided write operation, the written data may overwrite the unprocessed data on the response side, affecting the reliability of data processing on the device side.
Before writing data to the data buffer of the peer device, the writeable offset position and remaining space size of the data buffer of the peer device are obtained, and the size and position of the data to be written based on this information is determined to ensure the write The entered data will not overwrite unprocessed data.
It effectively avoids the phenomenon of writing data covering unprocessed data, and improves the reliability of data processing of peer equipment.
Smart Images

Figure CN119441091A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of database technology, and in particular to a communication method based on RDMA technology and related products. Background Art
[0002] RDMA (Remote Direct Memory Access) technology is a high-performance network communication technology. This technology runs user programs to bypass the operating system kernel and directly interact with the network card information for network communication. Compared with other network communication methods, it has the advantages of high bandwidth, low latency, and low CPU resource consumption.
[0003] In the process of information exchange using RDMA technology, common information exchange methods include unilateral read and write operations and bilateral read and write operations. Unilateral read and write operations refer to the local end directly performing read and write operations on the remote end's memory, while the remote end is unaware of the read and write operations. Bilateral read and write operations require the participation of the CPUs at both ends, unloading the protocol stack to the hardware's sending and receiving operations. Unilateral read and write operations can save a lot of resources and improve the efficiency of data transmission due to their zero-copy and non-requirement of the remote end's CPU, and are suitable for application scenarios with large amounts of data transmission. Bilateral operations are more suitable for application scenarios with controlled information exchange because both ends can exchange information.
[0004] During unilateral operation, the write operation capability provided by RDMA technology is only the communication capability. Although the CPU of the responding end does not need to participate, which can save its resources, the responding end cannot perceive whether the write operation is completed. Before starting the write operation, the requesting end cannot determine whether there is any unprocessed data in the memory of the responding end. If data is written directly to the responding end, the written data may overwrite the stored unprocessed data, affecting the reliability of data processing on the device end. Summary of the invention
[0005] The present invention provides a communication method and related products based on RDMA technology, which are used to prevent the problem that during the execution of a unilateral write operation, the data written at the response end may overwrite the unprocessed data, thereby affecting the reliability of data processing at the device end.
[0006] In a first aspect, the present invention provides a communication method based on RDMA technology, comprising:
[0007] The steps of controlling information synchronization and writing data into the peer data buffer of the peer device;
[0008] The step of synchronizing the control information includes:
[0009] Before the step of writing data into the peer data buffer of the peer device, obtaining a writable offset position and a remaining space size of the peer data buffer;
[0010] The step of writing data to the peer data buffer of the peer device comprises:
[0011] The size of the data to be written is determined according to the remaining space size of the peer data buffer, and the data to be written is written into the peer data buffer according to the writable offset position of the peer control buffer.
[0012] Furthermore, the communication method further includes:
[0013] After detecting that data in the local data buffer is used for business processing, determining whether there is remaining data in the local data buffer;
[0014] If so, the remaining data is shifted left so that the remaining space of the local data buffer is a continuous memory space.
[0015] Furthermore, the step of synchronizing the control information further includes:
[0016] After the data to be written arrives at the local device, the legitimacy of the data to be written is detected, and after the legitimacy of the data to be written is detected, a preset confirmation character is returned to the opposite device;
[0017] If a preset confirmation character is received from the peer device, a corresponding completion queue and queue record are generated.
[0018] Furthermore, the step of synchronizing the control information further includes:
[0019] After the step of writing data into the peer data buffer of the peer device, sending the size of the data to be written to the peer device;
[0020] After receiving the size of the data to be written from the opposite end device, the writable offset position and the remaining space size of the local data buffer are updated according to the size of the data to be written.
[0021] Furthermore, the local device is provided with a preset data structure, which is used to store the offset position of the unprocessed data in the local data buffer, the end offset position of the unprocessed data and the remaining space size; and the communication method further includes:
[0022] After detecting that the data in the local data buffer has changed, the preset data structure is updated.
[0023] Further, the communication method further comprises the step of establishing an RDMA communication connection, which comprises the step of requesting to establish the RDMA communication connection, and / or the step of responding to establishing the RDMA communication connection;
[0024] The step of requesting to establish an RDMA communication connection comprises:
[0025] Setting a preset flag for starting the RDMA communication in a startup message, and sending the startup message to a peer device;
[0026] The step of responding to the RDMA communication connection comprises:
[0027] After receiving the startup message from the opposite device, detecting whether the startup message contains the preset identifier;
[0028] If yes, a communication connection based on RDMA technology is established with the opposite end device.
[0029] Furthermore, the step of establishing a communication connection based on RDMA technology with the peer device includes:
[0030] Exchange RDM communication resources with the opposite device, wherein the communication resources at least include a global identifier of the network card, a sequence number of a control queue pair, a sequence number of a data queue pair, a virtual address of a data buffer, and read and write permissions of the data buffer.
[0031] In a second aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the communication method based on the RDMA technology described in any one of the above items are implemented.
[0032] In a third aspect, the present invention further provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of any of the above-mentioned communication methods based on the RDMA technology.
[0033] In a fourth aspect, the present invention further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of any of the above-mentioned communication methods based on the RDMA technology.
[0034] In the technical solution of the present invention, before writing data to the peer data buffer of the peer device, control information is exchanged with the peer device to obtain the writable offset position and the remaining space size of the peer data buffer of the peer device; then, in the process of writing data to the peer data buffer of the peer device, the size of the data to be written is obtained according to the writable offset position and the remaining space size of the peer data buffer of the peer device, and the data to be written is written to the data buffer of the peer device. Since in the technical solution of the present invention, the size of the data to be written is equal to or less than the remaining space size, after the data to be written is written to the peer data buffer of the peer device, the phenomenon of the written data overwriting the unprocessed data in the peer data buffer can be avoided.
[0035] Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Hereinafter, some specific embodiments of the present invention will be described in detail in an exemplary and non-limiting manner with reference to the accompanying drawings. The same reference numerals in the accompanying drawings indicate the same or similar components or parts. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the accompanying drawings:
[0037] Figure 1 is a schematic flow chart of a communication method based on RDMA technology according to an embodiment of the present invention;
[0038] Figure 2 is a schematic diagram of the structure of a local device in a communication method according to an embodiment of the present invention;
[0039] Figure 3 is a schematic flow chart of moving the remaining data in the local data buffer in a communication method according to an embodiment of the present invention;
[0040] Figure 4 is a schematic diagram of a computer program product according to an embodiment of the present invention;
[0041] Figure 5 is a schematic diagram of a computer-readable storage medium according to an embodiment of the present invention; and
[0042] Figure 6 is a schematic diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0043] Refer to the following Figures 1 to 6To describe a communication method and related products based on RDMA technology in an embodiment of the present invention. In the description of this embodiment, when a feature "includes or contains" one or some of the features it covers, unless otherwise specifically described, this indicates that other features are not excluded and other features may be further included.
[0044] See also Figure 1 , Figure 1 What is shown is a schematic flow chart of a communication method based on RDMA technology according to an embodiment of the present invention. Before writing data to the data buffer of the opposite device, the communication method synchronizes control information with the opposite device to obtain information about the data buffer of the opposite device, so as to prevent the data written to the data buffer of the opposite device from overwriting unprocessed data, thereby achieving the purpose of improving the reliability of data processing of the opposite device.
[0045] like Figure 1 As shown, the communication method based on RDMA technology in this embodiment includes the following steps:
[0046] Step S102: Control information synchronization;
[0047] Step S104: writing data into the peer data buffer of the peer device.
[0048] In this embodiment, if the local device is the device that initiates the write operation, the local device is the requesting end; if the local device is the device to which data is written, the local device is the responding end. The process of the local device 110 writing data to the peer data buffer of the peer device 120 is as follows: Figure 2 As shown, in Figure 2 The local device end 110 is provided with a local control buffer 111 and a local data buffer 112, both of which are continuous memory spaces, wherein the local control buffer 111 is used to store control information of the local device end; the local data buffer 112 is used to store data written by the opposite device 120 when the local device end 110 acts as a responding end.
[0049] The peer device 120 is provided with a peer control buffer 121 and a peer data buffer 122, both of which are continuous memory spaces, wherein the peer control buffer 121 is used to store control information of the peer device; the peer data buffer 122 is used to store data written by the local device 110 when the peer device 120 acts as a responding end.
[0050] In this embodiment, a communication connection based on RDMA technology is adopted between the local device end 110 and the opposite device 120, and the communication connection includes a control communication connection and a data communication connection. The local device end 110 and the opposite device 120 exchange control information through a control communication connection in a bilateral operation manner; the local device end 110 and the opposite device 120 exchange data information through a data communication connection in a unilateral operation manner.
[0051] In the above step S102, the method for synchronizing control information includes the following steps:
[0052] Before writing data to the peer data buffer of the peer device, the local device obtains the writable offset position and the remaining space size of the peer data buffer of the peer device.
[0053] In this embodiment, before the local device writes data to the peer data buffer of the peer device, it can send write operation request information to the peer device through the control connection between the peer device; accordingly, after receiving the write operation request information, the peer device detects the writable offset position and the remaining space size of the peer data buffer, and sends the writable offset position and the remaining space size to the local device through the send operation of the control connection, and the local device receives the writable offset position and the remaining space size through the recv operation of the control connection.
[0054] The method for the peer device to obtain the writable offset position and remaining space size of the peer data buffer includes: if there is no unprocessed data in the peer data buffer, the writable offset position refers to the starting position of the peer data buffer, and the remaining space size refers to the size of the peer data buffer; if there is unprocessed data in the peer data buffer, the writable offset position refers to the next position of the end position of the unprocessed data in the peer data buffer, and the remaining space size refers to the difference between the total space size of the peer data buffer and the space size occupied by processed data.
[0055] The step of writing data to the peer data buffer of the peer device in the above step S104 includes:
[0056] The size of the data to be written is determined according to the remaining space size of the peer data buffer of the peer device, and the data to be written is written into the peer data buffer of the peer device according to the writable offset position of the peer data buffer of the peer device.
[0057] The above-mentioned determination of the size of the data to be written based on the remaining space size of the peer data buffer of the peer device refers to making the size of the data to be written equal to or less than the remaining space size of the peer data buffer; the process of writing the data to be written into the peer data buffer of the peer device refers to the process of writing the data to be written into the peer data buffer through a write operation starting from the writable offset position of the peer data buffer. Since the size of the data to be written is equal to or less than the remaining space size, after the data to be written is written into the peer data buffer of the peer device, it can be avoided that the written data overwrites the unprocessed data in the peer data buffer of the peer device.
[0058] According to the above content, the technical solution provided by this embodiment, before writing data to the peer data buffer of the peer device, performs control information interaction with the peer device to obtain the writable offset position and the remaining space size of the peer data buffer of the peer device; then, in the process of writing data to the peer data buffer of the peer device, according to the writable offset position and the remaining space size of the peer data buffer of the peer device, the size of the data to be written is obtained and the data to be written is written to the data buffer of the peer device. Since in the technical solution of this embodiment, the size of the data to be written is equal to or less than the remaining space size, after the data to be written is written to the peer data buffer of the peer device, the phenomenon of the written data overwriting the unprocessed data in the peer data buffer can be avoided.
[0059] In some embodiments of the present invention, the communication method based on the RDMA technology of this embodiment further includes the step of moving the remaining data in the local data buffer.
[0060] In this embodiment, the method for moving the remaining data in the local data buffer is as follows: Figure 3 As shown, the following steps are included:
[0061] Step S202: Detect whether the local device uses the data stored in the local data buffer to perform business processing;
[0062] If yes, execute step S204;
[0063] Step S204: after the local device completes the service processing, it is determined whether there is any remaining data in the local data buffer;
[0064] If yes, execute step S206;
[0065] Step S206: Shift the remaining data in the local data buffer to the left, so that the remaining space of the local data buffer is a continuous memory space.
[0066] In the above step S202, after the peer device writes the data to be written into the local data buffer of the local device, the local device can use the data in the local data buffer for business processing such as data query and data storage, and after business processing, delete the data used in the business processing from the local data buffer.
[0067] Since all data in the local data buffer may be used or only part of the data in the local data buffer may be used during business processing, it is necessary to determine whether there is any remaining data in the local data buffer after completing the business processing in the above step S204.
[0068] In this embodiment, the local data buffer can be checked to determine whether there is any remaining data in the local data buffer; or whether there is any remaining data in the local data buffer can be determined by determining whether the amount of data used in the business processing is the same as the amount of data remaining in the local data buffer before the business processing.
[0069] In the above step S206, since the data is stored from the left in the memory space, after the remaining data in the local data buffer is shifted left, not only the remaining data is stored continuously in the local data buffer, but also the remaining space of the local data buffer is continuous, so that the remaining space is the actual remaining space of the local data buffer.
[0070] Through the technical solution of this embodiment, it can be ensured that the remaining space of the local data buffer is a continuous memory space. When data is written to the local data buffer next time, the requesting end can write more data to the responding end, and the storage of the written data in the local data buffer is continuous.
[0071] In some embodiments of the present invention, the method for synchronizing control information in step S102 further includes the following steps:
[0072] After the data to be written arrives at the local device, the legitimacy of the data to be written is detected, and after detecting that the data to be written is legal, a preset confirmation character is returned to the peer device;
[0073] If a preset confirmation character is received from the peer device, a corresponding completion queue and queue record are generated.
[0074] In this embodiment, both the local device and the opposite device are provided with an IB network card, and the local device and the opposite device are connected for communication via the IB network card. When the local device is the responding end, the opposite device can write data to the local data buffer of the local device, and after the data to be written arrives at the IB network card of the local device, the IB network card of the local device uses a preset legality check procedure to check whether the received data to be written is legal, such as checking whether there is a preset check mark in the data to be written, or whether the length of the data to be written is a set multiple of a preset value, etc. And after the IB network card of the local device detects that the data to be written is legal, it returns a confirmation character (Acknowledgment, referred to as ACK) to the opposite device through the control information connection.
[0075] When the local device is the requesting end, if a confirmation character returned by the peer device is received, it can be determined that the data to be written is legal in the peer device and is written into the peer data buffer of the peer device, so the corresponding completion queue and queue record are generated.
[0076] The Completion Queue (Completion Queue for short) is used to store and manage the results of operations or tasks that have been completed but not yet processed by the application. It enables the program to efficiently handle multiple concurrent tasks, improving the performance and responsiveness of the program.
[0077] Completion Queue Entry (CQE) is often closely related to completion queues in asynchronous programming and network programming. CQE represents the result of a completed event or operation, which is stored in the completion queue for subsequent processing.
[0078] Through the technical solution of this embodiment, the legitimacy of the data written into the local data buffer can be detected when the local device is the responding end to ensure the legitimacy of the written data, thereby improving the reliability and accuracy of writing data into the local data buffer. And after the local device writes data to the peer data buffer of the peer device, it can receive the confirmation character returned by the peer device and generate a corresponding completion queue and queue record to facilitate the staff to query the execution status of the communication process, thereby improving the monitorability of the communication process.
[0079] In some embodiments of the present invention, the method for synchronizing control information in step S102 further includes the following steps:
[0080] After the step of writing data into the peer data buffer of the peer device, sending the size of the data to be written to the peer device;
[0081] After receiving the size of the data to be written from the peer device, the writable offset position and the remaining space size of the local data buffer are updated according to the size of the data to be written.
[0082] Since writing data from the local device to the peer device's data buffer is a one-way write operation, and the peer device is unaware of the write operation, after the local device writes the data to be written into the peer device's data buffer, it sends the size of the data to be written to the peer device through the send operation of the control connection, and the peer device receives the size of the data to be written through the recv operation of the control connection.
[0083] Correspondingly, if the peer device writes data to the local data buffer of the local device, the local device will receive the size of the data to be written sent by the peer device. Therefore, after receiving the size of the data to be written, the local device can not only determine that the peer device has written the data in the local device buffer of the local device, but also update the writable offset position and the size of the remaining space of the local data buffer according to the size of the data to be written.
[0084] In some embodiments of the present invention, a local device is provided with a preset data structure for storing the position offset of unprocessed data in the local data buffer, the position offset of the end of unprocessed data, and the remaining space size.
[0085] The communication method based on the RDMA technology of this embodiment further includes:
[0086] After detecting that the data in the local data buffer has changed, the preset data structure on the local device side is updated according to the position offset of the unprocessed data, the position offset of the end of the unprocessed data and the remaining space size in the local data buffer.
[0087] In this embodiment, the method for determining whether the data in the local data buffer has changed includes:
[0088] Perform real-time detection on the amount of data in the local buffer to determine whether the data in the local buffer has changed;
[0089] After the local device performs service processing based on the data in the local data buffer, it is determined that the remaining data in the local data buffer has changed; and
[0090] When the local device acts as the responder, if the requester writes data in the local data buffer, it is determined that the remaining data in the local data buffer has changed. In this embodiment, after receiving the size of the data to be written, it is determined that the responder has data written to the local data buffer.
[0091] Through the technical solution of this embodiment, the position offset of the unprocessed data in the local data buffer, the position offset of the end of the unprocessed data and the remaining space size can be recorded in a preset data structure, so as to obtain the writable offset position and the remaining space size of the local data buffer from the preset data structure, thereby improving the work efficiency of executing the communication method.
[0092] In some embodiments of the present invention, the communication method based on RDMA technology of the present invention further includes the step of establishing an RDMA communication connection.
[0093] Since the local device end may be the device end that issues a request to establish an RDMA communication connection, or may be the device end that responds to establishing an RDMA communication connection, the method for establishing an RDMA communication connection in this embodiment includes the step of requesting to establish an RDMA communication connection, and / or the step of responding to establishing an RDMA communication connection.
[0094] In this embodiment, the method for requesting to establish an RDMA communication connection includes:
[0095] A preset identifier for starting the RDMA communication connection is set in the startup message, and the startup message is sent to the peer device.
[0096] The steps of establishing an RDMA communication connection include:
[0097] After receiving the startup message from the other end, detecting whether the startup message contains a preset identifier for starting the RDMA communication connection;
[0098] If yes, establish an RDMA communication connection with the other end.
[0099] In this embodiment, the main process of the local device is used to receive the communication connection of the peer device. For example, the local device and the peer device are both devices using the RoCE or iWARP protocol. Because the network part of the protocol is based on Ethernet, the protocol generally also supports socket connections based on TCP / IP. The main process of the local device listens for the socket connection from the peer device, and after receiving the socket connection request from the peer device, the local device opens a new subprocess to process the request of the peer device.
[0100] The local device can send a startup message packet to the peer device through a socket connection. The startup message packet contains the relevant information for subsequent connection and authentication, as well as the Boolean flag enable_rdma of whether to enable the RDMA communication connection. As for the communication method between the local device and the peer device, you can select it by configuring the parameter enable_rdma on the local device, so that the local device and the peer device can communicate in different environments, that is, on a device without an RDMA environment, you can choose to communicate through a TCP / IP-based socket connection by not turning on this configuration parameter. If a socket connection is used for communication, do not configure enable_rdma or configure enable_rdma to false; conversely, if an RDMA communication connection is used, configure enable_rdma to true.
[0101] Correspondingly, if the subprocess on the local device receives the startup message packet from the peer device through the socket connection and parses it, if the Boolean flag enable_rdma in the startup message packet is false or not configured, the established socket connection is still used to communicate with the peer device; if the Boolean flag enable_rdma in the startup message packet is true, an RDMA connection is established with the client.
[0102] Through the technical solution of this embodiment, the RDMA communication connection mode between the two ends can be started through information interaction between the two end devices on the basis of the mobile communication connection, so as to improve the reliability of the communication connection management between the two end devices.
[0103] In some embodiments of the present invention, a method for establishing an RDMA communication connection between a local device peer and a peer device includes:
[0104] Exchange RDMA communication resources with the opposite device, and establish a communication connection based on RDMA technology with the opposite device according to the RDMA communication resources.
[0105] In this embodiment, the local device and the peer device can exchange RDMA communication resources through sockets and establish a connection through the event channel of the rdmac_cm interface. In order to better utilize the established socket connection, the RDMA communication resources of the local device and the peer device are exchanged through the established socket connection to establish a communication connection based on RDMA technology, so that the queue pairs of the local device and the peer device can be associated with each other and communicate with each other.
[0106] The RDMA communication resources exchanged between the local device and the peer device include the global identifier of the IB (InfiniBand, infinite bandwidth) network card, the sequence number of the control queue pair, the sequence number of the data queue pair, the virtual address of the data buffer and the read and write permissions of the data buffer, and the above RDMA communication resources are exchanged through the socket; after the local device receives the RDMA communication resources of the peer device, the state of the queue pair of the local device is converted through the ibv_modify_qp interface to be associated with the queue pair of the peer device, that is, the two ends establish a communication connection based on the RDMA technology.
[0107] Through the technical solution of this embodiment, after the local device side exchanges RDMA communication resources with the peer device, the local device side can obtain the read and write permissions of the peer device, and can communicate with the peer device based on the RDMA technology according to the RDMA communication resources of the peer device, thereby improving the reliability of the communication connection between the local device side and the peer device.
[0108] The flow chart provided by the present embodiment is not intended to indicate that the operation of the method will be performed in any particular order, or that all operations of the method are included in all every case. In addition, the method may include additional operations. Within the scope of the technical ideas provided by the present embodiment method, additional changes can be made to the above method.
[0109] It should be understood that in some embodiments, each part can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system.
[0110] This embodiment also provides a computer program product 10 , a computer readable storage medium 20 , and a computer device 30 . Figure 4 is a schematic diagram of a computer program product 10 according to an embodiment of the present invention, Figure 5 is a schematic diagram of a computer-readable storage medium 20 according to an embodiment of the present invention, Figure 6 is a schematic diagram of a computer device 30 according to an embodiment of the present invention. The computer program product 10 includes a computer program 11, which implements the steps of any of the above-mentioned communication methods based on RDMA technology when executed by a processor 32. The computer-readable storage medium 20 stores the above-mentioned computer program 11, which implements the steps of any of the above-mentioned communication methods based on RDMA technology when executed by a processor 32. The computer device 30 may include a memory 31, a processor 32, and a computer program 11 stored in the memory 31 and running on the processor 32.
[0111] The computer program 11 for performing the operation of the present invention may be an assembly instruction, an instruction set architecture (ISA) instruction, a machine instruction, a machine-related instruction, a microcode, a firmware instruction, a state setting data, a configuration data of an integrated circuit, or a source code or an object code written in any combination of one or more programming languages and process programming languages. The computer program 11 may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer may be connected to the user's computer via any type of network (including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider via the Internet). In some embodiments, in order to perform various aspects of the present invention, an electronic circuit including, for example, a programmable logic circuit, a field programmable gate array (FPGA) or a programmable logic array (PLA) may execute computer-readable program instructions by utilizing the state information of the computer-readable program instructions to personalize the electronic circuit.
[0112] In the description of this embodiment, the computer program product 10 is a related product including the computer program 11 .
[0113] For the purpose of the description of the present embodiment, the computer readable storage medium 20 is a tangible device capable of retaining and storing the computer program 11, which can be any device that can contain, store, communicate, propagate or use the computer program 11 for an instruction execution system, device or apparatus or in conjunction with these instruction execution systems, devices or apparatuses. More specific examples (a non-exhaustive list) of the computer readable storage medium 20 include the following: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, and any suitable combination of the above.
[0114] The computer device 30 may be, for example, a server, a desktop computer, a notebook computer, a tablet computer, or a smart phone. In some examples, the computer device 30 may be a cloud computing node. The computer device 30 may be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, a program module may include routines, programs, target programs, components, logic, data structures, etc. that perform specific tasks or implement specific abstract data types. The computer device 30 may be implemented in a distributed cloud computing environment where remote processing devices linked via a communication network perform tasks. In a distributed cloud computing environment, program modules may be located on a local or remote computing system storage medium including a storage device.
[0115] The computer device 30 may include a processor 32 adapted to execute stored instructions, and a memory 31 providing temporary storage space for the operation of the instructions during operation. The processor 32 may be a single-core processor, a multi-core processor, a computing cluster, or any number of other configurations. The memory 31 may include a random access memory (RAM), a read-only memory, a flash memory, or any other suitable storage system.
[0116] The computer device 30 may also include a network adapter / interface and an input / output (I / O) interface. The I / O interface allows data to be input and output with external devices that may be connected to the computer device. The network adapter / interface may provide communication between the computer device and a network, which is typically shown as a communication network.
[0117] At this point, those skilled in the art should recognize that, although multiple exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications that conform to the principles of the present invention can still be directly determined or derived based on the content disclosed in the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and recognized as covering all these other variations or modifications.
Claims
1. A communication method based on RDMA technology, characterized in that: include: The steps of controlling information synchronization and writing data into the peer data buffer of the peer device; The step of synchronizing the control information includes: Before the step of writing data into the peer data buffer of the peer device, obtaining a writable offset position and a remaining space size of the peer data buffer; The step of writing data to the peer data buffer of the peer device comprises: The size of the data to be written is determined according to the remaining space size of the peer data buffer, and the data to be written is written into the peer data buffer according to the writable offset position of the peer control buffer.
2. The communication method based on RDMA technology according to claim 1, characterized in that: Also includes: After detecting that data in the local data buffer is used for business processing, determining whether there is remaining data in the local data buffer; If so, the remaining data is shifted left so that the remaining space of the local data buffer is a continuous memory space.
3. The communication method based on RDMA technology according to claim 1, characterized in that: The step of controlling information synchronization also includes: After the data to be written arrives at the local device, the legitimacy of the data to be written is detected, and after the legitimacy of the data to be written is detected, a preset confirmation character is returned to the opposite device; If a preset confirmation character is received from the peer device, a corresponding completion queue and queue record are generated.
4. The communication method based on RDMA technology according to claim 3, characterized in that: The step of controlling information synchronization also includes: After the step of writing data into the peer data buffer of the peer device, sending the size of the data to be written to the peer device; After receiving the size of the data to be written from the opposite end device, the writable offset position and the remaining space size of the local data buffer are updated according to the size of the data to be written.
5. The communication method based on RDMA technology according to claim 1, characterized in that: The local device is provided with a preset data structure, and the preset data structure is used to store the offset position of the unprocessed data in the local data buffer, the end offset position of the unprocessed data and the remaining space size; And the communication method also includes: After detecting that the data in the local data buffer has changed, the preset data structure is updated.
6. The communication method based on RDMA technology according to claim 1, characterized in that: The communication method further comprises the step of establishing an RDMA communication connection, which comprises the step of requesting to establish the RDMA communication connection, and / or the step of responding to establishing the RDMA communication connection; The step of requesting to establish an RDMA communication connection comprises: Setting a preset flag for starting the RDMA communication in a startup message, and sending the startup message to a peer device; The step of responding to the RDMA communication connection comprises: After receiving the startup message from the opposite device, detecting whether the startup message contains the preset identifier; If yes, a communication connection based on RDMA technology is established with the opposite end device.
7. The communication method based on RDMA technology according to claim 6, characterized in that: The step of establishing a communication connection based on RDMA technology with the opposite end device comprises: Exchange RDM communication resources with the opposite device, wherein the communication resources at least include a global identifier of the network card, a sequence number of a control queue pair, a sequence number of a data queue pair, a virtual address of a data buffer, and read and write permissions of the data buffer.
8. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the communication method based on the RDMA technology according to any one of claims 1 to 7 are implemented.
9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the communication method based on the RDMA technology described in any one of claims 1 to 7 are implemented.
10. A computer device comprising a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the communication method based on the RDMA technology according to any one of claims 1 to 7.