Data processing method based on remote direct memory access, and related devices
By using a request processing method that converts bilateral primitives to unilateral primitives in RDMA communication, the problem of rkeys being easily guessed is solved, thereby improving data security and saving costs.
Patent Information
- Application Number
- PCT/CN2024/117085
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-02-26
- Filing Date
- 2024-09-05
- Publication Date
- 2025-12-04
AI Technical Summary
In existing RDMA one-sided communication methods, the client device's rkey is easily guessed and stolen by attackers, leading to data security issues.
Requests generated using RDMA bilateral primitives are converted into unilateral primitive requests. Upon receiving a request, the server device's RDMA network card directly determines its source and processes it, avoiding the transmission of rkeys and establishing a dedicated communication channel to ensure data security.
It effectively prevents attackers from impersonating client devices to steal data, improving data security while avoiding additional hardware costs and processor performance overhead.
Smart Images

Figure CN2024117085_04122025_PF_FP_ABST
Abstract
Description
A data processing method based on remote direct memory access and related equipment thereof
[0001] The present application claims priority to the Chinese patent application No. 202410211475.9, filed on February 26, 2024, and entitled "A data processing method based on remote direct memory access and related equipment thereof", the content of which is incorporated herein by reference in its entirety. TECHNICAL FIELD
[0002] Embodiments of the present application relate to the field of computer technology, and in particular to a data processing method based on remote direct memory access (RDMA) and related equipment thereof. BACKGROUND
[0003] RDMA technology is a technology that allows a client device to directly access the memory of a server device. The communication architecture based on RDMA technology has been widely used in data centers due to its lower communication latency, higher bandwidth, and higher resource utilization, and other advantages.
[0004] RDMA technology provides two communication modes: single-sided communication mode and double-sided communication mode. In single-sided communication mode, the processor of the server device does not participate in the process when the client device accesses the memory of the server device, while in double-sided communication mode, the processor of the server device participates in the process. In the current single-sided communication mode, when the client device needs to process data, it can send an RDMA request to the RDMA network card of the server device, which contains a remote key (rkey) allocated by the server device to the client device. Therefore, after the RDMA network card of the server device judges that the rkey in the request is legal, it can allow the client device to access the memory of the server device to obtain and process the data required by the client device in the memory.
[0005] In the current single-sided communication mode, due to the poor randomness of the rkey allocated by the server device to different client devices, the rkey of the client device is easy to be guessed, and it is easy to be guessed by attackers and misused to access the memory of the server device as a client device, thereby stealing data, causing user privacy leakage, and causing a series of data security problems.
[0006] SUMMARY
[0007] The embodiments of the present application provide a data processing method based on RDMA and related equipment thereof, which can prevent attackers from invading the server device and make it impossible to steal data, thereby ensuring data security.
[0008] A first aspect of the embodiments of the present application provides a data processing method based on remote direct memory access (RDMA), which is applied to a server device, the server device comprising a memory and an RDMA network card, and the method comprises the following steps:
[0009] When the client device needs to process target data, the client device can generate a first RDMA request by using RDMA two-sided primitives, the first RDMA request being used to request processing of the target data in a target memory region of the memory of the server device, wherein the target memory region refers to a memory region of the memory of the server device that is exclusively used by the client device, and the data stored in the target memory region can be directly accessed and processed by the client device.
[0010] After obtaining the first RDMA request, the RDMA network card of the server device can convert the first RDMA request constructed based on the RDMA two-sided primitives into a second RDMA request constructed based on RDMA one-sided primitives, and the second RDMA request can also be used to request processing of the target data in the target memory region.
[0011] After obtaining the second RDMA request, since the second RDMA request is constructed based on the RDMA one-sided primitives and is used to request processing of the target data in the target memory region, the RDMA network card of the server device can complete the processing of the target data in the target memory region of the memory of the server device according to the indication of the second RDMA request, so as to obtain a data processing result of the target data.
[0012] After obtaining the data processing result, the RDMA network card of the server device can return the data processing result to the client device for use by the client device.
[0013] As can be seen from the above method, since the first RDMA request transmitted between the client device and the server device is constructed based on the RDMA two-sided primitive, the first RDMA request does not carry the rkey of the target memory region exclusive to the client device. Moreover, after the client device and the server device establish a communication connection, a communication channel is established between the two for transmitting the RDMA request, so once the RDMA network card of the server device receives the first RDMA request through the communication channel, the RDMA network card of the server device can directly determine that the first RDMA request comes from the client device, and then allow the client device to access the target memory region. Therefore, the RDMA network card of the server device can convert the first RDMA request into a second RDMA request constructed based on the RDMA one-sided primitive, and access the target memory region according to the indication of the second RDMA request, to complete the processing on the target data. As can be seen, since the client device and the server device transmit the RDMA request constructed based on the RDMA two-sided primitive, which does not carry the rkey, the server device does not need to provide the rkey to the client device when establishing the connection, so the attacker cannot obtain any rkey information related to the client device, and can only randomly guess the rkey of the client device. Therefore, when the attacker sends the RDMA request constructed based on the one-sided primitive by impersonating the client device, the attacker will be rejected due to the incorrect rkey, so the attacker cannot intrude into the server device, cannot steal data, and thus the data security is ensured.
[0014] In a possible implementation, the RDMA network card includes a plurality of work queues, each of the work queues includes a plurality of RDMA requests for indicating an operation, the plurality of RDMA requests included in each of the work queues are constructed based on the RDMA one-sided primitives, the first RDMA request is used to request a target operation on target data in a target memory region, and the RDMA network card converts the first RDMA request to obtain a second RDMA request, including: the RDMA network card generates the second RDMA request based on the first RDMA request and a first RDMA request in a target work queue, the plurality of work queues include the target work queue, and the target work queue includes the plurality of RDMA requests for indicating the target operation. In the foregoing implementation, after the server device and the client device establish a connection, the processor of the server device can create, at the RDMA network card of the server device, a plurality of work queues constructed based on the RDMA one-sided primitives, in the plurality of work queues, each of the work queues includes a plurality of RDMA requests for indicating an operation, and the plurality of RDMA requests included in each of the work queues are constructed based on the RDMA one-sided primitives, so it can be seen that the plurality of one-sided work queues correspond to the plurality of operations one by one. After the RDMA network card of the server device receives the first RDMA request, since the first RDMA request is used to request a target operation on target data in a target memory region, the RDMA network card of the server device can determine, in the plurality of work queues, a target work queue corresponding to the target operation, and it can be understood that the target work queue includes a plurality of RDMA requests for indicating the target operation. Then, the RDMA network card of the server device can obtain, from the target work queue, a first RDMA request in the target work queue. Then, the RDMA network card of the server device can process the first RDMA request and the first RDMA request in the target work queue, to obtain a second RDMA request.
[0015] In a possible implementation, the server device further includes a processor, and the method further includes: after the processor instructs the RDMA network card to establish the plurality of communication channels with the client device, the RDMA network card receives an offloading request from the processor, each of the plurality of communication channels can transmit an RDMA request for indicating an operation, and the offloading request is for indicating a plurality of work queues corresponding to the plurality of communication channels; and the RDMA network card creates the plurality of work queues based on the offloading request. In the foregoing implementation, when the client device initiates multiple communication connections with the server device, the client device needs to inform the server device of the type of each communication connection, so as to establish a plurality of communication channels of different types between the client device and the server device, and the plurality of communication channels correspond to a plurality of operations one by one, that is, in the plurality of communication channels, each communication channel can be used to transmit an RDMA request for indicating a certain operation. After the RDMA network card of the client device establishes the plurality of communication channels with the RDMA network card of the server device, the processor of the server device can send an offloading request to the RDMA network card of the server device, and the offloading request is for indicating a plurality of work queues corresponding to the plurality of communication channels. Then, the RDMA network card of the server device can create the plurality of work queues based on the offloading request. In this way, for any one of the plurality of communication channels, the RDMA network card of the server device has a work queue corresponding to the communication channel. At this point, the processor of the server device successfully offloads the computing logic for the RDMA request to the RDMA network card of the server device.
[0016] In a possible implementation, the RDMA network card generates the second RDMA request based on the first RDMA request and the first RDMA request in the target work queue includes that, if the RDMA network card receives the first RDMA request through the target communication channel, the RDMA network card generates the second RDMA request based on the first RDMA request and the first RDMA request in the target work queue, and the target communication channel can transmit the RDMA request indicating the target operation. In the foregoing implementation, after the RDMA network card of the server device receives the first RDMA request from the client device, the RDMA network card of the server device can determine through which communication channel the first RDMA request is received. If the RDMA network card of the server device receives the first RDMA request through the target communication channel, the RDMA network card of the server device can obtain the first RDMA request in the target work queue from the target work queue corresponding to the target communication channel. Then, the RDMA network card of the server device can parse the first RDMA request, thereby obtaining the identifier of the target memory region and the identifier of the target data in the form of the RDMA bilateral primitive, and converting the identifier of the target memory region and the identifier of the target data in the form of the RDMA bilateral primitive into the identifier of the target memory region and the identifier of the target data in the form of the RDMA unilateral primitive. Since the first RDMA request already contains the identifier of the target operation in the form of the RDMA unilateral primitive, the RDMA network card of the server device can add the identifier of the target memory region and the identifier of the target data in the form of the RDMA unilateral primitive to the first RDMA request, thereby obtaining the second RDMA request.
[0017] In a possible implementation, the method further includes that the RDMA network card receives a multiplexing request from the processor; and after the RDMA network card uses the first RDMA request in the target work queue, the RDMA network card causes the first RDMA request in the target work queue to be the last RDMA request in the target work queue based on the multiplexing request. In the foregoing implementation, after the RDMA network card of the server device receives the multiplexing request from the processor of the server device, the RDMA network card of the server device has the multiplexing function of the RDMA request. Since the function is provided, after the RDMA network card of the server device uses the first RDMA request in the target work queue, the RDMA network card of the server device can cause the first RDMA request in the target work queue not to be consumed, but still remain in the target work queue and serve as the last RDMA request in the target work queue, for subsequent use by the RDMA network card of the server device. As can be seen, the RDMA request in the work queue is used in real time, and can also be multiplexed by the RDMA network card of the server device, which does not need the processor of the server device to participate, and can save the performance overhead of the processor of the server device.
[0018] In a possible implementation, after the RDMA network card uses the first RDMA request in the target work queue, the RDMA network card multiplexes the first RDMA request in the target work queue as the last RDMA request in the target work queue based on the multiplexing request. In the foregoing implementation, the RDMA network card of the server device has the multiplexing function of the RDMA request. Therefore, when the RDMA network card of the server device uses the first RDMA request in the target work queue, the RDMA network card of the server device can set the identifier of the first RDMA request from a first value to a second value in the target work queue, where the first value indicates that the RDMA request is not used, and the second value indicates that the RDMA request is used. After the RDMA network card of the server device uses the first RDMA request, the RDMA network card of the server device can reset the identifier of the first RDMA request from the second value to the first value in the target work queue, and multiplex the first RDMA request as the last RDMA request in the target work queue. In this way, the RDMA network card of the server device multiplexes the RDMA request.
[0019] In a possible implementation, the RDMA network card processes the target data in the target memory region based on the second RDMA request to obtain a data processing result, including: the RDMA network card performs a target operation on the target data in the target memory region based on the second RDMA request to obtain the data processing result, and the target operation includes any one of the following: a read operation and a write operation. In the foregoing implementation, if the second RDMA request is used to request to perform a read operation on the target data in the target memory region, the RDMA network card of the server device can perform the read operation on the target data in the target memory region according to the indication of the second RDMA request. If the second RDMA request is used to request to perform a write operation on the target data in the target memory region, the RDMA network card of the server device can perform the write operation on the target data in the target memory region according to the indication of the second RDMA request. In this way, the RDMA network card of the server device can successfully complete the processing on the target data.
[0020] A second aspect of the embodiments of the present application provides an RDMA network card, the RDMA network card is arranged in a server device, the server device further includes a memory, and the RDMA network card comprises: a receiving module, configured to receive a first RDMA request from a client device, the first RDMA request is constructed based on an RDMA double-sided primitive, and the first RDMA request is used to request processing of target data in a target memory region of the memory; a processing module, configured to convert the first RDMA request to obtain a second RDMA request, the second RDMA request is constructed based on an RDMA single-sided primitive, and the second RDMA request is used to request processing of the target data in the target memory region; the processing module is further configured to process the target data in the target memory region based on the second RDMA request to obtain a data processing result; and a sending module, configured to return the data processing result to the client device.
[0021] As can be seen from the above device, when the client device needs to process the target data, the first RDMA request can be constructed by using the RDMA bilateral primitive and sent to the server device, and the first RDMA request is used to request processing of the target data in the target memory region of the memory of the server device. After the RDMA network card of the server device receives the first RDMA request, the first RDMA request can be converted to obtain the second RDMA request constructed based on the RDMA unilateral primitive, and the second RDMA request is used to request processing of the target data in the target memory region. Then, the RDMA network card of the server device processes the target data in the target memory region based on the second RDMA request, to obtain a data processing result, and returns the data processing result to the client device. In the foregoing process, since the first RDMA request constructed based on the RDMA bilateral primitive is transmitted between the client device and the server device, the first RDMA request does not carry the rkey of the target memory region dedicated to the client device. Moreover, after the client device and the server device establish a communication connection, a communication channel dedicated to transmitting the RDMA request is established between the client device and the server device, so that the RDMA network card of the server device can directly determine that the first RDMA request comes from the client device as soon as the first RDMA request is received by the RDMA network card of the server device through the communication channel, and the client device is allowed to access the target memory region, so that the RDMA network card of the server device can convert the first RDMA request into the second RDMA request constructed based on the RDMA unilateral primitive, and process the target data in the target memory region according to the indication of the second RDMA request. As can be seen, since the RDMA request constructed based on the RDMA bilateral primitive is transmitted between the client device and the server device, the rkey is not carried, so that the server device does not need to provide the rkey to the client device when the connection is established, and therefore, the attacker cannot obtain any rkey information related to the client device, and can only randomly guess the rkey of the client device. When the attacker sends the RDMA request constructed based on the unilateral primitive by impersonating the client device, the RDMA request is rejected because the rkey is incorrect, so that the attacker cannot intrude into the server device, and cannot steal data, thereby ensuring data security.
[0022] In a possible implementation manner, the RDMA network card comprises a plurality of work queues, each work queue comprises a plurality of RDMA requests for indicating an operation, the plurality of RDMA requests comprised in each work queue are constructed based on the RDMA unilateral primitive, the first RDMA request is used to request a target operation on the target data in the target memory region, and the processing module is configured to generate the second RDMA request based on the first RDMA request and a first RDMA request in the target work queue. The plurality of work queues comprise the target work queue, and the target work queue comprises a plurality of RDMA requests for indicating the target operation.
[0023] In a possible implementation, the server device further includes a processor, and the receiving module is further configured to receive an offloading request from the processor after the processor instructs the RDMA network card to establish the plurality of communication channels with the client device, each of the plurality of communication channels being capable of transmitting an RDMA request for indicating an operation, and the offloading request being for indicating a plurality of work queues corresponding to the plurality of communication channels one by one; and the processing module is further configured to create the plurality of work queues based on the offloading request.
[0024] In a possible implementation, the processing module is configured to, if the RDMA network card receives the first RDMA request through the target communication channel, generate a second RDMA request based on the first RDMA request and the first RDMA request in the target work queue, and the target communication channel is capable of transmitting an RDMA request for indicating a target operation.
[0025] In a possible implementation, the receiving module is further configured to receive a multiplexing request from the processor; and the processing module is further configured to, after the RDMA network card uses the first RDMA request in the target work queue, instruct the first RDMA request in the target work queue to be the last RDMA request in the target work queue based on the multiplexing request.
[0026] In a possible implementation, the processing module is configured to: when the RDMA network card uses the first RDMA request in the target work queue, set an identifier of the first RDMA request from a first value to a second value in the target work queue, the first value being for indicating that the RDMA request is not used, and the second value being for indicating that the RDMA request is used; and after the RDMA network card uses the first RDMA request, set the identifier of the first RDMA request from the second value to the first value in the target work queue, and instruct the first RDMA request to be the last RDMA request in the target work queue.
[0027] In a possible implementation, the processing module is configured to perform a target operation on the target data in the target memory region based on the second RDMA request, to obtain a data processing result, and the target operation includes any one of the following: a read operation and a write operation.
[0028] A third aspect of the embodiment of the present application provides a device, which serves as a server device, and the server device includes a processor, a memory, and an RDMA network card. The RDMA network card is in communication connection with the processor and in communication connection with the memory. The RDMA network card is configured to perform the method according to the first aspect or any one of the possible implementation manners of the first aspect on the memory based on an instruction from the processor.
[0029] The fourth aspect of the embodiments of the present application provides a computer storage medium, which stores one or more instructions, and the instructions, when executed by one or more computers, cause the one or more computers to implement the method in the first aspect or any possible implementation manner of the first aspect.
[0030] The fifth aspect of the embodiments of the present application provides a computer program product, which stores instructions, and the instructions, when executed by a computer, cause the computer to implement the method in the first aspect or any possible implementation manner of the first aspect.
[0031] In the embodiments of the present application, when the client device needs to process target data, the first RDMA request can be constructed by using the RDMA bilateral primitive and sent to the server device, and the first RDMA request is used to request processing of the target data in the target memory region of the memory of the server device. After the RDMA network card of the server device receives the first RDMA request, the first RDMA request can be converted, so as to obtain the second RDMA request constructed based on the RDMA unilateral primitive, and the second RDMA request is used to request processing of the target data in the target memory region. Then, the RDMA network card of the server device processes the target data in the target memory region based on the second RDMA request, so as to obtain a data processing result, and returns the data processing result to the client device. In the foregoing process, since the first RDMA request constructed based on the RDMA bilateral primitive is transmitted between the client device and the server device, the first RDMA request does not carry the rkey of the target memory region special for the client device. Moreover, after the client device and the server device establish a communication connection, a communication channel special for transmitting the RDMA request is established between the client device and the server device, so that once the RDMA network card of the server device receives the first RDMA request through the communication channel, the RDMA network card of the server device can directly determine that the first RDMA request comes from the client device, and then the client device is allowed to access the target memory region, so that the RDMA network card of the server device can convert the first RDMA request into the second RDMA request constructed based on the RDMA unilateral primitive, and process the target data in the target memory region according to the indication of the second RDMA request. As can be seen, since the RDMA request constructed based on the RDMA bilateral primitive is transmitted between the client device and the server device, the RDMA request does not carry the rkey, so that the server device does not need to provide the rkey to the client device when the connection is established, and therefore, the attacker cannot obtain any rkey information related to the client device, and can only randomly guess the rkey of the client device. When the attacker sends the RDMA request constructed based on the unilateral primitive by impersonating the client device, the RDMA request is rejected because the rkey is incorrect, so that the attacker cannot intrude into the server device, and cannot steal data, thereby ensuring the data security.
[0032] Further, in the embodiments of the present application, in order to prevent the server device from being intruded by the attacker, only the function of the RDMA network card of the server device needs to be improved, without adding additional hardware in the server device or configuring additional intelligent network devices for the server device, so that the deployment can be realized at a lower hardware cost.
[0033] Further, in the embodiments of the present application, in order to prevent the server device from being intruded by the attacker, a new communication mode is provided, and the processor does not need to participate in the process of processing the RDMA request from the client device and completing the data processing, and the performance consumption of the processor is saved.
[0034] Further, in the embodiments of the present application, the RDMA request in the unilateral work queue is immediately used by the RDMA network card of the server, and can also be reused by the RDMA network card of the server device, and this process does not need the participation of the processor of the server device, so that the performance consumption of the processor of the server device is saved. BRIEF DESCRIPTION OF DRAWINGS
[0035] FIG. 1 is a structural schematic diagram of a data processing system provided by an embodiment of the present application;
[0036] FIG. 2 is another structural schematic diagram of a data processing system provided by an embodiment of the present application;
[0037] FIG. 3 is another structural schematic diagram of a data processing system provided by an embodiment of the present application;
[0038] FIG. 4 is a flow schematic diagram of an RDMA-based data processing method provided by an embodiment of the present application;
[0039] FIG. 5 is another structural schematic diagram of a data processing system provided by an embodiment of the present application;
[0040] FIG. 6 is another structural schematic diagram of a data processing system provided by an embodiment of the present application;
[0041] FIG. 7 is a schematic diagram of a comparison result provided by an embodiment of the present application;
[0042] FIG. 8 is another schematic diagram of a comparison result provided by an embodiment of the present application;
[0043] FIG. 9 is another schematic diagram of a comparison result provided by an embodiment of the present application;
[0044] FIG. 10 is another schematic diagram of a comparison result provided by an embodiment of the present application;
[0045] FIG. 11 is another schematic diagram of a comparison result provided by an embodiment of the present application;
[0046] FIG. 12 is a structural schematic diagram of an RDMA network card according to an embodiment of the present application;
[0047] FIG. 13 is a structural schematic diagram of a server device according to an embodiment of the present application. DETAILED DESCRIPTION
[0048] The embodiments of the present application provide a data processing method based on RDMA and related equipment, which can prevent attackers from invading the server device and stealing data, thereby ensuring data security.
[0049] The terms "first", "second", etc. in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily have to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged under appropriate circumstances, which is only a way of distinguishing the objects with the same attributes in the description of the embodiments of the present application. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, so that the processes, methods, systems, products or equipment containing a series of units do not have to be limited to those units, but can include other units not clearly listed or inherent to these processes, methods, products or equipment.
[0050] RDMA technology is a technology that can enable a client device to directly access the memory of a server device. The communication architecture based on RDMA technology has various advantages such as lower communication latency, higher bandwidth and higher resource utilization, resulting in the widespread application of the communication architecture based on RDMA technology in data centers.
[0051] RDMA technology provides two communication modes, i.e. single-sided communication mode and double-sided communication mode. In the single-sided communication mode, the processor of the server device does not participate in the process when the client device accesses the memory of the server device, while in the double-sided communication mode, the processor of the server device participates in the process. In the current single-sided communication mode, when the client device needs to process certain data, the client device can send an RDMA request indicating the data to the RDMA network card of the server device. The RDMA request contains an rkey assigned to the client device by the server device. Therefore, after judging that the rkey in the request is legal, the RDMA network card of the server device can directly access the memory of the server device to find the data indicated by the RDMA request and process it, thereby obtaining a data processing result. Then, the RDMA network card of the server device can return the data processing result to the client device. In this way, the single-sided communication is successfully completed.
[0052] In the current one-way communication mode, the randomness of the rkey assigned by the server device to different client devices is poor (for example, the difference between the rkeys of different client devices is fixed, etc.), which leads to the rkey of the client device being easy to guess, and the rkey of the client device being easy to be guessed by the attacker and stolen to impersonate the client device to access the memory of the server device, thereby stealing data, leading to user privacy leakage, and causing a series of data security problems.
[0053] Further, in some related technologies, in order to prevent the server device from being invaded by the attacker, the hardware of the server device can be improved, such as adding additional hardware in the server device or configuring additional intelligent network devices for the server device, to solve the security vulnerabilities existing in the above-mentioned one-way communication mode. However, the hardware cost required by this method is too high.
[0054] Further, in some related technologies, in order to prevent the server device from being invaded by the attacker, the hardware of the server device can be improved, such as adding additional hardware in the server device or configuring additional intelligent network devices for the server device, to solve the security vulnerabilities existing in the above-mentioned one-way communication mode. However, the hardware cost required by this method is too high.
[0055] To solve the above problems, an embodiment of the present application provides a data processing method based on RDMA, which can be implemented by a data processing system. FIG. 1 is a structural schematic diagram of a data processing system provided by an embodiment of the present application, as shown in FIG. 1, the data processing system includes a plurality of devices and a network, and the plurality of devices communicate with each other through the network. Among them, the plurality of devices can be presented in various ways, for example, the plurality of devices can be computing devices (for example, servers), and for example, the plurality of devices can also be storage devices (for example, storage arrays), and for example, the plurality of devices can also be other devices supporting RDMA technology, etc., which is not limited here. The network can be built based on a protocol supporting RDMA technology, which can be any one of the infiniband (IB) protocol, the RDMA over converged rthernet (RoCE) protocol based on converged Ethernet, and the internet wide area RDMA protocol (iWARP) etc.
[0056] In the system, any two devices can communicate through the network, for the convenience of introduction, the device generating and sending the RDMA request can be called as a client device, and the device receiving and processing the RDMA request can be called as a server device. The communication mode between the client device and the server device is introduced as follows in combination with Fig. 2. Fig. 2 is another structural schematic diagram of the data processing system provided by the embodiment of the present application. As shown in Fig. 2, the client device or the server device can be any one of the devices in Fig. 1.
[0057] The server device can include a processor, a memory and an RDMA network card. The processor, the memory and the RDMA network card are connected through a bus, for example, a peripheral component interconnect express (PCIe). Of course, the bus can also be a bus for connecting devices in the device. In addition, the bus can include a data bus, a power bus, a control bus and a state signal bus, etc. The processor can be a central processing unit (CPU). Of course, the processor can also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The RDMA network card can also be called as a host channel adapter (HCA). The RDMA network card is an intelligent network card supporting the RDMA technology.
[0058] The client device also includes a processor, a memory and an RDMA network card. The related introduction of the processor of the client device, the memory of the client device and the RDMA network card of the client device can also be referred to the related description of the processor of the server device, the memory of the server device and the RDMA network card of the server device. Here, the introduction is not repeated.
[0059] The above is the introduction of the server device and the client device from the pure hardware point of view. The server device and the client device are introduced from the combination of software and hardware as follows. Fig. 3 is another structural schematic diagram of the data processing system provided by the embodiment of the present application. As shown in Fig. 3, the components of the server device and the client device are further introduced as follows in combination with the communication process of the server device and the client device:
[0060] After the client device is started, the processor of the client device can run the application and the RDMA communication library (LibSecRDMA). The RDMA communication library of the client device can provide a secure interface to the application of the server device, and when the application of the client device needs to access the memory of the server device for processing of the target data, the application of the client device can call the secure interface to make the RDMA communication library of the client device generate an RDMA request using the RDMA bilateral primitive, and the RDMA request is used to request processing of the target data in a memory region (MR) of the memory of the server device that is exclusive to the client device. Then, the RDMA communication library of the client device can send the RDMA request to the RDMA network card of the client device, so that the RDMA network card of the client device sends the RDMA request to the server device through a communication channel between the RDMA network card of the client device and the server device.
[0061] After the server device is started, the processor of the server device can also run the application and the RDMA communication library. The application of the server device can register an MR exclusive to the application of the server device in the memory of the server device, and the MR stores data of the application of the server device. The application of the server device can further divide the MR into multiple MRs and allocate the MRs to different client devices, that is, each client device has an MR exclusive to the client device in the memory of the server device, and each MR is remotely accessed by the corresponding client device to obtain and process data in the corresponding MR. When the server device and the client device establish a communication connection, the RDMA communication library of the server device no longer provides the rkey of the MR exclusive to the client device to the client device, but creates work queues based on the RDMA unilateral primitive at the RDMA network card of the server device after the communication connection is established (which is equivalent to offloading the computing logic originally responsible by the RDMA communication library of the server device to the RDMA network card of the server device), and the work queues include RDMA requests generated using the RDMA unilateral primitive. The RDMA requests are not immediately executed by the RDMA network card of the server device, but are triggered to be executed by the RDMA request generated using the RDMA bilateral primitive from the client.
[0062] When the client needs to process the target data, the RDMA network card of the server device can receive the RDMA request from the client device through the communication channel between the RDMA network card of the server device and the client device, and the RDMA request is generated based on the RDMA two-sided primitive. Then, the RDMA network card of the server device can generate a new RDMA request by using the RDMA request in the work queue and the RDMA request from the client device, and the new RDMA request is also used to request to process the target data in the MR dedicated to the client device. Since the new RDMA request is generated based on the one-sided primitive, the RDMA network card of the server device can directly execute the new RDMA request to process the target data in the MR, so as to obtain the processing result of the target data. In this way, the server device can return the processing result to the client for use by the application of the client.
[0063] In addition, the RDMA communication library of the server device can also deploy multiplexing logic in the RDMA network card of the server device, that is, the RDMA network card of the server device does not consume the RDMA requests in the work queue after using the RDMA requests, but the work queue can still retain the RDMA requests, so as to realize the multiplexing of the RDMA requests.
[0064] Based on the above data processing system, it can be known that the communication between the client device and the server device adopts a new communication mode, which combines the traditional one-sided communication mode and the two-sided communication mode. Since the RDMA request transmitted between the client device and the server device is generated based on the RDMA two-sided primitive, the RDMA request does not carry the rkey. Moreover, after the client device and the server device establish the communication connection, there is a communication channel between the two devices for transmitting the RDMA request, so that once the RDMA network card of the server device receives the RDMA request through the communication channel, it can directly determine that the RDMA request comes from the client device, and then allow the client device to access the memory MR dedicated to it, and convert the RDMA request based on the RDMA one-sided primitive to generate the RDMA request based on the RDMA one-sided primitive, so as to access the MR dedicated to the client device in the memory of the server device based on the RDMA request, to complete the data processing. Therefore, the attacker can no longer impersonate the client device to access the MR dedicated to the client device at the server device to steal data, which can effectively improve the data security. In order to further understand the working process of the above data processing system, the process is further introduced in combination with FIG. 4. FIG. 4 is a flowchart of a data processing method based on RDMA provided by an embodiment of the present application, as shown in FIG. 4, the method can be implemented by the server device in the data processing system shown in FIG. 2 or FIG. 3, and the method comprises:
[0065] 401、The RDMA network interface of the server device receives the first RDMA request from the client device, the first RDMA request is constructed based on the RDMA bilateral primitive, and the first RDMA request is used to request processing of target data in a target memory region of the memory of the server device.
[0066] In this embodiment, when the processor of the client device needs to process the target data, it can generate a first RDMA request (for example, a Send request, etc.) using the RDMA bilateral primitive, and the first RDMA request is used to request processing of the target data in a target memory region of the memory of the server device, wherein the target memory region refers to a dedicated memory region of the memory of the server device allocated to the client device, and the data (including the target data) stored in the memory region can be directly accessed and processed by the client device.
[0067] After obtaining the first RDMA operation, the processor of the client device can send the first RDMA request to the RDMA network interface of the client device, so that the RDMA network interface of the client device sends the first RDMA request to the RDMA network interface of the server device.
[0068] Specifically, the first RDMA request can be presented in the following way:
[0069] The first RDMA request can include the identification of the target memory region (for example, the location information of the target memory region in the memory of the server device, etc.), the identification of the target data in the target memory region (for example, the location information of the target data in the target memory region, etc.), and the identification of the target operation on the target data (for example, the type of the target operation, etc.), and other information, all of which are presented in the form of the RDMA bilateral primitive, so that the first RDMA request can be used to request the target operation on the target data in the target memory region. It is worth noting that since the first RDMA request is constructed based on the RDMA bilateral primitive, the first RDMA request does not include the rkey of the target memory region. In addition, since the operation on the data in this embodiment can have multiple operations, the target operation is any one of the multiple operations, for example, the target operation is a write operation, and for example, the target operation is a read operation, etc.
[0070] For example, as shown in FIG. 5 (FIG. 5 is another structure schematic diagram of the data processing system provided by the embodiment of the present application), when the application of the client device needs to process the target data, it can call the secure interface provided by the RDMA communication library of the client device, so that the RDMA communication library of the client device generates a Send request using the RDMA bilateral primitive, and the Send request is used to request a read operation on the target data in the target MR of the memory of the server device.
[0071] 402、The RDMA network card converts the first RDMA request to obtain a second RDMA request, and the second RDMA request is constructed based on an RDMA unilateral primitive, and the second RDMA request is used to request processing of target data in a target memory region.
[0072] After obtaining the first RDMA request, the RDMA network card of the server device can convert the first RDMA request constructed based on an RDMA bilateral primitive into a second RDMA request (for example, a Read request or a Write request, etc.) constructed based on an RDMA unilateral primitive. Since the first RDMA request and the second RDMA request only change in expression form, the essential content is similar, so the second RDMA request can also be used to request processing of target data in a target memory region.
[0073] Specifically, the first RDMA request can be presented in the following way:
[0074] The second RDMA request can include the identification of the target memory region, the identification of the target data in the target memory region, and the identification of the target operation on the target data, etc. These information are all presented in the form of an RDMA unilateral primitive, so the second RDMA request can be used to request the target operation on the target data in the target memory region. It is worth noting that although the second RDMA request is constructed based on an RDMA unilateral primitive, it is a request generated internally by the server device, so the second RDMA request does not include the rkey of the target memory region.
[0075] Still as in the above example, after the RDMA network card of the server device receives the Send request, since the Send request is used to request a read operation on the target data in the target MR, the Send request generated using the RDMA bilateral primitive can be converted into a Read request generated using the RDMA unilateral primitive, and the Read request is used to request a read operation on the target data in the target MR.
[0076] Specifically, the RDMA network card of the server device can obtain the second RDMA request in the following way:
[0077] After the server device and the client device establish a connection, the processor of the server device can create a plurality of work queues (WQs) constructed based on an RDMA unilateral primitive at the RDMA network card of the server device. For ease of description, the plurality of work queues are referred to as a plurality of unilateral work queues in the following. In the plurality of unilateral work queues, each unilateral work queue includes a plurality of RDMA requests used to indicate an operation, and the plurality of RDMA requests included in each work queue are constructed based on an RDMA unilateral primitive. As can be seen, the plurality of unilateral work queues correspond to a plurality of operations one by one.
[0078] Since the first RDMA request is used to request the target operation on the target data in the target memory region, the RDMA network card of the server device can determine, in the multiple single-side work queues, a target single-side work queue corresponding to the target operation (the target single-side work queue is the aforementioned target work queue, and the target single-side work queue contains multiple RDMA requests used to indicate the target operation). Then, the RDMA network card of the server device can obtain, from the target single-side work queue, a first RDMA request of the target single-side work queue. Then, the RDMA network card of the server device can parse the first RDMA request, so as to obtain the identifier of the target memory region and the identifier of the target data in the form of the RDMA bilateral primitive, and convert the identifiers into the identifiers of the target memory region and the target data in the form of the RDMA unilateral primitive. Since the first RDMA request of the target single-side work queue already contains the identifier of the target operation in the form of the RDMA unilateral primitive, the RDMA network card of the server device can add the identifiers of the target memory region and the target data in the form of the RDMA unilateral primitive to the first RDMA request of the target single-side work queue, so as to obtain a second RDMA request.
[0079] More specifically, the processor of the server device can cause the RDMA network card of the server device to create the multiple single-side work queues in the following manner:
[0080] When the client device initiates multiple communication connections to the server device, the client device needs to inform the server device of the type of each communication connection, so as to establish multiple communication channels of different types between the client device and the server device. For example, when the processor of the client device performs a certain communication connection with the processor of the server device, the processor of the client device can send a connection request to the processor of the server device to inform the processor of the server device that the type of the communication connection is a read operation (or a write operation), so that the processor of the server device can cause the RDMA network card of the server device to complete the communication connection with the RDMA network card of the client device based on the connection request. After the communication connection succeeds, the communication channel established between the RDMA network card of the client device and the RDMA network card of the server device corresponds to the read operation (that is, the communication channel can be used to transmit RDMA requests used to indicate the read operation (or the write operation) exclusively). As can be seen, the multiple communication channels established between the client device and the server device correspond to the multiple operations one by one, that is, in the multiple communication channels, each communication channel can be used to transmit RDMA requests used to indicate a certain operation exclusively.
[0081] When the plurality of communication channels are established between the RDMA network card of the client device and the RDMA network card of the server device, the RDMA network card of the server device creates a plurality of bilateral work queues, the plurality of bilateral work queues are in one-to-one correspondence with the plurality of communication channels, and each bilateral work queue is used to receive the RDMA request from the client device transmitted by the corresponding communication channel.
[0082] After the plurality of communication channels are established between the RDMA network card of the client device and the RDMA network card of the server device, the processor of the server device can offload the computing logic to the RDMA network card of the server device, that is, the processor of the server device can send an offloading request to the RDMA network card of the server device, and the offloading request is used to indicate a plurality of unilateral work queues corresponding to the plurality of communication channels. Then, the RDMA network card of the server device can create the plurality of unilateral work queues based on the offloading request, and correspond the plurality of unilateral work queues to the plurality of bilateral work queues. In this way, for any one of the plurality of communication channels, the RDMA network card of the server device has one bilateral work queue corresponding to the communication channel, and one unilateral work queue corresponding to the bilateral work queue.
[0083] Still as the above example, as shown in FIG. 6 (FIG. 6 is another structure schematic diagram of a data processing system provided by an embodiment of the present application, and FIG. 6 is obtained based on FIG. 5), when the client device needs to establish a communication connection with the server device, the RDMA communication library of the client device can send a connection request to the RDMA communication library of the server device to declare the type of the communication connection to the RDMA communication library of the server device, such as a read operation or a write operation. Then, the RDMA communication library of the server device can make the RDMA network card of the server device and the RDMA network card of the client device establish communication channel 1 and communication channel 2 in sequence based on the connection request, where the communication channel 1 is used to transmit the RDMA request indicating the read operation, and the communication channel 2 is used to transmit the RDMA request indicating the write operation.
[0084] When the RDMA network card of the server device establishes the communication channel 1 and the communication channel 2 with the RDMA network card of the client device, the RDMA network card of the server device can create a bilateral work queue 1 corresponding to the communication channel 1 and a bilateral work queue 2 corresponding to the communication channel 2, where the bilateral work queue 1 is used to receive the RDMA request transmitted by the communication channel 1, and the bilateral work queue 2 is used to transmit the RDMA request transmitted by the communication channel 2.
[0085] After the RDMA network interface card of the server device successfully establishes the communication channel 1 and the communication channel 2 with the RDMA network interface card of the client device, the RDMA communication library of the server device can send an offloading request to the RDMA network interface card of the server device, so that the RDMA network interface card of the server device generates the unilateral work queue 1 corresponding to the bilateral work queue 1 and the unilateral work queue 2 corresponding to the bilateral work queue 2 based on the offloading request, wherein the unilateral work queue 1 contains a plurality of initial Read requests generated by using the RDMA unilateral primitive (each initial Read request contains the identification of the read operation presented in the form of the RDMA unilateral primitive), and the unilateral work queue 2 contains a plurality of initial Write requests generated by using the RDMA unilateral primitive (each initial Write request contains the identification of the write operation presented in the form of the RDMA unilateral primitive).
[0086] More specifically, on the basis of the above communication channel, bilateral work queue and unilateral work queue, the RDMA network interface card of the server device can also obtain the second RDMA request by the following way:
[0087] After the RDMA network interface card of the server device receives the first RDMA request from the client device, the RDMA network interface card of the server device can determine through which communication channel the first RDMA request is received. For example, since the first RDMA request is used to request the target operation on the target data in the target memory region, the network interface card of the client device can send the first RDMA request to the RDMA network interface card of the server device through the target communication channel (the target communication channel can be used to transmit the RDMA request indicating the target operation). After the first RDMA request reaches the RDMA network interface card of the server device, the first RDMA request will be received by the target bilateral work queue corresponding to the target communication channel, and the target unilateral work queue corresponding to the target bilateral work queue will be directly triggered. After the RDMA network interface card of the server device detects the triggering operation, the first RDMA request in the target unilateral work queue can be obtained from the target work queue, and the first RDMA request and the first RDMA request in the target unilateral work queue are processed, so as to obtain the second RDMA request.
[0088] Still as the above example, if the RDMA NIC of the server device receives the Send request sent by the client device through the communication channel 1, the Send request will be received by the bilateral work queue 1 and trigger the unilateral work queue 1. After detecting the trigger, the RDMA NIC of the server device can obtain the first initial Read request from the unilateral work queue 1. Then, the server device can parse the Send request to obtain the identifier of the target MR and the identifier of the target data presented in the form of the RDMA bilateral primitive, and convert them into the identifier of the target MR and the identifier of the target data presented in the form of the RDMA unilateral primitive. Since the first initial Read request already contains the identifier of the read operation presented in the form of the RDMA unilateral primitive, the RDMA NIC of the server device can add the identifier of the target MR and the identifier of the target data presented in the form of the RDMA unilateral primitive to the first initial Read request, thereby obtaining the final Read request.
[0089] 403、The RDMA NIC processes the target data in the target memory region based on the second RDMA request to obtain a data processing result, and returns the data processing result to the client device.
[0090] After obtaining the second RDMA request, since the second RDMA request is constructed based on the RDMA unilateral primitive and is used to request processing of the target data in the target memory region, the RDMA NIC of the server device can directly find the target memory region in the memory of the server device based on the second RDMA request, and process the target data in the target memory region, thereby obtaining the data processing result of the target data. Finally, the RDMA NIC of the server device can return the data processing result to the client device for use by the client device.
[0091] Specifically, the RDMA NIC of the server device can process the target data in the following manner:
[0092] Since the second RDMA request is used to request the target operation on the target data in the target memory region, the RDMA NIC of the server device can perform the target operation on the target data in the target memory region according to the indication of the second RDMA request, thereby obtaining the data processing result. For example, if the second RDMA request is used to request the read operation on the target data in the target memory region, the RDMA NIC of the server device performs the read operation on the target data in the target memory region. For another example, if the second RDMA request is used to request the write operation on the target data in the target memory region, the RDMA NIC of the server device performs the write operation on the target data in the target memory region.
[0093] Still as the above example, after obtaining the final Read request, the RDMA network card of the server device can find the target MR in the memory of the server device based on the final Read request, read the target data, so as to obtain the data processing result, and return the data processing result to the client device.
[0094] Further, the processor of the server device can also deploy the multiplexing logic at the RDMA network card of the server device, which is specifically as follows:
[0095] The RDMA network card of the server device receives the multiplexing request from the processor of the server device, and the multiplexing request can be understood as that the processor of the server device enables the RDMA network card of the server device to have the multiplexing function of the RDMA request. Since the RDMA network card of the server device has the multiplexing function of the RDMA request, after the RDMA network card of the server device uses the first RDMA request in the target work queue, the first RDMA request in the target work queue will not be consumed, but still remain in the target work queue and be used as the last RDMA request in the target work queue for subsequent use by the RDMA network card of the server device.
[0096] Specifically, the RDMA network card of the server device can multiplex the RDMA request in the following manner:
[0097] Each RDMA request in the target work queue has a dedicated identifier (metadata), and the initial value of the identifier of the RDMA request is a first value, which is used to represent that the RDMA request is not used (i.e., the RDMA request is available). Since the RDMA network card of the server device has the multiplexing function of the RDMA request, when the RDMA network card of the server device uses the first RDMA request in the target work queue, the RDMA network card of the server device can set the identifier of the first RDMA request from the first value to a second value in the target work queue, and the second value is used to indicate that the RDMA request has been used (i.e., the RDMA request is not available). After the RDMA network card of the server device uses the first RDMA request, the RDMA network card of the server device can reset the identifier of the first RDMA request from the second value to the first value in the target work queue, and use the first RDMA request as the last RDMA request in the target work queue.
[0098] In addition, the communication manner (such as offload in the subsequent figures) provided by the embodiments of the present application and the communication manner (such as native in the subsequent figures) provided by the related art can also be compared in some performance indicators, and the comparison results are shown in FIG. 7 and FIG. 8 (FIG. 7 is a schematic diagram of the comparison results provided by the embodiments of the present application, and FIG. 8 is another schematic diagram of the comparison results provided by the embodiments of the present application).
[0099] Based on FIG. 7 and FIG. 8, when the input / output (IO) request size is 32KB, the embodiment of the present application brings a performance overhead of 9.7% on average latency (AVG) and a performance overhead of 11.9% on P99 tail latency compared with the related art. When the IO request size is 2MB, the performance overhead of the embodiment of the present application on average latency and P99 tail latency is less than 1% compared with the related art.
[0100] Further, the communication manner provided by the embodiment of the present application can also be compared with the communication manner provided by the related art on other performance indicators, and the comparison result is shown in FIG. 9 (FIG. 9 is another schematic diagram of the comparison result provided by the embodiment of the present application).
[0101] Based on FIG. 9, the bandwidth of reading remote memory when different numbers of concurrent threads and different IO depths (the number of requests in a pending state at the same time) are known. When the IO depth is 10 and the number of threads is 12, the embodiment of the present application only brings a decrease of 2.0% in bandwidth compared with the related art. When the IO depth is 10 and the number of threads is 24, the embodiment of the present application only brings a decrease of 3.3% in bandwidth compared with the related art.
[0102] Further, the communication manner provided by the embodiment of the present application can also be compared with the communication manner provided by the related art on other performance indicators, and the comparison result is shown in FIG. 10 and FIG. 11 (FIG. 10 is another schematic diagram of the comparison result provided by the embodiment of the present application, and FIG. 11 is another schematic diagram of the comparison result provided by the embodiment of the present application).
[0103] Based on FIG. 10 and FIG. 11, in a distributed key-value pair storage (KVS, Key-Value Store), when different value sizes and different numbers of threads are known, the latency and throughput of put operation of a client device using the embodiment of the present application and the related art are respectively. When the value size is 32KB and the number of threads is 24, the performance overhead of the embodiment of the present application on the latency of put operation is only 2.5%, and the overhead on the throughput is only 2.4%. When the value size is 64KB and the number of threads is 24, the performance overhead of the embodiment of the present application on the latency of put operation is only 1.8%, and the overhead on the throughput is only 2.2%.
[0104] In the embodiment of the present application, when the client device needs to process target data, the RDMA double-sided primitive can be used to construct a first RDMA request and send the first RDMA request to the server device, and the first RDMA request is used to request processing of the target data in a target memory region of the memory of the server device. After the RDMA network card of the server device receives the first RDMA request, the first RDMA request can be converted to obtain a second RDMA request constructed based on the RDMA single-sided primitive, and the second RDMA request is used to request processing of the target data in the target memory region. Then, the RDMA network card of the server device processes the target data in the target memory region based on the second RDMA request, thereby obtaining a data processing result, and returns the data processing result to the client device. In the foregoing process, since the first RDMA request constructed based on the RDMA double-sided primitive is transmitted between the client device and the server device, the first RDMA request does not carry the rkey of the target memory region specific to the client device. Moreover, after the client device and the server device establish a communication connection, a communication channel for transmitting the RDMA request is established between the two devices, so that once the RDMA network card of the server device receives the first RDMA request through the communication channel, the RDMA network card of the server device can directly determine that the first RDMA request comes from the client device, and then allow the client device to access the target memory region. Therefore, the RDMA network card of the server device can convert the first RDMA request into the second RDMA request constructed based on the RDMA single-sided primitive, and process the target data in the target memory region according to the indication of the second RDMA request. As can be seen, since the RDMA request constructed based on the RDMA double-sided primitive is transmitted between the client device and the server device, the rkey is not carried, so that the server device does not need to provide the rkey to the client device when the connection is established. Therefore, the attacker cannot obtain any rkey information related to the client device, and can only randomly guess the rkey of the client device. When the attacker sends the RDMA request constructed based on the single-sided primitive by impersonating the client device, the RDMA request will be rejected because the rkey is incorrect, so that the attacker cannot intrude into the server device, cannot steal data, and thus the data security is ensured.
[0105] Further, in the embodiment of the present application, in order to prevent the server device from being attacked, it is only necessary to improve the function of the RDMA network card of the server device, without adding additional hardware or configuring additional intelligent network devices in the server device, so that the deployment can be realized at a low hardware cost.
[0106] Further, in the embodiments of the present application, in order to prevent the server device from being attacked by an attacker, a new communication mode is provided, and in the process of processing the RDMA request from the client device and completing the data processing, the processor does not need to participate, and the performance overhead of the processor is saved.
[0107] Further, in the embodiments of the present application, the RDMA request in the unilateral work queue is used by the RDMA network card of the server device in real time, and can also be reused by the RDMA network card of the server device, and this process does not need the processor of the server device to participate, and the performance consumption of the processor of the server device can be saved.
[0108] The above is a detailed description of the RDMA-based data processing method provided by the embodiments of the present application, and the RDMA network card and the server device provided by the embodiments of the present application will be introduced below. FIG. 12 is a structural schematic diagram of an RDMA network card provided by an embodiment of the present application, as shown in FIG. 12, the RDMA network card is arranged in a server device, and the server device further includes a memory. The RDMA network card includes:
[0109] The receiving module 1201 is configured to receive a first RDMA request from a client device, the first RDMA request is constructed based on an RDMA bilateral primitive, and the first RDMA request is used to request processing of target data in a target memory region of the memory; for example, the receiving module 1201 can be used to implement the step 401 of the embodiment shown in FIG. 4.
[0110] The processing module 1202 is configured to convert the first RDMA request to obtain a second RDMA request, the second RDMA request is constructed based on an RDMA unilateral primitive, and the second RDMA request is used to request processing of the target data in the target memory region; for example, the processing module 1202 can be used to implement the step 402 of the embodiment shown in FIG. 4.
[0111] The processing module 1202 is further configured to process the target data in the target memory region based on the second RDMA request to obtain a data processing result; for example, the processing module 1202 can be used to implement the step 403 of the embodiment shown in FIG. 4.
[0112] The sending module 1203 is configured to return the data processing result to the client device. For example, the sending module 1203 can be used to implement the step 403 of the embodiment shown in FIG. 4.
[0113] In the embodiment of the present application, when the client device needs to process the target data, the RDMA double-sided primitive can be used to construct the first RDMA request and send the first RDMA request to the server device, and the first RDMA request is used to request processing of the target data in the target memory region of the memory of the server device. After the RDMA network card of the server device receives the first RDMA request, the first RDMA request can be converted to obtain the second RDMA request constructed based on the RDMA single-sided primitive, and the second RDMA request is used to request processing of the target data in the target memory region. Then, the RDMA network card of the server device processes the target data in the target memory region based on the second RDMA request, to obtain a data processing result, and returns the data processing result to the client device. In the foregoing process, since the first RDMA request constructed based on the RDMA double-sided primitive is transmitted between the client device and the server device, the first RDMA request does not carry the rkey of the target memory region specific to the client device. Moreover, after the client device and the server device establish a communication connection, a communication channel for transmitting the RDMA request is established between the client device and the server device, so that the RDMA network card of the server device can directly determine that the first RDMA request comes from the client device as soon as the first RDMA request is received through the communication channel, and then the client device is allowed to access the target memory region. Therefore, the RDMA network card of the server device can convert the first RDMA request into the second RDMA request constructed based on the RDMA single-sided primitive, and process the target data in the target memory region according to the indication of the second RDMA request. As can be seen, since the RDMA request constructed based on the RDMA double-sided primitive is transmitted between the client device and the server device, the rkey is not carried, so the server device does not need to provide the rkey to the client device when the connection is established. Therefore, the attacker cannot obtain any rkey information related to the client device, and can only randomly guess the rkey of the client device. When the attacker sends the RDMA request constructed based on the single-sided primitive by impersonating the client device, the RDMA request will be rejected because the rkey is incorrect, so that the attacker cannot intrude into the server device, and cannot steal data, thereby ensuring data security.
[0114] In a possible implementation manner, the RDMA network card comprises a plurality of work queues, each work queue comprises a plurality of RDMA requests for indicating an operation, and the plurality of RDMA requests comprised in each work queue are constructed based on the RDMA single-sided primitive. The first RDMA request is used to request a target operation on the target data in the target memory region. The processing module 1202 is configured to generate a second RDMA request based on the first RDMA request and a first RDMA request in a target work queue. The plurality of work queues comprise the target work queue, and the target work queue comprises a plurality of RDMA requests for indicating the target operation.
[0115] In a possible implementation, the server device further includes a processor, and the receiving module 1201 is further configured to receive an offloading request from the processor after the processor instructs the RDMA network card to establish the plurality of communication channels with the client device, each of the plurality of communication channels being capable of transmitting an RDMA request used to indicate an operation, and the offloading request being used to indicate a plurality of work queues corresponding to the plurality of communication channels in one-to-one manner; and the processing module 1202 is further configured to create the plurality of work queues based on the offloading request.
[0116] In a possible implementation, the processing module 1202 is configured to, if the RDMA network card receives a first RDMA request through a target communication channel, generate a second RDMA request based on the first RDMA request and a first RDMA request in a target work queue, and the target communication channel is capable of transmitting an RDMA request used to indicate a target operation.
[0117] In a possible implementation, the receiving module 1201 is further configured to receive a multiplexing request from the processor; and the processing module 1202 is further configured to, after the RDMA network card uses the first RDMA request in the target work queue, instruct the first RDMA request in the target work queue to be the last RDMA request in the target work queue based on the multiplexing request.
[0118] In a possible implementation, the processing module 1202 is configured to, when the RDMA network card uses the first RDMA request in the target work queue, set an identifier of the first RDMA request from a first value to a second value in the target work queue, the first value being used to indicate that the RDMA request is not used, and the second value being used to indicate that the RDMA request is used. After the RDMA network card uses the first RDMA request, set the identifier of the first RDMA request from the second value to the first value in the target work queue, and instruct the first RDMA request to be the last RDMA request in the target work queue.
[0119] In a possible implementation, the processing module 1202 is configured to perform a target operation on target data in a target memory region based on the second RDMA request, to obtain a data processing result, and the target operation includes any one of the following: a read operation and a write operation.
[0120] It should be noted that the information interaction and implementation process between the modules / units of the apparatus are based on the same consideration as the method embodiments of the present application, and the technical effects brought by the same are the same as those of the method embodiments of the present application. For details, refer to the description in the method embodiments of the present application.
[0121] FIG. 13 is a structural schematic diagram of a server device provided in an embodiment of the present application. As shown in FIG. 13, the server device 1300 includes a processor 1301, a memory 1302, an RDMA network card 1303, a bus 1304 and a memory 1305. The processor 1301, the memory 1302, the RDMA network card 1303 and the memory 1305 communicate through the bus 1304, and can also communicate through wireless transmission or other means. The processor 1301 is configured to run an application and an RDMA communication library. For the application and the RDMA communication, refer to the related description in the foregoing embodiment shown in FIG. 3, which will not be repeated here.
[0122] The RDMA network card 1303 includes a processor 1306 and a memory 1307 and a communication interface 1308. The processor 1306 is configured to execute computer-executed instructions stored in the memory to implement the following operation steps.
[0123] receiving a first RDMA request from a client device, the first RDMA request being constructed based on an RDMA bilateral primitive, and the first RDMA request being configured to request processing of target data in a target memory region of the memory;
[0124] converting the first RDMA request to obtain a second RDMA request, the second RDMA request being constructed based on an RDMA unilateral primitive, and the second RDMA request being configured to request processing of the target data in the target memory region;
[0125] processing the target data in the target memory region based on the second RDMA request to obtain a data processing result, and returning the data processing result to the client device.
[0126] It should be understood that, in the embodiments of the present application, the processor 1301 or the processor 1306 can be a CPU, and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor or the like.
[0127] The memory 1302 or the memory 1307 can include read-only memory and random access memory, and provide instructions and data for the processor. The memory 1302 or the memory 1307 can also include non-volatile random access memory. For example, the memory 1302 or the memory 1307 can also store device type information.
[0128] The memory 1302 or the memory 1307 can be volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. The nonvolatile memory can be read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), electrically EPROM (EEPROM), or flash memory, for example. The volatile memory can be random access memory (RAM), which is used as external cache. By way of example, and not limitation, many forms of RAM are available, for example, static RAM (SRAM), dynamic RAM (DRAM), synchronous dynamic RAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and direct rambus RAM (DR RAM). The memory 1302 or the memory 1307 can also be any second level cache, any flash memory, any database, any disk, any optical memory, any semiconductor memory, or any other medium that can be used to store desired program code in the memory 1302 or the memory 1307 and that can be accessed by the processor 1301.
[0129] The bus 1304 can include a power bus, a control bus, and a status signal bus, among others. For the sake of clarity, the various buses are illustrated in Figure 13 as the bus 1304. The bus 1304 can also include a network connection, such as an Ethernet connection, an optical connection, a Bluetooth connection, a Wi-Fi connection, a WiMax connection, or other types of connections for connecting to a wired or wireless network.
[0130] It should be understood that the server device 1300 according to the embodiments of the present application can correspond to the server device shown in Figure 12, and can correspond to a server device that executes the method shown in Figure 4 according to the embodiments of the present application, and in addition, the device can also be any device in the system shown in Figure 1, and the above and other operations and / or functions of each module in the server device 1300 are respectively used to implement the corresponding flow of each method in the figure, and for the sake of brevity, will not be repeated here.
[0131] The embodiments of the present application also provide a computer storage medium, which stores one or more instructions, and the instructions, when executed by one or more computers, cause the one or more computers to implement the method steps of the embodiments shown in Figure 4.
[0132] The embodiment of the present application further provides a computer program product, which stores instructions, and the instructions make the computer implement the method steps of the embodiment shown in FIG. 4 when the computer executes the instructions.
[0133] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described system, device and unit can refer to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0134] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other manners. For example, the described device embodiments are merely schematic, and the division of the units is merely a logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or units, and can be electrical, mechanical or in other forms.
[0135] The units described as separated components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments.
[0136] In addition, each functional unit in the embodiments of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be implemented in the form of hardware, or in the form of software functional units.
[0137] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, read-only memory), a random access memory (RAM, random access memory), a magnetic disk or an optical disk, and various media that can store program codes.
Claims
1. A method of data processing based on Remote Direct Memory Access (RDMA), characterized in that, The method is applied to a server device, the server device comprises a memory and an RDMA network card, and the method comprises the following steps: The RDMA network card receives a first RDMA request from a client device, the first RDMA request is constructed based on an RDMA bilateral primitive, and the first RDMA request is used to request the server device to process target data in a target memory region of the memory; The RDMA network card converts the first RDMA request to obtain a second RDMA request, the second RDMA request is constructed based on an RDMA unilateral primitive, and the second RDMA request is used to request the server device to process the target data in the target memory region; The RDMA network card processes the target data in the target memory region based on the second RDMA request to obtain a data processing result, and returns the data processing result to the client device.
2. The method of claim 1, wherein, The RDMA network card comprises a plurality of work queues, each work queue comprises a plurality of RDMA requests used to indicate an operation, the plurality of RDMA requests comprised in each work queue are constructed based on an RDMA unilateral primitive, the first RDMA request is used to request a target operation on the target data in the target memory region, and the conversion of the RDMA network card on the first RDMA request to obtain a second RDMA request comprises the following steps: The RDMA network card generates a second RDMA request based on the first RDMA request and a first RDMA request in a target work queue, the plurality of work queues comprise the target work queue, and the target work queue comprises a plurality of RDMA requests used to indicate the target operation.
3. The method of claim 2, wherein, The server device further comprises a processor, and the method further comprises the following steps: After the processor instructs the RDMA network card to establish a plurality of communication channels with the client device, the RDMA network card receives an offloading request from the processor, each communication channel in the plurality of communication channels can transmit an RDMA request used to indicate an operation, and the offloading request is used to indicate a plurality of work queues corresponding to the plurality of communication channels one by one; The RDMA network card creates the plurality of work queues based on the offloading request.
4. The method of claim 3, wherein, The generation of the second RDMA request by the RDMA network card based on the first RDMA request and the first RDMA request in the target work queue comprises the following steps: If the RDMA network card receives the first RDMA request through a target communication channel, the RDMA network card generates a second RDMA request based on the first RDMA request and the first RDMA request in the target work queue, and the target communication channel can transmit an RDMA request used to indicate the target operation.
5. The method according to any one of claims 2 to 4, characterized in that, The method further comprises the following steps: The RDMA network card receives a multiplexing request from the processor; After the RDMA network card uses the first RDMA request in the target work queue, the RDMA network card instructs the first RDMA request in the target work queue to be the last RDMA request in the target work queue based on the multiplexing request.
6. The method of claim 5, wherein, The RDMA network card, after using the first RDMA request in the target work queue, makes the first RDMA request in the target work queue as the last RDMA request in the target work queue based on the multiplexing request. When the RDMA network card uses the first RDMA request in the target work queue, the RDMA network card sets the identifier of the first RDMA request from a first value to a second value in the target work queue, the first value being used to indicate that an RDMA request is not used, and the second value being used to indicate that an RDMA request is used. After the RDMA network card uses the first RDMA request, the RDMA network card sets the identifier of the first RDMA request from the second value to the first value in the target work queue, and makes the first RDMA request as the last RDMA request in the target work queue.
7. The method according to any one of claims 1 to 6, characterized in that, The RDMA network card processes the target data in the target memory area based on the second RDMA request to obtain a data processing result. The RDMA network card performs a target operation on the target data in the target memory area based on the second RDMA request to obtain a data processing result, the target operation including any one of the following: a read operation and a write operation.
8. An RDMA network card, comprising: The RDMA network card is arranged in a server device, and the server device further includes a memory. The receiving module is configured to receive a first RDMA request from a client device, the first RDMA request being constructed based on an RDMA two-sided primitive, and the first RDMA request being used to request the server device to process target data in a target memory area of the memory. The processing module is configured to convert the first RDMA request to obtain a second RDMA request, the second RDMA request being constructed based on an RDMA The processing module is further configured to process the target data in the target memory area based on the second RDMA request to obtain a data processing result. The sending module is configured to return the data processing result to the client device. The RDMA network card includes a plurality of work queues, each work queue including a plurality of RDMA requests used to indicate an operation, the plurality of RDMA requests included in each work queue being constructed based on an RDMA one-sided primitive, the first RDMA request being used to request a target operation on the target data in the target memory area, and the processing module being configured to generate a second RDMA request based on the first RDMA request and a first RDMA request in a target work queue, the plurality of work queues including the target work queue, and the target work queue including a plurality of RDMA requests used to indicate the target operation.
9. The RDMA network card of claim 8, wherein, 10. The RDMA network card of claim 9, wherein, The server device further includes a processor, and the receiving module is further configured to receive an offloading request from the processor after the processor causes the RDMA network card to establish a plurality of communication channels with the client device, each of the plurality of communication channels being capable of transmitting an RDMA request indicating an operation, and the offloading request indicating a plurality of work queues corresponding to the plurality of communication channels one by one. The processing module is further configured to create the plurality of work queues based on the offloading request.
11. The RDMA network card of claim 10, wherein, The processing module is configured to, if the RDMA network card receives the first RDMA request through a target communication channel, generate a second RDMA request based on the first RDMA request and a first RDMA request in the target work queue, and the target communication channel being capable of transmitting an RDMA request indicating the target operation.
12. The RDMA network card of any of claims 9 to 11, wherein, The receiving module is further configured to receive a multiplexing request from the processor. The processing module is further configured to, after the RDMA network card uses the first RDMA request in the target work queue, cause the first RDMA request in the target work queue to be the last RDMA request in the target work queue based on the multiplexing request.
13. The RDMA network card of claim 12, wherein, The processing module is configured to: when the RDMA network card uses the first RDMA request in the target work queue, set an identifier of the first RDMA request from a first value to a second value in the target work queue, the first value indicating that an RDMA request is not used, and the second value indicating that an RDMA request is used; and after the RDMA network card uses the first RDMA request, set the identifier of the first RDMA request from the second value to the first value in the target work queue, and cause the first RDMA request to be the last RDMA request in the target work queue.
14. The RDMA network card of any of claims 8 to 13, wherein, The processing module is configured to perform a target operation on the target data in the target memory region based on the second RDMA request to obtain a data processing result, the target operation including any one of the following: a read operation and a write operation.
15. An apparatus, comprising: The device serves as a server device, and the server device includes a processor, a memory, and an RDMA network card, the RDMA network card is in communication connection with the processor, the RDMA network card is in communication connection with the memory, and the RDMA network card is configured to perform the method according to any one of claims 1 to 7 on the memory based on an instruction from the processor.
16. A computer storage medium, comprising, The computer storage medium stores one or more instructions, which, when executed by one or more computers, cause the one or more computers to implement the method according to any one of claims 1 to 7.
17. A computer program product, characterised in that, The computer program product stores instructions, which, when executed by a computer, cause the computer to implement the method according to any one of claims 1 to 7.