Method, device, readable storage medium and electronic equipment for accelerating IO response
By establishing a small data mapping table in the solid-state drive, dynamically managing memory space, and optimizing the lookup process for small I/O requests, the response latency problem caused by the frequency and randomness of small I/O requests is solved, resulting in faster I/O response speed and higher system efficiency.
Patent Information
- Application Number
- CN202411046600.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-01
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2044-08-01
AI Technical Summary
How to improve the IO response speed of solid-state drives, especially the response latency caused by the frequency and randomness of small IO requests.
A small data mapping table is established to store data smaller than a first preset value. A linked list structure is used to dynamically manage memory space. The IO access data is first searched in the small data mapping table. If it is not found, it is searched in the P2L table to reduce access to physical storage devices.
By enabling fast lookups through small data mapping tables, direct access to the hard drive is reduced, improving I/O response speed, avoiding resource waste, and increasing system efficiency.
Smart Images

Figure CN119002811B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of solid-state hard disk data reading and writing, and in particular to a method, device, readable storage medium and electronic device for accelerating IO response. Background Art
[0002] With the rapid development of new-generation information technologies such as cloud computing, mobile internet, and big data, efficient data storage and access have become key issues that need to be addressed in the storage field. Flash-based solid-state drives (SSDs), with their fast read and write speeds, low power consumption, and shock resistance, are gradually replacing traditional mechanical hard disk drives (HDDs) as the mainstream storage device.
[0003] SSD firmware strategies primarily focus on optimizing performance, lifespan, and stability. As SSD capacities increase and data continues to be written, key issues facing SSD firmware strategies include efficiently managing the mapping between logical and physical addresses (such as P2L and L2P entries), optimizing the file system's cleanup of dirty data, and fully utilizing cache RAM to improve access speeds. These strategies aim to provide faster data read and write speeds, a longer lifespan, and more stable performance.
[0004] Managing P2L and L2P entries is a complex and critical task for SSD firmware. These entries must accurately map logical addresses to physical addresses. As SSD capacity increases and data is continuously written, the number and size of entries also increase, placing higher demands on the firmware's processing capabilities. Improper entry management or errors can lead to data loss or performance degradation, impacting the user experience. Summary of the Invention
[0005] The technical problem to be solved by the present invention is: how to improve the IO response speed.
[0006] In order to solve the above technical problems, a technical solution adopted by the present invention is:
[0007] A method for accelerating IO response is provided, comprising the steps of: establishing a small data mapping table, wherein the small data mapping table corresponds to data whose size is smaller than a first preset value; receiving IO access data, and searching through the small data mapping table if the IO access data is smaller than the first preset value.
[0008] In order to solve the above technical problems, another technical solution adopted by the present invention is:
[0009] A device for accelerating IO response, comprising:
[0010] An input module, configured to establish a small data mapping table corresponding to data having a size smaller than a first preset value;
[0011] The search module is configured to receive IO access data and perform a search through the small data mapping table if the IO access data is smaller than a first preset value.
[0012] In order to solve the above technical problems, another technical solution adopted by the present invention is:
[0013] A computer-readable storage medium stores a computer program, which implements the steps of the method for accelerating IO response when executed by a processor.
[0014] In order to solve the above technical problems, another technical solution adopted by the present invention is:
[0015] An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, each step of the method for accelerating IO response is implemented.
[0016] The beneficial effects of the present invention are as follows: since small IO requests are relatively frequent and random, if the existing normal access search is performed through the L2P mapping table, IO requests of different sizes are mixed together, and small IO requests are easily overwritten in the L2P mapping table in the memory, so that the location needs to be searched in the hard disk, and the time overhead of accessing the hard disk is large, which slows down the response speed; by establishing a small data mapping table specifically for storing small IO access data, the memory space occupied is small, and when a small IO request is received, the relevant information can be directly obtained from the small data mapping table, reducing direct access to the physical storage device, thereby accelerating the response to these requests with a smaller memory overhead. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A flowchart of a method according to an embodiment of the present invention;
[0018] Figure 2 A schematic diagram of the structure of a mapping table entry according to an embodiment of the present invention;
[0019] Figure 3 Schematic diagram of the structure of a device according to an embodiment of the present invention;
[0020] Figure 4 The figure is a schematic structural diagram of a device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0021] To illustrate the technical content, achieved objectives and effects of the present invention in detail, the following description is given in conjunction with the embodiments and accompanying drawings.
[0022] A method for accelerating IO response includes the steps of: establishing a small data mapping table corresponding to data with a size smaller than a first preset value; receiving IO access data, and searching through the small data mapping table if the IO access data is smaller than the first preset value.
[0023] As can be seen from the above description, the beneficial effects of the present invention are as follows: since small IO requests are relatively frequent and random, if the existing normal access search is performed through the L2P mapping table, IO requests of different sizes are mixed together, and small IO requests can easily be overwritten in the L2P mapping table in the memory, thereby requiring a search for the location on the hard disk, which takes up a lot of time and slows down the response speed; by establishing a small data mapping table specifically for storing small IO access data, the memory space occupied is small, and when a small IO request is received, the relevant information can be directly obtained from the small data mapping table, reducing direct access to the physical storage device, thereby accelerating the response to these requests with a smaller memory overhead.
[0024] Furthermore, the small data mapping table is a linked list structure; the search through the small data mapping table includes: if the storage address corresponding to the IO access data cannot be found in the small data mapping table, then the storage address is obtained from the disk and stored in the small data mapping table in association with the IO access data.
[0025] As can be seen from the above description, the small data mapping table is configured as a linked list structure, eliminating the need to pre-allocate a fixed amount of memory space to store elements. If the corresponding storage address for IO access data cannot be found, the storage address is retrieved and stored in association with the IO access data, thereby updating the stored small IO access data in the small data mapping table. When the same IO access data appears again, the storage address is retrieved from the small data mapping table instead of being retrieved from disk, thereby improving efficiency and reducing response time.
[0026] Furthermore, the associating and storing the IO data in the small data mapping table includes: if the small data mapping table is full, removing the first element from the linked list, and associating the storage address with the IO access data and storing it at the end of the small data mapping table.
[0027] From the above description, it can be seen that since the IO access that is less than the first preset value is relatively frequent and random, and the nodes in the linked list can be dynamically created and deleted on demand, when there is no extra space in the linked list, deleting the first element in the table means deleting the data first stored in the table. The earlier the node is stored in the linked list, the earlier the position is. Overwriting the earlier saved data helps to update, ensuring that the data in the table can effectively help reduce the system burden and delete mappings that may be used less frequently.
[0028] Furthermore, the establishing of the small data mapping table includes: storing the small data mapping table in a memory.
[0029] As can be seen from the above description, by storing the small data mapping table in the memory, the small data mapping table can be quickly located when an IO access is received, thereby enabling rapid query of the IO access data and improving the IO response speed.
[0030] Furthermore, the establishing of the small data mapping table includes: setting the maximum value of the space occupied by the nodes in the linked list structure to a second preset value.
[0031] From the above description, it can be seen that the amount of spatial data in the small data mapping table is not a fixed value. The space in the dynamic planning mapping table is realized. Since the amount of data written randomly each time is different and the content of each data needs to be recorded is different, the amount of spatial data required is not fixed. Only the maximum value of the space is limited, which effectively avoids the problem of resource waste caused by fixed space and makes reading and writing more flexible.
[0032] Further, searching through the small data mapping table includes: if the IO access data is not found in the small data mapping table, searching for the IO access data in a P2L table.
[0033] As can be seen from the above description, searching the small data mapping table for data first differs significantly from the prior art method of first searching the P2L table and, if no data is found, searching the L2P table on the SSD. Searching the L2P table requires the firmware to first read the table entry data, then find the physical location, and finally read the data requested by the host, which wastes time. However, the small data mapping table is in memory and has faster search speeds than the P2L table. Performing the search process in the small data mapping table first can avoid wasting time and resources.
[0034] Furthermore, the storage content of each node in the linked list structure includes a physical starting address, a logical starting address and a data length; the search through the small data mapping table includes: obtaining the pending logical address in the IO access data, judging whether the pending logical address falls within the logical address range of the target node in the linked list structure, and if so, returning the physical actual address and data length in the target node; the logical address range is obtained through the logical starting address and data length in the target node.
[0035] From the above description, it can be seen that the physical starting address, logical starting address and data length are recorded in the small data mapping table, so that when querying the data in the small data mapping table, the data can be directly accessed through the physical starting address, thereby realizing the operation of not needing to query the physical address in the hard disk.
[0036] Please refer to Figure 3 Another embodiment of the present invention provides a device for accelerating IO response, comprising:
[0037] An input module, configured to establish a small data mapping table corresponding to data having a size smaller than a first preset value;
[0038] The search module is configured to receive IO access data and perform a search through the small data mapping table if the IO access data is smaller than a first preset value.
[0039] Another embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computer program implements the steps of the above-mentioned method for accelerating IO response.
[0040] Please refer to Figure 4 Another embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements each step of the above-mentioned method for accelerating IO response when executing the computer program.
[0041] The system deployment method, device, computer-readable storage medium, and electronic device of the present invention are applicable to the field of solid-state hard disk data reading and writing, and are described below through specific implementation methods.
[0042] Please refer to Figure 1-2 , embodiment 1 of the present invention is:
[0043] A method for accelerating IO response, comprising the steps of:
[0044] S1. Establish a small data mapping table corresponding to data whose size is smaller than a first preset value, store the table in a memory, and set the maximum space occupied by nodes in the linked list structure to a second preset value;
[0045] In an optional embodiment, the number of groups of the linked list and the number of nodes in the linked list are determined according to the memory size and a first preset value; specifically, the available percentage of the memory size can be set as the upper limit of the occupied space of the entire small data mapping table; the total number of nodes in the linked list is calculated according to the first preset value and the upper limit of the occupied space, and the number of groups of the linked list is calculated according to the total number of nodes; for example, if the upper limit of the occupied space is 8MB and the first preset value is 4KB, the total number of nodes is 2048, that is, when establishing the small data mapping table, if IO information already exists, 2048 IO information are directly obtained to establish the small data mapping table. If IO information does not exist, an empty linked list to be used is first established; according to the calculation of 2048 summary points, a total of 32 groups are obtained, each group includes 64 nodes; if the upper limit of the occupied space is 512MB and the first preset value is 256KB, the total number of summary points is 2048.
[0046] Among them, file nodes in the file system are usually managed with 4KB as the source data. When adding, deleting, reading or writing files, these file nodes will be frequently updated. They will be recorded in the small data mapping table. The next time they are accessed, they can be quickly hit in the cache and directly access the corresponding physical address, improving the efficiency of modifying file nodes.
[0047] In an optional embodiment, as Figure 2 As shown, the small data mapping table is a linked list structure, and the maximum value of the space occupied by each node in the linked list structure is a second preset value. The storage content of each node in the linked list structure includes a physical starting address, a logical starting address, a data length, and a current node index; for example, the amount of data in the linked list structure space is not greater than 16384 LBAs (Logical Block Addresses), the physical starting address in each node occupies 4 bytes, the logical starting address occupies 4 bytes, the data length occupies 2 bytes, and the current node index occupies 2 bytes, corresponding to the number of records in the linked list to which the current node belongs. It also includes two pointers, one pointer pointing to the position of the previous record in the linked list, and the other pointer pointing to the position of the next record.
[0048] S2. Receive IO access data. If the IO access data is less than a first preset value, traverse the small data mapping table and determine, based on the pending logical address in the IO access data, whether the pending logical address falls within the logical address range of the target node in the linked list structure. If so, execute S3. If no target node matching the IO access data is found in the small data mapping table after traversal, execute S4.
[0049] In an optional implementation, it is first determined which group of the linked list structure the address to be found falls within, and then the address is searched in the group after determination; for example, there are 2048 pieces of information in the linked list that need to be traversed, and the linked list is divided into 32 groups, each group storing 64 pieces of information in a certain range, then it is first determined which group of the 32 groups the address falls within based on the address range of each group, and then the address is searched for in the 64 pieces of information in the group.
[0050] S3. Obtain the logical address range through the logical start address and data length in the target node, return the physical start address and data length in the target node, and obtain the physical address based on the difference between the pending logical address and the logical start address and the sum of the physical start address.
[0051] In an optional embodiment, the method further includes:
[0052] When adding, deleting, reading or writing files, after obtaining the target node, directly access the physical location to modify the file node.
[0053] S4. If no target node matching the IO access data is found in the small data mapping table, it is determined whether there is excess space in the small data mapping table. If there is, S41 is executed; otherwise, S42 is executed.
[0054] S41 . Query the physical address corresponding to the IO access data in the P2L on the RAM (cache), and associate the physical address with the IO access data and store them at the end of the mapping table.
[0055] In an optional embodiment, the method further includes:
[0056] If the storage address corresponding to the access data is not retrieved on the RAM, the physical address corresponding to the IO access data is queried in the L2P on the nand (disk), and the physical address is associated with the IO access data and stored at the end of the mapping table.
[0057] S42. Remove the first element from the small data mapping table and execute S41.
[0058] In an optional embodiment, the method further includes:
[0059] Remove the element with the least number of accesses from the small data mapping table and execute S41;
[0060] In one use case of the solution in this embodiment, after the amount of writes to the storage system exceeds the full disk capacity, the disk data needs to be erased to write new data. This may cause multiple blocks to be erased to create the required storage size, and the disk data will begin to become chaotic. At this time, the host file system will usually also activate the file defragmentation function. In this case, if a performance testing tool is used to test random reads and sequential reads, the time during which the host defragments the file system's dirty data before the system IO read operation is interspersed with the time it takes for the system IO to perform a read operation will be significantly different from the range of the current random test. Using the solution in this embodiment can minimize the need to search for data on the disk, thereby minimizing the impact of system IO on the test results.
[0061] The second embodiment of the present invention is:
[0062] A device for accelerating IO response, comprising:
[0063] An input module, configured to establish a small data mapping table corresponding to data having a size smaller than a first preset value;
[0064] a search module, configured to receive IO access data and perform a search through the small data mapping table if the IO access data is less than a first preset value;
[0065] The device is also configured to execute the various steps of the first embodiment, which will not be described in detail here.
[0066] Example 3
[0067] A computer-readable storage medium stores a computer program, which implements the steps in the first embodiment when executed by a processor.
[0068] Example 4
[0069] Please refer to Figure 3 , an electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the first embodiment when executing the computer program.
[0070] In summary, the present invention provides a method, device, computer-readable storage medium, and electronic device for accelerating IO responses, comprising the following steps: establishing a small data mapping table, wherein the small data mapping table corresponds to data whose size is less than a first preset value; receiving IO access data, and if the IO access data is less than the first preset value, searching through the small data mapping table. By establishing a small data mapping table to store small IO access data and dynamically planning the space in the mapping table, the problem of resource waste caused by fixed space is effectively avoided, and the small data mapping table can be searched when an IO request is received, thereby reducing direct access to physical storage devices, accelerating responses to these requests with less memory overhead, and making reading and writing more flexible.
[0071] In the above embodiments provided in the present application, it should be understood that the disclosed methods, devices, computer-readable storage media, and electronic devices can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules is merely a logical function division. In actual implementation, there may be other division methods, such as multiple components or modules can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or components or modules, which can be electrical, mechanical or other forms.
[0072] The components described as separate parts may or may not be physically separate, and the components shown as components may or may not be physical modules, that is, they may be located in one place or distributed across multiple network modules. Some or all of these components may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0073] In addition, the functional modules in various embodiments of the present invention may be integrated into a single processing module, or each component may exist physically separately, or two or more modules may be integrated into a single module. The aforementioned integrated modules may be implemented in the form of hardware or software functional modules.
[0074] If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0075] It should be noted that for the aforementioned method embodiments, for ease of description, they are all expressed as a series of action combinations. However, those skilled in the art should be aware that the present invention is not limited by the order of the actions described, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0076] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0077] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's description and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for accelerating IO response, characterized in that: Including steps: Establishing a small data mapping table, wherein the small data mapping table corresponds to data whose data size is smaller than a first preset value; receiving IO access data, and searching through the small data mapping table if the IO access data is less than a first preset value; The small data mapping table is a linked list structure; The storage content of each node in the linked list structure includes a physical start address, a logical start address and a data length; The searching through the small data mapping table includes: obtaining a pending logical address in the IO access data, determining whether the pending logical address falls within the logical address range of the target node in the linked list structure, and if so, returning the physical address and data length of the target node; The logical address range is obtained by the logical start address and data length in the target node.
2. The method for accelerating IO response according to claim 1, wherein: The searching through the small data mapping table includes: if the storage address corresponding to the IO access data cannot be found in the small data mapping table, obtaining the storage address from the disk and storing it in the small data mapping table in association with the IO access data.
3. The method for accelerating IO response according to claim 2, wherein the step of associating the IO access data with the small data mapping table comprises: If the small data mapping table is full, the first element is removed from the linked list, and the storage address and the IO access data are associated and stored at the end of the small data mapping table.
4. The method for accelerating IO response according to claim 1, wherein: The establishment of the small data mapping table includes: The small data mapping table is stored in a memory.
5. The method for accelerating IO response according to claim 2, wherein: The establishment of the small data mapping table includes: The maximum value of the space occupied by the nodes in the linked list structure is set to a second preset value.
6. The method for accelerating IO response according to claim 1, wherein: The searching through the small data mapping table includes: If the IO access data is not found in the small data mapping table, the IO access data is searched in the P2L table.
7. A device for accelerating IO response, characterized in that: include: An input module, configured to establish a small data mapping table corresponding to data having a size smaller than a first preset value; a search module, configured to receive IO access data and perform a search through the small data mapping table if the IO access data is less than a first preset value; The small data mapping table is a linked list structure; The storage content of each node in the linked list structure includes a physical start address, a logical start address and a data length; The searching through the small data mapping table includes: obtaining a pending logical address in the IO access data, determining whether the pending logical address falls within the logical address range of the target node in the linked list structure, and if so, returning the physical address and data length of the target node; The logical address range is obtained by the logical start address and data length in the target node.
8. 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 for accelerating IO response according to any one of claims 1 to 6 are implemented.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, each step of the method for accelerating IO response according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Solid state disk processing method suitable for user requests of different sizes
CN113377690A