Data transmission method, device, equipment and storage medium for remote memory access
By using different operation and control methods to process small and large messages in the RDMA network, using shared reception queues and data residence time thresholds, the main memory bandwidth competition problem is solved, communication efficiency and cache multiplexing rate are improved, and high Throughput and low latency network communication.
Patent Information
- Application Number
- CN202410166037.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-06
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2044-02-06
AI Technical Summary
There is a problem of main memory bandwidth competition in RDMA network applications, resulting in a decline in network throughput and an increase in latency. RNICs find it difficult to obtain sufficient main memory bandwidth to process the received data packets, resulting in data overflow and discarding.
Different RDMA operations and control methods are used to process small messages and large messages, and the shared reception queue mechanism and data residence time threshold are used to avoid cache resource exclusivity. Small messages and large messages are processed respectively through RDMA SEND/RECV and RDMA READ/WRITE operations. Message and allocate isolated cache pools in the last level cache to improve cache reuse rate.
It significantly improved communication throughput, reduced network latency and main memory bandwidth usage. The experimental results showed that the communication throughput increased by 2.11 times, the average network latency decreased by 64.2%, and the main memory bandwidth usage decreased by 96.4%.
Smart Images

Figure CN118093499B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data transmission, and in particular to a data transmission method, device, equipment and storage medium for remote memory access. Background Art
[0002] Data center applications are increasingly dependent on high-speed networks, which require network communication features with high throughput, low latency, and low CPU overhead to support large-scale network communication. In particular, for bandwidth-intensive applications such as distributed machine learning and cloud storage, more than 100Gbps of network bandwidth is required between servers, while for online services such as database online analytical processing, low latency is required to minimize query response time. At the same time, most applications want the network stack to have low CPU overhead in order to reserve as many CPU cores as possible for computing.
[0003] Remote Direct Memory Access (RDMA) has become a popular high-speed network technology, mainly due to its high throughput, low latency and low CPU overhead provided by its architectural innovations such as kernel bypass and transport offload. However, despite the high performance and low CPU overhead of RDMA technology, commercial RDMA Network Interface Card (RNIC) still faces the problem of main memory bandwidth competition, which is manifested as follows: when RNIC performs direct memory access (DMA) operations to store received messages to main memory, RNIC will compete with other CPU computing processes (such as main memory data analysis, data replication and garbage collection, etc.) for main memory bandwidth; under this competition, RNIC is difficult to obtain sufficient main memory bandwidth to store received data packets to main memory in time, causing the RNIC on-chip cache to be filled with unprocessed data packets, eventually leading to data overflow in RNIC, and it can only discard the received but unprocessed data packets; at the same time, data overflow triggers congestion control, resulting in a decrease in network throughput and a significant increase in latency.
[0004] With the development of high-speed networks and the expansion of deployment scale, the main memory bandwidth competition problem will be further aggravated. Therefore, how to avoid the impact of main memory bandwidth competition on RDMA network communication is an urgent problem to be solved in RDMA network applications. Summary of the invention
[0005] Based on this, it is necessary to propose a data transmission method, device, equipment and storage medium for remote memory access to address the above problems.
[0006] A data transmission method for remote memory access, the method comprising:
[0007] S1, a message to be transmitted that the second host needs to send to the first host;
[0008] S2. The second host determines the message type of the message to be transmitted, where the message type includes a large message and a small message;
[0009] S3. After determining that the message type of the message to be transmitted is a small message, the second host communicates with the first host through the RDMA Send&Recv primitive; the second host generates a corresponding work queue element and puts it into the sending queue; the first host takes a cache block from the small message cache area in the last-level cache module and generates a corresponding work queue element and puts it into the shared receiving queue;
[0010] S4: The first host determines whether there are any remaining cache blocks or free caches in the small message cache area;
[0011] S5: If there are no remaining cache blocks and free cache in the small message cache area, the first host rejects the communication request of the second host;
[0012] S6: If there are remaining cache blocks or free caches in the small message cache area, the second host takes out the message to be transmitted according to the main memory message storage address pointed to by the work queue element and sends it to the first host. The first host transmits the message to be transmitted to the prepared cache space according to the address pointed to by the work queue element in the shared receiving queue, and executes S11;
[0013] S7. After determining that the message type of the message to be transmitted is a large message, the second host communicates with the first host through an RDMA Read / Write primitive, and the first host determines the required capacity size of the message to be transmitted;
[0014] S8. The first host determines whether the required capacity of the message to be transmitted satisfies the remaining storage space;
[0015] S9. If the required capacity of the message to be transmitted is greater than the remaining storage space, the first host rejects the communication request of the second host;
[0016] S10, if the required capacity of the message to be transmitted is less than or equal to the remaining storage space, the first host allocates capacity in the large message buffer according to the required capacity, and the second host divides the message to be sent into multiple data packets for transmission, and executes S11 immediately after each data packet arrives at the large message buffer of the first host;
[0017] S11, when the cache area in the last-level cache module receives the data, the cache area notifies the application to process the data through a shared cache mapping with the application;
[0018] S12, if the residence time of the data in the last-level cache module is greater than the data residence time threshold, unloading the data of the message to the receiving buffer of the main memory, and informing the application of the relevant information, and the application subsequently retrieves the data from the main memory and processes it;
[0019] S13: If the residence time of the data in the last-level cache module is less than or equal to the data residence time threshold, it is determined that the processing is completed.
[0020] In a specific embodiment, before S1, the method further includes:
[0021] The first host establishes RDMA communication with the second host and initializes communication resources, including queue pair numbers and data cache addresses of both parties;
[0022] The initialization of communication resources is completed through socket communication or RDMA connection manager.
[0023] In the method, determining the message type of the message to be transmitted specifically includes: comparing the size of the message to be transmitted with a data threshold, and determining the message type according to the comparison result;
[0024] If the size of the message to be transmitted is less than or equal to the data threshold, determining that the message type is a small message;
[0025] If the size of the message to be transmitted is greater than the data threshold, the message type is determined to be a large message.
[0026] In a specific embodiment, the data threshold is set to 4KB; each work queue element in the shared receiving queue points to a cache block of 4KB in size in the last-level cache module.
[0027] In a specific embodiment, the cache space used for data reception under RDMA communication is allocated in the last-level cache module, and the small message cache area and the large message cache area share the cache space; the cache space size of the last-level cache module = network bandwidth * data residence time threshold * proportion of residence data that needs to be processed in the cache space.
[0028] In a specific embodiment, the first host determines the required capacity size of the message to be transmitted, specifically including: the required capacity of the message to be transmitted = the amount of data to be sent * the data residence time threshold, and the data residence time threshold is set to 200 microseconds.
[0029] In a specific embodiment, the second host divides the message to be sent into multiple data packets for sending, specifically including: dividing the message to be sent into multiple data packets no larger than 256KB for sending.
[0030] A remote communication device, comprising:
[0031] A request module, used for generating a communication request when the second host needs to send a message to be transmitted to the first host;
[0032] A message type determination module, used to determine the message type of the message to be transmitted, wherein the message type includes a large message and a small message;
[0033] A small message transmission module is used to determine that the message type of the message to be transmitted is a small message, and then the second host communicates with the first host through the RDMA Send&Recv primitive; the second host generates a corresponding work queue element and puts it into the sending queue; the first host takes out a cache block from the small message cache area in the final cache module and generates a corresponding work queue element and puts it into the shared receiving queue, and determines whether there are remaining cache blocks or free caches in the small message cache area; if there are no remaining cache blocks and free caches in the small message cache area, the communication request from the second host to the first host is rejected; if there are remaining cache blocks or free caches in the small message cache area, the second host takes out the message to be transmitted according to the main memory message storage address pointed to by the work queue element and sends it to the first host, and the first host transmits the message to be transmitted to the prepared cache space according to the address pointed to by the work queue element in the shared receiving queue;
[0034] A large message transmission module is used to determine that the message type of the message to be transmitted is a large message, and then the second host communicates with the first host through the RDMA Read / Write primitive, and the first host determines the required capacity of the message to be transmitted, and judges whether the required capacity of the message to be transmitted meets the remaining storage space; if the required capacity of the message to be transmitted is greater than the remaining storage space, the communication request from the second host to the first host is rejected; if the required capacity of the message to be transmitted is less than or equal to the remaining storage space, the first host allocates capacity in the large message buffer area according to the required capacity, and the second host divides the message to be sent into multiple data packets for transmission;
[0035] The transmission processing module is used to notify the application to process the data through the shared cache mapping with the application after the cache area in the last-level cache module receives the data; if the residence time of the data in the last-level cache module is greater than the data residence time threshold, the data of the message is unloaded to the receiving buffer of the main memory, and the relevant information is notified to the application, and the application subsequently retrieves the data from the main memory and processes it; if the residence time of the data in the last-level cache module is less than the data residence time threshold, it is determined that the processing is completed.
[0036] An electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following steps:
[0037] S1, a message to be transmitted that the second host needs to send to the first host;
[0038] S2. The second host determines the message type of the message to be transmitted, where the message type includes a large message and a small message;
[0039] S3. After determining that the message type of the message to be transmitted is a small message, the second host communicates with the first host through the RDMA Send&Recv primitive; the second host generates a corresponding work queue element and puts it into the sending queue; the first host takes a cache block from the small message cache area in the last-level cache module and generates a corresponding work queue element and puts it into the shared receiving queue;
[0040] S4: The first host determines whether there are any remaining cache blocks or free caches in the small message cache area;
[0041] S5: If there are no remaining cache blocks and free cache in the small message cache area, the first host rejects the communication request of the second host;
[0042] S6: If there are remaining cache blocks or free caches in the small message cache area, the second host takes out the message to be transmitted according to the main memory message storage address pointed to by the work queue element and sends it to the first host. The first host transmits the message to be transmitted to the prepared cache space according to the address pointed to by the work queue element in the shared receiving queue, and executes S11;
[0043] S7. After determining that the message type of the message to be transmitted is a large message, the second host communicates with the first host through an RDMA Read / Write primitive, and the first host determines the required capacity size of the message to be transmitted;
[0044] S8. The first host determines whether the required capacity of the message to be transmitted satisfies the remaining storage space;
[0045] S9. If the required capacity of the message to be transmitted is greater than the remaining storage space, the first host rejects the communication request of the second host;
[0046] S10, if the required capacity of the message to be transmitted is less than or equal to the remaining storage space, the first host allocates capacity in the large message buffer according to the required capacity, and the second host divides the message to be sent into multiple data packets for transmission, and executes S11 immediately after each data packet arrives at the large message buffer of the first host;
[0047] S11, when the cache area in the last-level cache module receives the data, the cache area notifies the application to process the data through a shared cache mapping with the application;
[0048] S12, if the residence time of the data in the last-level cache module is greater than the data residence time threshold, unloading the data of the message to the receiving buffer of the main memory, and informing the application of the relevant information, and the application subsequently retrieves the data from the main memory and processes it;
[0049] S13: If the residence time of the data in the last-level cache module is less than or equal to the data residence time threshold, it is determined that the processing is completed.
[0050] A computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to perform the following steps:
[0051] S1, a message to be transmitted that the second host needs to send to the first host;
[0052] S2. The second host determines the message type of the message to be transmitted, where the message type includes a large message and a small message;
[0053] S3. After determining that the message type of the message to be transmitted is a small message, the second host communicates with the first host through the RDMA Send&Recv primitive; the second host generates a corresponding work queue element and puts it into the sending queue; the first host takes a cache block from the small message cache area in the last-level cache module and generates a corresponding work queue element and puts it into the shared receiving queue;
[0054] S4: The first host determines whether there are any remaining cache blocks or free caches in the small message cache area;
[0055] S5: If there are no remaining cache blocks and free cache in the small message cache area, the first host rejects the communication request of the second host;
[0056] S6: If there are remaining cache blocks or free caches in the small message cache area, the second host takes out the message to be transmitted according to the main memory message storage address pointed to by the work queue element and sends it to the first host. The first host transmits the message to be transmitted to the prepared cache space according to the address pointed to by the work queue element in the shared receiving queue, and executes S11;
[0057] S7. After determining that the message type of the message to be transmitted is a large message, the second host communicates with the first host through an RDMA Read / Write primitive, and the first host determines the required capacity size of the message to be transmitted;
[0058] S8. The first host determines whether the required capacity of the message to be transmitted satisfies the remaining storage space;
[0059] S9. If the required capacity of the message to be transmitted is greater than the remaining storage space, the first host rejects the communication request of the second host;
[0060] S10, if the required capacity of the message to be transmitted is less than or equal to the remaining storage space, the first host allocates capacity in the large message buffer according to the required capacity, and the second host divides the message to be sent into multiple data packets for transmission, and executes S11 immediately after each data packet arrives at the large message buffer of the first host;
[0061] S11, when the cache area in the last-level cache module receives the data, the cache area notifies the application to process the data through a shared cache mapping with the application;
[0062] S12, if the residence time of the data in the last-level cache module is greater than the data residence time threshold, unloading the data of the message to the receiving buffer of the main memory, and informing the application of the relevant information, and the application subsequently retrieves the data from the main memory and processes it;
[0063] S13: If the residence time of the data in the last-level cache module is less than or equal to the data residence time threshold, it is determined that the processing is completed.
[0064] The embodiments of the present invention have the following beneficial effects:
[0065] The present invention adopts different RDMA operation and control methods for small messages and large messages respectively. For small messages, RDMA SEND / RECV is selected, and the receiving queue is aggregated by using a shared receiving queue mechanism; for large messages, RDMA READ / WRITE is used, and according to the required capacity, the two share the cache space of the data receiving cache pool, and the cache resource monopoly is avoided by setting the data usage threshold of the two types of messages. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0067] in:
[0068] Figure 1 is a flow chart of a data transmission method for remote memory access in one embodiment;
[0069] Figure 2 A flowchart of a small message receiving process in a data transmission method for remote memory access in one embodiment;
[0070] Figure 3 A flowchart of a large message receiving process in a data transmission method for remote memory access in one embodiment;
[0071] Figure 4 FIG. 4 is a structural block diagram of an electronic device in an embodiment. DETAILED DESCRIPTION
[0072] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0073] The basic idea of the present invention to solve the main memory bandwidth competition problem is to avoid excessive use of slow main memory and directly use the CPU cache, that is, to reserve a small isolated cache pool in the last level cache (LLC). From the bandwidth point of view, the CPU cache is sufficient to meet the needs of RNIC, but only a very limited cache capacity can be used. If the data obtained by RNIC is small enough and the life cycle is short enough, then the CPU cache is sufficient. However, for data that is relatively large or has a long life cycle, a better solution is needed.
[0074] Specifically, the RNIC data receiving module moves the main memory out of the receiver's data path and reserves a small isolated cache pool in the last-level cache (LLC) to receive message data from the network card; then, in order to improve the reuse level of the reserved LLC, different RDMA operations and control methods are used for small messages and large messages respectively; small messages use RDMA SEND / RECV operations and use the shared receive queue mechanism to aggregate the receive queue; large messages use RDMA READ / WRITE operations and allocate cache according to the message size and data residence time threshold. Small and large messages share the cache pool and avoid exclusive cache resources through the user-set data residence time threshold and the proportion of residence data that needs to be processed in the cache space.
[0075] In addition, in order to improve data processing efficiency and cache reuse, the present invention uses the SLAB (Sequential Locality Allocation Buffer) algorithm to manage the cache to avoid internal fragmentation, uses multi-threaded parallel data processing operations to improve processing efficiency, and uses pipeline technology to achieve more fine-grained cache recycling. In order to maintain a high-performance network, when the application occupies the cache for more than a threshold, the data on the cache pool will be copied to the main memory, thereby quickly releasing the cache.
[0076] The present invention can significantly improve communication throughput and reduce network delay and main memory bandwidth occupancy.
[0077] Existing experimental results show that the present invention increases the communication throughput by 2.11 times, reduces the average network delay by 64.2%, and reduces the main memory bandwidth occupancy by 96.4%.
[0078] In one embodiment, a data transmission method for remote memory access is provided.
[0079] like Figure 1 As shown, the data transmission method for remote memory access specifically includes the following steps:
[0080] S1, a message to be transmitted that the second host needs to send to the first host;
[0081] S2. The second host determines the message type of the message to be transmitted, where the message type includes a large message and a small message;
[0082] Specifically, comparing the size of the message to be transmitted with a data threshold, and determining the message type according to the comparison result;
[0083] If the size of the message to be transmitted is less than or equal to the data threshold, determining that the message type is a small message;
[0084] If the size of the message to be transmitted is greater than the data threshold, the message type is determined to be a large message.
[0085] Exemplarily, the data threshold is set to 4 KB; each work queue element in the shared receiving queue points to a cache block of 4 KB in the last-level cache module.
[0086] S3. After determining that the message type of the message to be transmitted is a small message, the second host communicates with the first host through the RDMA Send&Recv primitive; the second host generates a corresponding work queue element and puts it into the sending queue; the first host takes a cache block from the small message cache area in the last-level cache module and generates a corresponding work queue element and puts it into the shared receiving queue;
[0087] Specifically, the cache space used for data reception under RDMA communication is allocated in the last-level cache module, and the small message cache area and the large message cache area share the cache space; the cache space size of the last-level cache module = network bandwidth * data residence time threshold * proportion of residence data that needs to be processed in the cache space.
[0088] The first host takes a cache block from the small message cache area in the final cache module and generates a corresponding work queue element and puts it into the shared receive queue. The second host generates a corresponding work queue element request and puts it into the send queue, where the data threshold for distinguishing message types is set to 4KB. Each work queue element in the shared receive queue points to a cache block of 4KB in the final cache module.
[0089] The cache in the last level cache module is determined according to the actual CPU structure. If the last level cache of the CPU is L3 cache, the cache is allocated in the L3 cache; if the last level cache of the CPU is L4 cache, the cache is allocated in the L4 cache.
[0090] The cache space allocated in the last-level cache module is exclusively used for data reception under RDMA communication and cannot be used for other purposes. That is, the cache space is isolated, and the small message cache area and the large message cache area share a cache space, but there is a minimum occupied space threshold between the two. When one side is lower than the threshold set by itself, the other side is refused to continue to occupy the cache space. The size of the minimum occupied space threshold is determined according to the request frequency of small and large messages in the actual business.
[0091] The cache space management of the small message cache area and the large message cache area in the last-level cache module uses the SLAB algorithm based on object management, and the object granularity of management is 4KB. The small message cache area pre-allocates a fixed number of cache blocks, and the number of pre-allocated cache blocks is related to the set space threshold and the actual small message request frequency. The SLAB (Sequential Locality Allocation Buffer) algorithm is an efficient algorithm for memory management, which is used to improve the efficiency of memory allocation and release and reduce memory fragmentation. The algorithm divides the memory into different cache blocks and selects the appropriate block for allocation according to the size of the object, thereby avoiding frequent memory allocation and release operations and improving memory utilization.
[0092] For the communication of RDMA Send / Recv primitives, before data transmission, the receiver will check whether there is a free cache block in the small message buffer. If so, it will generate a corresponding work queue element and notify the other end to send data.
[0093] In the communication of the above primitives, after each data packet arrives at the corresponding area of the cache, the cache monitor immediately notifies the application to process the data through the shared cache mapping with the application. After the application completes the processing, it notifies the cache monitor through the shared cache mapping to release and recycle the cache that has been used for further use. If the data processing time exceeds the maximum residence time, the cache monitor copies the data to the main memory and notifies the application, and releases and recycles the cache occupied by the data for further use.
[0094] When the application processes data, it uses multithreading and pipeline technology to process the data arriving at the cache. The data received by the data receiving cache pool in LLC is managed with a granularity of 4KB using the SLAB algorithm, that is, each incoming data packet is cut into small packets no larger than 4KB and then input into a data processing pipeline for processing. The pipeline includes three stages: data storage, data processing, and data release. It uses multithreaded parallel processing. After a granular data goes through three stages, the corresponding cache space is released immediately without waiting for the entire message to be processed by the application.
[0095] S4: The first host determines whether there are any remaining cache blocks or free caches in the small message cache area;
[0096] S5: If there are no remaining cache blocks and free cache in the small message cache area, the first host rejects the communication request of the second host;
[0097] S6: If there are remaining cache blocks or free caches in the small message cache area, the second host takes out the message to be transmitted according to the main memory message storage address pointed to by the work queue element and sends it to the first host. The first host transmits the message to be transmitted to the prepared cache space according to the address pointed to by the work queue element in the shared receiving queue, and executes S11;
[0098] Specifically, the data address translation and permission protection functions are provided by the main memory translation table (MTT) and the main memory protection table (MPT), respectively. At the same time, huge page technology, physical segment technology, and traffic locality technology are used to shrink the table structure and store these two tables in the network card storage medium.
[0099] S7. After determining that the message type of the message to be transmitted is a large message, the second host communicates with the first host through an RDMA Read / Write primitive, and the first host determines the required capacity size of the message to be transmitted;
[0100] Specifically, the required capacity of the message to be transmitted = the amount of data to be sent * the data residence time threshold, and the data residence time threshold is set to 200 microseconds.
[0101] For RDMA Read / Write primitive communication, before data transmission, the receiver will calculate the buffer capacity required to receive the data. If the remaining buffer space in the large message buffer is greater than or equal to the required capacity, the buffer space is allocated and the peer is notified to send the data. Before the message is sent, it will be divided into data packets according to the preset maximum transmission unit size.
[0102] In the communication of the above primitives, after each data packet arrives at the corresponding area of the cache, the cache monitor immediately notifies the application to process the data through the shared cache mapping with the application. After the application completes the processing, it notifies the cache monitor through the shared cache mapping to release and recycle the cache that has been used for further use. If the data processing time exceeds the maximum residence time, the cache monitor copies the data to the main memory and notifies the application, and releases and recycles the cache occupied by the data for further use.
[0103] When the application processes data, it uses multi-threading and pipeline technology to process the data arriving at the cache. The data received by the data receiving cache pool in LLC is managed with a granularity of 4KB using the SLAB algorithm, that is, each incoming data packet is cut into small packets no larger than 4KB and then input into a data processing pipeline for processing. The pipeline includes three stages: data storage, data processing, and data release. It uses multi-threaded parallel processing. After a granular data goes through three stages, the corresponding cache space is released immediately without waiting for the entire message to be processed by the application.
[0104] S8. The first host determines whether the required capacity of the message to be transmitted satisfies the remaining storage space;
[0105] S9. If the required capacity of the message to be transmitted is greater than the remaining storage space, the first host rejects the communication request of the second host;
[0106] S10, if the required capacity of the message to be transmitted is less than or equal to the remaining storage space, the first host allocates capacity in the large message buffer according to the required capacity, and the second host divides the message to be sent into multiple data packets for transmission, and executes S11 immediately after each data packet arrives at the large message buffer of the first host;
[0107] Specifically, the message to be sent is divided into several data packets no larger than 256KB and sent.
[0108] The first host allocates the required capacity from the large message buffer area, and the second host divides the message to be sent into multiple data packets for transmission, each of which is no larger than 256KB.
[0109] As soon as each data packet arrives at the large message buffer of the first host, it proceeds to the next step without waiting for the message to be completely transmitted.
[0110] S11, when the cache area in the last-level cache module receives the data, the cache area notifies the application to process the data through a shared cache mapping with the application;
[0111] Specifically, data is pipelined through multi-threading and pipeline technology.
[0112] The specific details of the multi-thread and pipeline technology for data pipeline processing are as follows: the last-level cache module divides the incoming data into 4KB granularity, and the divided data undergoes three stages: data storage, data processing, and data release, and multi-thread parallel processing is used to form a data processing pipeline. After a granularity of data has gone through the three stages, the cache monitoring module immediately releases and reclaims the corresponding cache space, without waiting for the entire message to be processed by the application before releasing and reclaiming the cache space.
[0113] S12, if the residence time of the data in the last-level cache module is greater than the data residence time threshold, unloading the data of the message to the receiving buffer of the main memory, and informing the application of the relevant information, and the application subsequently retrieves the data from the main memory and processes it;
[0114] Specifically, for the unloaded data, the cache monitoring module reclaims and releases the corresponding cache space.
[0115] S13: If the residence time of the data in the last-level cache module is less than or equal to the data residence time threshold, it is determined that the processing is completed.
[0116] Specifically, if the residence time of the data in the last-level cache module is less than the data residence time threshold, the data leaves the pipeline and the processing is considered completed. Without waiting for the processing result, the cache monitoring module reclaims and releases the corresponding cache space.
[0117] Furthermore, before S1, the method further includes:
[0118] The first host establishes RDMA communication with the second host and initializes communication resources, including queue pair numbers and data cache addresses of both parties;
[0119] The initialization of communication resources is completed through socket communication or RDMA connection manager.
[0120] Specifically, the communication resources are initialized including information such as the queue pair numbers of both parties, data cache addresses, etc. The data of both parties are sent from the main memory, and the last level cache receives the data.
[0121] Exemplarily, assuming that the second host needs to transmit information to the first host, the initialization of communication resources can be completed through socket communication or RDMA connection manager.
[0122] The queue pair context is stored in the network card storage medium. The queue pair scheduler is responsible for scheduling the ready queue pairs, and the work queue element mover is responsible for taking out the work queue elements of the ready queue pairs in batches from the main memory each time.
[0123] In LLC, an isolated cache is allocated according to network bandwidth and business complexity as a cache pool for data reception. In order to improve the statistical multiplexing level of LLC, the present invention adopts different RDMA operations and control methods for small messages and large messages respectively. For small messages, RDMA SEND / RECV is selected, and the receiving queue is aggregated using a shared receiving queue mechanism; for large messages, RDMA READ / WRITE is used, and the required cache is allocated according to the product of the message size and the data residence time threshold. The two share the cache space of the data receiving cache pool, and the cache resource monopoly is avoided by setting the usage threshold of the two types of messages.
[0124] Compared with the data direct IO access (Data Direct Input Output) technology without cache isolation, the present invention increases the hit throughput by an average of 1.6 times, the network throughput by an average of 5%, and the main memory bandwidth usage by an average of 5%. At the same time, according to Little's law, the size of the buffer used for data reception is limited to solve the mismatch between the small size of the reserved LLC and the inefficient reservation of the RDMA queue pair, and only a small cache is needed to support high bandwidth requirements.
[0125] For example, for a bandwidth of 200 Gbps, when the data residence time threshold is 200 microseconds, the present invention only needs 5 MB of cache space to support the demand.
[0126] In order to better understand the specific details and features of a remote memory access data transmission method of the present invention when receiving a small message, combined with Figure 2 Detailed instructions, including steps 1 to 6:
[0127] Step 1: Prepare resources for communication between the two parties, including constructing a queue pair, obtaining the queue pair number, data cache address and other information of the other end, and the two parties use a reliable connector to establish a connection; after the establishment is completed, the second host applies for a data sending request to the first host, informing it that a small message is about to be sent, and the second host will use the RDMA Send primitive to send data.
[0128] Step 2: The first host receives the data sending request from the second host, determines that the request is for a small message, and uses the RDMA Recv primitive to receive data. The application in the first host checks whether there are any free cache blocks or free caches in the small message buffer area in the LLC. If not, the corresponding work queue element receiving request is rejected. If there are free cache blocks or free caches, the corresponding receiving cache block is allocated, and the application generates a corresponding work queue element pointing to the cache block, and stores the work queue element in the receiving queue of the main memory, waiting for the network card program to extract it.
[0129] Step 3: After the first host is ready to receive the data buffer block and work queue element, it notifies the second host that it can send data. After receiving the data, the second host replies with an acknowledgment (ACK), and the first host polls the completion queue to confirm that the other end has received the information.
[0130] Step 4: The second host puts the corresponding sending request into the sending queue in the form of a work queue element, and the work queue element points to the data information to be sent in the main memory, including the address, length, etc. When the program on the network card obtains the work queue element from the main memory and executes it, the data to be sent is transferred to the network card receiving queue of the first host according to the information stored in the work queue element. The first host takes out the corresponding work queue element from the shared receiving queue and transfers the data from the receiving queue to the cache block allocated in advance in the small message buffer area.
[0131] Step 5: As soon as the transmitted data reaches the corresponding cache block in the last-level cache, the application processes the data through multi-threading and pipelining techniques.
[0132] Step 6: As soon as the data leaves the pipeline, the application notifies the cache monitor through the shared cache mapping to reclaim the cache block for further use.
[0133] In order to better understand the specific details and features of a remote memory access data transmission method of the present invention when receiving a large message, combined with Figure 3 A detailed description is given, including RDMA Read and RDMA Write:
[0134] The RDMA Read process includes steps 1 to 5:
[0135] Step 1: Prepare the resources for communication between the two parties, including constructing a queue pair, obtaining the queue pair number, data address and other information of the other end, and the first host notifies the second host that it needs to perform an RDMA Read operation and prepares the data to be read. The second host places the data to be read in the registered area of the main memory, notifies the first host that the data to be read is ready, and informs the main memory information and permissions for storage.
[0136] Step 2: The first host checks whether the large message buffer area in the last-level cache has enough capacity to receive the data to be read. If yes, it generates a corresponding Read work queue element request and puts it into the send queue. When the program on the network card obtains the work queue element from the main memory and executes it, the first host sends a Read request to the second host, which contains the target main memory address of the data to be read, the data size, access rights and other information.
[0137] Step 3: After the second host receives the RDMA Read request sent by the first host, the network card of the second host obtains data from the corresponding area in the main memory according to the information in the request and divides it into data packets according to the set packet size and sends it to the network card receiving queue of the first host. When each data packet arrives at the network card of the first host, the first host replies with an ACK confirmation to indicate that the data has been received.
[0138] Step 4: When the network card of the first host sends the transmitted data packet from RX to the corresponding cache area of the last-level cache with a granularity of 4KB, the application immediately processes the data through multi-threading and pipeline technology as soon as the data arrives.
[0139] Step 5: As soon as the data leaves the pipeline, the application notifies the cache monitor through the shared cache mapping to reclaim the cache for further use.
[0140] The RDMA Write process includes steps 6 to 11:
[0141] Step 6: Prepare resources for communication between the two parties, including constructing a queue pair and obtaining the queue pair number, data address and other information of the other end.
[0142] Step 7: The second host sends a Write request, which includes relevant information about the data to be written.
[0143] Step 8: After receiving the request, the first host checks whether the large message buffer area in the last-level cache of the first host has enough capacity to receive the data to be written based on the relevant information provided. After finding enough buffer, the first host replies with an ACK to notify the second host to write the data. The reply contains information such as the cache address and access rights of the data to be written.
[0144] Step 9: The second host prepares the data to be written from the main memory and places it in the registered main memory area. The network card of the second host divides the data to be written according to the set packet size and sends it to the network card receiving queue of the first host.
[0145] Step 10: When the network card of the first host sends the transmitted data packet from the receiving queue to the corresponding cache area of the last-level cache with a granularity of 4KB, the application immediately processes the data through multi-threading and pipeline technology as soon as the data arrives.
[0146] Step 11: As soon as the data leaves the pipeline, the application notifies the cache monitor through the shared cache mapping to reclaim the cache for further use.
[0147] In one embodiment, a remote communication device is provided, the device comprising:
[0148] The request module is used to generate a communication request when the second host needs to send a message to be transmitted to the first host;
[0149] The message type determination module is used to determine the message type of the message to be transmitted, and the message type includes a large message and a small message;
[0150] The small message transmission module is used to determine that the message type of the message to be transmitted is a small message, and then the second host communicates with the first host through the RDMA Send&Recv primitive; the second host generates a corresponding work queue element and puts it into the sending queue; the first host takes out a cache block from the small message cache area in the final cache module and generates a corresponding work queue element and puts it into the shared receiving queue, and determines whether there are remaining cache blocks or free caches in the small message cache area; if there are no remaining cache blocks and free caches in the small message cache area, the communication request from the second host to the first host is rejected; if there are remaining cache blocks or free caches in the small message cache area, the second host takes out the message to be transmitted according to the main memory message storage address pointed to by the work queue element and sends it to the first host, and the first host transmits the message to be transmitted to the prepared cache space according to the address pointed to by the work queue element in the shared receiving queue;
[0151] The large message transmission module is used to determine that the message type of the message to be transmitted is a large message, and then the second host communicates with the first host through the RDMA Read / Write primitive. The first host determines the required capacity of the message to be transmitted, and determines whether the required capacity of the message to be transmitted meets the remaining storage space; if the required capacity of the message to be transmitted is greater than the remaining storage space, the communication request from the second host to the first host is rejected; if the required capacity of the message to be transmitted is less than or equal to the remaining storage space, the first host allocates capacity in the large message buffer area according to the required capacity, and the second host divides the message to be sent into multiple data packets for transmission;
[0152] The transmission processing module is used to notify the application to process the data through the shared cache mapping with the application after the cache area in the last-level cache module receives the data; if the residence time of the data in the last-level cache module is greater than the data residence time threshold, the data of the message is unloaded to the receiving buffer of the main memory, and the relevant information is notified to the application, and the application subsequently retrieves the data from the main memory and processes it; if the residence time of the data in the last-level cache module is less than the data residence time threshold, it is determined that the processing is completed.
[0153] In one embodiment, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following steps:
[0154] S1, a message to be transmitted that the second host needs to send to the first host;
[0155] S2. The second host determines the message type of the message to be transmitted, where the message type includes a large message and a small message;
[0156] S3. After determining that the message type of the message to be transmitted is a small message, the second host communicates with the first host through the RDMA Send&Recv primitive; the second host generates a corresponding work queue element and puts it into the sending queue; the first host takes a cache block from the small message cache area in the last-level cache module and generates a corresponding work queue element and puts it into the shared receiving queue;
[0157] S4: The first host determines whether there are any remaining cache blocks or free caches in the small message cache area;
[0158] S5: If there are no remaining cache blocks and free cache in the small message cache area, the first host rejects the communication request of the second host;
[0159] S6: If there are remaining cache blocks or free caches in the small message cache area, the second host takes out the message to be transmitted according to the main memory message storage address pointed to by the work queue element and sends it to the first host. The first host transmits the message to be transmitted to the prepared cache space according to the address pointed to by the work queue element in the shared receiving queue, and executes S11;
[0160] S7. After determining that the message type of the message to be transmitted is a large message, the second host communicates with the first host through an RDMA Read / Write primitive, and the first host determines the required capacity size of the message to be transmitted;
[0161] S8. The first host determines whether the required capacity of the message to be transmitted satisfies the remaining storage space;
[0162] S9. If the required capacity of the message to be transmitted is greater than the remaining storage space, the first host rejects the communication request of the second host;
[0163] S10, if the required capacity of the message to be transmitted is less than or equal to the remaining storage space, the first host allocates capacity in the large message buffer according to the required capacity, and the second host divides the message to be sent into multiple data packets for transmission, and executes S11 immediately after each data packet arrives at the large message buffer of the first host;
[0164] S11, when the cache area in the last-level cache module receives the data, the cache area notifies the application to process the data through a shared cache mapping with the application;
[0165] S12, if the residence time of the data in the last-level cache module is greater than the data residence time threshold, unloading the data of the message to the receiving buffer of the main memory, and informing the application of the relevant information, and the application subsequently retrieves the data from the main memory and processes it;
[0166] S13: If the residence time of the data in the last-level cache module is less than or equal to the data residence time threshold, it is determined that the processing is completed.
[0167] like Figure 4 As shown, the electronic device 500 includes a processor 501, and the processor 501 can run a computer program in a readable storage medium 503 or run a computer program loaded from a storage unit 508 to the readable storage medium 503 to implement the functions described in the present invention.
[0168] The PCIe bus 505 in the device 500 is connected to the internal bus 504. The various components in the device 500 interact with these two types of buses. The components connected to the PCIe bus include an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as a display, a speaker, etc.; a storage unit 508, such as a disk, an optical disk, etc.; a communication unit 509, including a network card, a network card storage area, and a processing unit; the network card storage medium stores a computer program, and the processing unit on the network card executes the embodiment of the present invention by running the computer program therein. The communication unit 509 allows the device 500 to exchange information / data with other devices through a computer network such as the Internet. The communication unit 509 can be implemented in computer hardware, firmware, software, and / or a combination thereof, such as a digital electronic circuit system, an integrated circuit system, a field programmable gate array (FPGA), an application-specific integrated circuit (ASIC), an application-specific standard product (ASSP), a system on a chip (SOC), a complex programmable logic device (CPLD), etc.
[0169] In one embodiment, a computer-readable storage medium is provided, storing a computer program, wherein when the computer program is executed by a processor, the processor performs the following steps:
[0170] S1, a message to be transmitted that the second host needs to send to the first host;
[0171] S2. The second host determines the message type of the message to be transmitted, where the message type includes a large message and a small message;
[0172] S3. After determining that the message type of the message to be transmitted is a small message, the second host communicates with the first host through the RDMA Send&Recv primitive; the second host generates a corresponding work queue element and puts it into the sending queue; the first host takes a cache block from the small message cache area in the last-level cache module and generates a corresponding work queue element and puts it into the shared receiving queue;
[0173] S4: The first host determines whether there are any remaining cache blocks or free caches in the small message cache area;
[0174] S5: If there are no remaining cache blocks and free cache in the small message cache area, the first host rejects the communication request of the second host;
[0175] S6: If there are remaining cache blocks or free caches in the small message cache area, the second host takes out the message to be transmitted according to the main memory message storage address pointed to by the work queue element and sends it to the first host. The first host transmits the message to be transmitted to the prepared cache space according to the address pointed to by the work queue element in the shared receiving queue, and executes S11;
[0176] S7. After determining that the message type of the message to be transmitted is a large message, the second host communicates with the first host through an RDMA Read / Write primitive, and the first host determines the required capacity size of the message to be transmitted;
[0177] S8. The first host determines whether the required capacity of the message to be transmitted satisfies the remaining storage space;
[0178] S9. If the required capacity of the message to be transmitted is greater than the remaining storage space, the first host rejects the communication request of the second host;
[0179] S10, if the required capacity of the message to be transmitted is less than or equal to the remaining storage space, the first host allocates capacity in the large message buffer according to the required capacity, and the second host divides the message to be sent into multiple data packets for transmission, and executes S11 immediately after each data packet arrives at the large message buffer of the first host;
[0180] S11, when the cache area in the last-level cache module receives the data, the cache area notifies the application to process the data through a shared cache mapping with the application;
[0181] S12, if the residence time of the data in the last-level cache module is greater than the data residence time threshold, unloading the data of the message to the receiving buffer of the main memory, and informing the application of the relevant information, and the application subsequently retrieves the data from the main memory and processes it;
[0182] S13: If the residence time of the data in the last-level cache module is less than or equal to the data residence time threshold, it is determined that the processing is completed.
[0183] The computer readable storage medium includes a receiving storage medium, a readable storage medium or a network card storage medium. The receiving storage medium stores data sent by the network card. The readable storage medium and the network card storage medium store computer programs to implement the data communication method based on remote direct data access described in the present invention.
[0184] Specifically, the receiving storage medium may be any entity or recording medium capable of receiving data sent by the network card, including static random access memory (SRAM), embedded dynamic random access memory (eDRAM), etc. The readable storage medium may be any entity or recording medium capable of carrying the computer program instructions, including a USB flash drive, a mobile hard disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), etc. The network card storage medium may be any entity or recording medium capable of carrying the computer program instructions and combined with the network card, including a field programmable gate array (FPGA), static random access memory (SRAM), flash memory, electronically erasable programmable read-only memory (EEPROM), etc.
[0185] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0186] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A data transmission method for remote memory access, characterized in that: Applied to a remote communication device, the remote communication device managing a last-level cache module; The last-level cache module is provided with a cache area, the cache area includes a small message cache area and a large message cache area, the small message cache area and the large message cache area share the cache space of the cache area, and the small message cache area is divided into a preset number of cache blocks of a preset data threshold size for management; The method comprises: S1. The second host needs to send a message to be transmitted to the first host; S2. The second host determines the message type of the message to be transmitted, where the message type includes a large message and a small message; the determining the message type of the message to be transmitted specifically includes: comparing the size of the message to be transmitted with the data threshold, and determining the message type according to the comparison result; if the size of the message to be transmitted is less than or equal to the data threshold, determining the message type to be a small message; if the size of the message to be transmitted is greater than the data threshold, determining the message type to be a large message; After determining that the message type of the message to be transmitted is the small message, executing step S3; after determining that the message type of the message to be transmitted is the large message, executing step S7; S3, the second host communicates with the first host through the RDMA Send&Recv primitive; the second host generates a corresponding work queue element and puts it into the sending queue, and the work queue element points to the data information to be sent in the main memory, including the address and length; the first host generates a corresponding work queue element and puts it into the shared receiving queue, and each work queue element in the shared receiving queue points to a cache block of 4KB in the last-level cache module; S4: The first host determines whether there are any remaining cache blocks or free caches in the small message cache area; S5: If there are no remaining cache blocks and free cache in the small message cache area, the first host rejects the communication request of the second host; S6: If there are remaining cache blocks or free caches in the small message cache area, a receiving cache block is allocated, the second host takes out the message to be transmitted according to the main memory message storage address pointed to by the work queue element, and sends it to the first host, and the first host transmits the message to be transmitted to the prepared cache space according to the address pointed to by the work queue element in the shared receiving queue; then S11 is executed; S7, the second host communicates with the first host through RDMA Read / Write primitives, and the first host determines the required capacity size of the message to be transmitted; S8. The first host determines whether the required capacity of the message to be transmitted meets the remaining storage space, where the remaining storage space is the free buffer space in the large message buffer area; S9. If the required capacity of the message to be transmitted is greater than the remaining storage space, the first host rejects the communication request of the second host; S10, if the required capacity of the message to be transmitted is less than or equal to the remaining storage space, the first host allocates capacity in the large message buffer area according to the required capacity, and the second host divides the message to be sent into multiple data packets for transmission, and executes S11 immediately after each data packet arrives at the large message buffer area of the first host; S11, when the cache area in the last-level cache module receives the data, the cache area notifies the application to process the data through a shared cache mapping with the application; S12, if the residence time of the data in the last-level cache module is greater than the data residence time threshold, the data of the message is unloaded to the receiving buffer of the main memory, and the application is informed of the relevant information; the application subsequently retrieves the data from the main memory and processes it; S13: If the residence time of the data in the last-level cache module is less than or equal to the data residence time threshold, it is determined that the processing is completed.
2. The remote memory access data transmission method according to claim 1, characterized in that: Before S1, the method further includes: The first host establishes RDMA communication with the second host and initializes communication resources, including queue pair numbers and data cache addresses of both parties; The initialization of communication resources is completed through socket communication or RDMA connection manager.
3. The remote memory access data transmission method according to claim 1, characterized in that: The data threshold is set to 4KB; each work queue element in the shared receiving queue points to a cache block of 4KB in the last-level cache module.
4. The remote memory access data transmission method according to claim 1, characterized in that: The cache space used for data reception under RDMA communication is allocated in the final cache module, and the small message cache area and the large message cache area share the cache space; the size of the cache space allocated by the final cache module = network bandwidth * data residence time threshold * the proportion of residence data that needs to be processed in the cache space.
5. The remote memory access data transmission method according to claim 1, characterized in that: The first host determines the required capacity size of the message to be transmitted, specifically including: the required capacity of the message to be transmitted = the amount of data to be sent * the data residence time threshold, and the data residence time threshold is set to 200 microseconds.
6. The remote memory access data transmission method according to claim 1, characterized in that: The second host divides the message to be sent into multiple data packets for sending, specifically including: dividing the message to be sent into multiple data packets no larger than 256KB for sending.
7. A remote communication device, characterized in that: The device manages a final level cache module; The last-level cache module is provided with a cache area, the cache area includes a small message cache area and a large message cache area, the small message cache area and the large message cache area share the cache space of the cache area, and the small message cache area is divided into a preset number of cache blocks of a preset data threshold size for management; The device comprises: A request module, used for generating a communication request when the second host needs to send a message to be transmitted to the first host; A message type determination module is used to determine the message type of the message to be transmitted, wherein the message type includes a large message and a small message; the determining the message type of the message to be transmitted specifically includes: comparing the size of the message to be transmitted with the data threshold, and determining the message type according to the comparison result; if the size of the message to be transmitted is less than or equal to the data threshold, determining the message type to be a small message; if the size of the message to be transmitted is greater than the data threshold, determining the message type to be a large message; A small message transmission module, used to respond after determining that the message type of the message to be transmitted is a small message, including: the second host communicates with the first host through the RDMA Send&Recv primitive; the second host generates a corresponding work queue element and puts it into the sending queue, and the work queue element points to the data information to be sent in the main memory, including the address and length; the first host generates a corresponding work queue element and puts it into the shared receiving queue, and each work queue element in the shared receiving queue points to a cache block of 4KB in the last-level cache module; it is determined whether there are remaining cache blocks or free caches in the small message cache area; if there are no remaining cache blocks and free caches in the small message cache area, the communication request from the second host to the first host is rejected; if there are remaining cache blocks or free caches in the small message cache area, a receiving cache block is allocated, and the second host takes out the message to be transmitted according to the main memory message storage address pointed to by the work queue element and sends it to the first host, and the first host transmits the message to be transmitted to the prepared cache space according to the address pointed to by the work queue element in the shared receiving queue; A large message transmission module, used to respond after determining that the message type of the message to be transmitted is a large message, including: the second host communicates with the first host through RDMA Read / Write primitives, the first host determines the required capacity of the message to be transmitted, and judges whether the required capacity of the message to be transmitted meets the remaining storage space, and the remaining storage space is the free cache space in the large message buffer area; if the required capacity of the message to be transmitted is greater than the remaining storage space, the communication request from the second host to the first host is rejected; if the required capacity of the message to be transmitted is less than or equal to the remaining storage space, the first host allocates capacity in the large message buffer area according to the required capacity, and the second host divides the message to be sent into multiple data packets for transmission; The transmission processing module is used to notify the application to process the data through the shared cache mapping with the application after the cache area in the last-level cache module receives the data; if the residence time of the data in the last-level cache module is greater than the data residence time threshold, the data of the message is unloaded to the receiving buffer of the main memory, and the relevant information is notified to the application; the application subsequently retrieves the data from the main memory and processes it; if the residence time of the data in the last-level cache module is less than the data residence time threshold, it is determined that the processing is completed.
8. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor is caused to execute the steps of the method according to any one of claims 1 to 6.
