Memory scheduling method, device, electronic device and readable storage medium

By using a pre-registered first alternate memory queue in the RDMA system on the receiving side, the problem of high latency and business lag caused by insufficient RDMA memory is solved, and the stability of memory application is improved.

CN119759571APending Publication Date: 2025-04-04INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411875633.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

In the case of insufficient pre-registered RDMA memory, new RDMA memory needs to be temporarily registered, resulting in high delay of RDMA requests and causing business stuttering or suspension.

Method used

On the receiving end, by obtaining the queue information of the first registered memory queue, if the RDMA operation requirements are not met, the adapted target memory is applied from the pre-registered first spare memory queue, perform RDMA operations, and feedback the result to the sending end.

Benefits of technology

It avoids the problem of high request delay caused by temporary memory registration, improves the stability of memory applications, especially when traffic bursts, improves the stability of memory applications, and solves the problem of business lag or suspension.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119759571A_ABST
    Figure CN119759571A_ABST
Patent Text Reader

Abstract

The present application discloses a memory scheduling method, device, electronic device and readable storage medium, which are applied in the field of computer technology. The method includes: in response to a remote direct memory access request sent by a sending end, obtaining the data length of the operation data corresponding to the remote direct memory access request, obtaining the queue information of the first registered memory queue pre-registered for the sending end in the receiving end, if it is determined according to the queue information that the first registered memory queue does not meet the remote direct memory access operation requirements, then applying for a first target memory adapted to the data length from the first spare memory queue pre-registered in the receiving end, performing a remote direct memory access operation based on the first target memory, and feeding back the access operation result of the remote direct memory access operation to the sending end. This method can avoid the problem of high request latency caused by insufficient registered memory and the need to temporarily register new memory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer technology, and specifically relates to a memory scheduling method, device, electronic device and readable storage medium. Background Art

[0002] Based on Remote Direct Memory Access (RDMA) technology, the sender can directly obtain data from the RDMA registered memory of the receiver, or send data directly to the RDMA registered memory of the receiver.

[0003] In the related art, a DMRA memory is pre-registered at the receiving end, and an RDMA operation is performed based on the pre-registered RDMA memory.

[0004] However, when performing RDMA operations based on the related art methods, if the pre-registered DMRA memory is insufficient, new RDMA memory needs to be temporarily registered, which will cause high latency of RDMA requests and cause business freezes or suspensions. Summary of the invention

[0005] The present application aims to provide a memory scheduling method, device, electronic device and readable storage medium, which at least solves the problem in the prior art that when the pre-registered DMRA memory is insufficient, new RDMA memory needs to be temporarily registered, which leads to high request latency and service freeze or suspension.

[0006] In a first aspect, an embodiment of the present application discloses a memory scheduling method, which is applied to a receiving end, comprising:

[0007] In response to a remote direct memory access request sent by a sending end, acquiring a data length of operation data corresponding to the remote direct memory access request;

[0008] Acquire queue information of a first registered memory queue in the receiving end; the first registered memory queue is a queue of memory blocks pre-registered for the sending end;

[0009] If it is determined according to the queue information that the first registered memory queue does not meet the remote direct memory access operation requirement, then applying for a first target memory adapted to the data length from a first standby memory queue; the first standby memory queue is a queue of memory blocks pre-registered in the receiving end;

[0010] The remote direct memory access operation is performed based on the first target memory, and an access operation result of the remote direct memory access operation is fed back to the sending end.

[0011] In a second aspect, an embodiment of the present application further discloses a memory scheduling device, which is applied to a receiving end, and the device includes:

[0012] A first acquisition module, configured to, in response to a remote direct memory access request sent by a sending end, acquire a data length of operation data corresponding to the remote direct memory access request;

[0013] A second acquisition module is used to acquire queue information of a first registered memory queue in the receiving end; the first registered memory queue is a queue of memory blocks pre-registered for the sending end;

[0014] A first application module is used to apply for a first target memory adapted to the data length from a first standby memory queue if it is determined according to the queue information that the first registered memory queue does not meet the remote direct memory access operation requirement; the first standby memory queue is a queue of memory blocks pre-registered in the receiving end;

[0015] The first execution module is used to execute the remote direct memory access operation based on the first target memory, and feed back the access operation result of the remote direct memory access operation to the sending end.

[0016] In a third aspect, an embodiment of the present application further discloses an electronic device, including:

[0017] Memory, used to store computer programs;

[0018] A processor is used to execute the computer program to implement the steps in the memory scheduling method as described in the first aspect.

[0019] In a fourth aspect, an embodiment of the present application further discloses a computer-readable storage medium for storing a computer program; wherein when the computer program is executed by a processor, the steps in the memory scheduling method described in the first aspect are implemented.

[0020] In an embodiment of the present application, when the first registered memory does not meet the preset RDMA operation conditions, the first target memory is applied for from the pre-registered first backup memory. Based on the method of this embodiment, when a traffic burst occurs in the RDMA connection between the transmitter and the receiver, resulting in insufficient first registered memory, there is no need to temporarily register the memory, but instead apply for the first target memory for RDMA operation from the pre-applied first backup memory. Thus, the problem of high request latency caused by temporary registration of memory is avoided, and the stability of memory application is improved, especially the stability of memory application during traffic bursts. This embodiment solves the problem in the related art that a new RDMA memory needs to be temporarily registered, resulting in high request latency, which may cause service freezes or suspensions.

[0021] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for describing the embodiments are briefly introduced below.

[0023] Figure 1 It is a flowchart of the steps of a memory scheduling method provided by an embodiment of the present application;

[0024] Figure 2 is a schematic diagram of a memory scheduling system provided in an embodiment of the present application;

[0025] Figure 3 It is a flowchart of the steps of a memory scheduling method provided by an embodiment of the present application;

[0026] Figure 4 It is a flowchart of the steps of a memory scheduling method provided by an embodiment of the present application;

[0027] Figure 5 It is a flow chart of the interactive steps of a memory scheduling method provided in an embodiment of the present application;

[0028] Figure 6 A flowchart of a memory scheduling method for a read request provided by an embodiment of the present application;

[0029] Figure 7 A flowchart of a memory scheduling method for write requests provided in an embodiment of the present application;

[0030] Figure 8 is a block diagram of a memory scheduling device provided in an embodiment of the present application;

[0031] Fig. 9 is a block diagram of a memory scheduling device provided in an embodiment of the present application;

[0032] Fig.10 It is a block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0034] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0035] Some nouns or terms appearing in this application are subject to the following interpretations:

[0036] Remote Direct Memory Access (RDMA) is a technology that allows devices to access memory from one device to another. Based on RDMA technology, when sending data, there is no need to copy the data from user-mode memory to kernel buffer memory. Instead, the data to be sent can be directly copied to the registered memory, and then the corresponding driver interface is called according to the specific business to send the data.

[0037] Transmission Control Protocol (TCP) is a connection-oriented, byte stream-based transport layer communication protocol.

[0038] The memory scheduling method provided in the embodiment of the present application is described in detail below through specific embodiments in conjunction with the accompanying drawings.

[0039] Figure 1 is a flowchart of a memory scheduling method provided by an embodiment of the present application, and the method is applied to a receiving end, such as Figure 1 As shown, the method may include the following steps:

[0040] Step 101, in response to a remote direct memory access request sent by a sending end, obtain the data length of operation data corresponding to the remote direct memory access request.

[0041] For example, the RDMA request may be a read request for performing a read operation on the receiving end, or a write request for performing a write operation on the receiving end. In the case where the RDMA request is a read request, the operation corresponding to the remote direct memory access request is the data to be read from the receiving end, and the data length is the length of the data to be read from the receiving end. In the case where the RDMA request is a write request, the operation data corresponding to the remote direct memory access request is the data to be written to the receiving end, and the data length is the length of the data to be written to the receiving end.

[0042] For example, in an application scenario where the client needs to perform RDMA operations on the server, the client is the sender in this embodiment, and the server is the receiver in this embodiment. In an application scenario where the server performs RDMA operations on the client, the sender is the server, and the receiver is the client.

[0043] Step 102, obtaining queue information of the first registered memory queue in the receiving end.

[0044] The first registered memory queue is a queue of memory blocks pre-registered for the transmitter. The queue information of the first registered memory queue may include information of the memory blocks in the first registered memory queue.

[0045] This application is applicable to distributed storage application scenarios, preferably, to high-performance networks that perform memory access operations based on RDMA. In distributed storage application scenarios, the sender can be a client and the receiver can be a server, where a server can establish an RDMA connection with multiple clients. For example, refer to Figure 2 , client 0, client 1 to client N-1, all establish RDMA connections with the server.

[0046] Furthermore, for each sending end, before the sending end sends an RDMA request to the receiving end, an RDMA connection is established between the sending end and the receiving end, and for the RDMA connection, an RDMA memory is registered for it at the receiving end to obtain a first registered memory queue corresponding to the RDMA connection.

[0047] In other words, the first registered memory queue is a queue of memory blocks pre-registered for the sender at the receiving end. For example, the first registered memory queue may be a ring queue.

[0048] Compared with the method of data transmission based on the TCP communication protocol, data transmission based on RDMA technology can save the copying step from user-state memory to kernel buffer memory, thereby reducing latency. When performing access operations based on RDMA technology, it is necessary to register the RDMA memory, then copy the data to be sent to the registered RDMA memory, and then call the corresponding driver interface according to the specific business call to call the data from the registered RDMA memory. Furthermore, the RDMA memory can be registered at the receiving end based on the RDMA registration mechanism. Memory access operations based on RDMA have the characteristics of low latency, high throughput, low central processing unit (CPU) utilization, and support for zero copy.

[0049] Step 103: If it is determined according to the queue information that the first registered memory queue does not meet the remote direct memory access operation requirement, a first target memory adapted to the data length is applied for from the first standby memory queue.

[0050] The first standby memory queue is a queue of memory blocks pre-registered in the receiving end.

[0051] Furthermore, if the first registered memory queue of the receiving end meets the remote direct memory access operation requirement, a first target memory adapted to the data length is directly requested from the first registered memory queue.

[0052] For example, the RDMA memory is registered at the receiving end to obtain a first standby memory queue that can be accessed by each sending end. That is, the first registered memory queue is a registered memory queue that corresponds one-to-one to the RDMA connection of the receiving end, and the first standby memory queue can be a memory queue shared by each RDMA connection of each receiving end.

[0053] For example, refer to Figure 2 , the sending end is the client, the receiving end is the server, the first registered memory queue corresponding to the RDMA connection of client 0 is the first registered memory queue 0, and the first registered memory queue corresponding to the RDMA connection of client 1 is the first registered memory queue 1. Among them, the first standby memory queue is a standby memory queue shared by clients 0 to N-1.

[0054] For example, when an RDMA request sent by a sending end is received, it is determined whether a first registered memory queue corresponding to the RDMA connection of the sending end is empty, and based on the determination result, it is determined whether the first registered memory queue meets the requirements of the RDMA operation.

[0055] For example, when the first registered memory queue is empty, it means that there is no memory block in the first registered memory queue for the sender to perform RDMA operation. In this case, it is determined that the first registered memory does not meet the RDMA operation requirements, and the first target memory adapted to the data length is applied from the first standby queue.

[0056] For example, when the first registered memory queue is not empty, it means that there are memory blocks in the first registered memory queue for the sender to perform RDMA operations. In this case, it is determined that the first registered memory meets the RDMA operation requirements, and a first target memory with a memory size greater than or equal to the data length of the RDMA access operation is applied from the first registered memory queue.

[0057] For example, applying for a first target memory adapted to the data length from the first standby memory queue includes: applying for a first target memory whose memory size is greater than or equal to the data length of the RDMA access operation from the first standby memory queue.

[0058] Step 104: perform a remote direct memory access operation based on the first target memory, and feed back an access operation result of the remote direct memory access operation to the sending end.

[0059] An RDMA request may be a read request or a write request, and correspondingly, an RDMA operation may be a read operation or a write operation.

[0060] If the RDMA operation is a read operation, the receiving end reads the read data required by the RDMA request from a storage space such as a disk based on the RDMA request, stores the read data in a first target memory, and then feeds back the read data from the first target memory to the receiving end; if the RDMA operation is a write operation, the receiving end obtains the write data of the RDMA request, writes the write data to the first target memory, then stores the data in the first target memory in a storage medium such as a disk, and feeds back a response indicating that the operation is completed.

[0061] When performing access operations based on RDMA technology, RDMA memory needs to be registered, and the registration of RDMA memory usually takes a long time. In addition, when the data transmitted based on RDMA technology is relatively small (for example, the data length is equal to 64 bytes), the time consumed to register RDMA memory may be longer than the time required for data transmission.

[0062] In order to reduce the time-consuming impact of registering RDMA memory, in the related art, when initializing the network module in the distributed storage system, a large block of continuous memory is pre-registered, and then the pre-registered memory is managed in a linked list. When performing RDMA operations, memory is requested from the pre-registered memory, and the requested memory is released after the RDMA operation. This method reduces the time loss caused by registering memory. In order to avoid the problem of RDMA operation failure due to insufficient registered memory, in the related art, an extension function is usually set for the memory pool. When the registered memory is insufficient, new memory is registered based on the extension function to meet the RDMA operation requirements. However, this method of registering new RDMA memory when determining that the registered memory is insufficient will increase the latency of the RDMA request, which will in turn cause the service in the RDMA connection to freeze or pause.

[0063] In an embodiment of the present application, when the first registered memory does not meet the preset RDMA operation conditions, the first target memory is applied for from the pre-registered first backup memory. Based on the method of this embodiment, when a traffic burst occurs in the RDMA connection between the transmitter and the receiver, resulting in insufficient first registered memory, there is no need to temporarily register the memory, but instead apply for the first target memory for RDMA operation from the pre-applied first backup memory. Thus, the problem of high request latency caused by temporary registration of memory is avoided, and the stability of memory application is improved, especially the stability of memory application during traffic bursts. This embodiment solves the problem in the related art that a new RDMA memory needs to be temporarily registered, resulting in high request latency, which may cause service freezes or suspensions.

[0064] In one embodiment, there is at least one sending end, and a remote direct memory access connection is established between each sending end and a receiving end. A remote direct memory access request is a request sent by the sending end through the remote direct access connection between the sending end and the receiving end.

[0065] Combine the following Figure 3 , the method of this embodiment is further illustrated by reference to Figure 3 , the method may include the following steps:

[0066] Step 201 : for each remote direct memory access connection, register a first registered memory queue corresponding to the remote direct memory connection in a receiving end.

[0067] The first registered memory is the memory queue registered for the RDMA connection on the sender side.

[0068] Specifically, each sending end and receiving end respectively establish an RDMA connection, and for each RDMA connection, memory registration is performed at the receiving end to obtain a first registered memory queue including at least one registered memory block. The first registered memory queue thus obtained is a memory queue used only for memory access by the RDMA connection corresponding thereto.

[0069] After establishing a remote direct memory access connection between a sending end and a receiving end, a first registered memory and a first spare memory are pre-registered so that after the receiving end receives a remote direct memory access request sent by the sending end, a remote direct memory access operation is performed based on the first registered memory and the first spare memory with pre-registered numbers.

[0070] For example, refer to Figure 2 , client 0, client 1 to client N-1, respectively establish RDMA connections with the receiving end, and the RDMA connections of client 0, client 1 and client N-1 correspond to their respective first registered memories.

[0071] The information of the memory blocks in the first registered memory is stored through the first registered memory queue, and the first registered memory queues corresponding to the client 0, the client 1 and the client N-1 are the first registered memory queue 0, the first registered memory queue 1 and the first registered memory queue N-1 respectively.

[0072] In the application scenario of distributed storage, a client can be connected to multiple storage nodes, and a storage node can be connected to multiple clients. Based on this connection mode, RDMA connections can be cross-established between multiple clients and multiple storage nodes. There are many RDMA connections, and the business loads of RDMA connections between different clients and storage nodes are also different. Therefore, different RDMA connections have different requirements for RDMA registered memory.

[0073] In the related art, multiple RDMA connections use the same registered memory pool for RDMA operations. This may cause multiple RDMA connections to apply for memory from the same registered memory pool at the same time, resulting in competition between the multiple RDMA connections and reduced memory application efficiency.

[0074] For example, a memory is registered for each connection between a sender and a receiver, and a common RDMA registration memory pool is registered for all connections and used as a first backup memory, which is a buffer of the RDMA registration memory.

[0075] Step 202: In response to the remote direct memory access request sent by the sending end, obtain the data length of the operation data corresponding to the remote direct memory access request.

[0076] The remote direct memory access request is a request sent by the sender through the remote direct access connection between the sender and the server. Specifically, the sender sends the RDMA request to the receiver through the RDMA connection between the sender and the receiver.

[0077] There is at least one sender, and a remote direct memory access connection is established between each sender and the server; the remote direct memory access request is a request sent by the sender through the remote direct access connection between the sender and the server.

[0078] The method for obtaining the operation data length corresponding to the remote direct memory access request has been described in the aforementioned step 101 and will not be repeated here.

[0079] Step 203: Obtain queue information of the first registered memory queue in the receiving end.

[0080] The first registered memory queue is a queue of memory blocks pre-registered for the sender. The method of this step has been described in the aforementioned step 102 and will not be repeated here.

[0081] Step 204: Determine whether the first registered memory queue is empty based on the queue information.

[0082] The first registered memory queue can be used to record the information of the registered memory block. If there is no information of the registered memory block in the first registered memory, it is determined that the first registered memory queue is empty; otherwise, it is determined that the first registered memory queue is not empty.

[0083] Step 205: If the first registered memory queue is empty, it is determined that the first registered memory of the receiving end does not meet the remote direct memory access requirement.

[0084] Further, if the first registered memory queue is not empty, it is determined that the first registered memory of the receiving end meets the remote direct memory access requirement.

[0085] Step 206: Apply for a first target memory that matches the data length from the first spare memory queue.

[0086] Furthermore, if the first registered memory queue of the receiving end meets the remote direct memory access operation requirement, a first target memory having a size equal to or greater than the data length is requested from the first registered memory queue according to the data length.

[0087] Step 207: perform a remote direct memory access operation based on the first target memory, and feed back an access operation result of the remote direct memory access operation to the sending end through the remote direct memory access connection between the sending end and the receiving end.

[0088] By registering the first registered memory queue corresponding to the RDMA connection for each connection between the receiving end and each sending end, each RDMA connection can be managed by a separate memory pool based on the first registered memory queue corresponding to the RDMA connection, which can avoid multiple sending ends accessing the same first registered memory queue in the receiving end through the RDMA connection, thereby avoiding competition between RDMA connections and causing the request time to be extended. Based on the first registered memory queue corresponding to the RDMA connection, the memory queue can be locked-free, improving the memory allocation efficiency of the RDMA registered memory.

[0089] Step 208: Obtain a first memory block number and a first memory block number threshold of the memory blocks in the first registered memory queue.

[0090] The memory blocks in the first registered memory queue are memory blocks that can perform RDMA operations. The first memory block number threshold is a load size prediction value of the RDMA connection calculated based on historical data. Specifically, the request latency and number of threads for performing historical RDMA operations through the RDMA connection between the sender and the receiver during the historical time period are obtained, and the load size prediction value of the RDMA operation performed through the RDMA connection is calculated based on the request latency and the number of threads.

[0091] Step 208 may include the following sub-steps:

[0092] Sub-step A1, obtaining the request latency and the number of threads of historical remote direct memory access operations performed through the remote direct memory access connection between the sending end and the receiving end within a preset historical time period.

[0093] The request latency is the average I / O latency in the RDMA connection. Further, the request latency and the number of threads of the historical remote direct memory access operation performed through the remote direct memory access connection between the sending end and the receiving end in a preset historical time period can be obtained according to the preset time interval.

[0094] For example, the receiving end calculates the average I / O latency of the RDMA connection and the number of threads in the RDMA connection every second.

[0095] Sub-step A2, obtaining the product of the request delay and the number of threads, and obtaining the first memory block number threshold according to the product of the request delay and the number of threads.

[0096] For example, the receiving end obtains the first memory block number threshold L1 according to the following method:

[0097] L1=K1×(T1×iops1) / 1000000

[0098] Wherein, T1 is the request delay of the receiving end, iops1 is the number of threads of the receiving end. The receiving end may be a server. K1 is a preset coefficient, for example, the preset coefficient may be set to 20%.

[0099] Obtain the request delay and thread number of the historical remote direct memory access operation through the remote direct memory access connection between the sending end and the receiving end within a preset historical time period, then obtain the product of the request delay and the thread number, and obtain the first memory block number threshold according to the product of the request delay and the thread number, so that the first memory number threshold obtained can reflect the predicted load size of the RDMA connection. Based on the first memory number threshold and the first memory block number of the memory blocks in the first registered memory queue, it can be determined whether the first registered memory queue meets the load demand of the RDMA, so as to timely adjust the first registered memory queue according to the determination result.

[0100] For example, before sending the RDMA request, the second registered memory queue and the second standby memory queue are registered in the memory of the sending end. When the sending end performs the RDMA operation, if the second registered memory queue is not empty, the second target memory is applied from the second registered memory queue, otherwise the second target memory is applied from the second standby memory queue. Then the RDMA operation is performed through the second target memory.

[0101] After executing the RDMA operation, determine whether the third memory block number of the memory blocks in the second registered memory queue is greater than or equal to the fourth memory block number threshold. If so, release the second target memory applied from the second memory queue back to the second standby memory queue; otherwise, release the second target memory back to the second registered memory queue.

[0102] The fourth memory block number threshold is obtained according to the following method: the sending end obtains the request delay and the number of threads for performing remote direct memory access operations through the remote direct memory access connection between the sending end and the receiving end within a preset historical time period, and obtains the fourth memory block number threshold L2 according to the request delay and the thread, and the calculation method is as follows:

[0103] L2 = (T2 × iops2) / 1,000,000

[0104] Among them, T2 is the request delay of the sender, and iops2 is the number of threads of the sender.

[0105] The fourth memory number threshold is calculated by the request latency and the number of threads in the historical time period. The fourth memory number threshold is used to determine whether the second target memory is released back to the second registered memory queue or the second standby memory queue, thereby ensuring that the length of the second registered memory queue will not be too long to avoid increasing management costs.

[0106] Step 209: If the number of first memory blocks is greater than or equal to the first memory block number threshold, the first target memory is released to the first standby memory queue.

[0107] If the number of first memory blocks is greater than or equal to the first memory block number threshold, it means that the length of the first registered memory queue is too long, and the first target memory is released to the first standby memory queue to avoid increasing the management cost of the first registered memory.

[0108] Step 210: If the number of first memory blocks is less than the first memory block number threshold, the first target memory is released to the first registered memory queue.

[0109] For example, after step 207, the method further includes:

[0110] Step 211, obtaining a second memory block number threshold and a third memory block number threshold, and obtaining a second memory block number of memory blocks in the first standby memory queue at a preset time interval.

[0111] Furthermore, the length of the first standby memory queue may be detected by a timer thread at a preset time interval (eg, 1 ms) to obtain the number of memory blocks in the first standby memory.

[0112] For example, obtaining the second memory block number threshold in step 211 may include the following sub-steps:

[0113] Sub-step B1, obtaining the initial number of memory blocks in the first spare memory when registering the first spare memory queue.

[0114] The initial number of memory blocks in the first standby registration memory can be set according to user requirements.

[0115] Sub-step B2, obtaining the product of the first preset coefficient and the initial number of memory blocks, and determining the product of the first preset coefficient and the initial number of memory blocks as the second memory block number threshold.

[0116] Furthermore, the first preset coefficient is greater than 1. For example, the first preset coefficient may be 200%.

[0117] Step 212: if the number of the second memory blocks is greater than or equal to the second memory block number threshold, reduce the registered memory blocks in the first standby memory queue.

[0118] Specifically, if the number of the second memory blocks is greater than or equal to the second memory block number threshold, a deregistration operation is performed on some of the memory blocks in the first standby memory queue.

[0119] For example, the first preset coefficient is 200%. When the length of the first standby memory queue is greater than or equal to 200% of the initial length of the first standby memory queue, the memory block in the first standby memory queue whose length is equal to the initial memory queue length is deregistered.

[0120] Step 213: if the number of the second memory blocks is less than or equal to the third memory block number threshold, then add a registered memory block in the first standby memory queue.

[0121] For example, the product of the second preset coefficient and the initial number of memory blocks is obtained, and the product of the second preset coefficient and the initial number of memory blocks is determined as the third memory block number threshold. The second preset coefficient may be 20%.

[0122] For example, in some extreme application scenarios, if the receiving end has a large number of RDMA connections, a large number of RDMA connections may generate burst services, which may lead to the exhaustion of the first standby memory as the standby buffer memory. In this case, a timer thread can be added to regularly detect the number of memory blocks in the first standby memory queue. When the number of second memory blocks in the first standby memory queue is less than 20% of the initial number of memory blocks, the number of memory blocks in the first standby memory is increased to expand the memory of the first standby memory so that it can meet the RDMA operation requirements of multiple RDMA connections.

[0123] In this embodiment, if the number of second memory blocks is greater than or equal to the second memory block number threshold, a deregistration operation is performed on some memory blocks in the first standby memory queue. Thus, when the first standby memory queue is long enough, the length of the first standby memory queue can be reduced by deregistering the operation, thereby reducing management costs. If the number of second memory blocks is less than or equal to the third memory block number threshold, the registered memory blocks in the first standby memory queue are increased. Thus, it can be ensured that the first standby registered memory can meet the RDMA operation requirements.

[0124] Furthermore, based on the method of this embodiment, when the first backup memory is insufficient, the first backup memory can be expanded in time to ensure the success of the memory application. When the length of the first backup memory queue is greater than or equal to the product of the initial first backup memory queue length and the second preset multiple, some memory blocks in the first backup memory queue are unregistered. Therefore, when the first backup memory is too large, part of the first backup memory can be released in time to reduce the management cost of the first backup memory. Through this embodiment, the first backup memory is regularly detected to expand and release the first backup memory in time to ensure that the registered memory can be successfully applied for from the first backup memory, avoid the request delay caused by temporary registration, and improve the execution efficiency of the RDMA connection service.

[0125] In the case where the remote direct memory access request is a read operation request, step 207 may include the following sub-steps:

[0126] Sub-step C1, acquiring read data corresponding to the remote direct memory access request from the storage medium of the receiving end.

[0127] The storage medium is a storage medium other than the memory of the receiving end. For example, the receiving end is the server, and the preset storage medium may be a disk for storing data in the server. The read data required to be read by the RDMA request is read from the address of the disk.

[0128] Sub-step C2, storing the read data into the first target memory;

[0129] The first target memory is a memory pre-registered in the receiving end. After obtaining the read data, there is no need to re-register, and the read data is directly stored in the first target memory.

[0130] Sub-step C3, sending the read data in the first target memory to the sending end, so that the sending end stores the read data in the second target memory of the sending end;

[0131] For example, the receiving end pushes the read data in the local first target memory to the second target memory of the receiving end by calling the unilateral Write interface.

[0132] In the case where the remote direct memory access request is a write operation request, step 207 may include the following sub-steps:

[0133] Sub-step D1, obtaining write data from the second target memory of the sending end, and writing the write data into the first target memory of the receiving end;

[0134] For example, by calling the unilateral Read interface, write data is obtained from the second target memory of the sender, and the write data is written to the local first target memory.

[0135] Sub-step D2, writing the write data in the first target memory into the storage medium of the receiving end;

[0136] Among them, the second target memory is the memory applied for by the sending end from the second registered memory queue when the second registered memory queue meets the remote direct memory access operation requirements, or the memory applied for from the second standby memory queue when the second registered memory queue does not meet the remote direct memory access operation requirements; the second registered memory queue and the second standby memory queue are queues of memory blocks pre-registered in the sending end.

[0137] Reference Figure 4 This embodiment also provides a memory scheduling method applied to a sending end, including:

[0138] Step 301, sending a remote direct memory access request to a receiving end, so that the receiving end responds to the remote direct memory access request sent by the sending end, obtains the operation data length corresponding to the remote direct memory access request, and obtains the queue information of the first registered memory queue in the receiving end; if it is determined according to the queue information that the first registered memory queue does not meet the remote direct memory access operation requirements, then apply for a first target memory adapted to the data length from the first spare memory queue, perform a remote direct memory access operation based on the first target memory, and feed back the access operation result of the remote direct memory access operation to the sending end.

[0139] The first registered memory queue is a queue of memory blocks pre-registered for the sending end, and the first standby memory queue is a queue of memory blocks pre-registered in the receiving end.

[0140] The processing method of the receiving end in this step can refer to the description of the aforementioned steps 101 to 104, which will not be repeated here.

[0141] Step 302, receiving a remote direct memory access result;

[0142] The first registered memory queue and the first standby memory queue are queues of memory blocks pre-registered in the receiving end.

[0143] The sending end sends an RDMA request to the receiving end. When the first registered memory pre-registered at the receiving end meets the preset RDMA operation conditions, the receiving end directly applies for the first target memory from the pre-registered first registered memory and performs RDMA operations according to the first target memory. When the first registered memory does not meet the preset RDMA operation conditions, the first target memory is applied from the pre-registered first backup memory. When the first registered memory is insufficient due to a traffic burst, there is no need to temporarily register the memory. Instead, the first target memory for the RDMA operation is applied from the pre-applied first backup memory. This avoids the problem of high request latency caused by temporary registered memory and improves the stability of memory application, especially the stability of memory application during traffic bursts.

[0144] Reference Figure 5 , the memory scheduling method of the present application may include the following steps:

[0145] Step 401: The sending end sends a remote direct memory access request to the receiving end.

[0146] The method of this step has been described in the aforementioned step 301 and will not be repeated here.

[0147] Step 402: The receiving end obtains the data length of the operation data corresponding to the remote direct memory access request in response to the remote direct memory access request sent by the sending end.

[0148] The method of this step has been described in the aforementioned step 101 and will not be repeated here.

[0149] Step 403, the receiving end obtains queue information of a first registered memory queue in the receiving end; the first registered memory queue is a queue of memory blocks pre-registered for the sending end.

[0150] The method of this step has been described in the aforementioned step 102 and will not be repeated here.

[0151] Step 404: If the receiving end determines, based on the queue information, that the first registered memory queue does not meet the remote direct memory access operation requirement, a first target memory adapted to the data length is requested from the first standby memory queue.

[0152] Wherein, the first standby memory queue is a queue of memory blocks pre-registered in the receiving end;

[0153] The method of this step has been described in the aforementioned step 103 and will not be repeated here.

[0154] Step 405: The receiving end performs a remote direct memory access operation based on the first target memory, and feeds back an access operation result of the remote direct memory access operation to the sending end.

[0155] The method of this step has been described in the aforementioned step 104 and will not be repeated here.

[0156] Step 406: The sending end receives the memory access operation result.

[0157] The method of this step has been described in the aforementioned step 302 and will not be repeated here.

[0158] In this embodiment, when the sending end sends an RDMA request to the receiving end, and the first registered memory in the receiving end does not meet the preset RDMA operation conditions, the first target memory is applied for from the pre-registered first backup memory. Based on the method of this embodiment, when a traffic burst occurs in the RDMA connection between the sending end and the receiving end, resulting in insufficient first registered memory, there is no need to temporarily register the memory, but instead apply for the first target memory for RDMA operation from the pre-applied first backup memory. The problem of high request latency caused by temporary registration of memory can be avoided, and the stability of memory application is improved, especially the stability of memory application during traffic bursts. This embodiment solves the problem in the related art that new RDMA memory needs to be temporarily registered, resulting in high request latency, which can cause service freezes or suspensions.

[0159] The following takes the sending end as the client and the receiving end as the server as an example to further illustrate the memory scheduling method of the present application.

[0160] Reference Figure 2 The clients include client 0 to client N-1, with a total of N clients. N clients establish N RDMA connections with the server. Specifically, client 0 establishes an RDMA connection with the server, client 1 establishes an RDMA connection with the server, and client N-1 establishes an RDMA connection with the server.

[0161] Each RDMA connection has a corresponding first registered memory queue, and multiple RDMAs have a shared first standby memory queue. When the first registered memory recorded in the first registered memory queue is insufficient due to burst traffic of the RDMA connection, the registered memory can be applied from the first standby memory queue without temporarily registering the RDMA memory.

[0162] Furthermore, the length of the first registered memory can be periodically detected through a timer thread, and the first registered memory can be expanded or released according to the detection result. Figure 2 When the memory space of the first registered memory is insufficient, the registered memory can be exchanged with the first backup memory. When the first backup memory is insufficient, a new backup memory can be expanded and registered from the memory. When the backup memory is too large, part of the backup memory can be released.

[0163] Refer to the following Figure 6 , further exemplary description of the memory scheduling method of the present application is given, referring to Figure 6 , the method may include the following steps:

[0164] Step S1: The client applies for the device address of the server from the management node and actively establishes an RDMA connection with the server.

[0165] Specifically, the client and server are initialized respectively, protection domains and receiving queues are created on the client and server respectively, and the detection function is started to initialize the service thread, timer thread, and RDMA memory pool. Among them, the protection domain (PD) is used to define the permission scope of the memory registration operation. The receive queue (Shared Receive Queue, SRQ) can allow multiple send queues to share a receive queue.

[0166] The activated detection functions include: the server detects the length of the first registered memory queue and the first standby memory queue registered in the server, and the client detects the length of the second registered memory queue and the second standby memory queue in the client.

[0167] For example, this embodiment can be applied to a distributed system, in which there can be multiple clients, each of which can establish an RDMA connection with a server, and multiple clients and multiple servers can share a management node.

[0168] Step S2: Create a first ring-shaped registered memory queue corresponding to the RDMA connection on the server side, and create a second registered memory queue corresponding to the RDMA connection on the client side.

[0169] Further, the first registered memory queue and the second registered memory queue are ring queues. After the first registered memory queue and the second registered memory queue are created, the ring-shaped registered memory queue can be initialized.

[0170] The queue pair of the RDMA connection includes a second registered memory queue and a second standby memory queue in the client.

[0171] Furthermore, the server receives a request from the client to establish an RDMA connection, creates a queue pair for the request, and then initializes a memory registration ring queue belonging to the RDMA connection. The queue pair for the request includes a first registered memory queue and a first standby memory queue in the server.

[0172] Step S3: The client sends an RDMA request to the server through the RDMA connection.

[0173] The RDMA request includes the data length of the operation data used to perform the RDMA operation on the server.

[0174] Step S4, the server determines whether the first registration memory queue is empty. If it is empty, it proceeds to step S5, otherwise it proceeds to step S6.

[0175] The method of this step has been described in the aforementioned step 205 and will not be repeated here.

[0176] Step S5: determine whether the first registered memory queue meets the RDMA operation requirement, and apply for a first target memory from the first registered memory queue.

[0177] Step S6: determine that the first registered memory queue does not meet the RDMA operation requirement, and apply for the first target memory from the first standby registered memory queue.

[0178] Step S7, the server reads the read data required by the client from the disk, stores it in the first target memory, and then pushes the data stored in the first target memory to the second target memory of the client through the unilateral Write interface.

[0179] The second target memory is a registered memory requested from the second registered memory queue or the second standby registered memory queue.

[0180] Specifically, for example, if the RDMA request is a read request, the client sends a bilateral message including the memory access address, data length and Key value of the RDMA operation to the server through the Send instruction. The memory access address is used to locate the data location in the preset storage medium for RDMA; the data length is used to determine the size of the memory application; and the Key value is used to perform permission verification during the RDMA operation.

[0181] The server receives the bilateral message from the client, applies for the first target memory belonging to the RDMA connection according to the data length, and applies for the registered memory from the first spare memory when the first registered memory queue belonging to the RDMA connection is empty.

[0182] The server reads the data required by the client from the disk, stores it in the requested first target memory, and then pushes the data stored in the first target memory to the client's second target memory through the unilateral Write interface.

[0183] Step S8: The client stores the read data in the second target memory into the disk.

[0184] The second target memory is a registered memory applied from the second registered memory queue or the second standby memory queue. Specifically, if the second registered memory queue is empty, the second target memory is applied from the second standby memory queue; if the second registered memory queue is not empty, the second target memory is directly applied from the second registered memory queue.

[0185] Step S3 may include the following steps:

[0186] Step S9: The client stores the write data into the second target memory.

[0187] The second target memory is the memory applied from the second registered memory queue or the second standby registered memory queue. The application method is as in step S8, which will not be described in detail here.

[0188] For example, if the RDMA request is a write request, the client sends a bilateral message including the memory access address, data length and Key value of the RDMA operation through the Send instruction. The memory access address is used to locate the data location in the preset storage medium for RDMA; the data length is used to determine the size of the memory requested; and the Key value is used to perform permission verification during the RDMA operation.

[0189] Step S10, the server reads the write data from the second target memory of the client through the Read interface, writes it to the applied first target memory, and then stores the write data in the first target memory into the disk.

[0190] The server receives the bilateral message from the client, applies for the first target memory of the RDMA connection according to the data length, and writes the write data into the first target memory.

[0191] For example, the write data in the first target memory may also be stored in other storage media except the disk.

[0192] Step S11, returning a Reply response to the client through the Send interface.

[0193] For example, if the number of third memory blocks in the second registered memory queue does not exceed 20% of the fourth memory block number threshold, the client releases the second memory back to the second registered memory queue after receiving the Reply from the server.

[0194] If the number of the third memory blocks in the second registered memory queue is greater than 20% of the fourth memory block number threshold, the applied second target memory is released back to the second standby memory queue.

[0195] Pre-register the standby memory queue and use it as a common memory queue for multiple RDMA connections. When the RDMA connection runs out of memory due to burst traffic, you can apply for memory in the standby memory queue without registering new RDMA registered memory to the network card. This improves the service stability of RDMA communication in burst situations and has the advantages of wide application scenarios and strong universality.

[0196] This embodiment manages memory based on RDMA connection, and intelligently predicts the length of the registered memory queue according to the number of business load threads and IO latency of the connection, and adjusts the registered memory according to the predicted memory queue length. When the registered memory is too large, part of the registered memory is released to reduce the process RDMA memory usage, thereby improving the business stability during network traffic bursts. This embodiment adds a timed detection mechanism for the length of the standby memory queue to expand and release the standby memory in advance to achieve the optimal efficiency of the current business.

[0197] Reference Figure 7 , the method further comprises the following steps:

[0198] Step F1, the timer thread detects the length of the backup memory every 1 ms.

[0199] The server and the client are respectively based on timer threads to detect the length of their respective standby memory queues.

[0200] Step F2: when the length of the standby memory queue is less than or equal to 20% of the initial standby memory length, a new RDMA registration memory is applied for and saved in the standby memory queue.

[0201] The length of the initial standby memory queue of the server is equal to the number of initial memory blocks in the first standby memory when the server constructs the first standby memory. The length of the initial standby memory queue of the client is equal to the number of initial memory blocks in the second standby memory when the client constructs the second standby memory.

[0202] The server and the client manage their spare memory respectively based on the method in this step.

[0203] Step F3, when the length of the standby memory is greater than or equal to 200% of the initial standby memory queue length, cancel the registration memory of the original standby memory queue length.

[0204] Figure 8 is a block diagram of a memory scheduling device 50 provided in an embodiment of the present application, which is applied to a receiving end, such as Figure 8As shown, the device 50 includes:

[0205] A first acquisition module 501 is used to respond to a remote direct memory access request sent by a sending end and acquire a data length of operation data corresponding to the remote direct memory access request;

[0206] The second acquisition module 502 is used to acquire queue information of a first registered memory queue in the receiving end; the first registered memory queue is a queue of memory blocks pre-registered for the sending end;

[0207] The first application module 503 is used to apply for a first target memory adapted to the data length from a first standby memory queue if it is determined according to the queue information that the first registered memory queue does not meet the remote direct memory access operation requirement; the first standby memory queue is a queue of memory blocks pre-registered in the receiving end;

[0208] The first execution module 504 is configured to execute a remote direct memory access operation based on the first target memory, and feed back an access operation result of the remote direct memory access operation to the sending end.

[0209] Optionally, the device 50 further includes:

[0210] A third acquisition module is used to acquire the first number of memory blocks in the first registered memory queue and a first memory block number threshold after executing a remote direct memory access operation based on the first target memory and feeding back the execution result to the sending end;

[0211] A first releasing module, configured to release the first target memory to a first standby memory queue if the number of the first memory blocks is greater than or equal to a first memory block number threshold;

[0212] The second releasing module is used to release the first target memory to the first registered memory queue if the number of the first memory blocks is less than the first memory block number threshold.

[0213] Optionally, obtain modules, including:

[0214] A first acquisition submodule is used to acquire a request delay and a number of threads for performing a historical remote direct memory access operation through a remote direct memory access connection between a sending end and a receiving end within a preset historical time period;

[0215] The second acquisition submodule is used to obtain the product of the request delay and the number of threads, and obtain the first memory block number threshold according to the product of the request delay and the number of threads.

[0216] Optionally, the device 50 further includes:

[0217] A fourth acquisition module, configured to acquire a second memory block number threshold after feeding back the access operation result of the remote direct memory access operation to the sending end, and acquire a second memory block number of the memory blocks in the first standby memory queue at a preset time interval;

[0218] The fifth acquisition module is configured to cancel the registration operation on some memory blocks in the first standby memory queue if the number of the second memory blocks is greater than or equal to the second memory block number threshold.

[0219] Optionally, the fourth acquisition module includes:

[0220] A third acquisition submodule is used to acquire the initial number of memory blocks in the first spare memory when registering the first spare memory queue;

[0221] The fourth acquisition submodule is used to acquire the product of the first preset coefficient and the initial number of memory blocks, and determine the product of the first preset coefficient and the initial number of memory blocks as the second memory block number threshold.

[0222] Optionally, there is at least one sending end, and a remote direct memory access connection is established between each sending end and the receiving end; the remote direct memory access request is a request sent by the sending end through the remote direct access connection between the sending end and the receiving end; the first execution module 504 includes:

[0223] A feedback submodule, configured to feed back the access operation result of the remote direct memory access operation to the sending end through the remote direct memory access connection between the sending end and the receiving end;

[0224] The device 50 further comprises:

[0225] The registration module is used to register a first registration memory queue corresponding to the remote direct memory connection in the receiving end for each remote direct memory access connection before obtaining the operation data length corresponding to the remote direct memory access request in response to the remote direct memory access request sent by the sending end.

[0226] Optionally, the device 50 further includes:

[0227] A judgment module, used for judging whether the first registered memory queue is empty according to the queue information;

[0228] The determination module is used to determine that the first registered memory of the receiving end does not meet the remote direct memory access requirement if the first registered memory queue is empty.

[0229] Optionally, when the remote direct memory access request is a read operation request, the first execution module 504 includes:

[0230] A fifth acquisition submodule, used to acquire read data corresponding to the remote direct memory access request from a storage medium of the receiving end; the storage medium is a storage medium other than the memory of the receiving end;

[0231] A first storage submodule, used for storing read data into a first target memory;

[0232] A first sending submodule, used for sending the read data in the first target memory to the sending end, so that the sending end stores the read data in the second target memory of the sending end;

[0233] In the case where the remote direct memory access request is a write operation request, the first execution module 504 includes:

[0234] a sixth acquisition submodule, configured to acquire write data from the second target memory of the sending end, and write the write data into the first target memory of the receiving end;

[0235] The first writing submodule is used to write the write data in the first target memory into the storage medium of the receiving end; wherein the second target memory is the memory applied by the sending end from the second registered memory queue when the second registered memory queue meets the remote direct memory access operation requirements, or the memory applied from the second standby memory queue when the second registered memory queue does not meet the remote direct memory access operation requirements; the second registered memory queue and the second standby memory queue are queues of memory blocks pre-registered in the sending end.

[0236] In an embodiment of the present application, when the first registered memory does not meet the preset RDMA operation conditions, the first target memory is applied for from the pre-registered first backup memory. Based on the method of this embodiment, when a traffic burst occurs in the RDMA connection between the transmitter and the receiver, resulting in insufficient first registered memory, there is no need to temporarily register the memory, but instead apply for the first target memory for RDMA operation from the pre-applied first backup memory. Thus, the problem of high request latency caused by temporary registration of memory is avoided, and the stability of memory application is improved, especially the stability of memory application during traffic bursts. This embodiment solves the problem in the related art that a new RDMA memory needs to be temporarily registered, resulting in high request latency, which may cause service freezes or suspensions.

[0237] Fig. 9 is a block diagram of a memory scheduling device 40 provided in an embodiment of the present application, such as Fig. 9 As shown, the device 60 includes:

[0238] The sending module 601 is used to send a remote direct memory access request to a receiving end, so that the receiving end can respond to the remote direct memory access request sent by the sending end and obtain the operation data length corresponding to the remote direct memory access request; obtain the queue information of the first registered memory queue in the receiving end; the first registered memory queue is a queue of memory blocks pre-registered for the sending end; if it is determined according to the queue information that the first registered memory queue does not meet the remote direct memory access operation requirements, then apply for a first target memory adapted to the data length from the first spare memory queue; the first spare memory queue is a queue of memory blocks pre-registered in the receiving end; perform a remote direct memory access operation based on the first target memory, and feed back the access operation result of the remote direct memory access operation to the sending end.

[0239] The receiving module 602 is used to receive feedback results.

[0240] The sending end sends an RDMA request to the receiving end. When the first registered memory pre-registered at the receiving end meets the preset RDMA operation conditions, the receiving end directly applies for the first target memory from the pre-registered first registered memory and performs RDMA operations according to the first target memory. When the first registered memory does not meet the preset RDMA operation conditions, the first target memory is applied from the pre-registered first backup memory. When the first registered memory is insufficient due to a traffic burst, there is no need to temporarily register the memory. Instead, the first target memory for the RDMA operation is applied from the pre-applied first backup memory. This avoids the problem of high request latency caused by temporary registered memory and improves the stability of memory application, especially the stability of memory application during traffic bursts.

[0241] The present application also provides an electronic device, Fig.10 is a block diagram of an electronic device provided in an embodiment of the present application, such as Fig.10 As shown, the electronic device 70 includes a processor 701 , a communication interface 702 , a memory 703 and a communication bus 704 , wherein the processor 701 , the communication interface 702 , and the memory 703 communicate with each other via the communication bus 704 .

[0242] Memory 703, used to store computer programs;

[0243] The processor 701 is used to execute the computer program stored in the memory 703 to implement the following steps: in response to a remote direct memory access request sent by a sending end, obtain the data length of the operation data corresponding to the remote direct memory access request; obtain the queue information of the first registered memory queue in the receiving end; the first registered memory queue is a queue of memory blocks pre-registered for the sending end; if it is determined according to the queue information that the first registered memory queue does not meet the remote direct memory access operation requirements, apply for a first target memory adapted to the data length from the first spare memory queue; the first spare memory queue is a queue of memory blocks pre-registered in the receiving end; perform a remote direct memory access operation based on the first target memory, and feed back the access operation result of the remote direct memory access operation to the sending end.

[0244] The processor 701 may also implement other steps in the above-mentioned memory scheduling method, which will not be described in detail here.

[0245] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0246] The communication interface is used for communication between the above electronic device and other devices.

[0247] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0248] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0249] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium is used to store a computer program. When the computer program is executed by a processor, the memory scheduling method in the above embodiment is implemented.

[0250] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes the memory scheduling method in the above embodiment.

[0251] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. Available media can be magnetic media, (e.g., floppy disk, hard disk, tape), optical media (e.g., DVD), or semiconductor media (e.g., solid-state hard disk Solid State Disk (SSD)), etc.

[0252] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of more restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or device including the elements. Each embodiment in this specification is described in a related manner, and the same and similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. For the embodiments of the device, electronic device, computer-readable storage medium and computer program product containing instructions, since they are basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0253] The above are only preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A memory scheduling method, characterized in that: Applied to the receiving end, the method includes: In response to a remote direct memory access request sent by a sending end, acquiring a data length of operation data corresponding to the remote direct memory access request; Acquire queue information of a first registered memory queue in the receiving end; the first registered memory queue is a queue of memory blocks pre-registered for the sending end; If it is determined according to the queue information that the first registered memory queue does not meet the remote direct memory access operation requirement, then applying for a first target memory adapted to the data length from a first standby memory queue; the first standby memory queue is a queue of memory blocks pre-registered in the receiving end; The remote direct memory access operation is performed based on the first target memory, and an access operation result of the remote direct memory access operation is fed back to the sending end.

2. The method according to claim 1, characterized in that After performing the remote direct memory access operation based on the first target memory and feeding back the access operation result of the remote direct memory access operation to the sending end, the method further includes: Obtaining a first memory block number and a first memory block number threshold of the memory blocks in the first registered memory queue; If the number of the first memory blocks is greater than or equal to the first memory block number threshold, releasing the first target memory to the first standby memory queue; If the number of the first memory blocks is less than the first memory block number threshold, the first target memory is released to the first registered memory queue.

3. The method according to claim 2, characterized in that Get the first memory block number threshold, including: Obtaining request delays and number of threads for performing historical remote direct memory access operations through a remote direct memory access connection between the sending end and the receiving end within a preset historical time period; The product of the request latency and the number of threads is obtained, and the first memory block number threshold is obtained according to the product of the request latency and the number of threads.

4. The method according to claim 1, characterized in that: After feeding back the access operation result of the remote direct memory access operation to the sending end, the method further includes: Obtaining a second memory block number threshold and a third memory block number threshold, and obtaining a second memory block number of memory blocks in the first standby memory queue at a preset time interval; If the number of the second memory blocks is greater than or equal to the second memory block number threshold, reducing the registered memory blocks in the first standby memory queue; If the number of the second memory blocks is less than or equal to the third memory block number threshold, then the registered memory blocks in the first standby memory queue are increased.

5. The method according to claim 4, characterized in that The obtaining of the second memory block number threshold and the third memory block number threshold comprises: Obtaining an initial number of memory blocks in the first standby memory when registering the first standby memory queue; Obtaining a product of a first preset coefficient and the initial number of memory blocks, and determining the product of the first preset coefficient and the initial number of memory blocks as the second memory block number threshold; The product of the second preset coefficient and the initial number of memory blocks is obtained, and the product of the second preset coefficient and the initial number of memory blocks is determined as the third memory block number threshold.

6. The method according to claim 1, characterized in that There is at least one sending end, and a remote direct memory access connection is established between each of the sending ends and the receiving end; the remote direct memory access request is a request sent by the sending end through the remote direct access connection between the sending end and the receiving end; Feeding back the access operation result of the remote direct memory access operation to the sending end, including: Feedback the access operation result of the remote direct memory access operation to the sending end through the remote direct memory access connection between the sending end and the receiving end; Before the step of obtaining an operation corresponding to the remote direct memory access request in response to the remote direct memory access request sent by the sending end, the step further includes: For each remote direct memory access connection, the first registered memory queue corresponding to the remote direct memory connection is registered in the receiving end.

7. The method according to claim 1, characterized in that The method further comprises: According to the queue information, determining whether the first registered memory queue is empty; If the first registered memory queue is empty, it is determined that the first registered memory of the receiving end does not meet the remote direct memory access requirement.

8. The method according to claim 1, characterized in that In the case where the remote direct memory access request is a read operation request, performing the remote direct memory access operation based on the first target memory and feeding back the access operation result of the remote direct memory access operation to the sending end include: Acquire read data corresponding to the remote direct memory access request from a storage medium of the receiving end; the storage medium is a storage medium other than the memory of the receiving end; storing the read data into the first target memory; sending the read data in the first target memory to a sending end, so that the sending end stores the read data in a second target memory of the sending end; In the case where the remote direct memory access request is a write operation request, performing the remote direct memory access operation based on the first target memory and feeding back the access operation result of the remote direct memory access operation to the sending end include: Acquire write data from the second target memory of the sending end, and write the write data into the first target memory of the receiving end; Writing the write data in the first target memory into a storage medium at the receiving end; Among them, the second target memory is the memory applied for by the sending end from the second registered memory queue when the second registered memory queue meets the remote direct memory access operation requirements, or the memory applied for from the second standby memory queue when the second registered memory queue does not meet the remote direct memory access operation requirements; the second registered memory queue and the second standby memory queue are queues of memory blocks pre-registered in the sending end.

9. A memory scheduling device, characterized in that: Applied to a receiving end, the device comprises: A first acquisition module, configured to, in response to a remote direct memory access request sent by a sending end, acquire a data length of operation data corresponding to the remote direct memory access request; A second acquisition module is used to acquire queue information of a first registered memory queue in the receiving end; the first registered memory queue is a queue of memory blocks pre-registered for the sending end; A first application module is used to apply for a first target memory adapted to the data length from a first standby memory queue if it is determined according to the queue information that the first registered memory queue does not meet the remote direct memory access operation requirement; the first standby memory queue is a queue of memory blocks pre-registered in the receiving end; The first execution module is used to execute the remote direct memory access operation based on the first target memory, and feed back the access operation result of the remote direct memory access operation to the sending end.

10. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the memory scheduling method according to any one of claims 1 to 8.