Solid state disk cache management method and device, equipment and storage medium

Through a cache management method that combines multi-linked lists with machine learning, it predicts the status information of cached data and dynamically updates linked lists, solving the problem of low cache miss rates in solid-state drives, improving read and write speeds, and extending the service life of solid-state drives.

CN118535094APending Publication Date: 2024-08-23SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202410667391.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-27
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

The cache miss rate in SSDs is low, resulting in slower read and write speeds and shortened service life. It is difficult for existing cache management solutions to effectively improve cache hit rates and extend the service life of SSDs.

Method used

A cache management method that combines multi-linked lists with machine learning is used to predict the status information of cached data through pre-trained machine learning models, dynamically update linked lists, prioritize cached data with high access frequency, delete data that is unlikely to be accessed, and improve caching. Hit rate.

Benefits of technology

Significantly improves the cache hit rate, improves the read and write performance and lifespan of the solid state drive, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535094A
    Figure CN118535094A
Patent Text Reader

Abstract

The embodiment of the invention provides a solid state disk cache management method and device, equipment and a storage medium, and relates to the technical field of storage, the method comprises the following steps: receiving a current user request sent by a host; collecting feature information of a user request corresponding to the cache data in the cache, inputting the feature information of the user request into a pre-trained machine learning model, and predicting current state information corresponding to the cache data in the cache; and when the cache data hit by the current user request does not exist in the cache, writing current request data corresponding to the current user request into the cache as cache data, and according to the current state information corresponding to the cache data in the cache, updating and managing the linked list of the cache data in the cache. The embodiment of the invention can improve the read-write speed of the data in the solid state disk and prolong the life cycle of the solid state disk.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of storage technology, and in particular to a solid state drive cache management method, device, equipment and storage medium. Background Art

[0002] Solid State Disks (SSDs) based on NAND Flash (non-volatile storage technology) technology have advantages such as higher performance and low power consumption compared to traditional mechanical hard disks, and have been widely used in storage systems. The DRAM (Dynamic Random Access Memory) in the SSD controller can cache user IO (Input / Output) requests from the flash memory, and share the IO with the same logical page address as the previous user request, thereby shortening the IO response time. However, the storage space of the cache is limited, so the cache solution used plays a crucial role in the performance and life of the SSD.

[0003] In a solid-state drive, the average memory access time is T average By the hit time T hit , hit rate R hit and miss penalty P miss So T average =T hit +(1-R hit )*P miss , where T hit is the time spent searching the cache, R hit is the frequency of cache hits, P miss It is the cost caused by cache miss. In SSD, if the cache misses, it will cause more read and write requests to the underlying flash memory, and will activate garbage collection (GC) faster, which will accelerate the consumption of flash memory PE (Program / Erase Cycle) times, thereby reducing the life of the SSD. Therefore, an effective cache solution can improve the cache hit rate, increase the read and write speed, and extend the life of the SSD. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a solid state drive cache management method, device, equipment and storage medium. The specific technical solution is as follows:

[0005] In a first aspect of the present invention, a cache management method in a solid state drive is provided, wherein the cache is used to temporarily store cache data corresponding to a user request, the cache includes a plurality of linked lists, the linked lists are used to manage cache data of different state information, the state information is used to characterize a future cache hit rate of the cache data, and the method includes:

[0006] Receive the current user request sent by the host;

[0007] Collecting feature information of user requests corresponding to the cached data in the cache, and inputting the feature information of the user requests into a pre-trained machine learning model to predict current state information corresponding to the cached data in the cache;

[0008] When there is no cache data hit by the current user request in the cache, the current request data corresponding to the current user request is written into the cache as cache data, and the linked list of the cache data in the cache is updated and managed according to the current status information corresponding to the cache data in the cache.

[0009] Optionally, the machine learning model is trained in the following manner:

[0010] Obtaining a sample user request; wherein the sample read and write command includes sample logical block address information;

[0011] Reconstructing the sample user request into a plurality of sample page requests according to the sample logical block address information; wherein the sample page requests respectively have corresponding tags, and the tags include real state information of the sample page requests;

[0012] Collecting sample feature information of the sample page request, and inputting the sample feature information of the sample page request into a machine learning model to be trained, to obtain prediction state information corresponding to the sample user request;

[0013] Calculating a loss value of the machine learning model according to the real state information and the predicted state information;

[0014] When the loss value meets the preset convergence condition, the trained machine learning model is obtained.

[0015] Optionally, the current user request and the sample user request include read requests and write requests; the machine learning model is a decision tree model using a decision tree algorithm; the feature information and the sample feature information include at least the access frequency, the size of the user request, the number of recent consecutive hits, the number of user requests from the cached data in the cache to the current access, and the life cycle of the cached data.

[0016] Optionally, the user request includes logic block address information, and the collecting feature information of the user request corresponding to the cached data in the cache, and inputting the feature information of the user request into a pre-trained machine learning model to predict current state information corresponding to the cached data in the cache, includes:

[0017] reconstructing the user request corresponding to the cache data in the cache into a plurality of page requests according to the logic block address information;

[0018] The characteristic information of the page request is collected, and the characteristic information of the page request is input into a pre-trained machine learning model to predict the current state information corresponding to the cache data in the cache.

[0019] Optionally, the state information includes at least a valid state and an invalid state, and the linked list includes at least a valid linked list for managing cache data in a valid state, and an invalid linked list for managing the valid linked list of cache data in an invalid state; writing the current request data corresponding to the current user request into the cache as cache data, and updating the linked list for managing the cache data in the cache according to the current state information corresponding to the cache data in the cache, comprises:

[0020] Detecting whether the storage space of the cache is full;

[0021] If it is detected that the storage space of the cache is not full, writing the current request data corresponding to the current user request into the cache as cache data, and updating the cache information of the cache data in the cache in the valid linked list;

[0022] If it is detected that the storage space of the cache is full, then detecting whether the invalidation linked list is empty;

[0023] If it is detected that the invalid linked list is not empty, deleting the cache data corresponding to the invalid linked list in the cache;

[0024] If it is detected that the invalid linked list is empty, deleting the cache data corresponding to the valid linked list in the cache;

[0025] Writing the current request data corresponding to the current user request in the cache as cache data, and updating cache information of the cache data in the valid linked list and the invalid linked list according to the current state information corresponding to the cache data in the cache;

[0026] The cache information at least includes the cache scheme, cache address, hit count and status information of the corresponding cache data; the cache scheme at least includes data stored in the valid linked list or the invalid linked list.

[0027] Optionally, deleting the cache data corresponding to the invalid linked list in the cache includes:

[0028] The cache data corresponding to the tail node of the invalid linked list is deleted from the cache.

[0029] Optionally, deleting the cache data corresponding to the valid linked list in the cache includes:

[0030] The cache data corresponding to the tail node of the valid linked list is deleted from the cache.

[0031] Optionally, after receiving the current user request sent by the host, the method further includes:

[0032] When cache data hit by the current user request exists in the cache, cache information of the cache data in the cache in the valid linked list is updated.

[0033] Optionally, when the cache data hit by the current user request exists in the cache, after updating the cache information of the cache data in the cache in the valid linked list, the method further includes:

[0034] If the current user request is a write request, the cache data corresponding to the write request is updated in the cache according to the write request.

[0035] Optionally, the trained machine learning model is stored in the flash memory of the solid state drive, and the collecting of feature information of user requests corresponding to the cached data in the cache, and inputting the feature information of the user requests into the pre-trained machine learning model to predict current state information corresponding to the cached data in the cache, includes:

[0036] When calling the machine learning model from the flash memory, converting the machine learning model into a tree structure, and instantiating the tree structure obtained by converting the machine learning model into a model function;

[0037] Collecting characteristic information of user requests corresponding to the cache data in the cache, and setting the characteristic information of the user requests as input parameters of the model function;

[0038] The input parameters are input into the model function to predict current state information corresponding to the cache data in the cache.

[0039] Optionally, before receiving the current user request sent by the host, the method further includes:

[0040] Determine whether to use a cache management scheme for cache data that manages different state information through different linked lists;

[0041] If it is determined to use a cache management scheme that manages cache data with different status information through different linked lists, then collect the feature information of the user requests corresponding to the cache data in the cache, and input the feature information of the user requests into a pre-trained machine learning model to predict the current status information corresponding to the cache data in the cache.

[0042] Optionally, the determining whether to use a cache management solution for managing cache data of different state information through different linked lists includes:

[0043] Acquire management parameters of a cache management scheme for managing cache data of different state information through different linked lists; wherein the management parameters include cache hit rate and performance parameters;

[0044] If the management parameter satisfies a preset threshold parameter, a cache management solution for managing cache data of different state information through different linked lists is determined.

[0045] Optionally, the determining whether to use a cache management solution for managing cache data of different state information through different linked lists further includes:

[0046] If the management parameter does not meet the preset threshold parameter, other cache management schemes are used to manage the cache; wherein the other cache management schemes at least include a least recently used cache management scheme.

[0047] Optionally, before receiving the current user request sent by the host, the method further includes:

[0048] When a preset trigger condition is met, the cache data corresponding to the invalidation linked list is deleted in the cache, and the invalidation linked list is updated according to the cache data deleted in the cache.

[0049] Optionally, when a preset trigger condition is met, deleting the cache data corresponding to the invalid linked list in the cache, and updating the invalid linked list according to the cache data deleted from the cache, includes:

[0050] When the preset deletion time is reached, the cache data corresponding to the tail node of the invalid linked list is deleted in the cache, and the invalid linked list is updated according to the cache data deleted in the cache.

[0051] Optionally, when a preset trigger condition is met, deleting the cache data corresponding to the invalid linked list in the cache, and updating the invalid linked list according to the cache data deleted from the cache, includes:

[0052] Regularly checking whether the storage space of the cache is full;

[0053] If it is detected that the storage space of the cache is full, the cache data corresponding to the tail node of the invalidation linked list is deleted from the cache, and the invalidation linked list is updated according to the cache data deleted from the cache.

[0054] In a second aspect of the present invention, a cache management device in a solid state drive is provided, wherein the cache is used to temporarily store cache data corresponding to a user request, the cache includes a plurality of linked lists, the linked lists are used to manage cache data of different state information, the state information is used to characterize a future cache hit rate of the cache data, and the device includes:

[0055] A receiving module, used for receiving a current user request sent by the host;

[0056] A prediction module, used to collect feature information of user requests corresponding to the cached data in the cache, and input the feature information of the user requests into a pre-trained machine learning model to predict current state information corresponding to the cached data in the cache;

[0057] An update module is used to write the current request data corresponding to the current user request as cache data into the cache when there is no cache data hit by the current user request in the cache, and to update the linked list of the cache data in the cache according to the current status information corresponding to the cache data in the cache.

[0058] In a third aspect of the implementation of the present invention, there is also provided a communication device, comprising: a transceiver, a memory, a processor, and a program stored in the memory and executable on the processor;

[0059] The processor is used to read the program in the memory to implement the solid state drive cache management as described in any one of the first aspects.

[0060] In a fourth aspect of the implementation of the present invention, a computer-readable storage medium is further provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is executed on a computer, the computer implements the solid-state hard disk cache management as described in any one of the first aspects.

[0061] In a fifth aspect of the implementation of the present invention, a computer program product is also provided, including a computer program / instruction, which, when executed by a processor, implements the solid state drive cache management as described in any one of the first aspects.

[0062] An embodiment of the present invention provides a solid-state hard disk cache management method, wherein the solid-state hard disk includes a cache for temporarily storing cache data corresponding to a user request, the cache includes a plurality of linked lists of cache data respectively used to manage different status information, the status information is used to characterize the future cache hit rate of the cache data, and a current user request sent by a host is received. Feature information of the user request corresponding to the cache data in the cache can be collected, and the feature information of the user request can be input into a pre-trained machine learning model, so that the current status information corresponding to the cache data in the cache can be predicted. When the cache data hit by the current user request does not exist in the cache, the current request data corresponding to the current user request can be written into the cache as cache data, and the linked list of cache data in the cache can be updated according to the current status information corresponding to the cache data in the cache. The embodiment of the present invention can predict the current status information of the cached data in the cache through a machine learning model, and update the linked list used to manage the cache accordingly according to the current status information. Since the status information in the embodiment of the present invention is used to characterize the future cache hit rate of the cached data, updating the linked list used to manage the cache accordingly according to the current status information is beneficial to improving the future cache hit rate of the cached data in the cache managed by the linked list. The improvement in the cache hit rate can enable more data to be quickly obtained from the solid-state hard disk, thereby improving the overall system performance of the solid-state hard disk, thereby improving the reading and writing speed of data in the solid-state hard disk and extending the life cycle of the solid-state hard disk, thereby improving the user experience of the solid-state hard disk. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] Figure 1 It is a flowchart of the steps of a solid state drive cache management method provided by an embodiment of the present invention;

[0064] Figure 2 It is a schematic diagram of the structure of a cache system of a solid state drive provided by an embodiment of the present invention;

[0065] Figure 3 This is a schematic diagram of an effective cache data discrimination provided by an embodiment of the present invention;

[0066] Figure 4 It is a schematic diagram of a machine learning process for improving cache hit rate provided by an embodiment of the present invention;

[0067] Figure 5 It is a schematic diagram of a cache prediction management chain provided by an embodiment of the present invention;

[0068] Figure 6It is a flow chart of updating a cache linked list provided by an embodiment of the present invention;

[0069] Figure 7 is a schematic diagram of a process of calling a machine learning model from firmware provided by an embodiment of the present invention;

[0070] Figure 8 It is a diagram of the internal structure of a solid state hard disk provided by an embodiment of the present invention;

[0071] Fig. 9 is a solid state drive cache management flow chart provided by an embodiment of the present invention;

[0072] Fig.10 It is a structural diagram of a solid state hard disk cache management device provided by an embodiment of the present invention;

[0073] Fig.11 It is a schematic diagram of a communication device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0074] At present, there are two main types of SSD cache solutions. One type is a cache solution that improves cache hit rate by utilizing spatial locality, including LRU (Least Recently Used), EELRU (Early Eviction Least Recently Used), ARC (Adaptive Replacement Cache), 2Q (Two queues) and other methods. Among them, LRU is a cache management algorithm. The data in the linked list is updated by inserting data at the head of the linked list. The newly updated data or hit data is moved to the head of the linked list because these data have a high probability of being re-accessed. Another cache solution considers the hit rate and miss penalty in the SSD, such as Clean First LRU (CFLRU). CFLRU uses an LRU linked list to distinguish clean data from dirty data. At the end of the linked list, CFLRU has a data window in which clean data is eliminated first. This is because the replacement scheme for clean data deletes cached data instead of deleting the data to the flash memory.

[0075] With the continuous reading and writing of solid-state hard disks, the frequent execution of garbage collection and other operations, studying how to manage the cache more effectively is an important topic for the current solid-state hard disk controller performance optimization. In response to the above problems, the embodiments of the present invention provide a method and device for improving the cache hit rate and performance of solid-state hard disks. In order to improve the read and write cache hit rate of solid-state hard disks, the embodiments of the present invention innovatively propose an algorithm combining a multi-linked list with machine learning. By introducing this algorithm, a unique and clear decision is provided for each cached data, and data that is unlikely to be accessed in the cache is preferentially evicted. Compared with the traditional LRU algorithm, the embodiments of the present invention greatly improve the cache hit rate, while improving the read and write performance and life of the solid-state hard disk. Specifically, the embodiments of the present invention propose a cache management solution based on an ML (Machine Learning) model, and the machine learning model is used to predict whether the cached data in the solid-state hard disk is likely to be accessed in the future. When a data item (cache data) enters the cache, an embodiment of the present invention can use a multi-linked list cache management method to configure the residence time of the cache data in the cache. In the cache, the cache data can be divided into valid cache data and invalid cache data, wherein the valid cache data will be accessed in the future, while the invalid cache data will not have a chance to be accessed again in the future, so the invalid cache data in the cache is cleared, thereby improving the future hit rate of the cache and preventing the flash memory in the solid-state drive from degrading.

[0076] To make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that in the embodiments of the present invention, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can be implemented. The division of the following embodiments is for the convenience of description, and should not constitute any limitation on the specific implementation of the present invention. The various embodiments can be combined and referenced with each other without contradiction.

[0077] Reference Figure 1 , shows a flow chart of the steps of a solid state drive cache management method provided by an embodiment of the present invention, wherein the cache is used to temporarily store cache data corresponding to a user request, the cache includes a plurality of linked lists, the linked lists are used to manage cache data with different state information, the state information is used to characterize the future cache hit rate of the cache data, and the method may include:

[0078] Step 101: Receive a current user request sent by a host.

[0079] Step 102: Collect feature information of user requests corresponding to the cached data in the cache, and input the feature information of the user requests into a pre-trained machine learning model to predict current state information corresponding to the cached data in the cache.

[0080] Among them, user requests can be divided into read requests and write requests, so user requests can also be called read and write commands, read and write operations or read and write instructions, etc. The linked list is a multi-linked list, which is used to manage cache data of different state information respectively. The state information can include at least a valid state and an invalid state. The linked list at least includes a valid linked list for managing cache data in a valid state (valid) (i.e., valid data), and an invalid linked list for managing a valid linked list of cache data in an invalid state (invalid) (i.e., invalid data).

[0081] Among them, the characteristic information may at least include other information such as access frequency, size of user request, number of recent consecutive hits, number of user requests from the cached data in the cache to the current access, and life cycle of the cached data. Specifically, the scope of feature information extraction in the embodiment of the present invention is limited to the life cycle of cached data in the cache. During the life cycle of cached data, the characteristic information collection and processing module in the solid-state drive collects the following characteristic information corresponding to the following characteristics: 1) Access frequency, which refers to the number of continued accesses to the same LPA (Logical Page Address) of a page request (a page request is a reconstructed user request) within a period of time. 2) The size of user requests, the order of LPA in these pages increases successively, the sequence length affects the cache hit rate, and countless partition page requests with long continuous sequence lengths will occupy a large amount of cache space. 3) The number of recent consecutive hits, which refers to the number of requests between (read / write) cached data in the last two consecutive user requests. A larger value indicates that the cached data has not been used recently. 4) The number of read and write requests from the cached data in the cache to the current access. 5) The life cycle of cached data. If the life cycle of cached data is small and the number of user requests is large, it means that the cached data is invalid cached data.

[0082] In an embodiment of the present invention, a machine learning model is pre-trained for a solid-state drive, and the machine learning model can be used to predict in advance the status information of cached data stored in the cache of the solid-state drive. Therefore, when receiving a current user request sent by the host, feature information of the user request corresponding to the cached data in the cache can be collected, and then the feature information of the user request is input into the pre-trained machine learning model, so that the machine learning model can be used to predict the current status information corresponding to the cached data in the cache, that is, whether it is an invalid state or a valid state.

[0083] Reference Figure 2, is a schematic diagram of the structure of a cache system of a solid state drive provided by an embodiment of the present invention, including a host and a solid state drive. In the actual application process, the host file system (host) can send a user request to the solid state drive to obtain the corresponding data from the cache or flash memory of the solid state drive. The solid state drive of the embodiment of the present invention adds a computing unit (Computing Unit) for the solid state drive to execute the machine learning model and feature information collection. The front end of the solid state drive can obtain the feature information corresponding to the user request for the received user request (R / W), that is, the input parameter of the machine learning model. The feature information collected is obtained from the user request, and the machine learning model determines whether the cache data corresponding to the user request in the cache is valid cache data according to the feature information. The embodiment of the present invention designs a multi-linked list to effectively manage the cache data, and distinguishes the cache data in the cache through different linked list management. In the embodiment of the present invention, the invalid cache data in the linked list is deleted first and saved in the Nand Flash (flash memory) of the solid state drive, and the cache (cache) of the solid state drive stores the valid cache data as much as possible. In this way, when the user request of the host is received, the cache hit rate of the user request in the cache can be improved. Specifically, the SSD includes a Flash Translation Layer (FTL), which mainly includes functions such as address mapping, garbage collection (GC), and wear leveling (WL), and also includes a computing unit. The cache in the SSD is the cache in DRAM (Dynamic Random Access Memory), which also includes Cache, Meta data, and Mapping Table. The SSD may also include a Flash Memory Control Layer for managing the flash memory (non-volatile memory) in the SSD.

[0084] With the increasing demand for solid-state drives, in order to optimize the read and write performance and the life of solid-state drives, the embodiments of the present invention innovatively propose an algorithm that combines multiple linked lists with machine learning to improve cache hit rates, thereby improving performance and speed.

[0085] Step 103: When there is no cache data hit by the current user request in the cache, write the current request data corresponding to the current user request into the cache as cache data, and update the linked list of the cache data in the cache according to the current status information corresponding to the cache data in the cache.

[0086] In an embodiment of the present invention, after obtaining the status information corresponding to the cache data in the cache through the machine learning model prediction, if it is determined that there is no cache data hit by the current user request in the cache, the current request data corresponding to the current user request can be written into the cache as cache data. At the same time, the linked lists of cache data in the cache, i.e., the valid linked lists and the invalid linked lists, are updated and managed according to the current status information corresponding to the cache data in the cache. In this way, the future cache hit rate of the cache data in the cache can be improved.

[0087] An embodiment of the present invention provides a solid-state hard disk cache management method, wherein the solid-state hard disk includes a cache for temporarily storing cache data corresponding to a user request, the cache includes a plurality of linked lists of cache data respectively used to manage different status information, the status information is used to characterize the future cache hit rate of the cache data, and a current user request sent by a host is received. Feature information of the user request corresponding to the cache data in the cache can be collected, and the feature information of the user request can be input into a pre-trained machine learning model, so that the current status information corresponding to the cache data in the cache can be predicted. When the cache data hit by the current user request does not exist in the cache, the current request data corresponding to the current user request can be written into the cache as cache data, and the linked list of cache data in the cache can be updated according to the current status information corresponding to the cache data in the cache. The embodiment of the present invention can predict the current status information of the cached data in the cache through a machine learning model, and update the linked list used to manage the cache accordingly according to the current status information. Since the status information in the embodiment of the present invention is used to characterize the future cache hit rate of the cached data, updating the linked list used to manage the cache accordingly according to the current status information is beneficial to improving the future cache hit rate of the cached data in the cache managed by the linked list. The improvement in the cache hit rate can enable more data to be quickly obtained from the solid-state hard disk, thereby improving the overall system performance of the solid-state hard disk, thereby improving the reading and writing speed of data in the solid-state hard disk and extending the life cycle of the solid-state hard disk, thereby improving the user experience of the solid-state hard disk.

[0088] In one embodiment of the present invention, the machine learning model is trained in the following manner:

[0089] Obtaining a sample user request; wherein the sample read and write command includes sample logical block address information;

[0090] Reconstructing the sample user request into a plurality of sample page requests according to the sample logical block address information; wherein the sample page requests respectively have corresponding tags, and the tags include real state information of the sample page requests;

[0091] Collecting sample feature information of the sample page request, and inputting the sample feature information of the sample page request into a machine learning model to be trained, to obtain prediction state information corresponding to the sample user request;

[0092] Calculating a loss value of the machine learning model according to the real state information and the predicted state information;

[0093] When the loss value meets the preset convergence condition, the trained machine learning model is obtained.

[0094] In a specific implementation, the method of distinguishing whether cached data in the cache is valid or invalid in the embodiment of the present invention can be specifically referred to Figure 3 , Figure 3 is a schematic diagram of an effective cache data discrimination provided by an embodiment of the present invention, such as Figure 3 As shown, at time T=T0, DATA1 (cache data 1) and DATA2 (cache data 2) enter the cache. At time T=T1, i.e., the current time, DATA1 is accessed multiple times and hit N times. Based on the cache hit rate, DATA1 can be determined to be hot data. The embodiment of the present invention is different from other cache algorithms in that hot data is not determined to be valid data. At time T=T1, the future cache hit rates (hit) of DATA1 and DATA2 are all set to 0. At the future time T=T2, the number of cache data hits changes. At this time, DATA2 has N hits before the cache is released, i.e., DATA2 is marked as valid data and can continue to be retained in the cache. DATA1 is considered dirty data, i.e., invalid data, and can be released from the cache.

[0095] Based on the above-mentioned method for distinguishing valid cache data, an embodiment of the present invention proposes using valid data and invalid data as reference indicators for prediction results of machine learning classification by the machine learning model of the embodiment of the present invention, where 1 can represent valid data and 0 can represent invalid data. According to the working characteristics of the solid-state drive, the embodiment of the present invention can use the machine learning model to predict in advance the access of the received user request in the cache, and general machine learning to determine whether the cache data in the future cache is valid. The embodiment of the present invention can spare no effort to eliminate invalid data in the cache, such as DATA1 in the above example, to ensure that there is free storage space in the cache to accommodate valid data.

[0096] Reference Figure 4, is a schematic diagram of a machine learning process for improving cache hit rate provided by an embodiment of the present invention. First, a request reconstruction module (Request restruct) divides a sample user request (IO read / write request) according to sample logical block address information (LBA, Logical Block Addressing) and reconstructs it into multiple sample page requests (page). A label (label) is added to the new sample page request, and the label is used to reflect the real state information of the sample page request. The feature information collection module (Feature Collection) collects sample feature information (LPAFeatures / LogicalPage Address Features, that is, sample feature information of the logical page address), and then the feature information collection module transmits the collected sample feature information such as access frequency, recent continuous hit time, life cycle, etc. to the agent module, so as to train the machine learning model through the agent module using the sample feature information. Specifically, the sample feature information can be input into the machine learning model to obtain the predicted state information corresponding to the sample user request, and then, the loss value of the machine learning model is calculated according to the real state information and the predicted state information. When the loss value meets the preset convergence condition, the trained machine learning model can be obtained. Subsequently, the trained machine learning model can be used to predict the state information of the cached data in the cache in advance, so as to realize the update of the cached data in the cache.

[0097] In an optional embodiment, the machine learning model of the embodiment of the present invention is a decision tree model using a decision tree algorithm (Classification and Regression Trees, CART). Of course, in practical applications, other machine learning models besides the decision tree model can also be used, and the embodiment of the present invention does not need to be limited to this. Specifically, the decision tree algorithm is a supervised machine learning algorithm with the advantages of high precision and small space occupation. In the decision tree algorithm, each non-leaf node represents a test of a feature attribute; each branch represents the output of the feature attribute within a certain value range; each leaf node stores a category. The decision process based on the decision tree algorithm starts from the root node to test the feature attributes in the item to be classified, and uses its results to ensure that the output branch reaches the leaf node. The category in the leaf node is recorded as the decision result. The embodiment of the present invention uses the Gini index to evaluate the classification quality, which simplifies the calculation quality. The decision tree algorithm uses the Gini index to promote feature classification. The execution mode of the Gini index is similar to that of information gain and information gain ratio. There is no logarithmic operation, and fast training results can be produced. By analyzing the historical read and write access patterns in the workload, a classification model in the machine learning model framework is obtained to reveal the read and write access patterns hidden in the workload. According to the characteristics of user requests, the machine learning model provides classification results for predicted access patterns.

[0098] The machine learning model of the embodiment of the present invention can be a decision tree model using a decision tree algorithm, and the decision tree algorithm has the advantages of high precision and small space occupation. Therefore, the application of the machine learning model of the embodiment of the present invention will not affect the performance of the solid state drive.

[0099] In an embodiment of the present invention, the user request includes logic block address information, and the collecting feature information of the user request corresponding to the cache data in the cache, and inputting the feature information of the user request into a pre-trained machine learning model to predict current state information corresponding to the cache data in the cache, includes:

[0100] reconstructing the user request corresponding to the cache data in the cache into a plurality of page requests according to the logic block address information;

[0101] The characteristic information of the page request is collected, and the characteristic information of the page request is input into a pre-trained machine learning model to predict the current state information corresponding to the cache data in the cache.

[0102] In a specific implementation, a user request may include logical block address information (LBA). The user request corresponding to the cached data in the cache can be reconstructed into several page requests through the logical block address information. Then, the characteristic information of the reconstructed page requests, i.e., access frequency, most recent continuous hit time, life cycle and other characteristic information, can be collected separately and input into a pre-trained machine learning model. In this way, the machine learning model can be used to predict in advance the current status information corresponding to the cached data in the cache, and then the cached data and linked lists in the cache can be updated according to the current status information, thereby improving the cache hit rate and improving the user experience of the solid-state drive.

[0103] In an embodiment of the present invention, the state information includes at least a valid state and an invalid state, and the linked list includes at least a valid linked list for managing cache data in a valid state, and an invalid linked list for managing the valid linked list of cache data in an invalid state; writing the current request data corresponding to the current user request into the cache as cache data, and updating the linked list for managing the cache data in the cache according to the current state information corresponding to the cache data in the cache, comprises:

[0104] Detecting whether the storage space of the cache is full;

[0105] If it is detected that the storage space of the cache is not full, writing the current request data corresponding to the current user request into the cache as cache data, and updating the cache information of the cache data in the cache in the valid linked list;

[0106] If it is detected that the storage space of the cache is full, then detecting whether the invalidation linked list is empty;

[0107] If it is detected that the invalid linked list is not empty, deleting the cache data corresponding to the invalid linked list in the cache;

[0108] If it is detected that the invalid linked list is empty, deleting the cache data corresponding to the valid linked list in the cache;

[0109] The current request data corresponding to the current user request is written into the cache as cache data, and cache information of the cache data in the valid linked list and the invalid linked list is updated according to the current state information corresponding to the cache data in the cache.

[0110] Among them, the cache information for the cache data in the linked list includes at least the cache scheme (Access), cache address (Address), hit number / count (Count) and status information (Label) of the corresponding cache data; the cache scheme may at least include storage in a valid linked list or an invalid linked list.

[0111] Reference Figure 5 , is a schematic diagram of a cache prediction management chain provided by an embodiment of the present invention, Figure 5 The four rectangles in the figure represent the cache structure corresponding to a cache data respectively. Each cache structure includes whether the current cache data can use the cache scheme of the embodiment of the present invention, the cache address, the number of hits, and the status information (whether the data is valid). First, all caches can use double linked lists (invalid linked lists and valid linked lists) for link management. Valid data and invalid data are linked using different double linked lists respectively. If the cache structure corresponding to the current cache data is valid data, it is added to the valid linked list (vHead). If the cache structure corresponding to the current cache data is invalid data, it is added to the invalid linked list (iHead). Of course, if the cache data in the cache is not linked using the double linked list of the embodiment of the present invention, the cache information corresponding to the cache data can be stored in other linked lists (Head).

[0112] In a specific implementation, since it is relatively complicated to improve the cache hit rate, the performance of the solid-state drive must be improved while improving the hit rate. Therefore, all cache data in the cache can be managed by the double linked list of the embodiment of the present invention, or part of the cache data in the cache can be managed by the double linked list of the embodiment of the present invention. Alternatively, when it is determined that the cache data in the cache can be managed by the double linked list of the embodiment of the present invention, which can improve the hit rate and the performance of the solid-state drive, the double linked list of the embodiment of the present invention can be used for link management. The embodiment of the present invention does not need to be limited to this. Among them, the cache management scheme can be manually selected by the user, or it can be automatically selected based on the relevant management parameters obtained. The embodiment of the present invention does not need to be limited to this.

[0113] Reference Figure 6 , is a flow chart for updating a cache linked list provided by an embodiment of the present invention. When a user request from a host is received, it is detected whether the user request hits in the cache. If the cache hits, the valid linked list is updated. If the cache does not hit, it is detected whether the storage space of the cache is full. If the storage space of the cache is full, first, it is checked whether the invalid linked list is not empty. If the invalid linked list is not empty, the cache data corresponding to the invalid linked list in the cache is released. If the invalid linked list is empty, the cache data corresponding to the valid linked list in the cache is released, and the user request data corresponding to the user request is written as the new cache data in the cache, and the valid linked list and the invalid linked list are updated. If the storage space of the cache is not full, the user request data corresponding to the user request can be directly written as the new cache data in the cache, and the valid linked list is updated. In this way, the real-time update of the cache and the linked list can be realized, and the subsequent cache hit rate is guaranteed.

[0114] In an embodiment of the present invention, deleting the cache data corresponding to the invalid linked list in the cache includes:

[0115] The cache data corresponding to the tail node of the invalid linked list is deleted from the cache.

[0116] In actual applications, there are multiple cache data stored in the cache, and the cache information of the cache data is stored in the corresponding node in the invalid linked list. The corresponding cache data can be obtained in the cache through the cache information. Among them, the tail node of the invalid linked list corresponds to the cache data with the lowest cache hit rate. Therefore, in the embodiment of the present invention, when it is necessary to release the storage space of the cache, the cache data corresponding to the tail node of the invalid linked list in the cache can be released first, so that the cache data with a relatively high cache hit rate can be prevented from being released in advance.

[0117] In an embodiment of the present invention, deleting the cache data corresponding to the valid linked list in the cache includes:

[0118] The cache data corresponding to the tail node of the valid linked list is deleted from the cache.

[0119] In actual applications, there are multiple cache data stored in the cache, and the cache information of the cache data is stored in the corresponding node in the valid linked list. The corresponding cache data can be obtained in the cache through the cache information. Among them, the tail node of the valid linked list corresponds to the cache data with the lowest cache hit rate (of course, the cache hit rate of the cache data corresponding to the tail node of the valid linked list is higher than that of all cache data in the invalid linked list). Therefore, in an embodiment of the present invention, when the storage space of the cache needs to be released but the invalid linked list is empty, the cache data corresponding to the tail node of the valid linked list in the cache can be released first, so that the cache data with a relatively high cache hit rate can be prevented from being released in advance.

[0120] In one embodiment of the present invention, after receiving the current user request sent by the host, the method further includes:

[0121] When there is cache data hit by the current user request in the cache, cache information of the cache data in the cache in the valid linked list is updated. If the current user request is a write request, the cache data corresponding to the write request is updated in the cache according to the write request.

[0122] Reference Figure 6, detect whether the user request hits the cache, if the cache hits, update the valid linked list, and if the user request is a write request, the cache data corresponding to the user request in the cache can be updated according to the write request. The embodiment of the present invention can update the cache data in the cache according to the request type of the user request. For example, when the request type of the user request is a write request, the cache data corresponding to the write request can be updated in the cache according to the write request. In this way, it can be ensured that the cache data in the cache is correctly updated, thereby ensuring the subsequent use of the cache data.

[0123] In one embodiment of the present invention, the trained machine learning model is stored in the flash memory of the solid state drive, and the characteristic information of the user request corresponding to the cached data in the cache is collected, and the characteristic information of the user request is input into the pre-trained machine learning model to predict the current state information corresponding to the cached data in the cache, including:

[0124] When calling the machine learning model from the flash memory, converting the machine learning model into a tree structure, and instantiating the tree structure obtained by converting the machine learning model into a model function;

[0125] Collecting characteristic information of user requests corresponding to the cache data in the cache, and setting the characteristic information of the user requests as input parameters of the model function;

[0126] The input parameters are input into the model function to predict current state information corresponding to the cache data in the cache.

[0127] Reference Figure 7 , is a schematic diagram of a process of calling a machine learning model from firmware provided by an embodiment of the present invention. The machine learning model is stored in the flash memory of the solid-state drive in the form of a dictionary. The model abstract module (Model Abstract) converts the machine learning model into a tree structure, and the tree structure is instantiated (instantiate) as a model function in the firmware, wherein the leaf nodes in the tree structure are called the return values ​​of the model function, and the feature information requested by the user is set as the input parameters of the model function. Then, the input parameters are input into the model function, and the missing model function outputs a judgment result, wherein the result may include the status information (i.e., label) of the cached data corresponding to the user request, i.e., a valid state or an invalid state. Since the machine learning model is converted into a model function, the computational cost of the machine learning model can be ignored, thereby improving the efficiency of the solid-state drive.

[0128] In one embodiment of the present invention, before receiving the current user request sent by the host, the method further includes:

[0129] Determine whether to use a cache management scheme for cache data that manages different state information through different linked lists;

[0130] If it is determined to use a cache management scheme that manages cache data with different status information through different linked lists, then collect the feature information of the user requests corresponding to the cache data in the cache, and input the feature information of the user requests into a pre-trained machine learning model to predict the current status information corresponding to the cache data in the cache.

[0131] The cache management scheme for cache in the embodiment of the present invention is a cache management scheme for cache data that uses different linked lists to manage different status information, that is, a cache management scheme using a double linked list. In actual applications, whether to use the double linked list cache management scheme of the embodiment of the present invention can be determined according to different usage requirements.

[0132] Among them, if it is determined to use the double linked list cache management scheme of the embodiment of the present invention, after receiving the user request of the host, it can start to collect the characteristic information of the user request corresponding to the cache data in the cache, and input the characteristic information of the user request into a pre-trained machine learning model, so as to predict the relevant steps of the current status information corresponding to the cache data in the cache through the machine learning model, thereby realizing the double linked list cache management scheme of the embodiment of the present invention.

[0133] The embodiment of the present invention makes the cache management solution for the solid state drive cache more diversified by determining whether to use the double linked list cache management solution of the embodiment of the present invention according to different usage requirements.

[0134] In one embodiment of the present invention, the determining whether to use a cache management scheme for managing cache data of different state information through different linked lists includes:

[0135] Acquire management parameters of a cache management scheme for managing cache data of different state information through different linked lists; wherein the management parameters include cache hit rate and performance parameters;

[0136] If the management parameter satisfies a preset threshold parameter, determining to use a cache management scheme for managing cache data of different state information through different linked lists;

[0137] If the management parameter does not meet the preset threshold parameter, other cache management schemes are used to manage the cache; wherein the other cache management schemes at least include a least recently used cache management scheme.

[0138] In an embodiment of the present invention, management parameters of a cache management scheme for managing cache data of different state information through different linked lists, such as cache hit rate and performance parameters, etc., are obtained. Then, the management parameters can be compared with preset threshold parameters to determine whether the management parameters meet the preset threshold parameters. If they meet, the cache management scheme of the embodiment of the present invention can be used. If they do not meet, other cache management schemes can be used, such as the least recently used (LRU) cache management scheme. Of course, other cache management schemes can also include EELRU, ARC and 2Q, etc. Exemplarily, if the management parameters include a cache hit rate, the cache hit rate can be compared with a preset cache hit rate. If the cache hit rate is higher than the preset cache hit rate, it can be determined that the cache management scheme of the embodiment of the present invention can improve the cache hit rate, so it can be determined that the cache management scheme of the embodiment of the present invention is used to manage the cache of the solid-state drive. On the contrary, if the cache hit rate is lower than the preset cache hit rate, it can be determined that the cache management scheme of the embodiment of the present invention is not enough to improve the cache hit rate, and other cache management schemes such as LRU can be used, thereby ensuring the cache hit rate or performance of the solid-state drive.

[0139] In one embodiment of the present invention, before receiving the current user request sent by the host, the method further includes:

[0140] When a preset trigger condition is met, the cache data corresponding to the invalidation linked list is deleted in the cache, and the invalidation linked list is updated according to the cache data deleted in the cache.

[0141] In an embodiment of the present invention, the invalid linked list may be when a user request from the host is received, and there is no cache data in the cache that is hit by the user request. At this time, it can be considered that the preset trigger condition is met, and the cache data corresponding to the invalid linked list in the cache can be deleted to release the storage space of the cache. Optionally, the embodiment of the present invention can delete the cache data corresponding to the invalid linked list in the cache in advance when other preset trigger conditions are met, and update the invalid linked list according to the cache data deleted in the cache, so that there is no need to wait for the invalid linked list to be deleted from the cache when the user request from the host is received, and there is no cache data in the cache that is hit by the user request. The cache data corresponding to the invalid linked list in the cache is deleted from the cache, thereby improving the processing efficiency of the cache data in the cache.

[0142] In an embodiment of the present invention, when a preset trigger condition is met, deleting the cache data corresponding to the invalid linked list in the cache, and updating the invalid linked list according to the cache data deleted in the cache, includes:

[0143] When the preset deletion time is reached, the cache data corresponding to the tail node of the invalid linked list is deleted in the cache, and the invalid linked list is updated according to the cache data deleted in the cache; or,

[0144] Regularly checking whether the storage space of the cache is full;

[0145] If it is detected that the storage space of the cache is full, the cache data corresponding to the tail node of the invalidation linked list is deleted from the cache, and the invalidation linked list is updated according to the cache data deleted from the cache.

[0146] In one example, when a preset deletion time is reached, such as 1 a.m. every day, the cache data corresponding to the tail node of the invalid linked list is deleted from the cache, and the invalid linked list is updated according to the cache data deleted from the cache. Optionally, the cache data corresponding to all nodes of the invalid linked list can also be deleted from the cache.

[0147] In another example, it is possible to periodically detect whether the storage space of the cache is full, for example, it is possible to detect whether the storage space of the cache is full every two days. If it is detected that the storage space of the cache is full, the cache data corresponding to the tail node of the invalid linked list is deleted from the cache, and the invalid linked list is updated according to the cache data deleted from the cache. Optionally, the cache data corresponding to all nodes of the invalid linked list can also be deleted from the cache.

[0148] The embodiment of the present invention can set a variety of preset trigger conditions to clear the storage space of the cache in advance, thereby improving the processing efficiency of the cache data in the cache.

[0149] In one embodiment of the present invention, the solid state drive uses multi-core collaborative operation. Figure 8 , is a diagram of the internal structure of a solid-state hard disk provided by an embodiment of the present invention. The host may include components such as a central processing unit (CPU), and the solid-state hard disk is multi-core, namely core 0, core 1, core 2, core 3, etc. The multi-core can collaboratively operate modules such as a machine learning module, an update cache module, and a multi-linked list in the solid-state hard disk. Current computer devices (hosts) generally use non-volatile storage, namely solid-state hard disks, and the embodiment of the present invention implements an innovative method, an algorithm combining a multi-linked list with machine learning, which aims to improve the cache hit rate of the solid-state hard disk. At the same time, the internal structure of the solid-state hard disk is managed by adopting multi-core collaborative operations. This design not only significantly improves the overall read and write performance of the solid-state hard disk, but also provides higher performance for the machine learning model function.

[0150] The application of the embodiments of the present invention can at least bring the following beneficial effects: Improve system performance: The improvement of cache hit rate enables more data to be quickly obtained from the solid-state drive, which directly leads to the improvement of the overall system performance and reduces the delay time of data access. Reduce I / O latency: The improvement of cache hit rate reduces the frequent access to the solid-state drive and reduces I / O latency. Improve the response speed of upper-layer applications: The improvement of cache hit rate enables applications to obtain required data more quickly, thereby improving the user experience. Reduce resource consumption: The improvement of cache hit rate can reduce the frequent access to slower storage media, thereby reducing the consumption of system resources. Extend hardware life: The improvement of cache hit rate reduces the number of reads and writes to the solid-state drive NAND, thereby extending its service life. Overall, the innovative design of the embodiments of the present invention has made progress in improving the cache hit rate in solid-state drives, which has a beneficial impact on the development of storage technology.

[0151] In order to enable those skilled in the art to better understand the embodiments of the present invention, a specific example is used to illustrate the embodiments of the present invention. In order to improve the cache hit rate, an innovative solid state drive cache management method is used. Fig. 9 , is a solid state drive cache management flow chart provided by an embodiment of the present invention, and the detailed steps are as follows:

[0152] 1) The host sends a user command: The host sends a read or write command (user request) to the front end, which includes at least one set of logical block address (LBA) information.

[0153] 2) User request reconstruction: According to the user request sent by the host, it is divided into different pages according to LBA and labelled.

[0154] 3) Feature information extraction: Based on the reconstructed user request, the feature information is obtained and passed to the machine learning model.

[0155] 4) The machine learning model outputs results (labels) based on the feature information, and the machine learning model outputs whether the current cache is valid data.

[0156] 5) Update the cache. According to the tag, update the cache information about the cached data in the cache and linked list.

[0157] In the example of the present invention, the design realizes more intelligent and efficient cache management and successfully improves the cache hit rate. This technology provides an excellent solution for improving the performance and optimizing resource utilization of large-capacity solid-state hard drives.

[0158] Reference Fig.10 , is a schematic diagram of the structure of a solid state drive cache management device provided by an embodiment of the present invention, and its main components include:

[0159] 1) Front-end request module: This module is specifically used to receive user requests from the host and send corresponding user requests to the FTL (Flash Translation Layer).

[0160] 2) Request reconstruction module: Divide into different pages according to user requests and add tags to each page.

[0161] 3) Feature collection module: collects relevant feature information in user requests.

[0162] 4) Machine learning module: obtains corresponding results based on the information of the feature collection module

[0163] 5) Proxy module: Machine learning model training takes a lot of time. Because the state information and labels correspond one to one, the machine learning model is trained linearly through the proxy module.

[0164] 6) Training model module: training machine learning models through feature information and labels

[0165] 7) Update cache module: Update the data in the cache according to the results of the machine learning model, and update the corresponding cache information in the multi-linked list.

[0166] The cache management device of the embodiment of the present invention effectively processes user requests from the host through the collaborative work of the front-end and the back-end. Through the management method combining machine learning with multi-linked lists, the cache hit rate is improved, and the read and write speeds and solid-state hard disk performance are improved. This process is designed to improve the performance and efficiency of the entire mapping table management system.

[0167] In summary, the embodiments of the present invention provide a method and device for improving the cache hit rate and performance of a solid-state hard disk, and improve the cache hit rate and the overall read and write performance of the solid-state hard disk through an algorithm combining a multi-linked list with machine learning. Machine learning is used to quickly distinguish whether the cache is valid data, and the multi-linked list is used to save the machine learning results. The multi-linked list is used to avoid unnecessary linked list traversal when updating the cache.

[0168] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of 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 the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0169] An embodiment of the present invention also provides a solid state drive cache management device, wherein the cache is used to temporarily store cache data corresponding to a user request, and the cache includes a plurality of linked lists, each of which is used to manage cache data of different state information, and the state information is used to characterize a future cache hit rate of the cache data. The device includes:

[0170] A receiving module, used for receiving a current user request sent by the host;

[0171] A prediction module, used to collect feature information of user requests corresponding to the cached data in the cache, and input the feature information of the user requests into a pre-trained machine learning model to predict current state information corresponding to the cached data in the cache;

[0172] An update module is used to write the current request data corresponding to the current user request as cache data into the cache when there is no cache data hit by the current user request in the cache, and to update the linked list of the cache data in the cache according to the current status information corresponding to the cache data in the cache.

[0173] In one embodiment of the present invention, the machine learning model is trained in the following manner:

[0174] Obtaining a sample user request; wherein the sample read and write command includes sample logical block address information;

[0175] Reconstructing the sample user request into a plurality of sample page requests according to the sample logical block address information; wherein the sample page requests respectively have corresponding tags, and the tags include real state information of the sample page requests;

[0176] Collecting sample feature information of the sample page request, and inputting the sample feature information of the sample page request into a machine learning model to be trained, to obtain prediction state information corresponding to the sample user request;

[0177] Calculating a loss value of the machine learning model according to the real state information and the predicted state information;

[0178] When the loss value meets the preset convergence condition, the trained machine learning model is obtained.

[0179] In one embodiment of the present invention, the current user request and the sample user request include a read request and a write request; the machine learning model is a decision tree model using a decision tree algorithm; the feature information and the sample feature information include at least the access frequency, the size of the user request, the number of recent consecutive hits, the number of user requests from the cached data in the cache to the current access, and the life cycle of the cached data.

[0180] In one embodiment of the present invention, the user request includes logical block address information, and the prediction module is used to:

[0181] reconstructing the user request corresponding to the cache data in the cache into a plurality of page requests according to the logic block address information;

[0182] The characteristic information of the page request is collected, and the characteristic information of the page request is input into a pre-trained machine learning model to predict the current state information corresponding to the cache data in the cache.

[0183] In one embodiment of the present invention, the state information includes at least a valid state and an invalid state, the linked list includes at least a valid linked list for managing cache data in a valid state, and an invalid linked list for managing the valid linked list of cache data in an invalid state; the update module is used to:

[0184] Detecting whether the storage space of the cache is full;

[0185] If it is detected that the storage space of the cache is not full, writing the current request data corresponding to the current user request into the cache as cache data, and updating the cache information of the cache data in the cache in the valid linked list;

[0186] If it is detected that the storage space of the cache is full, then detecting whether the invalidation linked list is empty;

[0187] If it is detected that the invalid linked list is not empty, deleting the cache data corresponding to the invalid linked list in the cache;

[0188] If it is detected that the invalid linked list is empty, deleting the cache data corresponding to the valid linked list in the cache;

[0189] Writing the current request data corresponding to the current user request in the cache as cache data, and updating cache information of the cache data in the valid linked list and the invalid linked list according to the current state information corresponding to the cache data in the cache;

[0190] The cache information at least includes the cache scheme, cache address, hit count and status information of the corresponding cache data; the cache scheme at least includes data stored in the valid linked list or the invalid linked list.

[0191] In one embodiment of the present invention, the update module is used to:

[0192] The cache data corresponding to the tail node of the invalid linked list is deleted from the cache.

[0193] In one embodiment of the present invention, the update module is used to:

[0194] The cache data corresponding to the tail node of the valid linked list is deleted from the cache.

[0195] In one embodiment of the present invention, after receiving the current user request sent by the host, the device further includes: a valid linked list updating module, which is used to:

[0196] When cache data hit by the current user request exists in the cache, cache information of the cache data in the cache in the valid linked list is updated.

[0197] In one embodiment of the present invention, the device further includes: a write request update module, configured to:

[0198] If the current user request is a write request, the cache data corresponding to the write request is updated in the cache according to the write request.

[0199] In one embodiment of the present invention, the trained machine learning model is stored in the flash memory of the solid state drive, and the prediction module is used to:

[0200] When calling the machine learning model from the flash memory, converting the machine learning model into a tree structure, and instantiating the tree structure obtained by converting the machine learning model into a model function;

[0201] Collecting characteristic information of user requests corresponding to the cache data in the cache, and setting the characteristic information of the user requests as input parameters of the model function;

[0202] The input parameters are input into the model function to predict current state information corresponding to the cache data in the cache.

[0203] In an embodiment of the present invention, the device further includes: a cache management scheme selection module, configured to:

[0204] Determine whether to use a cache management scheme for cache data that manages different state information through different linked lists;

[0205] If it is determined to use a cache management scheme that manages cache data with different status information through different linked lists, then collect the feature information of the user requests corresponding to the cache data in the cache, and input the feature information of the user requests into a pre-trained machine learning model to predict the current status information corresponding to the cache data in the cache.

[0206] In one embodiment of the present invention, the cache management scheme selection module is used to:

[0207] Acquire management parameters of a cache management scheme for managing cache data of different state information through different linked lists; wherein the management parameters include cache hit rate and performance parameters;

[0208] If the management parameter satisfies a preset threshold parameter, a cache management solution for managing cache data of different state information through different linked lists is determined.

[0209] In one embodiment of the present invention, the cache management scheme selection module is used to:

[0210] If the management parameter does not meet the preset threshold parameter, other cache management schemes are used to manage the cache; wherein the other cache management schemes at least include a least recently used cache management scheme.

[0211] In one embodiment of the present invention, the device further includes: an updating module, configured to:

[0212] When a preset trigger condition is met, the cache data corresponding to the invalidation linked list is deleted in the cache, and the invalidation linked list is updated according to the cache data deleted in the cache.

[0213] In one embodiment of the present invention, the update module is used to:

[0214] When the preset deletion time is reached, the cache data corresponding to the tail node of the invalid linked list is deleted in the cache, and the invalid linked list is updated according to the cache data deleted in the cache.

[0215] In one embodiment of the present invention, the update module is used to:

[0216] Regularly checking whether the storage space of the cache is full;

[0217] If it is detected that the storage space of the cache is full, the cache data corresponding to the tail node of the invalidation linked list is deleted from the cache, and the invalidation linked list is updated according to the cache data deleted from the cache.

[0218] In one embodiment of the present invention, the solid state drive adopts multi-core collaborative operation.

[0219] The embodiment of the present invention also provides a communication device, such as Fig.11 As shown, it includes a processor 1101, a communication interface 1102, a memory 1103 and a communication bus 1104, wherein the processor 1101, the communication interface 1102, and the memory 1103 communicate with each other through the communication bus 1104.

[0220] Memory 1103, used for storing computer programs;

[0221] The processor 1101, when used to execute the program stored in the memory 1103, can implement the following steps:

[0222] Receive the current user request sent by the host;

[0223] Collecting feature information of user requests corresponding to the cached data in the cache, and inputting the feature information of the user requests into a pre-trained machine learning model to predict current state information corresponding to the cached data in the cache;

[0224] When there is no cache data hit by the current user request in the cache, the current request data corresponding to the current user request is written into the cache as cache data, and the linked list of the cache data in the cache is updated and managed according to the current status information corresponding to the cache data in the cache.

[0225] In another embodiment provided by the present invention, a computer-readable storage medium is also provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the solid-state hard disk cache management method described in any of the above embodiments.

[0226] In another embodiment provided by the present invention, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the solid state drive cache management method described in any of the above embodiments.

Claims

1. A cache management method in a solid state drive, characterized in that: The cache is used to temporarily store cache data corresponding to user requests, the cache includes a plurality of linked lists, the linked lists are used to manage cache data of different state information, the state information is used to characterize the future cache hit rate of the cache data, and the method includes: Receive the current user request sent by the host; Collecting feature information of user requests corresponding to the cached data in the cache, and inputting the feature information of the user requests into a pre-trained machine learning model to predict current state information corresponding to the cached data in the cache; When there is no cache data hit by the current user request in the cache, the current request data corresponding to the current user request is written into the cache as cache data, and the linked list of the cache data in the cache is updated and managed according to the current status information corresponding to the cache data in the cache.

2. The method according to claim 1, characterized in that The machine learning model is trained as follows: Obtaining a sample user request; wherein the sample read and write command includes sample logical block address information; Reconstructing the sample user request into a plurality of sample page requests according to the sample logical block address information; wherein the sample page requests respectively have corresponding tags, and the tags include real state information of the sample page requests; Collecting sample feature information of the sample page request, and inputting the sample feature information of the sample page request into a machine learning model to be trained, to obtain prediction state information corresponding to the sample user request; Calculating a loss value of the machine learning model according to the real state information and the predicted state information; When the loss value meets the preset convergence condition, the trained machine learning model is obtained.

3. The method according to claim 1 or 2, characterized in that: The current user request and sample user request include read requests and write requests; the machine learning model is a decision tree model using a decision tree algorithm; the feature information and sample feature information include at least the access frequency, the size of the user request, the number of recent consecutive hits, the number of user requests from the cached data in the cache to the current access, and the life cycle of the cached data.

4. The method according to claim 1, characterized in that: The user request includes logic block address information, and the collecting feature information of the user request corresponding to the cache data in the cache, and inputting the feature information of the user request into a pre-trained machine learning model to predict current state information corresponding to the cache data in the cache, includes: reconstructing the user request corresponding to the cache data in the cache into a plurality of page requests according to the logic block address information; The characteristic information of the page request is collected, and the characteristic information of the page request is input into a pre-trained machine learning model to predict the current state information corresponding to the cache data in the cache.

5. The method according to claim 4, characterized in that The state information includes at least a valid state and an invalid state, the linked list includes at least a valid linked list for managing cache data in a valid state, and an invalid linked list for managing the valid linked list of cache data in an invalid state; the writing of the current request data corresponding to the current user request into the cache as cache data, and updating the linked list for managing the cache data in the cache according to the current state information corresponding to the cache data in the cache, comprises: Detecting whether the storage space of the cache is full; If it is detected that the storage space of the cache is not full, writing the current request data corresponding to the current user request into the cache as cache data, and updating the cache information of the cache data in the cache in the valid linked list; If it is detected that the storage space of the cache is full, then detecting whether the invalidation linked list is empty; If it is detected that the invalid linked list is not empty, deleting the cache data corresponding to the invalid linked list in the cache; If it is detected that the invalid linked list is empty, deleting the cache data corresponding to the valid linked list in the cache; Writing the current request data corresponding to the current user request in the cache as cache data, and updating cache information of the cache data in the valid linked list and the invalid linked list according to the current state information corresponding to the cache data in the cache; The cache information at least includes the cache scheme, cache address, hit count and status information of the corresponding cache data; the cache scheme at least includes data stored in the valid linked list or the invalid linked list.

6. The method according to claim 5, characterized in that Deleting the cache data corresponding to the invalid linked list in the cache includes: The cache data corresponding to the tail node of the invalid linked list is deleted from the cache.

7. The method according to claim 5, characterized in that Deleting the cache data corresponding to the valid linked list in the cache includes: The cache data corresponding to the tail node of the valid linked list is deleted from the cache.

8. The method according to claim 5, characterized in that After receiving the current user request sent by the host, the method further includes: When cache data hit by the current user request exists in the cache, cache information of the cache data in the cache in the valid linked list is updated.

9. The method according to claim 8, characterized in that After updating cache information of the cache data in the cache in the valid linked list when the cache data hit by the current user request exists in the cache, the method further includes: If the current user request is a write request, the cache data corresponding to the write request is updated in the cache according to the write request.

10. The method according to claim 1, characterized in that The trained machine learning model is stored in the flash memory of the solid state drive, and the characteristic information of the user request corresponding to the cached data in the cache is collected, and the characteristic information of the user request is input into the pre-trained machine learning model to predict the current state information corresponding to the cached data in the cache, including: When calling the machine learning model from the flash memory, converting the machine learning model into a tree structure, and instantiating the tree structure obtained by converting the machine learning model into a model function; Collecting characteristic information of user requests corresponding to the cache data in the cache, and setting the characteristic information of the user requests as input parameters of the model function; The input parameters are input into the model function to predict current state information corresponding to the cache data in the cache.

11. The method according to claim 1, characterized in that: Before receiving the current user request sent by the host, the method further includes: Determine whether to use a cache management scheme for cache data that manages different state information through different linked lists; If it is determined to use a cache management scheme that manages cache data with different status information through different linked lists, then collect the feature information of the user requests corresponding to the cache data in the cache, and input the feature information of the user requests into a pre-trained machine learning model to predict the current status information corresponding to the cache data in the cache.

12. The method according to claim 11, characterized in that The determining whether to use a cache management scheme for cache data that manages different state information through different linked lists includes: Acquire management parameters of a cache management scheme for managing cache data of different state information through different linked lists; wherein the management parameters include cache hit rate and performance parameters; If the management parameter satisfies a preset threshold parameter, a cache management solution for managing cache data of different state information through different linked lists is determined.

13. The method according to claim 12, characterized in that The determining whether to use a cache management scheme for cache data that manages different state information through different linked lists also includes: If the management parameter does not meet the preset threshold parameter, other cache management schemes are used to manage the cache; wherein the other cache management schemes at least include a least recently used cache management scheme.

14. The method according to claim 1, characterized in that Before receiving the current user request sent by the host, the method further includes: When a preset trigger condition is met, the cache data corresponding to the invalidation linked list is deleted in the cache, and the invalidation linked list is updated according to the cache data deleted in the cache.

15. The method according to claim 14, characterized in that When a preset trigger condition is met, deleting the cache data corresponding to the invalid linked list in the cache, and updating the invalid linked list according to the cache data deleted in the cache, comprises: When the preset deletion time is reached, the cache data corresponding to the tail node of the invalid linked list is deleted in the cache, and the invalid linked list is updated according to the cache data deleted in the cache.

16. The method according to claim 14, characterized in that When a preset trigger condition is met, deleting the cache data corresponding to the invalid linked list in the cache, and updating the invalid linked list according to the cache data deleted in the cache, comprises: Regularly checking whether the storage space of the cache is full; If it is detected that the storage space of the cache is full, the cache data corresponding to the tail node of the invalidation linked list is deleted from the cache, and the invalidation linked list is updated according to the cache data deleted from the cache.

17. The method according to claim 1, characterized in that The solid state hard disk adopts multi-core collaborative operation.

18. A cache management device in a solid state hard disk, characterized in that: The cache is used to temporarily store cache data corresponding to user requests, the cache includes a plurality of linked lists, the linked lists are used to manage cache data of different state information, the state information is used to characterize the future cache hit rate of the cache data, the device includes: A receiving module, used for receiving a current user request sent by the host; A prediction module, used to collect feature information of user requests corresponding to the cached data in the cache, and input the feature information of the user requests into a pre-trained machine learning model to predict current state information corresponding to the cached data in the cache; An update module is used to write the current request data corresponding to the current user request as cache data into the cache when there is no cache data hit by the current user request in the cache, and to update the linked list of the cache data in the cache according to the current status information corresponding to the cache data in the cache.

19. A communication device, characterized in that: include: A transceiver, a memory, a processor, and a program stored on the memory and executable on the processor; The processor is used to read the program in the memory to implement the cache management method in the solid state drive as described in any one of claims 1-17.

20. A readable storage medium for storing a program, characterized in that: When the program is executed by the processor, the cache management method in the solid state drive as described in any one of claims 1 to 17 is implemented.

21. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by the processor, the cache management method in the solid state drive as described in any one of claims 1-17 is implemented.

Citation Information

Cited By

  • Cache data management method and device, storage medium and program product

    CN118860298A

  • Automatic reading system for main control chip of solid state disk, use method, device and medium

    CN119781678A

  • Storage device, electronic device, data storage method and storage medium

    CN120723169A

  • Data writing method and system, electronic equipment, storage medium and program product

    CN121029106A