Data transmission method and device, computer equipment and readable storage medium
The data transmission method addresses inaccurate memory address writing in RDMA by determining idle memory pages and calculating starting addresses, enhancing cache efficiency and system performance by eliminating redundant data copying.
Patent Information
- Application Number
- CN202411174442.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-12-27
AI Technical Summary
Existing RDMA technologies require repeated data copying due to inaccurate memory address writing, leading to reduced cache efficiency in storage systems.
A data transmission method that determines a memory page meeting a preset idle condition and calculates a starting address to directly write target data into the target memory via an access network card, improving cache efficiency by avoiding redundant data copying.
Enhances cache efficiency by ensuring accurate data transmission directly to the target memory, reducing redundant copying and improving system performance.
Smart Images

Figure CN119201828A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data transmission method, device, computer equipment and readable storage medium. Background Art
[0002] Remote Direct Memory Access (RDMA) is a direct memory access technology. RDMA allows computers to directly access the memory of other computers without going through the processor. RDMA quickly moves data from one system to the memory of a remote system without affecting the operating system.
[0003] In actual applications, user systems usually use a variety of network communication methods to access storage systems. When user systems use RDMA to access storage systems, the cache module needs to run in user mode. In related technologies, RDMA communication requires the storage system to pre-register the memory required for communication with the RDMA network card. After receiving the corresponding network request, the RDMA network card will directly write the data to the memory address specified by the network request. However, in related technologies, writing data to the memory address specified by the network request does not guarantee that the data is accurately written to the registered address of the RDMA network card. Therefore, the data needs to be copied to the registered address again, resulting in repeated data copying, which will reduce the cache efficiency of the cache module. Summary of the invention
[0004] Based on this, it is necessary to provide a data transmission method, device, computer equipment and readable storage medium that can improve the cache efficiency of the cache module in response to the above technical problems.
[0005] In a first aspect, the present application provides a data transmission method, comprising:
[0006] In response to the cache application request, determining a first memory page in a user state that meets a preset idle condition, and determining a starting address of the first memory page;
[0007] Based on the starting address, an access message is obtained and sent to the access network card; the first target data corresponding to the cache application request is written into the target memory corresponding to the starting address in the access network card through the access network card.
[0008] In this embodiment, by responding to a cache application request, a first memory page that meets a preset free condition is determined, and a starting address of the first memory page is determined; an access message is determined based on the starting address, and the access message is sent to an access network card; the access network card writes the first target data corresponding to the cache application request to the target memory, and sends the first target data to the user system through the access network card to realize data transmission. By using the starting address to determine the access message, the first target data can be directly stored in the target memory of the access network card, thereby improving the cache efficiency of the system.
[0009] In one embodiment, the user state includes multiple memory items, each memory item includes an index item area and a page item area, the index item area includes multiple index items, the page item area includes multiple memory pages, and each index item corresponds to a memory page; determining the starting address of the first memory page includes:
[0010] Determine the position of the target index item in the index item area based on the number of bytes included in the target index item of the first memory page and the index item number of the target index item;
[0011] Determining an offset of the first memory page based on a page size of the memory page and a page number of the target index item;
[0012] The starting address of the first memory page is calculated based on the address of the initial index item, the position of the target index item in the memory item, and the offset of the first memory page.
[0013] In this embodiment, the starting address of the first memory page is determined by the byte data contained in the target index item of the first memory page, the index item number, the page size of the memory page, the page label of the target index item and the address of the initial index item, thereby improving the accuracy of the starting address of the memory page and improving the accuracy of subsequent data transmission to the RDMA network card.
[0014] In one embodiment, in response to the cache application request, determining the first memory page in the user state that meets the preset idle condition includes:
[0015] In response to the cache application request, a password identifier is added to any memory item in the user state, a first memory page in the user state that meets a preset idle condition is determined, and the password identifier of the memory item corresponding to the first memory page is deleted.
[0016] In this embodiment, by adding a password identifier to the memory item when responding to a cache application request, other cache application requests cannot access the memory item at the same time, thereby improving the accuracy of the cache. In addition, after determining the first memory page, the password identifier of the memory item of the first memory page is deleted, so that other cache application requests can identify other memory pages on the memory item, which is convenient for the subsequent reasonable use of the memory page.
[0017] In one embodiment, the cache application request also includes a write request, the ring queue includes at least a first queue for sending messages from kernel mode to the user mode, the ring queue includes an operation code, and the operation code is used to indicate an operation to be performed on the memory page; the method further includes:
[0018] In response to the write request, determining a second memory page in kernel mode that meets the preset idle condition, and writing second target data corresponding to the write request into the shared physical memory through the second memory page;
[0019] Sending the write request from the kernel state to the user state through the operation code in the first queue;
[0020] A third memory page corresponding to the second memory page is determined based on the user state, second target data is read from the shared physical memory through the third memory page, and the second target data in the third memory page is output.
[0021] In this embodiment, by using a circular queue, only write requests are transmitted from kernel state to user state, ensuring that data in kernel state does not need to be repeatedly copied to be read by user state, thereby improving the storage system's ability to utilize the CPU.
[0022] In one embodiment, the method further comprises:
[0023] In response to the write request, sending the write request to the user state through the access network card, and determining a fourth memory page of the user state that meets the preset idle condition;
[0024] The third target data corresponding to the write request is written into the fourth memory page, and the third target data in the fourth memory page is output.
[0025] In this embodiment, the storage system is accessed in RDMA mode, and with the help of the RDMA network card, the data of the write request of the user system is directly written to the hard disk end through the user state, which reduces the copying of memory data and improves the performance of the storage system.
[0026] In one embodiment, the cache application request further includes a read request, the ring queue further includes a second queue for sending messages from the user state to the kernel state, and the method further includes:
[0027] In response to the read request, determining a fifth memory page of the kernel state that meets the preset idle condition, and sending the read request from the kernel state to the user state through the operation code in the first queue;
[0028] In the user state, a sixth memory page corresponding to the fifth memory page is determined; and fourth target data read from the hard disk and corresponding to the read request is written into the shared physical memory through the sixth memory page;
[0029] Through the operation code in the second queue, the information of the fourth target data written into the shared physical memory is sent to the kernel state, and through the kernel state, the fourth target data is read from the shared physical memory based on the information and sent to the user system based on the first network protocol.
[0030] In this embodiment, a circular queue is used to send request messages from kernel state to user state, and messages from user state to kernel state, without the need to repeatedly copy data, ensuring that only page codes are transmitted during the communication process, thereby improving communication performance.
[0031] In one embodiment, the cache application request further includes a memory borrowing request, and the method further includes:
[0032] Responding to the borrowed memory request, and sending the borrowed memory request from the user state to the kernel state through the second queue;
[0033] Through the kernel state, determine the seventh memory page of the kernel state that meets the preset idle state; if the memory of the seventh memory page does not meet the memory of the borrowed memory request, delete the cold data in the seventh memory page so that the seventh memory page meets the borrowed memory request.
[0034] In this embodiment, when the memory pressure of other modules in the storage system is high, memory can be borrowed from the kernel state by sending a memory borrowing request, thereby improving the processing capability and availability of the storage system.
[0035] In a second aspect, the present application also provides a data transmission device, including:
[0036] A determination module, configured to determine, in response to a cache application request, a first memory page in a user state that meets a preset idle condition, and determine a starting address of the first memory page;
[0037] A sending module is used to obtain an access message based on the starting address and send the access message to the access network card; so as to write the first target data corresponding to the cache application request into the target memory corresponding to the starting address in the access network card through the access network card.
[0038] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0039] In response to the cache application request, determining a first memory page in a user state that meets a preset idle condition, and determining a starting address of the first memory page;
[0040] Based on the starting address, an access message is obtained and sent to the access network card; the first target data corresponding to the cache application request is written into the target memory corresponding to the starting address in the access network card through the access network card.
[0041] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0042] In response to the cache application request, determining a first memory page in a user state that meets a preset idle condition, and determining a starting address of the first memory page;
[0043] Based on the starting address, an access message is obtained and sent to the access network card; the first target data corresponding to the cache application request is written into the target memory corresponding to the starting address in the access network card through the access network card.
[0044] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0045] In response to the cache application request, determining a first memory page in a user state that meets a preset idle condition, and determining a starting address of the first memory page;
[0046] Based on the starting address, an access message is obtained and sent to the access network card; the first target data corresponding to the cache application request is written into the target memory corresponding to the starting address in the access network card through the access network card.
[0047] The above-mentioned data transmission method, device, computer equipment and readable storage medium determine the first memory page that meets the preset free condition and determine the starting address of the first memory page in response to the cache application request; determine the access message based on the starting address, and send the access message to the access network card; the access network card writes the first target data corresponding to the cache application request to the target memory, and sends the first target data to the user system through the access network card to realize data transmission, and by using the starting address to determine the access message, the first target data can be directly stored in the target memory of the access network card, thereby improving the cache efficiency of the storage system. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0049] Figure 1 An application environment diagram of a data transmission method in an embodiment;
[0050] Figure 2 A schematic diagram of a data transmission method in one embodiment;
[0051] Figure 3 is a schematic diagram of a memory page in a cache module in an embodiment;
[0052] Figure 4 A schematic diagram of a flow chart of page allocation in one embodiment;
[0053] Figure 5 is a schematic diagram of a circular queue in one embodiment;
[0054] Figure 6 A schematic diagram of a flow chart of a data transmission method in an embodiment;
[0055] Figure 7 A schematic diagram of a flow chart of a data transmission method in an embodiment;
[0056] Figure 8 is a structural block diagram of a data transmission device in an embodiment;
[0057] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail 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 used to limit the present application.
[0059] The data transmission method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. The user system can access the storage system through a variety of network protocols. When the user system uses the Transmission Control Protocol (TCP) to access the storage system, the cache module runs in the kernel state; when the user system uses RDMA to access the storage system, the cache module runs in the user state. The user state and the kernel state can be mapped to the same shared physical memory in the physical memory. The data on the hard disk can be pre-loaded into the shared physical memory. The storage system can pre-set future read requests and load related data into the physical memory in advance, which can be accessed by both the user state and the kernel state.
[0060] In an exemplary embodiment, Figure 2 As shown, a data transmission method is provided, which is applied to Figure 1 The storage system in FIG. 1 is used as an example to illustrate the method, which includes the following steps:
[0061] Step 201: In response to a cache application request, determine a first memory page in user mode that meets a preset idle condition, and determine a start address of the first memory page.
[0062] The cache application request may include a read request, and the read request may be for the user system to read the target data on the hard disk through the storage system. The preset idle condition may be that the current memory page is in an idle state and the memory size of the memory page meets the memory size of the cache application request. The starting address may be the starting position of the first memory page in the user state.
[0063] Specifically, when the cache application request sent by the user system represents that the user system accesses the storage system in an RDMA manner, in response to the cache application request sent by the user system, the cache module in the storage system can be in user state. The user state can directly receive the cache application request sent by the user system by accessing the network card, traverse the memory pages of the user state based on the cache application request, and find unused memory pages. If the memory of the memory page meets the memory corresponding to the cache application request, the storage system can determine that the memory page meets the preset idle condition, and can determine the memory page as the first memory page. For example, the storage system can determine the first memory page by finding a memory page marked as an idle mark, and the remaining memory of the memory page found to be the idle mark is greater than or equal to the memory corresponding to the cache application. In addition, after confirming the first memory page, the storage system modifies the mark of the first memory page, that is, the used mark. The storage system determines the starting address of the first memory page according to the memory distribution of the user state. The user state can read the corresponding first target data from the hard disk end or the shared physical memory according to the cache application request.
[0064] Step 202: Based on the starting address, an access message is obtained, and the access message is sent to the access network card; the first target data corresponding to the cache application request is written into the target memory corresponding to the starting address in the access network card through the access network card.
[0065] The access message may be an RDMA message, the access network card may be an RDMA network card, and the target memory is a pre-registered memory of the RDMA network card, which is used to receive or send data.
[0066] Specifically, the storage system can obtain the RDMA message according to the starting address of the first memory page. For example, the RDMA message can include a message written to the starting address, or the RDMA message can be generated according to the starting address. The user state can send the RDMA message to the RDMA network card. The RDMA network card can directly write the first target data corresponding to the cache application request into the target memory of the RDMA network card according to the starting address in the RDMA message, and send the first target data to the user system through the target memory.
[0067] The above-mentioned data transmission method determines the first memory page that meets the preset free condition and determines the starting address of the first memory page in response to the cache application request; determines the access message based on the starting address, and sends the access message to the access network card; the access network card writes the first target data corresponding to the cache application request to the target memory, and sends the first target data to the user system through the access network card to realize data transmission. By using the starting address to determine the access message, the first target data can be directly stored in the target memory of the access network card, thereby improving the cache efficiency of the system.
[0068] In an exemplary embodiment, the specific implementation process of the step of “determining the starting address of the first memory page” may include:
[0069] Based on the number of bytes contained in the target index item of the first memory page and the index item number of the target index item, determine the position of the target index item in the index item area; based on the page size of the memory page and the page number of the target index item, determine the offset of the first memory page; based on the address of the initial index item, the position of the target index item in the memory item and the offset of the first memory page, calculate the starting address of the first memory page.
[0070] The user state includes multiple memory items, each memory item includes an index item area and a page item area, the index item area includes multiple index items, the page item area includes multiple memory pages, and each index item corresponds to a memory page. The index item area can maintain the management information of the memory page through a linked list, including linked list items, page numbers, index item numbers, atomic tags, numa (Non-Uniform Memory Access) node ids, and whether the corresponding memory page is used, etc. The memory page size in the page area can be a 4KB (kilobyte) page, such as Figure 3 As shown, Figure 3 It is a schematic diagram of a memory page in a cache module in an embodiment, where the index item area index includes multiple index items (index0, index1...indexn); the page item area item includes multiple memory pages (item0, item1...itemn).
[0071] Specifically, the storage system can read the address of the initial index item, the index number and the page number of the target index item in the index item area corresponding to the first memory page according to the first memory page. The storage system multiplies the number of bytes contained in the target index item of the first memory page and the index item number of the target index item to obtain the position of the target index item in the index item area. The storage system multiplies the page size of the memory page and the page number of the target index item to obtain the offset of the first memory page. The starting address of the first memory page is obtained based on the sum of the address of the initial index item, the position of the memory item of the target index item and the offset of the first memory page. The expression formula of the starting address can be:
[0072] pageAddr=baseAddr+sizeof(index)×indexNum+4096×index sn
[0073] Where pageaddr is the starting address; baseAddr is the address of the initial index item; sizeof(index) is the byte data contained in the target index item; indexNum is the index item number of the target index item; index sn The page number of the target index entry.
[0074] In this embodiment, the starting address of the first memory page is determined by the byte data contained in the target index item of the first memory page, the index item number, the page size of the memory page, the page label of the target index item and the address of the initial index item, thereby improving the accuracy of the starting address of the memory page and improving the accuracy of subsequent data transmission to the RDMA network card.
[0075] In one of the embodiments, in response to a cache application request, determining the first memory page of the user state that meets the preset idle condition includes: after responding to the cache application request, adding a password identifier to any memory item in the user state, and determining the first memory page of the user state that meets the preset idle condition, and deleting the password identifier of the memory item corresponding to the first memory page.
[0076] The password identifier is used to lock the memory item so that multiple cache application requests cannot access the same memory item at the same time. Any memory item is one of the multiple memory items.
[0077] Specifically, Figure 4 As shown, it is a flow chart of page allocation in one embodiment. After responding to the cache application request, the storage system adds a password identifier to any memory item, and other cache application requests cannot access the memory item with the added password identifier. The storage system can search for a memory page that meets the preset free condition in the memory item with the added password identifier as the first memory page. If there is no memory page that meets the preset free condition in the memory item with the added password identifier, it returns insufficient memory, deletes the password identifier in the memory item, and then searches for other memory items again until a memory page that meets the preset free condition is found. If a memory page that meets the preset free condition is found in the memory item, the storage system modifies the information of the index item corresponding to the first memory page, and deletes the password identifier of the memory item corresponding to the first memory page. It should be understood that in addition to adding a password identifier to the memory item in the case of the cache application request in this embodiment, the storage system can also add a password identifier when traversing the memory items when responding to other cache application requests.
[0078] Specifically, after determining the first memory page, the storage system may delete the password identifier of the memory item of the first memory page, so that other cache application request processing can identify other memory pages on the memory item.
[0079] In this embodiment, by adding a password identifier to the memory item when responding to a cache application request, other cache application requests cannot access the memory item at the same time, thereby improving the accuracy of the cache. In addition, after determining the first memory page, the password identifier of the memory item of the first memory page is deleted, so that other cache application requests can identify other memory pages on the memory item, which is convenient for the subsequent reasonable use of the memory page.
[0080] In an exemplary embodiment, the data transmission method further includes:
[0081] In response to a write request, a second memory page in kernel state that meets a preset idle condition is determined, and second target data corresponding to the write request is written into a shared physical memory through the second memory page; the write request is sent from kernel state to user state through an operation code in a first queue; a third memory page corresponding to the second memory page is determined based on the user state, the second target data is read in the shared physical memory through the third memory page, and the second target data in the third memory page is output.
[0082] The cache application request also includes a write request. The shared physical memory can be a memory mapping method that allows the kernel state and the user state to share the same physical memory segment, ensuring that the same data is cached only once in the memory. The circular queue at least includes a first queue (Kernel-User, KU queue) that sends messages from the kernel state to the user state. The kernel state thread writes the tail of the circular queue, and the user state thread reads the head of the circular queue. The circular queue includes an operation code and a memory page number list. The operation code is used to indicate the operation to be performed on the memory page, and the memory page code list includes the page code of the memory page. The kernel state includes multiple memory items, each memory item includes an index item area and a page item area, the index item area includes multiple index items, the page item area includes multiple memory pages, and each index item corresponds to a memory page.
[0083] Specifically, when a user system sends a write request, it indicates that the user system accesses the storage system through TCP, and responds to the write request sent by the user system. At this time, the cache module in the storage system can be in kernel state. Based on the write request, the storage system determines that the kernel state satisfies the idle state and the memory is greater than or equal to the memory page corresponding to the write request. The storage system can determine that the memory page meets the preset idle condition and can determine the memory page as the second memory page. The storage system writes the second target data corresponding to the write request to the shared physical memory through the second memory page. The storage system transmits the write request to the user state through the operation code in the first queue, such as Figure 5 As shown, Figure 5The diagram is a schematic diagram of a circular queue in an embodiment. The user state determines a third memory page corresponding to the second memory page according to the memory page encoding list, reads the second target data from the shared physical memory based on the third memory page, and can output the second target data to the hard disk.
[0084] Specifically, after the storage system responds to the write request sent by the user system, it can add a password identifier to the traversed memory item. When it is found that the memory item with the added password identifier has a memory page that meets the preset free condition, the password identifier of the memory item is deleted and subsequent processing is performed; if not, the password identifier of the memory item is also deleted, and the traversal is continued until a memory page that meets the preset free condition is found.
[0085] In this embodiment, by using a circular queue, only write requests are transmitted from kernel state to user state, ensuring that data in kernel state does not need to be repeatedly copied to be read by user state, thereby improving the storage system's ability to utilize the CPU.
[0086] In an exemplary embodiment, the data transmission method further includes:
[0087] In response to a write request, the write request is sent to the user state by accessing the network card, and a fourth memory page of the user state that meets a preset idle condition is determined; the third target data corresponding to the write request is written to the fourth memory page, and the third target data in the fourth memory page is output.
[0088] Specifically, the cache application request sent by the user system represents that the user system accesses the storage system via RDMA, and the storage system responds to the write request sent by the user system. At this time, the cache module in the storage system can be in user state. The storage system can directly send the write request to the user state in the cache module through the RDMA network card. The user state can traverse the memory items, find the memory page that meets the idle state and the memory is greater than or equal to the memory corresponding to the write request, and the memory page can meet the preset conditions of the user state fourth memory page. The user state writes the corresponding third target data to the fourth memory page, and outputs the third target data of the fourth memory page, which can be output to the hard disk end, and can also be sent to the shared memory page, so that the kernel state can read the data later.
[0089] In this embodiment, the storage system is accessed in RDMA mode, and with the help of the RDMA network card, the data of the write request of the user system is directly written to the hard disk end through the user state, which reduces the copying of memory data and improves the performance of the storage system.
[0090] In an exemplary embodiment, the data transmission method further includes:
[0091] In response to a read request, a fifth memory page in kernel state that meets a preset idle condition is determined, and the read request is sent from kernel state to user state through an operation code in a first queue; in user state, a sixth memory page corresponding to the fifth memory page is determined; through the sixth memory page, fourth target data read from the hard disk and corresponding to the read request is written into a shared physical memory; through an operation code in a second queue, information of the fourth target data written into the shared physical memory is sent to kernel state, and through kernel state, the fourth target data is read from the shared physical memory based on the information, and sent to the user system based on the first network protocol.
[0092] The cache application request also includes a read request, the ring queue also includes a second queue (User-Kernel queue, UK queue) for sending messages from user state to kernel state, the sending thread in user state writes the head of the ring queue, and the receiving thread in kernel state reads the tail of the ring queue. The first network protocol can be a TCP protocol.
[0093] Specifically, the cache application request sent by the user system represents that the user system accesses the storage system via TCP. The storage system responds to the read request sent by the user system, and the cache module of the storage system can be in kernel state. Based on the read request, the storage system determines the memory page in the kernel state that satisfies the idle state and has a memory greater than or equal to the read request, and the memory page is the fifth memory page in the kernel state that meets the preset idle condition. The storage system sends the read request from the kernel state to the user state through the operation code in the first queue, and determines the sixth memory page in the user state corresponding to the fifth memory page through the page code of the fifth memory page in the memory page number list. The user state reads the fourth target data corresponding to the read request from the hard disk through the sixth memory page and writes it to the shared physical memory. The storage system uses Figure 5 The operation code in the second queue in the , sends the information of writing the fourth target data into the shared physical memory to the kernel state. The kernel state can read the fourth target data from the shared physical memory and send it to the user system based on the TCP protocol.
[0094] In this embodiment, a circular queue is used to send request messages from kernel state to user state, and messages from user state to kernel state, without the need for repeated copying of data, ensuring that only page codes are transmitted during the communication process, thereby improving communication performance by about 27%.
[0095] In an exemplary embodiment, the data transmission method further includes:
[0096] Respond to a borrowed memory request, and send the borrowed memory request from the user state to the kernel state through the second queue; through the kernel state, determine the seventh memory page of the kernel state that meets the preset idle state; if the memory of the seventh memory page does not meet the memory of the borrowed memory request, delete the cold data in the seventh memory page so that the seventh memory page meets the borrowed memory request.
[0097] The cache application request also includes a memory borrowing request. A computing module can be set in the user state. The preset idle state can be an idle flag. Cold data can be data detected in the storage system with a low number of accesses.
[0098] Specifically, Figure 6 As shown, Figure 6 The present invention is a flowchart of a method for transmitting data in an embodiment. When the computing module initiates a memory borrowing request to the kernel state through the user state, the storage system sends the memory borrowing request from the user state to the kernel state through the second queue. The kernel state traverses the memory items to determine whether there are memory pages in the memory items that meet the memory borrowing request. When the demand for borrowed memory is less than the memory of the memory page, the seventh memory page that meets the free condition is marked as used; if the demand for borrowed memory is greater than the memory of the memory page, the cold data in the memory page is deleted and the seventh memory page is marked as used. The kernel state uses the seventh memory page as a page that meets the memory borrowing request of the computing module, and subsequent data processing can be performed on the seventh memory page.
[0099] In this embodiment, when the memory pressure of other modules in the storage system is high, memory can be borrowed from the kernel state by sending a memory borrowing request, thereby improving the processing capability and availability of the storage system.
[0100] In an exemplary embodiment, Figure 7 As shown, Figure 7 A schematic flow chart of a data transmission method in an embodiment is provided, wherein the data processing method specifically includes:
[0101] The storage system responds to the cache application request sent by the user system. The storage system adds a password identifier to any memory item, and determines whether the memory item with the added password identifier meets the preset free condition; if not, it returns that the memory item does not meet the preset free condition and deletes the password identifier, and then re-searches other memory items until a memory page that meets the preset free condition is found; if so, the storage system determines the first target memory page in the memory item, and modifies the first target memory page to a used state and deletes the password identifier; the storage system calculates the starting address of the page based on the first target memory. The storage system writes the starting address of the first target memory page into the RDMA message, and sends the access message to the RDMA network card. The RDMA network card writes the first target data corresponding to the cache application request to the target memory corresponding to the starting address in the access network card.
[0102] In an exemplary embodiment, in the embodiment of the present application, it is considered that due to the ubiquitous existence of numa (Non-Uniform Memory Access) mechanism in the current cpu, each cpu core belongs to a numa node, and the memory efficiency of the cpu accessing this numa node is the highest, and the network card also has the same mechanism when accessing memory. When receiving a cache application operation from a user system, it is necessary to copy the data in the network card cache area to the cache module. If there is cross-numa access during the copy process, the performance of the system will be reduced. Therefore, in the embodiment of the present application, when the binary program of the cache module is loaded, it is necessary to pass the numa node information to which the network card belongs to the cache module. When the cache module in the kernel state applies for memory, according to the incoming parameters, the physical memory of the same node as the network card numa node is applied.
[0103] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0104] Based on the same inventive concept, the embodiment of the present application also provides a data transmission device for implementing the data transmission method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the one or more data transmission device embodiments provided below can refer to the limitations on the data transmission method above, and will not be repeated here.
[0105] In an exemplary embodiment, Figure 8 As shown, a data transmission device 80 is provided, comprising: a determination module 81 and a sending module 82, wherein:
[0106] A determination module 81, configured to determine, in response to a cache application request, a first memory page in a user state that meets a preset idle condition, and determine a starting address of the first memory page;
[0107] The sending module 82 is used to obtain an access message based on the starting address and send the access message to the access network card; so as to write the first target data corresponding to the cache application request into the target memory corresponding to the starting address in the access network card through the access network card.
[0108] In one example, the user state includes multiple memory items, each memory item includes an index item area and a page item area, the index item area includes multiple index items, the page item area includes multiple memory pages, and each index item corresponds to a memory page; the determination module 81 is used to determine the position of the target index item in the index item area based on the number of bytes contained in the target index item of the first memory page and the index item number of the target index item;
[0109] Determining an offset of the first memory page based on a page size of the memory page and a page number of the target index entry;
[0110] Based on the address of the initial index item, the position of the target index item in the memory item, and the offset of the first memory page, the starting address of the first memory page is calculated.
[0111] In one example, the determination module 81 is further used to add a password identifier to any memory item in the user state after responding to the cache application request; after determining the first memory page, delete the password identifier of the memory item corresponding to the first memory page.
[0112] In one example, the cache application request also includes a write request, the ring queue includes at least a first queue for sending messages from kernel state to user state, and the ring queue includes an operation code, and the operation code is used to indicate the operation to be performed on the memory page of user state or kernel state; the sending module 82 is also used to respond to the write request, and determine a second memory page of kernel state that meets a preset idle condition, and write the second target data corresponding to the write request into the shared physical memory through the second memory page;
[0113] Sending a write request from kernel state to user state via the opcode in the first queue;
[0114] A third memory page corresponding to the second memory page is determined in the user state, and the second target data is read in the shared physical memory through the second memory page and output to the hard disk end.
[0115] In one of the examples, the sending module 82 is also used to respond to a write request, send the write request to the user state by accessing the network card, determine the fourth memory page of the user state that meets the preset idle condition, write the third target data corresponding to the write request to the fourth memory page, and output it to the hard disk end.
[0116] In one example, the cache application request also includes a read request, the ring queue also includes a second queue for sending messages from the user state to the kernel state, and the sending module 82 is further used to respond to the read request, determine a fifth memory page in the kernel state that meets a preset idle condition, and send the read request from the kernel state to the user state through the operation code in the first queue;
[0117] Determine in user mode a sixth memory page corresponding to the fifth memory page; and write the fourth target data corresponding to the read request read from the hard disk into the shared physical memory through the sixth memory page;
[0118] The information of writing the fourth target data into the shared physical memory is sent to the kernel state through the operation code in the second queue; the fourth target data is read from the shared physical memory through the kernel state and sent to the user system based on the first network protocol.
[0119] In one example, the cache application request also includes a borrowed memory request, and the sending module 82 is further used to respond to the borrowed memory request and send the borrowed memory request from the user state to the kernel state through the second queue;
[0120] Through the kernel state, determine the seventh memory page of the kernel state that meets the preset idle state; if the memory of the seventh memory page does not meet the memory borrowing request, delete the cold data in the seventh memory page to make the seventh memory page meet the borrowing memory request.
[0121] Each module in the above data transmission device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0122] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Fig. 9 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. 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, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data corresponding to cache application requests. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data transmission method is implemented.
[0123] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0124] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0125] In response to the cache application request, determining a first memory page in the user state that meets a preset idle condition, and determining a starting address of the first memory page;
[0126] Based on the starting address, an access message is obtained and sent to the access network card; the first target data corresponding to the cache application request is written into the target memory corresponding to the starting address in the access network card through the access network card.
[0127] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0128] In response to the cache application request, determining a first memory page in the user state that meets a preset idle condition, and determining a starting address of the first memory page;
[0129] Based on the starting address, an access message is obtained and sent to the access network card; the first target data corresponding to the cache application request is written into the target memory corresponding to the starting address in the access network card through the access network card.
[0130] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0131] In response to the cache application request, determining a first memory page in the user state that meets a preset idle condition, and determining a starting address of the first memory page;
[0132] Based on the starting address, an access message is obtained and sent to the access network card; the first target data corresponding to the cache application request is written into the target memory corresponding to the starting address in the access network card through the access network card.
[0133] Those skilled 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 the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0134] 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 application.
[0135] The above 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, characterized in that: The method comprises: In response to the cache application request, determining a first memory page in a user state that meets a preset idle condition, and determining a starting address of the first memory page; Based on the starting address, an access message is obtained and sent to the access network card; the first target data corresponding to the cache application request is written into the target memory corresponding to the starting address in the access network card through the access network card.
2. The method according to claim 1, characterized in that The user state includes a plurality of memory items, each memory item includes an index item area and a page item area, the index item area includes a plurality of index items, the page item area includes a plurality of memory pages, and each index item corresponds to a memory page; the determining the starting address of the first memory page includes: Determine the position of the target index item in the index item area based on the number of bytes included in the target index item of the first memory page and the index item number of the target index item; Determining an offset of the first memory page based on a page size of the memory page and a page number of the target index item; The starting address of the first memory page is calculated based on the address of the initial index item, the position of the target index item in the memory item, and the offset of the first memory page.
3. The method according to claim 2, characterized in that The step of determining, in response to the cache application request, a first memory page in the user state that meets a preset idle condition comprises: In response to the cache application request, a password identifier is added to any memory item in the user state, a first memory page in the user state that meets a preset idle condition is determined, and the password identifier of the memory item corresponding to the first memory page is deleted.
4. The method according to claim 1, characterized in that: The cache application request also includes a write request, the circular queue includes at least a first queue for sending messages from the kernel state to the user state, and the circular queue includes an operation code, and the operation code is used to indicate the operation to be performed on the memory page; The method further comprises: In response to the write request, determining a second memory page in kernel mode that meets the preset idle condition, and writing second target data corresponding to the write request into the shared physical memory through the second memory page; Sending the write request from the kernel state to the user state through the operation code in the first queue; A third memory page corresponding to the second memory page is determined based on the user state, second target data is read from the shared physical memory through the third memory page, and the second target data in the third memory page is output.
5. The method according to claim 4, characterized in that The method further comprises: In response to the write request, sending the write request to the user state through the access network card, and determining a fourth memory page of the user state that meets the preset idle condition; The third target data corresponding to the write request is written into the fourth memory page, and the third target data in the fourth memory page is output.
6. The method according to claim 4, characterized in that The cache application request further includes a read request, the ring queue further includes a second queue for sending messages from the user state to the kernel state, and the method further includes: In response to the read request, determining a fifth memory page of the kernel state that meets the preset idle condition, and sending the read request from the kernel state to the user state through the operation code in the first queue; In the user state, a sixth memory page corresponding to the fifth memory page is determined; and fourth target data read from the hard disk and corresponding to the read request is written into the shared physical memory through the sixth memory page; Through the operation code in the second queue, the information of the fourth target data written into the shared physical memory is sent to the kernel state, and through the kernel state, the fourth target data is read from the shared physical memory based on the information and sent to the user system based on the first network protocol.
7. The method according to claim 6, characterized in that The cache application request also includes a memory borrowing request, and the method further includes: Responding to the borrowed memory request, and sending the borrowed memory request from the user state to the kernel state through the second queue; Through the kernel state, determine the seventh memory page of the kernel state that meets the preset idle state; if the memory of the seventh memory page does not meet the memory of the borrowed memory request, delete the cold data in the seventh memory page so that the seventh memory page meets the borrowed memory request.
8. A data transmission device, characterized in that: The device comprises: A determination module, configured to determine, in response to a cache application request, a first memory page in a user state that meets a preset idle condition, and determine a starting address of the first memory page; A sending module is used to obtain an access message based on the starting address and send the access message to the access network card; so as to write the first target data corresponding to the cache application request into the target memory corresponding to the starting address in the access network card through the access network card.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.