A method, system and medium for implementing RDMA service
By encapsulating the abstraction layer on the verbs interface of the RDMA service and providing socket interface semantics functions, it solves the problem that existing software using socket interfaces is difficult to implement RDMA services, and achieves efficient data transmission and system performance improvement.
Patent Information
- Application Number
- CN202411766338.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2044-12-04
AI Technical Summary
Existing software that uses socket interfaces is difficult to implement RDMA services and fails to fully utilize the advantages of RDMA services.
The abstract layer is encapsulated on the verbs interface of the RDMA service, providing socket interface semantics functions, and calling the verbs interface through the abstract layer to cache data to the RDMA memory area, and serialize or deserialize storage or send.
It realizes the provision of RDMA services on existing software using socket interfaces, supports zero copy and kernel bypass features, and improves network bandwidth utilization and system performance.
Smart Images

Figure CN119248538B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network communication technology, and in particular to a method, system and medium for implementing an RDMA service. Background Art
[0002] Distributed computing and storage are crucial in scenarios such as data analysis and machine learning training. Distributed computing and storage also have very high requirements for network bandwidth services. Low-speed networks often become bottlenecks for the entire project. RDMA (Remote Direct Memory Access) services have advantages such as protocol stack unloading, zero copy, and kernel bypass. Verbs API is the programming interface for RDMA services. This interface is different from the commonly used network programming interface socket. It is purely asynchronous and provides remote memory access semantics.
[0003] Most of the existing software uses the TCP / IP socket interface, but the socket interface and the verbs interface do not correspond one to one. Therefore, it is difficult for the existing software using the socket interface to use the RDMA service, or it is difficult to fully utilize the advantages of the RDMA service.
[0004] Currently, no effective solution has been proposed for the problem of how to implement RDMA service on existing software using socket interface in the related technology. Summary of the invention
[0005] The embodiments of the present application provide a method, system and medium for implementing an RDMA service, so as to at least solve the problem in the related art of how to implement the RDMA service on the existing software using the socket interface.
[0006] In a first aspect, an embodiment of the present application provides a method for implementing an RDMA service, wherein an abstract layer for providing a socket interface semantic function is encapsulated on the verbs interface of the RDMA service, and the method includes a data receiving stage and a data sending stage, wherein the data receiving stage includes:
[0007] By using the socket interface semantic function in the abstract layer, the verbs interface is called to cache the data received from the sender into the RDMA memory area;
[0008] The data in the RDMA memory area is directly read for serialization, and the serialized data is stored in a preset database, wherein the preset database is a database using a socket interface.
[0009] In some embodiments, the data sending phase includes:
[0010] Through the socket interface semantic function in the abstract layer, the verbs interface is called to cache the data in the preset database into the RDMA memory area;
[0011] The data in the RDMA memory area is directly read for deserialization, and the deserialized data is sent to the receiver, wherein the preset database is a database using a socket interface.
[0012] In some embodiments, before the data receiving phase and the data sending phase, the method includes:
[0013] A credit-based flow control method is used to establish an RDMA link between a sender and a receiver to prevent data transmitted through the RDMA link from exceeding the processing limit of the receiver.
[0014] In some embodiments, establishing an RDMA link between a sender and a receiver in a credit-based flow control manner includes:
[0015] Establishing an RDMA link between a sender and a receiver, wherein the sender and the receiver exchange credit information during the connection establishment process, wherein the credit information corresponds to the size of the RDMA memory area;
[0016] During data transmission via the RDMA link, the sender controls the amount of data sent according to the credit information of the receiver to prevent the amount of data from exceeding the size of the RDMA memory area of the receiver.
[0017] In some of the embodiments, the network event processing framework of the data receiving phase and the data sending phase is a multi-threaded run-to-complete network event processing framework.
[0018] In some embodiments, the method comprises:
[0019] In the data receiving phase and the data sending phase, each network packet processing and corresponding business logic processing in the data transmission request are executed by the same event loop thread, that is, multiple event loop threads separately execute different network packet processing and corresponding business logic processing.
[0020] In some of these embodiments, all RDMA links are maintained by a centralized multi-version link management mechanism.
[0021] In some embodiments, the preset database is a DolphinDB database.
[0022] In a second aspect, an embodiment of the present application provides a system for implementing an RDMA service, the system being used to execute the method described in any one of the first aspects above, the system comprising a sender and a receiver;
[0023] The receiver is used to call the verbs interface to cache the data received from the sender into the RDMA memory area through the socket interface semantic function in the abstract layer;
[0024] The receiver is used to directly read the data in the RDMA memory area for serialization, and store the serialized data in a preset database, wherein the preset database is a database using a socket interface;
[0025] The sender is used to call the verbs interface to cache the data in the preset database into the RDMA memory area through the socket interface semantic function in the abstract layer;
[0026] The sender is used to directly read the data in the RDMA memory area for deserialization, and send the deserialized data to the receiver, wherein the preset database is a database using a socket interface.
[0027] In a third aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect above.
[0028] Compared with the related art, the embodiments of the present application provide an implementation method, system and medium of an RDMA service, wherein in the method, an abstract layer for providing socket interface semantic functions is encapsulated on the verbs interface of the RDMA service, and the method includes a data receiving stage and a data sending stage. In the data receiving stage, the verbs interface is called to cache the data received from the sender to the RDMA memory area through the socket interface semantic functions in the abstract layer; the data in the RDMA memory area is directly read for serialization, and the serialized data is stored in a preset database, wherein the preset database is a database using the socket interface. Through the method, the abstract layer is encapsulated on the verbs interface to provide socket semantics, thereby providing RDMA services for existing databases using the socket interface, and further collaboratively extending the serialization and deserialization of the socket interface and the database to support the zero copy and kernel bypass characteristics of the RDMA service, thereby solving the problem of how to implement RDMA services on existing software using the socket interface. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0030] Figure 1 The following is a step flow of the RDMA service implementation method according to the embodiment of the present application: Figure 1 ;
[0031] Figure 2 The following is a step flow of the RDMA service implementation method according to the embodiment of the present application: Figure 2 ;
[0032] Figure 3 It is a schematic diagram of the internal structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0034] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as insufficient content disclosed in this application.
[0035] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0036] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantity limitation, and may indicate the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0037] The embodiment of the present application provides a method for implementing an RDMA service. An abstract layer for providing a socket interface semantic function is encapsulated on the verbs interface of the RDMA service. The method includes a data receiving stage and a data sending stage. Figure 1 The following is a step flow of the RDMA service implementation method according to the embodiment of the present application: Figure 1 ,like Figure 1 As shown, the data receiving stage includes the following steps:
[0038] Step S102, calling the verbs interface to cache the data received from the sender into the RDMA memory area through the socket interface semantic function in the abstract layer;
[0039] It should be noted that since most existing programs, including databases (such as DolphinDB), use TCP / IP socket interfaces, due to the differences between verbs and sockets, applications cannot be directly migrated from sockets to verbs, that is, they cannot directly use RDMA services. In order to minimize application modifications, an abstraction layer is encapsulated on top of the RDMA verbs interface to provide socket semantics.
[0040] Before step S102, the method includes step S101, establishing an RDMA link between a sender and a receiver based on a credit-based flow control method to prevent data transmitted through the RDMA link from exceeding a processing limit of the receiver.
[0041] Specifically, step S101 establishes an RDMA link between the sender and the receiver. During the connection establishment process, the sender and the receiver exchange credit information, wherein the credit information corresponds to the size of the RDMA memory area. During data transmission through the RDMA link, the sender controls the amount of data sent according to the credit information of the receiver to avoid the amount of data exceeding the size of the receiver's RDMA memory area.
[0042] It should be noted that a credit based flow control method is implemented. The two RDMA communication parties will exchange credit information during the link establishment phase, and each party will allocate a corresponding RDMA memory area for the credit. During the communication process, the sender controls the amount of data sent based on the current credit to avoid exceeding the capacity of the receiving end. After receiving the data, the receiving end does not immediately update the sender's credit, but delays the update based on the set threshold. For example, assume that the default maximum credit is 128. Only when the credit decreases to a certain value (the default is 64) will an update be triggered. At the same time, even if the sender continues to send data, updating the credit every 64 data will prevent the sender from stopping sending due to insufficient credit. The number of network communications is greatly reduced. With flow control, the memory usage during application communication can be controlled, and data accumulation due to mismatch in processing rates between the two communicating parties will not occur.
[0043] Preferably, the network event processing framework in the data receiving stage is a multi-threaded run-to-complete network event processing framework. In the data receiving stage, each network packet processing and corresponding business logic processing in the data transmission request are executed by the same event loop thread, that is, multiple event loop threads execute different network packet processing and corresponding business logic processing separately.
[0044] It should be noted that the original network event processing framework is to process the network packet through the event loop thread, and then transfer the task to the additional thread pool through the queue to perform business logic processing. This additional queue will introduce redundant locks, and easily lead to cache failure between threads and switching overhead between threads; at the same time, because the thread needs to process business logic in addition to processing network packets, if the business logic takes a long time, it will block the processing of all network packets. Therefore, this embodiment modifies the original network event processing framework. A multi-threaded run-to-complete event processing framework is implemented. Under this framework, after the event loop thread processes the network packet, it processes the business logic in the same thread, avoiding additional queue overhead and thread switching overhead, and also maximizing CPU cache utilization; and it has increased from the original single thread to multi-threading, avoiding the problem of global jamming caused by the single-threaded event loop.
[0045] Further preferably, all RDMA links are maintained by a centralized multi-version link management mechanism.
[0046] It should be noted that all RDMA links are maintained by a centralized multi-version link management mechanism, which not only provides a unified management entry, but also avoids the overhead of centralized manager lock competition between threads in high-concurrency scenarios, thereby improving scalability. In other words, the centralized multi-version link management mechanism is a lock-free hash table data structure. The key value contains the socket file descriptor and the global incrementing id, and the multiple versions come from the global incrementing id stored additionally in the key value. Because the file descriptors of the operating system can be reused, assuming that a worker that has entered an RDMA link is running, and at this time another thread closes the RDMA link and creates a new RDMA link with the same file descriptor, the previous worker will get this new, unexpected link if it only relies on the file descriptor, so a multi-version mechanism is added.
[0047] Step S104, directly read the data in the RDMA memory area for serialization, and store the serialized data in a preset database, wherein the preset database is a database using a socket interface, and the preset database is preferably a DolphinDB database.
[0048] It should be noted that the traditional socket interface call is a system call, which involves switching from the operating system user state to the operating system kernel state. This process is an overhead that cannot be ignored in the high-speed network card processing process. In other words, the copy of the traditional socket interface from the user state buffer to the kernel state buffer is an overhead that cannot be ignored in high-bandwidth scenarios. While providing socket semantics through encapsulation, this embodiment further collaborates to expand the data serialization process of the socket interface and DolphinDB to support zero copy and kernel bypass. The encapsulated verbs interface maintains an RDMA memory area by itself, and directly operates this memory area during serialization, instead of temporarily storing it in the user buffer and then copying it to the memory required by the network card. During the sending process, using the RDMA service, the network card directly sends the data in the RDMA memory maintained by itself to avoid additional memory copies. Compared with the traditional socket interface, the entire process is completed in the user state and does not involve privilege level conversion between user state / kernel state.
[0049] Through the embodiments of the present application, an abstract layer is encapsulated on the verbs interface to provide socket semantics, thereby providing RDMA services for existing databases that use the socket interface, and further collaboratively extending the socket interface and DolphinDB serialization to support zero-copy and kernel bypass features of the RDMA service, solving the problem of how to implement RDMA services on existing software that uses the socket interface.
[0050] In some of these embodiments, Figure 2 The following is a step flow of the RDMA service implementation method according to the embodiment of the present application: Figure 2 ,like Figure 2 As shown, the data sending phase includes the following steps:
[0051] Step S202, calling the verbs interface to cache the data in the preset database into the RDMA memory area through the socket interface semantic function in the abstract layer;
[0052] Before step S202, the method includes step S201, establishing an RDMA link between a sender and a receiver based on a credit-based flow control method to prevent data transmitted through the RDMA link from exceeding the processing limit of the receiver.
[0053] Specifically, step S201 establishes an RDMA link between the sender and the receiver. During the connection establishment process, the sender and the receiver exchange credit information, wherein the credit information corresponds to the size of the RDMA memory area. During data transmission through the RDMA link, the sender controls the amount of data sent according to the credit information of the receiver to avoid the amount of data exceeding the size of the receiver's RDMA memory area.
[0054] It should be noted that a credit based flow control method is implemented. The two RDMA communication parties will exchange credit information during the link establishment phase, and each party will allocate a corresponding RDMA memory area for the credit. During the communication process, the sender controls the amount of data sent based on the current credit to avoid exceeding the capacity of the receiving end. After receiving the data, the receiving end does not immediately update the sender's credit, but delays the update based on the set threshold. For example, assume that the default maximum credit is 128. Only when the credit decreases to a certain value (the default is 64) will an update be triggered. At the same time, even if the sender continues to send data, updating the credit every 64 data will prevent the sender from stopping sending due to insufficient credit. The number of network communications is greatly reduced. With flow control, the memory usage during application communication can be controlled, and data accumulation due to mismatch in processing rates between the two communicating parties will not occur.
[0055] Preferably, the network event processing framework in the data transmission phase is a multi-threaded run-to-complete network event processing framework. In the data transmission phase, each network packet processing and corresponding business logic processing in the data transmission request are executed by the same event loop thread, that is, multiple event loop threads execute different network packet processing and corresponding business logic processing separately.
[0056] It should be noted that the original network event processing framework is to process the network packet through the event loop thread, and then transfer the task to the additional thread pool through the queue to perform business logic processing. This additional queue will introduce redundant locks, and easily lead to cache failure between threads and switching overhead between threads; at the same time, because the thread needs to process business logic in addition to processing network packets, if the business logic takes a long time, it will block the processing of all network packets. Therefore, this embodiment modifies the original network event processing framework. A multi-threaded run-to-complete event processing framework is implemented. Under this framework, after the event loop thread processes the network packet, it processes the business logic in the same thread, avoiding additional queue overhead and thread switching overhead, and also maximizing CPU cache utilization; and it has increased from the original single thread to multi-threading, avoiding the problem of global jamming caused by the single-threaded event loop.
[0057] Further preferably, all RDMA links are maintained by a centralized multi-version link management mechanism.
[0058] It should be noted that all RDMA links are maintained by a centralized multi-version link management mechanism, which not only provides a unified management entry, but also avoids the overhead of centralized manager lock competition between threads in high-concurrency scenarios, thereby improving scalability. In other words, the centralized multi-version link management mechanism is a lock-free hash table data structure. The key value contains the socket file descriptor and the global incrementing id, and the multiple versions come from the global incrementing id stored additionally in the key value. Because the file descriptors of the operating system can be reused, assuming that a worker that has entered an RDMA link is running, and at this time another thread closes the RDMA link and creates a new RDMA link with the same file descriptor, the previous worker will get this new, unexpected link if it only relies on the file descriptor, so a multi-version mechanism is added.
[0059] Step S204, directly read the data in the RDMA memory area for deserialization, and send the deserialized data to the receiver, wherein the preset database is a database using a socket interface, and the preset database is preferably a DolphinDB database.
[0060] It should be noted that the traditional socket interface call is a system call, which involves switching from the operating system user state to the operating system kernel state. This process is an overhead that cannot be ignored in the high-speed network card processing process. In other words, the copy of the traditional socket interface from the user state buffer to the kernel state buffer is an overhead that cannot be ignored in high-bandwidth scenarios. While providing socket semantics through encapsulation, this embodiment further collaborates to expand the data deserialization process of the socket interface and DolphinDB to support zero copy and kernel bypass. The encapsulated verbs interface maintains an RDMA memory area by itself, and directly operates this memory area during deserialization, instead of temporarily storing it in the user buffer and then copying it to the memory required by the network card. During the sending process, using the RDMA service, the network card directly sends the data in the RDMA memory maintained by itself to avoid additional memory copies. Compared with the traditional socket interface, the entire process is completed in the user state and does not involve privilege level conversion between user state / kernel state.
[0061] Through the embodiments of the present application, an abstract layer is encapsulated on the verbs interface to provide socket semantics, thereby providing RDMA services for existing databases that use the socket interface, and further collaboratively extending the socket interface and DolphinDB deserialization to support zero-copy and kernel bypass features of the RDMA service, solving the problem of how to implement RDMA services on existing software that uses the socket interface.
[0062] The embodiment of the present application provides a system for implementing an RDMA service, the system comprising a sender and a receiver;
[0063] The receiver is used to call the verbs interface to cache the data received from the sender into the RDMA memory area through the socket interface semantic function in the abstraction layer;
[0064] The receiver is used to directly read the data in the RDMA memory area for serialization, and store the serialized data in a preset database, where the preset database is a database using a socket interface;
[0065] The sender is used to call the verbs interface to cache the data in the preset database into the RDMA memory area through the socket interface semantic function in the abstract layer;
[0066] The sender is used to directly read the data in the RDMA memory area for deserialization, and send the deserialized data to the receiver, wherein the preset database is a database using a socket interface.
[0067] Through the sender and receiver in the embodiments of the present application, an abstract layer is encapsulated on the verbs interface to provide socket semantics, thereby providing RDMA services for existing databases using the socket interface, and further collaboratively extending the socket interface and DolphinDB serialization and deserialization to support zero-copy and kernel bypass features of the RDMA service, solving the problem of how to implement RDMA services on existing software using the socket interface.
[0068] This embodiment further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0069] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0070] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0071] In addition, in combination with the implementation method of the RDMA service in the above embodiment, the embodiment of the present application can provide a storage medium for implementation. The storage medium stores a computer program; when the computer program is executed by the processor, any one of the implementation methods of the RDMA service in the above embodiment is implemented.
[0072] In one embodiment, a computer device is provided, which may be a terminal. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a method for implementing an RDMA service is implemented. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a key, trackball, or touchpad provided on the housing of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0073] In one embodiment, Figure 3 is a schematic diagram of the internal structure of an electronic device according to an embodiment of the present application, such as Figure 3As shown, an electronic device is provided, which may be a server, and its internal structure diagram may be as shown in Figure 3 As shown. The electronic device includes a processor, a network interface, an internal memory and a non-volatile memory connected through an internal bus, wherein the non-volatile memory stores an operating system, a computer program and a database. The processor is used to provide computing and control capabilities, the network interface is used to communicate with an external terminal through a network connection, the internal memory is used to provide an environment for the operation of the operating system and the computer program, the computer program is executed by the processor to implement a method for implementing an RDMA service, and the database is used to store data.
[0074] Those skilled in the art will understand that Figure 3 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0075] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0076] Those skilled in the art should understand that the technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described 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.
[0077] 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 invention patent. 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 patent of the present application shall be subject to the attached claims.
Claims
1. A method for implementing an RDMA service, characterized in that: The verbs interface of the RDMA service encapsulates an abstraction layer for providing the semantic functions of the socket interface to establish an RDMA link between the sender and the receiver. All RDMA links are maintained by a centralized multi-version link management mechanism, which is a lock-free hash table data structure. The key value contains the socket file descriptor and the global incrementing id. The multiple versions come from the global incrementing id stored in the key value. The method comprises a data receiving stage and a data sending stage, wherein the data receiving stage comprises: By using the socket interface semantic function in the abstract layer, the verbs interface is called to cache the data received from the sender into the RDMA memory area; Directly read the data in the RDMA memory area for serialization, and store the serialized data in a preset database, wherein the preset database is a database using a socket interface, and the encapsulated verbs interface maintains an RDMA memory area by itself. During serialization, this memory area is directly operated instead of being temporarily stored in the user buffer and then copied to the memory required by the network card; The data sending stage includes: Through the socket interface semantic function in the abstract layer, the verbs interface is called to cache the data in the preset database into the RDMA memory area; Directly read the data in the RDMA memory area for deserialization, and send the deserialized data to the receiver, wherein the preset database is a database using the socket interface, and the encapsulated verbs interface maintains an RDMA memory area by itself. This memory area is directly operated during deserialization, rather than temporarily storing it in the user buffer and then copying it to the memory required by the network card.
2. The method according to claim 1, characterized in that Before the data receiving stage and the data sending stage, the method includes: A credit-based flow control method is used to establish an RDMA link between a sender and a receiver to prevent data transmitted through the RDMA link from exceeding the processing limit of the receiver.
3. The method according to claim 2, characterized in that The credit-based flow control method to establish an RDMA link between the sender and the receiver includes: Establishing an RDMA link between a sender and a receiver, wherein the sender and the receiver exchange credit information during the connection establishment process, wherein the credit information corresponds to the size of the RDMA memory area; During data transmission via the RDMA link, the sender controls the amount of data sent according to the credit information of the receiver to prevent the amount of data from exceeding the size of the RDMA memory area of the receiver.
4. The method according to claim 1, characterized in that: The network event processing framework in the data receiving phase and the data sending phase is a multi-threaded run-to-complete network event processing framework.
5. The method according to claim 4, characterized in that The method comprises: In the data receiving phase and the data sending phase, each network packet processing and corresponding business logic processing in the data transmission request are executed by the same event loop thread, that is, multiple event loop threads separately execute different network packet processing and corresponding business logic processing.
6. The method according to any one of claims 1 to 5, characterized in that: The preset database is the DolphinDB database.
7. A system for implementing RDMA services, characterized in that: The system is used to execute the method according to any one of claims 1 to 6, and the system includes a sender and a receiver; The receiver is used to call the verbs interface to cache the data received from the sender into the RDMA memory area through the socket interface semantic function in the abstract layer; The receiver is used to directly read the data in the RDMA memory area for serialization, and store the serialized data in a preset database, wherein the preset database is a database using a socket interface; The sender is used to call the verbs interface to cache the data in the preset database into the RDMA memory area through the socket interface semantic function in the abstract layer; The sender is used to directly read the data in the RDMA memory area for deserialization, and send the deserialized data to the receiver, wherein the preset database is a database using a socket interface.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
RDMA data flow control method and system, electronic equipment and readable storage medium
CN110750486A
Zero-copy data transmission method based on Rsocket protocol
CN113064846A