Multi-stream management method for application data and flash memory device

Optimizing multi-stream management of SSDs through clustering and lifecycle mapping solves the write amplification problem in SSDs, improves storage performance and enables host transparency.

CN117806986BActive Publication Date: 2024-10-15DAPUSTOR CORP
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202311863315.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-29
Publication Date
2024-10-15
Estimated Expiration
2043-12-29

AI Technical Summary

Technical Problem

The existing multi-stream management mechanism has a write amplification problem in solid-state drives. It consumes host memory resources and is highly dependent on the operating system. It cannot effectively improve the write amplification problem of solid-state drives.

Method used

By obtaining the compression ratio of application data, clustering generates software flows, estimating the life cycle of each software flow, mapping it with hardware flows, and optimizing data storage locations to reduce write amplification.

Benefits of technology

It effectively reduces the write amplification problem of solid-state drives, improves storage performance, and does not need to rely on the host operating system, achieving transparent multi-stream management of the host.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117806986B_ABST
    Figure CN117806986B_ABST
Patent Text Reader

Abstract

An embodiment of the present application relates to the field of storage management technology, and discloses a multi-stream management method for application data and a flash memory device. The method generates multiple software streams by clustering data with similar compression rates, estimates the life cycle of each software stream, maps software streams with similar life cycles to the same hardware stream, and stores the data corresponding to the software stream in the storage location corresponding to the hardware stream. The present application can further store application data with similar life cycles in the storage location corresponding to the hardware stream based on the compression rate, so as to optimize the write amplification problem of the flash memory device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of storage management, and in particular to a multi-stream management method for application data and a flash memory device. Background Art

[0002] Solid State Disk (SSD) based on non-volatile storage media (NAND FLASH) can support "write in place", which means writing data directly to the storage medium. Before NAND FLASH writes, it is necessary to erase the old data and recycle the invalid pages through the garbage collection mechanism. However, when garbage collection is performed on data, there are still a large number of valid pages in the block to be recycled. These valid pages must be written to a free location first before the block can be erased and recycled for subsequent use.

[0003] However, the write-back operation of valid pages causes additional write operations, leading to the write amplification problem. Write amplification not only consumes bandwidth resources in the storage and reduces read and write performance, but also reduces the service life of the SSD. Therefore, SSDs that can support multi-stream features need to support data isolation at the hardware level, allowing application software to divert data with different update modes (for example: append updates, in-place updates) and different life cycles, so that data with similar life cycles are placed in the same physical block, and data with large differences in life cycles are placed in different physical blocks. When garbage collection is performed, the life cycle of the data in the recycled physical blocks is basically invalid. Therefore, reducing the amount of data that needs to be written back and thus reducing the write amplification problem of the SSD, for SSDs that support multi-stream features, how to perform accurate, efficient, and scalable multi-stream management is crucial.

[0004] At present, the commonly used multi-stream management mechanism is mainly based on statistical information and an automatic traffic diversion management mechanism that is opaque to the host. This automatic traffic diversion management mechanism estimates the life cycle of the data based on the characteristic information of the data corresponding to the statistical write request, and further maps data with different life cycles to different stream identifiers through an algorithm. The above method has the following disadvantages:

[0005] (1) It is necessary to count the characteristic information of a large amount of input or output data, which consumes the host's memory resources.

[0006] (2) The kernel of the operating system still needs to be modified. For example, the kernel of the operating system includes a virtual file system, a file system, a device driver, etc., and cannot be transparent to the host. The above method has a high dependence on application software and is not transparent to the host, and cannot effectively improve the write amplification problem of the solid-state drive. Summary of the invention

[0007] The embodiments of the present application provide a multi-stream management method for application data and a flash memory device, which solves the technical problem of data write amplification and can store application data with similar life cycles in the storage location corresponding to the hardware stream to optimize the write amplification problem of the flash memory device.

[0008] To solve the above technical problems, the present application provides the following technical solutions:

[0009] In a first aspect, an embodiment of the present application provides a multi-stream management method for application data, the method comprising:

[0010] Get the compression ratio of application data;

[0011] Clustering the application data according to the compression rate of the application data to generate multiple software flows;

[0012] Estimate the life cycle of each software flow;

[0013] Clustering the software flows according to the life cycle of each software flow to establish a first mapping relationship between each software flow and a hardware flow;

[0014] According to the first mapping relationship, the data corresponding to the software stream is stored in the storage location corresponding to the hardware stream.

[0015] In some embodiments, obtaining the compression rate of application data includes:

[0016] Determine a compression algorithm corresponding to the application data according to the data type corresponding to the application data;

[0017] The application data is compressed according to a compression algorithm to obtain a compression ratio of the application data.

[0018] In some embodiments, each software stream corresponds to at least one logical block address, the logical block address includes a plurality of logical pages, and the data corresponding to the software stream is stored in the logical pages;

[0019] Estimate the lifecycle of each software flow, including:

[0020] Estimate the life cycle of all logical pages corresponding to each software flow;

[0021] The average value of the life cycles of all logical pages corresponding to each software flow is calculated to determine the life cycle of each software flow.

[0022] In some embodiments, estimating the lifecycle of all logical pages corresponding to each software flow includes:

[0023] Counting the timestamp of each logical page access, wherein the timestamp includes a first timestamp and a second timestamp, and the first timestamp and the second timestamp are adjacent timestamps;

[0024] The difference between the first timestamp and the second timestamp is calculated to determine the life cycle of each logical page.

[0025] In some embodiments, each hardware flow corresponds to a preset life cycle one by one, and according to the life cycle of each software flow, the software flows are clustered to establish a first mapping relationship between the software flow and the hardware flow, including:

[0026] If the life cycle of the software stream is within the preset life cycle, the software stream is mapped to the hardware stream corresponding to the preset life cycle to determine a first mapping relationship between the software stream and the hardware stream, wherein each hardware stream corresponds to multiple software streams.

[0027] In some embodiments, the storage location includes a plurality of physical pages, and the method further includes:

[0028] Reclaiming valid data in the physical page corresponding to the storage location corresponding to the hardware stream includes:

[0029] Count the feedback information of the physical page corresponding to the storage location corresponding to each hardware stream;

[0030] According to the feedback information, the valid data in the storage location is moved to the preset storage location.

[0031] In some embodiments, the feedback information includes the write-back frequency of the physical page and the hardware stream number where the physical page is located;

[0032] According to the feedback information, the valid data in the storage location is moved to the preset storage location, including:

[0033] Determine the write-back frequency of the physical page within a period of time according to the write-back frequency of the physical page, and move valid data in the physical page corresponding to the storage location to a preset storage location according to the write-back frequency;

[0034] and / or,

[0035] According to the hardware stream number of the physical page, the valid data in the storage location is moved to the preset storage location according to the state machine;

[0036] Before moving the valid data in the storage location to the preset storage location, the method further includes:

[0037] A second mapping relationship between each hardware stream and a preset hardware stream is established, wherein the preset hardware stream corresponds to a preset storage location.

[0038] In some embodiments, according to the write-back frequency, moving valid data in a physical page corresponding to a storage location to a preset storage location includes:

[0039] If the write-back frequency is greater than or equal to the frequency threshold, then according to the second mapping relationship, the valid data in the physical page corresponding to the storage location is moved to the preset storage location.

[0040] In a second aspect, an embodiment of the present application provides a flash memory device, including:

[0041] A compression module, used to determine a compression algorithm corresponding to the application data according to a data type corresponding to the application data, and compress the application data according to the compression algorithm to obtain a compression ratio of the application data;

[0042] A first clustering module, used for clustering the application data according to the compression rate of the application data to generate multiple software flows;

[0043] Lifecycle estimation module, used to estimate the lifecycle of each software flow;

[0044] A second clustering module, used for clustering the software flows according to the life cycle of each software flow, so as to establish a first mapping relationship between each software flow and the hardware flow;

[0045] A flash memory conversion module, configured to store data corresponding to the software stream to a storage location corresponding to the hardware stream according to the first mapping relationship;

[0046] A remapping module, used for recovering valid data in a storage location corresponding to a hardware stream, so as to move the valid data in the storage location to a preset storage location;

[0047] Flash media, used to store application data.

[0048] In a third aspect, an embodiment of the present application provides a flash memory device, including:

[0049] at least one processor; and,

[0050] a memory communicatively connected to at least one processor; wherein,

[0051] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor to enable the at least one processor to perform the multi-stream management method of application data as described in the first aspect.

[0052] The beneficial effect of the embodiments of the present application is that, different from the prior art, the embodiments of the present application provide a multi-stream management method for application data, the method comprising: obtaining the compression rate of the application data; clustering the application data according to the compression rate of the application data to generate multiple software streams; estimating the life cycle of each software stream; clustering the software streams according to the life cycle of each software stream to establish a first mapping relationship between each software stream and the hardware stream; according to the first mapping relationship, storing the data corresponding to the software stream in the storage location corresponding to the hardware stream.

[0053] By clustering data with similar compression rates, generating multiple software streams, and estimating the life cycle of each software stream, the software streams with similar life cycles are mapped to the same hardware stream, and the data corresponding to the software streams are stored in the storage locations corresponding to the hardware streams. The present application can store application data with similar life cycles in the storage locations corresponding to the hardware streams, so as to optimize the write amplification problem of flash memory devices. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0055] Figure 1 This is a schematic diagram of a connection relationship between a host and a flash memory device provided in an embodiment of the present application;

[0056] Figure 2 It is a flowchart of a manual diversion mechanism provided in an embodiment of the present application;

[0057] Figure 3 It is a flow chart of an automatic traffic diversion mechanism based on statistical information provided in an embodiment of the present application;

[0058] Figure 4A It is a schematic diagram of a process of clustering and diverting application data based on compression rate provided in an embodiment of the present application;

[0059] Figure 4B It is a schematic diagram of a process of performing two-stage clustering and diversion of application data provided by an embodiment of the present application;

[0060] Figure 4C It is a flowchart of a two-stage multi-stream mapping method provided in an embodiment of the present application;

[0061] Figure 5 It is a flowchart of a multi-stream management method for application data provided by an embodiment of the present application;

[0062] Figure 6 yes Figure 5 A detailed flow chart of step S501;

[0063] Figure 7 This is an example schematic diagram of compression ratios corresponding to different types of data provided in an embodiment of the present application;

[0064] Figure 8 yes Figure 5 A detailed flow chart of step S503;

[0065] Fig. 9 yes Figure 8 A detailed flow chart of step S5031;

[0066] Fig.10 yes Figure 5 A detailed flow chart of step S504;

[0067] Fig.11 It is a schematic diagram of a process for recovering valid data in a physical page provided by an embodiment of the present application;

[0068] Fig.12 It is a schematic diagram of a process of establishing a second mapping relationship between a hardware flow and a preset hardware flow provided by an embodiment of the present application;

[0069] Fig.13 yes Fig.11 A detailed flow chart of step S1101;

[0070] Fig.14 yes Fig.13 A detailed flow chart of step S1112;

[0071] Fig.15 yes Fig.14 Step S1121 is a schematic diagram of a detailed process;

[0072] Fig.16 It is a schematic diagram of the overall structure of a flash memory device provided in an embodiment of the present application;

[0073] Fig.17 It is a schematic diagram of the structure of another flash memory device provided in an embodiment of the present application.

[0074] Description of Figure Numbers:

[0075] Label name Label name 100 Flash memory devices 106 Flash Media 101 Compression Module 107 Remap Module 102 The first clustering module 108 processor 103 Life Cycle Estimation Module 109 Memory 104 The second clustering module 200 Host 105 Flash conversion module DETAILED DESCRIPTION

[0076] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0077] It should be noted that, if there is no conflict, the various features in the embodiments of the present application can be combined with each other, all within the scope of protection of the present application. In addition, although the functional module division is performed in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a sequence different from the module division in the device or the flow chart. Furthermore, the words "first", "second", "third", etc. used in this application do not limit the data and execution order, but only distinguish the same items or similar items with basically the same functions and effects.

[0078] In addition, the technical features involved in each embodiment of the present application described below can be combined with each other as long as they do not conflict with each other.

[0079] Before introducing the embodiments of the present application, a brief introduction to the prior art known to the inventors of the present application is first given to facilitate subsequent understanding of the embodiments of the present application.

[0080] Multi-stream technology is an SSD interface that allows the host to pass data semantic information. Based on the semantic information of the data provided by the host, the multi-stream SSD can reasonably place the written data. When the semantic information of the data is its expected lifespan, the SSD can store data with similar lifespans in the same erase block, so that the data in the same erase block is invalidated together as much as possible, thereby reducing the number of valid pages migrated during garbage collection and write amplification, and ultimately improving the performance and lifespan of the SSD.

[0081] The technical solution of this application is described in detail below with reference to the accompanying drawings:

[0082] See also Figure 1 , Figure 1 This is a schematic diagram of a connection relationship between a host and a flash memory device provided in an embodiment of the present application;

[0083] like Figure 1 As shown, the flash memory device 100 is used to process the application data of the host 200, so as to classify and compress the application data of the host 200 according to the data type, cluster the compressed application data to generate multiple software streams, and estimate the life cycle of each software stream. Furthermore, a mapping relationship is established between the software stream corresponding to the application data of the host 200 and the hardware stream of the flash memory device 100. According to the mapping relationship, the application data corresponding to the software streams with different life cycles are respectively stored in different hardware streams, so as to realize the separate storage of application data with large differences in life cycles, which can optimize the write amplification problem of data in the flash memory device 100.

[0084] Among them, the flash memory device 100 includes solid state drives (SSD), USB flash drives, memory cards, flash drives (a storage device that integrates USB flash drives and memory cards), and other storage devices for storing application data.

[0085] Among them, the solid-state drive includes flash memory media. The flash memory media is the storage medium of the solid-state drive and is also called flash memory, Flash, NAND Flash memory or Flash particles. The flash memory media is used as a storage unit for application data, system data, etc.

[0086] Among them, NAND Flash memory is a non-volatile memory that can store data for a long time even without current supply. NAND Flash memory uses a single transistor as a storage unit for binary signals. Its structure is very similar to that of ordinary semiconductor transistors. The difference is that the single transistor of NAND Flash memory adds a floating gate and a control gate. The floating gate is used to store electrons. The surface is covered by a layer of silicon oxide insulator and is coupled with the control gate through a capacitor. When negative electrons are injected into the floating gate under the action of the control gate, the storage state of the single crystal of NAND Flash memory 12 changes from "1" to "0", and when the negative electrons are removed from the floating gate, the storage state changes from "0" to "1". The insulator covered on the surface of the floating gate is used to trap the negative electrons in the floating gate to achieve data storage. That is, the storage unit of NAND Flash memory 12 is a floating gate transistor, which uses the floating gate transistor to store data in the form of charge. The amount of stored charge is related to the magnitude of the voltage applied to the floating gate transistor. Specifically, whether data is stored in the storage unit depends on whether the voltage of the stored charge is greater than the preset voltage threshold Vth.

[0087] According to the different levels of voltage of the storage cell, NAND Flash memory can be divided into SLC, MLC, TLC and QLC. When the storage cell of the NAND Flash memory is of SLC type, a single storage cell only stores one bit of data 1 or 0. When the voltage of the charge stored in a single storage cell is greater than the preset voltage threshold Vth, it indicates that the data of the storage cell is 1; when the voltage of the charge stored in a single storage cell is less than the preset voltage threshold Vth, it indicates that the data of the storage cell is 0. Since the default data of the storage cell is 1, the data of the storage cell being 0 indicates that the charge stored in the single storage cell is released. When the charge is released to a certain extent so that the voltage of the floating gate transistor is less than the preset voltage threshold Vth, the operation of writing data 0 is completed. When the storage cell of the NAND Flash memory 12 is of MLC type, TLC type or QLC type, a single storage cell can store multi-bit data. Taking 2-bit data as an example, multiple preset voltage thresholds Vth are defined by controlling the amount of charge inside the storage cell. For writing data, the amount of charge inside the storage cell is controlled through the charging process so that it falls into the interval of two adjacent preset voltage thresholds Vth, corresponding to different data 00, 01, 10, 11; for reading data, the current inside the corresponding storage cell is obtained, and then the reading is completed through a series of decoding circuits to parse the data 00, 01, 10, 11 stored in the storage cell.

[0088] A NAND Flash memory includes at least one Chip chip, each Chip chip consists of several Block physical blocks, and each Block physical block includes several Page pages. Among them, Block physical block is the smallest unit for NAND Flash memory to perform erase operations, and Page page is the smallest unit for NAND Flash memory to perform read and write operations. The capacity of a NAND Flash memory is equal to the number of its Block physical blocks * the number of Page pages contained in a Block physical block * the capacity of a Page page.

[0089] Since the storage unit of NAND Flash memory is implemented by floating gate technology, the charge on the floating gate layer can change the distribution state of electrons, thereby changing the state of the storage unit. However, the charge on the floating gate layer will leak over time. Therefore, it is necessary to regularly erase and refresh the charge to maintain the persistence of the data.

[0090] See also Figure 2 , Figure 2 It is a flowchart of a manual diversion mechanism provided in an embodiment of the present application;

[0091] The manual diversion mechanism is mainly based on the developer's experience to judge the corresponding life cycles of different types of application data, that is, the life cycle of the application data is determined before the application data is input into the storage location corresponding to different hardware streams, and the data with different life cycles are mapped to the corresponding hardware streams according to the storage locations corresponding to different hardware stream identifiers. The life cycle of the application data stored in the storage location corresponding to each hardware stream is different.

[0092] It is understandable that due to the physical characteristics of flash memory devices and the settings of flash memory devices, the data transmission speed and concurrent stream support capabilities of flash memory devices are subject to certain limitations. For example, the data transmission of flash memory devices needs to follow certain protocols and standards, such as SATA, PCI e, etc. These protocols and standards will limit the number of streams supported by flash memory devices. Therefore, the number of hardware streams supported by different flash memory devices is determined by hardware or other technologies.

[0093] like Figure 2 As shown in the figure, the manual diversion mechanism is further explained by taking the RocksDB key-value database as an example. The RocksDB key-value database runs on the host. Before the data files in the RocksDB key-value database are diverted and stored in the multi-stream solid-state disk, the life cycle of different data files in the RocksDB key-value database is determined based on the developer's experience. By modifying the source code corresponding to the RocksDB key-value database, different "write hints" are set for the software flows corresponding to different files, that is, the hardware flow corresponding to the software flow is manually modified. Among them, the data files in the RocksDB key-value database include the write-ahead log (WAL) and the data in the Memtable. The Memtable is a data structure in the host memory for storing memory data. Before the data in the Memtable is flushed to the multi-stream solid-state disk, it is necessary to sort the string table (Sorted Strings Table, SSTable) reads memory data from Memtable, stores files with different life cycles in the memory data into different SSTable files respectively, and writes memory data and write-ahead logs from the application layer of the host to the multi-stream solid-state disk. Write hints are also sent down layer by layer along with the memory data and write-ahead logs. When the multi-stream solid-state disk receives a write hint, it converts the write hint into the corresponding hardware flow identifier to store the data in the software stream corresponding to the write hint corresponding to the hardware flow identifier in the storage location corresponding to the hardware flow identifier.

[0094] For example: when the write hint is a long life cycle, the write hint is converted into a hardware flow identifier 3, and the storage location corresponding to the hardware flow identifier 3 is used to store data files with a long life cycle; when the write hint is a medium life cycle, the write hint is converted into a hardware flow identifier 2, and the storage location corresponding to the hardware flow identifier 2 is used to store data files with a medium life cycle; when the write hint is a short life cycle, the write hint is converted into a hardware flow identifier 1, and the storage location corresponding to the hardware flow identifier 1 is used to store data files with a short life cycle, for example: log files often need to be refreshed, that is, the life cycle of log files is short, then the log files are stored in the storage location corresponding to the hardware flow identifier 1; when the write hint is default, the write hint is converted into a hardware flow identifier, and the hardware flow identifier is 0, and the storage location corresponding to the hardware flow identifier 0 is used to store the default data of the host, such as: system configuration information, application configuration information, default files or data, etc.

[0095] Above Figure 2 The use of a manual diversion mechanism to store host data in a multi-stream solid-state disk has the following disadvantages: (1) It requires developers to have a deep understanding of the host data; (2) It requires the source code of the application to be modified, which is highly invasive to the application; (3) When the data generated by different applications is stored in a multi-stream solid-state disk, each application needs to be adapted to the multi-stream solid-state disk, which has poor scalability; (4) When there are too many applications, the complexity of multi-stream management of application data will increase. Based on this, the embodiment of the present application provides a method for diverting application data with an automatic diversion mechanism to overcome the above disadvantages.

[0096] For details, please refer to Figure 3 , Figure 3 This is a flow chart of an automatic traffic diversion mechanism based on statistical information provided by an embodiment of the present application;

[0097] like Figure 3 As shown, the operating system kernel includes a statistical information collection module, a life cycle estimation module, and a multi-stream mapping module. The statistical information collection module is used to collect statistical characteristic information of application data, for example: the characteristic information includes the access frequency, rewrite interval, and program counter summary of the logical block address corresponding to the application data, wherein the program counter summary includes the value recorded by the program counter, such as the number of program executions, the average program execution time, the longest program execution time, etc.

[0098] The life cycle estimation module estimates the life cycle of the data of the write request based on the above-mentioned characteristic information, and then automatically maps the data to hardware streams of different priorities according to the estimated life cycle. For example, in the driver layer of the multi-stream solid-state disk, by counting the logical block addresses of the write requests, characteristic information such as the access popularity (frequency), recency (recency) and sequentiality (sequentiality) of the data corresponding to the logical block addresses can be obtained. This characteristic information can reflect the data life cycle to a certain extent. For example, the higher the access popularity of the data, the shorter its life cycle, the longer the life cycle of the data that has not been accessed for a long time, and the closer the life cycle of data with adjacent addresses.

[0099] The multi-stream mapping module is used to map data with similar life cycles to the same hardware flow identifier through multi-queue, clustering and other algorithms, so as to store data with similar life cycles in the storage location corresponding to the same hardware flow identifier to achieve automatic data diversion.

[0100] The above-mentioned automatic diversion mechanism can realize automatic data diversion, but it still has the following disadvantages: (1) It needs to be modified in the operating system kernel, such as the virtual file system, file system, block layer, device driver and other modules, which is relatively complex. (2) It needs to count a large amount of I / O feature information, which consumes a large amount of host memory resources. (3) It does not consider the write amplification problem of multi-stream solid-state drives. (4) The diversion strategy is not evaluated.

[0101] Based on this, the present application provides a multi-stream management method for application data, which does not require statistics of a large amount of I / O feature information and saves the host's memory resources.

[0102] See also Figure 4A , Figure 4A It is a schematic diagram of a process of clustering and diverting application data based on compression rate provided in an embodiment of the present application;

[0103] like Figure 4A As shown, the flash memory device 100 includes a compression module 101 , a first clustering module 102 , a flash memory conversion module 105 , and a flash memory medium 106 .

[0104] The compression module 101 receives application data sent by the host and compresses the application data, wherein the application data includes multiple types of data files, and different types of data files have different corresponding compression rates.

[0105] The first clustering module 102 clusters the application data according to the compression rates corresponding to different types of data files, and maps data files with similar compression rates to the same hardware stream to establish a mapping relationship between the data files and the hardware streams.

[0106] The flash conversion module 105 maps the data file to the hardware stream and stores the data file in the flash medium 106, wherein the flash medium 106 includes a plurality of super blocks, each hardware stream corresponds to a super block, each hardware stream corresponds to a hardware stream identifier, and stores the data file in the flash medium 106, that is, according to the hardware stream identifier corresponding to the data file, the data file is stored in the super block corresponding to the hardware stream identifier corresponding to the data file.

[0107] In an embodiment of the present application, application data with different compression rates are clustered by a first clustering module to achieve multi-stream mapping of a solid-state flash memory device. However, clustering and splitting application data based solely on compression rate cannot optimize the write amplification problem of the flash memory device.

[0108] In view of this, an embodiment of the present application provides a two-stage clustering and diversion method for application data, which can further cluster application data with similar life cycles in the same hardware flow based on the compression rate to optimize the write amplification problem of the flash memory device.

[0109] For details, please refer to Figure 4B , Figure 4B It is a schematic diagram of a process of performing two-stage clustering and diversion of application data provided by an embodiment of the present application;

[0110] like Figure 4B As shown, the flash memory device 100 includes a compression module 101 , a first clustering module 102 , a life cycle estimation module 103 , a second clustering module 104 , a flash memory conversion module 105 , and a flash memory medium 106 .

[0111] The compression module 101 receives application data sent by the host and compresses the application data, wherein the application data includes multiple types of data files, and different types of data files have different corresponding compression rates.

[0112] The first clustering module 102 clusters the application data according to the compression rates corresponding to different types of data files, and generates a plurality of software streams, wherein data files with similar compression rates are mapped into the same software stream.

[0113] The lifecycle estimation module 103 estimates the lifecycle of each software flow based on the compression ratio of the data file.

[0114] The second clustering module 104 clusters the software streams according to their life cycles, so as to map the software streams with similar life cycles to the same hardware stream, i.e., to establish a mapping relationship between the software streams and the hardware streams, wherein each hardware stream corresponds to multiple software streams. It is understandable that the number of hardware streams is determined by the type of flash memory device, and the number of hardware streams is usually less than the number of software streams, therefore, mapping the software streams to the hardware streams can match the software streams with the hardware streams.

[0115] The flash conversion module 105 stores the data in the software stream into the super block corresponding to the hardware stream according to the mapping relationship between the software stream and the hardware stream.

[0116] In an embodiment of the present application, data with similar compression rates are clustered through a first clustering module to map application data with the same compression rate to the same software stream. Further, software streams are clustered through a second clustering module to map software streams with similar life cycles to the same hardware stream. Clustering application data in two stages can place application data with similar life cycles together, avoid occupying multi-stream resources, and solve the problem of mismatch between software streams and hardware streams.

[0117] The above-mentioned multi-stream management method places application data with similar life cycles in the same hardware stream, which can effectively improve the write amplification problem of the flash memory device. However, the same hardware stream may still contain data with similar compression rates but longer life cycles, resulting in multiple rewrites during subsequent garbage collection, causing write amplification problems. To further improve this problem, an embodiment of the present application provides a two-stage multi-stream mapping method, which can effectively improve the write amplification problem during the garbage collection process.

[0118] See also Figure 4C , Figure 4C It is a flowchart of a two-stage multi-stream mapping method provided in an embodiment of the present application;

[0119] like Figure 4C As shown, Figure 4C is Figure 4B Based on the improvement, in order to solve Figure 4B In order to solve the write amplification problem caused by the garbage collection process mentioned in the specification, a remapping module 107 is added to the flash memory device 100. The remapping module 107 is used to map all hardware streams to a new hardware stream. During the garbage collection process, the valid data with a long life cycle in the physical page of the super block corresponding to each hardware stream is written back to the new hardware stream, which can effectively optimize the write amplification problem.

[0120] In an embodiment of the present application, data with similar compression rates are clustered through a first clustering module to map application data with the same compression rate to the same software stream. Further, software streams are clustered through a second clustering module to map software streams with similar life cycles to the same hardware stream. Clustering application data in two stages can place application data with similar life cycles together, avoid occupying multi-stream resources, and solve the problem of mismatch between software streams and hardware streams. At the same time, data with a longer life cycle and validity in the data block corresponding to the hardware stream is remapped through the remapping module, which can effectively improve the write amplification problem of the flash memory device.

[0121] See also Figure 5 , Figure 5 It is a flowchart of a multi-stream management method for application data provided by an embodiment of the present application;

[0122] like Figure 5 As shown, the multi-stream management method of application data includes:

[0123] Step S501: Obtain the compression rate of application data;

[0124] In an embodiment of the present application, there is an intrinsic correlation between the compression rate of application data and the life cycle of application data. For example, in the RocksDB and Cassandran application scenarios, the compression rate of WAL files is low, but the life cycle of WAL files is short, and the compression rate of SSTable files is high, but the life cycle of SSTable files is long. That is, in general, files with low compression rates have short life cycles, and files with high compression rates have long life cycles. Therefore, the compression rate can be used to indirectly characterize the life cycle, thereby firstly performing data diversion on application data based on the compression rate, and preliminarily mapping application data with similar life cycles into one software stream.

[0125] Specifically, the application data is compressed by a compression algorithm to obtain a compression ratio of the application data, wherein the compression algorithm includes compression algorithms such as LZ4, ZSTD, snappy, and DEFLATE.

[0126] In the embodiment of the present application, by compressing the application data, the total amount of data written to the flash memory device can be reduced.

[0127] Please refer to Figure 6 , Figure 6 yes Figure 5 A detailed flow chart of step S501;

[0128] like Figure 6 As shown, step S501 includes:

[0129] Step S5011: Determine the compression algorithm corresponding to the application data according to the data type corresponding to the application data;

[0130] In the embodiment of the present application, the application data has multiple data types. In order to improve the compression ratio and compression rate of the application data and to improve the write performance of the flash memory device, different compression algorithms are selected for application data of different data types. For example, if log files and temporary data are data for fast transmission and storage, the LZ4 algorithm can be used to process log files and temporary data faster. For large data sets, such as pictures and videos, the ZSTD algorithm can be used to process large data sets in batches to improve compression efficiency.

[0131] Specifically, the compression algorithm corresponding to the application data is determined according to the data type corresponding to the application data, wherein the data type includes structured data, unstructured data, real-time data, text data, log data, etc. It is understandable that different compression algorithms have different speeds and efficiencies in processing different types of data. For example, the LZ4 algorithm is more suitable for processing data that needs to be transmitted and stored quickly, such as log files, temporary data, etc.; the ZSTD algorithm is more suitable for processing large data sets, such as video, audio, pictures, etc.; the snappy algorithm is suitable for processing file-type data, such as text files, binary files, etc.

[0132] Please refer to Figure 7 , Figure 7 This is an example schematic diagram of compression ratios corresponding to different types of data provided in an embodiment of the present application;

[0133] like Figure 7 As shown, the compression ratio of each data block in the first database file is basically distributed around 0.17, the first database file includes the nci_database database file, the data compression ratio of the web page file is basically distributed around 0.4, the web page file includes the webster web page, the data compression ratio of the text file is basically distributed around 0.5, the text file includes the dickens_txt text file, the data compression ratio of each data block in the second database file is basically distributed around 0.74, the second database file includes the osdb_database database file, the data compression ratio of the image file is basically distributed around 0.82, the image file includes the xray_image picture, the data compression ratio of the binary file is basically distributed around 0.85, the binary file includes the sao_bin text file.

[0134] It can be seen from the above data that the compression rates of data of different data types are different. The compression rates of some different data types are quite different, such as the data compression rate between the nci_database database file and the xray_image picture. However, the compression rates of some different data types are quite different, such as the data compression rate between the osdb_database database file and the sao_bin text file.

[0135] In an embodiment of the present application, in the process of compressing data, the selection of a suitable compression algorithm needs to consider the compression ratio of the data, the performance requirements of the flash memory device, and the life cycle of the data. For example, whether excessive compression of the data will affect the I / O performance. Another example is that for data that is frequently read (data with a short life cycle), lightweight compression can be used to decompress the data faster when reading. For example, in the Cassandra scenario, the write-ahead log is often used, so there is no need to compress the write-ahead log. As a data structure in Cassandra, SSTable is divided into multiple layers, and the heat of the data stored in each layer of SSTable is different. For example, the data in the 0th layer SSTable has the highest heat, and the data in the nth layer SSTable (the last layer) has the lowest heat. A lightweight compression algorithm is used for the data in the 0th layer SSTable, and a heavyweight compression algorithm is used for the data in the nth layer SSTable. Among them, the higher the heat of the data, the more times the data is accessed and the shorter the life cycle of the data. The lower the heat of the data, the fewer times the data is accessed and the longer the life cycle of the data.

[0136] In an embodiment of the present application, a lightweight compression algorithm is used for data with high popularity, and the compression rate of the data with high popularity is low. A heavyweight compression algorithm is used for data with low popularity, and the compression rate of the data with low popularity is high. That is, the life cycle corresponding to the data with a low compression rate is shorter, and the life cycle corresponding to the data with a high compression rate is longer. The life cycle of the data is indirectly characterized by the compression rate, so as to further perform diversion management on the application data according to the compression rate of the data.

[0137] Step S5012: compressing the application data according to the compression algorithm to obtain a compression ratio of the application data;

[0138] Specifically, the application data is compressed according to a compression algorithm determined by the data type of the application data to obtain a compression ratio of the compressed application data.

[0139] In an embodiment of the present application, different compression algorithms are used for data of different data types, which can avoid the additional delay caused by the compression algorithm on the write critical path, thereby avoiding the impact of the compression algorithm on the write performance of the flash memory device.

[0140] Step S502: clustering the application data according to the compression rate of the application data to generate multiple software flows;

[0141] Specifically, according to the compression rate of the application data, the application data is clustered, that is, according to the compression rate of the application data, a clustering algorithm is used to divide the application data with similar compression rates into the same type of data to generate multiple software flows, wherein the clustering algorithm includes clustering algorithms such as K-means algorithm, DBSCAN algorithm, hierarchical clustering algorithm, spectral clustering algorithm, collaborative filtering algorithm, random forest algorithm, Gaussian process regression clustering algorithm, etc. The number of software flows (the number of categories) output by the clustering algorithm can be set according to specific needs. It should be noted that whether the compression rate is similar can be judged by whether the compression rate of the application data is within the same preset compression rate range, for example, the preset compression rate range is [0.1, 0.2]. Assuming that the compression rate of the text file is 0.17 and the compression rate of the picture is 0.1, the compression rates of the text file and the picture are both within the preset compression rate range, and the compression rates of the text file and the picture are similar.

[0142] Please refer to Figure 7 , Figure 7 This is an example schematic diagram of compression ratios corresponding to different types of data provided in an embodiment of the present application;

[0143] like Figure 7 As shown, the compression ratio of each data block in the first database file (such as the nci_database database file) is basically distributed around 0.17, the data compression ratio of the web page file (such as the webster web page) is basically distributed around 0.4, the data compression ratio of the text file (such as the dickens_txt text file) is basically distributed around 0.5, the data compression ratio of each data block in the second database file (such as the osdb_database database file) is basically distributed around 0.74, the data compression ratio of the image file (such as the xray_image picture) is basically distributed around 0.82, and the data compression ratio of the binary file (such as the sao_bin binary file) is basically distributed around 0.85.

[0144] From the above data, we can see that the compression rates of the data of the same type of files are basically the same, so the data of the same type of files are clustered in the same software flow. Figure 7 The data compression rate of the image file, the data compression rate of each data block in the second database file, and the data compression rate of the binary file are all high and close, that is, the corresponding life cycles of the image file, the second database file, and the binary file are close, so the image file, the second database file, and the binary file are clustered in the same software stream.

[0145] In an embodiment of the present application, data with different compression rates are clustered through a clustering algorithm, so that data of the same file type are clustered in the same software stream, and data of different file types are clustered in different software streams, and application data with similar life cycles are clustered in the same software stream, and application data with distant life cycles are clustered in different software streams, so as to realize multi-stream identification of the flash memory device.

[0146] Step S503: estimating the life cycle of each software flow;

[0147] In the embodiment of the present application, the compression rate is only an indirect representation of the life cycle of the application data, and the compression rates of the application data corresponding to different software streams vary greatly. The life cycles corresponding to the software streams with greatly different compression rates may be relatively close. At this time, distributing the software streams with relatively close life cycles to different hardware streams will cause a waste of multi-stream resources. Therefore, it is necessary to estimate the life cycle of each software stream so as to map the software streams with relatively close life cycles to the same hardware stream to save multi-stream resources. It should be noted that the number of hardware streams is limited by the flash memory device, and the number of hardware streams will not be too large.

[0148] In the embodiment of the present application, each software stream corresponds to at least one logical block address, the logical block address includes a plurality of logical pages, and the data corresponding to the software stream is stored in the logical pages.

[0149] Specifically, the time interval between two write operations on each logical page is recorded, the life cycle of each logical page is estimated based on the time interval corresponding to each logical page, and the average life cycle of all logical pages corresponding to each software flow is calculated to estimate the life cycle corresponding to each software flow.

[0150] Please refer to Figure 8 , Figure 8 yes Figure 5 A detailed flow chart of step S503;

[0151] like Figure 8 As shown, step S503 includes:

[0152] Step S5031: Estimate the life cycle of all logical pages corresponding to each software flow;

[0153] Specifically, the time interval between two recent adjacent write operations of each logical page is recorded, and the life cycle of all logical pages corresponding to each software flow is estimated based on the time interval between two recent adjacent write operations of each logical page.

[0154] Please refer to Fig. 9 , Fig. 9 yes Figure 8A detailed flow chart of step S5031;

[0155] like Fig. 9 As shown, step S5031 includes:

[0156] Step S5311: Counting the timestamp of each logical page access, wherein the timestamp includes a first timestamp and a second timestamp, and the first timestamp and the second timestamp are adjacent timestamps;

[0157] Specifically, the timestamp of each logical page access is counted, that is, the timestamp of each logical page write operation is recorded, and the timestamps of the two most recent adjacent write operations are taken. The timestamps include a first timestamp and a second timestamp. The first timestamp and the second timestamp are adjacent timestamps, and the first timestamp is smaller than the second timestamp.

[0158] Step S5312: Calculate the difference between the first timestamp and the second timestamp to determine the life cycle of each logical page;

[0159] Specifically, the difference between the first timestamp and the second timestamp is calculated, that is, the value obtained by subtracting the first timestamp from the second timestamp is the life cycle of the logical page. The life cycle of each logical page can be determined using the above calculation method.

[0160] Step S5032: Calculate the average value of the life cycles of all logical pages corresponding to each software flow to determine the life cycle of each software flow;

[0161] Specifically, calculate the average life cycle of all logical pages corresponding to each software stream, add up the life cycles of all logical pages corresponding to each software stream to obtain the total life cycle, divide the total life cycle by the number of logical pages corresponding to the software stream, and obtain the average life cycle of all logical pages. This average value is the life cycle of the software stream.

[0162] It should be noted that the life cycle of the software flow can also be determined by other methods, which are not limited here.

[0163] Step S504: clustering the software flows according to the life cycle of each software flow to establish a first mapping relationship between each software flow and the hardware flow;

[0164] In an embodiment of the present application, each hardware stream corresponds to a preset life cycle one by one. For example, assuming there are three hardware streams, the storage location corresponding to the first hardware stream is used to store data with a life cycle of one day, the storage location corresponding to the second hardware stream is used to store data with a life cycle of seven days, and the storage location corresponding to the third hardware stream is used to store data with a life cycle of one month. Before establishing the first mapping relationship between each software stream and the hardware stream, it is necessary to determine whether the life cycle of the current software stream is within the preset period corresponding to the current hardware stream. If the life cycle of the current software stream is five days, the current software stream is mapped to the second hardware stream.

[0165] In the embodiment of the present application, each hardware stream corresponds to a hardware stream number one by one, for example, there are three hardware streams, and the three hardware stream numbers are 0, 1, and 2. It should be noted that the preset life cycle corresponding to the hardware stream number is not affected by the order of the hardware stream number, for example, the preset life cycle of the hardware stream number 1 can be greater than the preset life cycle of the hardware stream number 0, and the preset life cycle of the hardware stream number 1 can also be less than the preset life cycle of the hardware stream number 0. The specific setting is based on actual needs and is not limited here.

[0166] Specifically, according to the life cycle of each software stream, the software streams are clustered by a clustering algorithm to determine whether the life cycle of each software stream is within the preset period corresponding to the hardware stream. If it is within the preset period corresponding to the hardware stream, a first mapping relationship between each software stream and the hardware stream is established, that is, each software stream is matched with a hardware stream number corresponding to a hardware stream. For example, assuming that there are currently 10 software streams and 4 hardware streams, and the life cycle of software streams 1-4 is within the preset life cycle of a hardware stream with a hardware stream number of 0, the software streams 1-4 are mapped to the hardware stream with a hardware stream number of 0. The number of clusters of the clustering algorithm is limited according to the number of hardware streams. For example, if there are currently 8 hardware streams, the number of clusters of the clustering algorithm is set to 8.

[0167] In the embodiment of the present application, by establishing a first mapping relationship between each software flow and a hardware flow, software flows with close life cycles are grouped into the same hardware flow, and one hardware flow corresponds to multiple software flows.

[0168] In an embodiment of the present application, the life cycle of each software stream is estimated so that software streams with large differences in compression rates and close life cycles are mapped to the same hardware stream, thereby avoiding the occupation of multi-stream resources. At the same time, multiple software streams are mapped to one hardware stream, solving the problem of mismatch between the number of software streams and the number of hardware streams.

[0169] Please refer to Fig.10 , Fig.10 yes Figure 5A detailed flow chart of step S504;

[0170] like Fig.10 As shown, the S504 includes:

[0171] Step S5041: Determine whether the life cycle corresponding to the current software flow is within the preset life cycle corresponding to the current hardware flow;

[0172] Specifically, determine whether the life cycle corresponding to the current software flow is within the preset life cycle corresponding to the current hardware flow. If it is within the preset life cycle corresponding to the current hardware flow, jump to step SS5042; otherwise, jump to step S5044.

[0173] Step S5042: Mapping the software flow to the hardware flow corresponding to the preset life cycle to determine a first mapping relationship between the software flow and the hardware flow;

[0174] Specifically, if the life cycle corresponding to the current software flow is within the preset life cycle corresponding to the current hardware flow, the current software flow is mapped to the current hardware flow through a clustering algorithm to determine the mapping relationship between the current software flow and the current hardware flow, and jump to step S5043.

[0175] Step S5043: Move to the next software flow;

[0176] Specifically, if the mapping relationship between the current software flow and the current hardware flow has been determined, the process moves to the next software flow and continues to execute step S5041 until all software flows are clustered into corresponding hardware flows.

[0177] Step S5044: Do not map the current software stream;

[0178] Specifically, if the life cycle corresponding to the current software flow is not within the preset life cycle corresponding to the current hardware flow, jump to step S5045.

[0179] Step S5045: Move to the next hardware flow;

[0180] Specifically, if it is determined that the life cycle corresponding to the current software flow is not within the preset life cycle corresponding to the current hardware flow, the process moves to the next hardware flow and continues to execute step S5041 until all software flows are clustered into corresponding hardware flows.

[0181] In the embodiment of the present application, a first mapping relationship between a software stream and a hardware stream is established to implement multi-stream management of application data.

[0182] Step S505: According to the first mapping relationship, the data corresponding to the software stream is stored in the storage location corresponding to the hardware stream;

[0183] Specifically, each hardware stream corresponds to a super block one by one, and according to the first mapping relationship between the software stream and the hardware stream, the data corresponding to the software stream is stored in the storage location corresponding to the hardware stream, that is, the data corresponding to the software stream is stored in the super block corresponding to the hardware stream.

[0184] In an embodiment of the present application, data with similar compression rates are clustered to generate multiple software streams, and the life cycle of each software stream is estimated so that software streams with similar life cycles are mapped to the same hardware stream, and the data corresponding to the software streams are stored in the storage locations corresponding to the hardware streams. This allows application data with similar life cycles to be stored in the storage locations corresponding to the hardware streams, and can reduce the number of times data is moved on the flash memory device to optimize the write amplification problem of the flash memory device.

[0185] In the embodiment of the present application, the diversion management of the host's application data is directly implemented inside the flash memory device without relying on the host's application program. The host is only responsible for transmitting data, thereby achieving a host transparent effect.

[0186] Please refer to Fig.11 , Fig.11 It is a schematic diagram of a process for recovering valid data in a physical page provided by an embodiment of the present application;

[0187] like Fig.11 As shown, the valid data in the physical page is recycled, including:

[0188] Step S1101: Reclaiming valid data in a physical page corresponding to a storage location corresponding to a hardware stream;

[0189] In an embodiment of the present application, when the garbage collection mechanism in the flash memory device is started, the storage space that is no longer in use will be automatically cleaned up to ensure the continuity and availability of the storage space.

[0190] In an embodiment of the present application, during the garbage collection process, a small amount of valid data with a long life cycle may still exist in the storage location corresponding to the hardware stream. In this case, the valid data with a long life cycle in the storage location corresponding to the hardware stream needs to be moved to another storage location before it can be erased. Since the valid data with a long life cycle needs to be rewritten each time garbage collection is performed, a write amplification problem is caused. Therefore, it is necessary to remap such data to a hardware stream with a long life cycle to reduce the number of times such data is moved.

[0191] Specifically, the storage location corresponding to the hardware stream is a super block, which is composed of multiple physical blocks. Each physical block includes multiple physical pages, and the physical pages are used to store data. The valid data in the storage location corresponding to the hardware stream is recovered, that is, the valid data in the physical pages corresponding to the storage location corresponding to the hardware stream is recovered.

[0192] Please refer to Fig.12 , Fig.12 It is a schematic diagram of a process of establishing a second mapping relationship between a hardware flow and a preset hardware flow provided by an embodiment of the present application;

[0193] like Fig.12 As shown, establishing a second mapping relationship between the hardware stream and the preset hardware stream includes:

[0194] Step S1201: establishing a second mapping relationship between each hardware stream and a preset hardware stream, wherein the preset hardware stream corresponds to a preset storage location;

[0195] Specifically, before recycling the valid data in the physical page corresponding to the storage location corresponding to the hardware stream, a second mapping relationship between each hardware stream and the preset hardware stream is established in advance. The preset hardware stream is used to store the valid data with a long life cycle in the hardware stream to the preset storage location corresponding to the preset hardware stream.

[0196] For example, for the physical pages of the common hardware stream, when the write-back frequency exceeds a threshold, the data will be written to the hardware stream 0 with the hardware stream number 0, which is used to store "colder" data. If the physical page of hardware stream 0 is written back again during garbage collection, the data in the physical page will be written to the hardware stream 1 with the hardware stream number 1, which is used to store "extremely cold" data. If the physical page of hardware stream 1 is written back again during garbage collection, the data is still written back to hardware stream 1; if the physical page of hardware stream 1 is overwritten, the new data will be written to the dedicated hardware stream 0; if the physical page of hardware stream 0 is overwritten, the new data will be written to the original hardware stream, that is, the hardware stream given by the second clustering module.

[0197] By storing cold data in a preset storage location corresponding to a preset hardware flow, where cold data is data with a long life cycle or data that is not frequently used, the embodiment of the present application can effectively improve the write amplification problem caused by the mixing of cold and hot data.

[0198] Please refer to Fig.13 , Fig.13 yes Fig.10 A detailed flow chart of step S1001;

[0199] like Fig.13 As shown, step S1101 includes:

[0200] Step S1111: counting feedback information of the physical page corresponding to the storage location corresponding to each hardware flow;

[0201] Specifically, the feedback information of the physical page corresponding to the storage location corresponding to each hardware stream is counted, wherein the feedback information includes the write-back frequency of the physical page and the hardware stream number where the physical page is located. The write-back frequency of the physical page indicates the frequency of use of the physical page in write operations and erase operations. Wherein, write-back refers to the data of the physical page that is still valid during garbage collection, and the valid data needs to be written to a new location.

[0202] In an embodiment of the present application, the improvement effect of write amplification of each hardware flow can be evaluated based on the feedback information of the physical page. For example, if the write-back frequency determined by the write-back frequency of a hardware flow is greater than or equal to the frequency threshold, it means that there is valid data with a long life cycle in the hardware flow. In this case, the valid data with a long life cycle in the hardware flow needs to be moved to the preset hardware flow to improve the write amplification problem of the hardware flow.

[0203] Step S1112: according to the feedback information, move the valid data in the storage location to the preset storage location;

[0204] Specifically, the feedback information includes the write-back frequency of the physical page and the hardware stream number where the physical page is located. Based on the write-back frequency of the physical page, it can be determined whether to move the valid data in the physical page to the preset storage location, or based on the hardware stream number where the physical page is located, it can be determined whether to move the valid data in the physical page to the preset storage location according to the state machine.

[0205] Please refer to Fig.14 , Fig.14 yes Fig.13 A detailed flow chart of step S1112;

[0206] like Fig.14 As shown, step S1112 includes:

[0207] Step S1121: determining the write-back frequency of the physical page within a period of time according to the write-back frequency of the physical page, and moving valid data in the physical page corresponding to the storage location to a preset storage location according to the write-back frequency;

[0208] Specifically, according to the write-back frequency of the physical page, the write-back frequency of the physical page within a period of time is determined, that is, the number of times the physical page is referenced within a period of time. According to the write-back frequency, that is, according to the number of times the physical page is referenced within a period of time, it is determined whether the number of times the physical page is referenced is greater than or equal to the frequency threshold. If the number of times the physical page is referenced is greater than or equal to the frequency threshold, it means that the physical page is frequently used. When garbage collection is performed on the valid data in the physical page, the valid data in the physical page is remapped to the same hardware stream. If the number of times the physical page is referenced is less than the frequency threshold, the valid data of the physical page is re-moved to the preset storage location corresponding to the preset hardware stream. The preset storage location includes a physical block. The physical block includes multiple physical pages. The valid data of the physical page is moved to the physical page in the physical block. Among them, a period of time refers to a preset time threshold. The preset time threshold is set according to specific needs. For example, it is set to a value such as 0.5s, 1s, etc., which is not limited here.

[0209] In the embodiment of the present application, by counting the feedback information of the physical page, the write amplification improvement effect of the flash memory device can be effectively evaluated.

[0210] Step S1122: according to the hardware stream number of the physical page, the valid data in the storage location is moved to the preset storage location according to the state machine;

[0211] In the embodiment of the present application, the state machine is used to record the state of the physical page, and the state of the physical page includes an idle state, a used state, and a recycled state.

[0212] Specifically, according to the hardware stream number where the physical page is located, the state of the physical page in the super block corresponding to the hardware stream number is searched in the state machine. If the state of the physical page is a recycled state, the valid data in the physical page corresponding to the recycled state in the storage location is moved to the preset storage location.

[0213] Please refer to Fig.15 , Fig.15 yes Fig.14 Step S1121 is a schematic diagram of a detailed process;

[0214] like Fig.15 As shown, step S1121 includes:

[0215] Step S1123: determining whether the write-back frequency of the physical page is greater than or equal to the frequency threshold;

[0216] Specifically, it is determined whether the write-back frequency of the physical page is greater than or equal to the frequency threshold. If the write-back frequency of the physical page is greater than or equal to the frequency threshold, the process jumps to step S1124; otherwise, the process jumps to step S1125.

[0217] Step S1124: according to the second mapping relationship, move the valid data in the physical page corresponding to the storage location to the preset storage location;

[0218] Specifically, for the physical pages of the common hardware stream, when the number of write-backs exceeds a threshold, the data will be written to the dedicated hardware stream 0 with the hardware stream number 0, which is used to store "relatively cold" data. If the physical page of hardware stream 0 is written back again during garbage collection, the data will be written to the hardware stream 1 with the hardware stream number 1, which is used to store "extremely cold" data. If the physical page of dedicated hardware stream 1 is written back again during garbage collection, the data will still be written back to dedicated hardware stream 1; if the physical page of hardware stream 1 is overwritten, the new data will be written to the dedicated hardware stream 0; if the physical page of hardware stream 0 is overwritten, the new data will be written to the original hardware stream, that is, the hardware stream given by the second clustering module.

[0219] It is understandable that "relatively cold" data refers to data that is not frequently used but is occasionally used, and "extremely cold" data refers to data that is basically not used. For example, the data can be determined to be first cold data or second cold data based on the time interval between the two most recent adjacent write operations of each logical page, wherein the first cold data is "relatively cold" data, and the second cold data is "extremely cold" data, for example, if the time interval exceeds the first time threshold, the data is determined to be the first cold data, and further, if the time interval exceeds the second time threshold, the data is determined to be the second cold data, wherein the first time threshold is less than the second time threshold.

[0220] Step S1125: do not move the data of the current physical page;

[0221] Specifically, if the write-back frequency of a physical page is less than the frequency threshold, it means that the physical page is frequently referenced, and there is no need to move the data of the current physical page.

[0222] In an embodiment of the present application, the hardware stream is remapped to a preset hardware stream so that valid data with a long life cycle in the hardware stream is moved to a preset storage location corresponding to the preset hardware stream, thereby reducing the number of times data with a long life cycle is moved, thereby improving the write amplification problem of the flash memory device.

[0223] In an embodiment of the present application, data with similar compression rates are clustered to generate multiple software streams, and the life cycle of each software stream is estimated so that software streams with similar life cycles are mapped to the same hardware stream, and the data corresponding to the software stream is stored in the storage location corresponding to the hardware stream. The present application can store application data with similar life cycles in the storage location corresponding to the hardware stream to optimize the write amplification problem of the flash memory device.

[0224] See also Fig.16 , Fig.16 It is a schematic diagram of the overall structure of a flash memory device provided in an embodiment of the present application;

[0225] like Fig.16 As shown, the flash memory device 100 includes a compression module 101 , a first clustering module 102 , a life cycle estimation module 103 , a second clustering module 104 , a flash memory conversion module 105 , a flash memory medium 106 , and a remapping module 107 .

[0226] The compression module 101 is connected to the first clustering module 102, and is used to obtain application data, and determine the compression algorithm corresponding to the application data according to the data type corresponding to the application data, and compress the application data according to the compression algorithm to obtain the compression rate of the application data. The compression algorithm includes compression algorithms such as LZ4, ZSTD, snappy, and DEFLATE.

[0227] The first clustering module 102 is connected to the compression module 101 and the life cycle estimation module 103, and is used to cluster the application data according to the compression rate of the application data to generate multiple software flows, wherein the first clustering module 102 is used to run a clustering algorithm, which includes a K-means algorithm, a DBSCAN algorithm, a hierarchical clustering algorithm, a spectral clustering algorithm, a collaborative filtering algorithm, a random forest algorithm, a Gaussian process regression clustering algorithm and other clustering algorithms.

[0228] Preferably, the first clustering module 102 includes a K-means clustering module, wherein K is the number of software flows. The K-means clustering module is used to run the K-means algorithm, and the number of clusters is set to the number of software flows to cluster the application data and generate K software flows. When initializing the K-means clustering algorithm, the compression rate (center point) of the software flow is preset as an initial value, but during the operation of the K-means clustering algorithm, the compression rate (center point) of the software flow itself will be adaptively changed or updated with the compression rate of the logical page data of the software flow.

[0229] It is understandable that the number of software streams is determined based on the experience of the developer and is usually a larger value, such as 32. Based on the data compression rate, the user data, that is, the write data, is divided into 32 clusters, that is, 32 software streams.

[0230] The life cycle estimation module 103 is connected to the first clustering module 102 and the second clustering module 104 and is used to estimate the life cycle of each software flow.

[0231] The second clustering module 104 is connected to the lifecycle estimation module 103 and the flash conversion module 105, and is used to cluster the software flows according to the lifecycle of each software flow to establish a first mapping relationship between each software flow and the hardware flow.

[0232] Preferably, the second clustering module 104 includes a K-means clustering module, wherein K is the number of hardware flows. The K-means clustering module is used to run the K-means algorithm, and the number of clusters is set to the number of hardware flows to cluster the application data and generate K hardware flows. When initializing the K-means clustering algorithm, the life cycle (center point) of the hardware flow is preset as an initial value, but during the operation of the K-means clustering algorithm, the life cycle (center point) of the hardware flow itself will be adaptively changed or updated with the life cycle of the software flow.

[0233] It is understandable that the number of hardware flows is smaller than the number of software flows. For example, if the hardware actually supports only 8 flows, then the 32 software flows still need to be clustered into the actual 8 hardware flows. The second clustering still uses the K-means algorithm, and the clustering distance is calculated based on the estimated flow life cycle. The second clustering output is 8 flows, which matches the actual hardware.

[0234] The flash conversion module 105 is connected to the second clustering module 104 and the flash medium 106, and is used to store the data corresponding to the software stream to the storage location corresponding to the hardware stream according to the first mapping relationship. The flash conversion module 105 includes a flash translation layer, and each function of the flash conversion module 105 is implemented by the flash translation layer (FTL).

[0235] The flash memory medium 106 is connected to the flash memory conversion module 105 and the remapping module 107 and is used to store application data.

[0236] The remapping module 107 is connected to the flash conversion module 105 and the flash medium 106 and is used to recycle the valid data in the storage location corresponding to the hardware stream so as to move the valid data in the storage location to a preset storage location.

[0237] In an embodiment of the present application, the compression rate of application data is obtained; the application data is clustered according to the compression rate of the application data to generate multiple software flows; the life cycle of each software flow is estimated; the software flows are clustered according to the life cycle of each software flow to establish a first mapping relationship between each software flow and a hardware flow; and according to the first mapping relationship, the data corresponding to the software flow is stored in the storage location corresponding to the hardware flow.

[0238] By clustering data with similar compression rates, generating multiple software streams, and estimating the life cycle of each software stream, the software streams with similar life cycles are mapped to the same hardware stream, and the data corresponding to the software streams are stored in the storage locations corresponding to the hardware streams. The present application can store application data with similar life cycles in the storage locations corresponding to the hardware streams, so as to optimize the write amplification problem of flash memory devices.

[0239] See also Fig.17 , Fig.17 is a schematic diagram of the structure of another flash memory device provided in an embodiment of the present application;

[0240] like Fig.17 As shown, the flash memory device 100 includes one or more processors 108 and a memory 109. Fig.17 A processor 101 is taken as an example.

[0241] The processor 108 and the memory 109 may be connected via a bus or other means. Fig.17 The example of connecting through bus is taken in the following.

[0242] The processor 108 is used to provide computing and control capabilities to control the flash memory device 100 to perform corresponding tasks, for example, to control the flash memory device 100 to perform a multi-stream management method for application data in any of the above-mentioned method embodiments, the multi-stream management method for application data comprising: obtaining a compression rate of the application data; clustering the application data according to the compression rate of the application data to generate multiple software streams; estimating the life cycle of each software stream; clustering the software streams according to the life cycle of each software stream to establish a first mapping relationship between each software stream and a hardware stream; according to the first mapping relationship, storing the data corresponding to the software stream in a storage location corresponding to the hardware stream.

[0243] By clustering data with similar compression rates, generating multiple software streams, and estimating the life cycle of each software stream, the software streams with similar life cycles are mapped to the same hardware stream, and the data corresponding to the software streams are stored in the storage locations corresponding to the hardware streams. The present application can store application data with similar life cycles in the storage locations corresponding to the hardware streams, so as to optimize the write amplification problem of flash memory devices.

[0244] The processor 108 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), a hardware chip or any combination thereof; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The above-mentioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.

[0245] The memory 109, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the multi-stream management method for application data in the embodiment of the present application. The processor 108 can implement the multi-stream management method for application data in any of the above method embodiments by running the non-transitory software programs, instructions and modules stored in the memory 109. Specifically, the memory 109 may include a volatile memory (VM), such as a random access memory (RAM); the memory 109 may also include a non-volatile memory (NVM), such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD) or other non-transitory solid-state storage device; the memory 109 may also include a combination of the above types of memories.

[0246] The memory 109 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 109 may optionally include a memory remotely arranged relative to the processor 108, and these remote memories may be connected to the processor 108 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0247] One or more modules are stored in the memory 109, and when executed by one or more processors 108, the multi-stream management method of application data in any of the above method embodiments is executed, for example, the multi-stream management method described above is executed. Figure 5 The steps shown.

[0248] The embodiment of the present application also provides a non-volatile computer-readable storage medium, such as a memory including a program code, and the program code can be executed by a processor to complete the multi-stream management method of application data in the above embodiment. For example, the non-volatile computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CDROM), a magnetic tape, a floppy disk, and an optical data storage device.

[0249] The embodiment of the present application also provides a computer program product, which includes one or more program codes, and the program codes are stored in a non-volatile computer-readable storage medium. The processor of the flash memory device reads the program code from the non-volatile computer-readable storage medium, and the processor executes the program code to complete the method steps of the multi-stream management method of application data provided in the above embodiment.

[0250] A person skilled in the art will appreciate that all or part of the steps for implementing the above embodiments may be accomplished by hardware or by hardware associated with a program code, and the program may be stored in a non-volatile computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0251] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution can be essentially or in other words, the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute various embodiments or certain parts of the embodiments.

[0252] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Under the concept of the present application, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other changes in different aspects of the present application as above, which are not provided in detail for the sake of simplicity. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features can be replaced by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A multi-stream management method for application data, characterized in that: The method comprises: Obtaining a compression ratio of the application data; clustering the application data according to the compression rate of the application data to generate a plurality of software flows; estimating the life cycle of each of said software flows; Clustering the software flows according to the life cycle of each of the software flows to establish a first mapping relationship between each of the software flows and the hardware flow; According to the first mapping relationship, storing the data corresponding to the software stream in a storage location corresponding to the hardware stream, wherein the storage location includes a plurality of physical pages; The method further comprises: Reclaiming valid data in a physical page corresponding to a storage location corresponding to the hardware stream, including: Counting feedback information of the physical page corresponding to the storage location corresponding to each of the hardware streams, wherein the feedback information includes a write-back frequency of the physical page and a hardware stream number where the physical page is located; According to the feedback information, the valid data in the storage location is moved to a preset storage location; The step of moving the valid data in the storage location to a preset storage location according to the feedback information includes: Determining the write-back frequency of the physical page within a period of time according to the write-back frequency of the physical page, and moving valid data in the physical page corresponding to the storage location to a preset storage location according to the write-back frequency; and / or, According to the hardware stream number where the physical page is located, the valid data in the storage location is moved to a preset storage location according to the state machine.

2. The method according to claim 1, characterized in that The obtaining the compression rate of the application data includes: Determining a compression algorithm corresponding to the application data according to a data type corresponding to the application data; The application data is compressed according to the compression algorithm to obtain a compression ratio of the application data.

3. The method according to claim 2, characterized in that Each of the software streams corresponds to at least one logical block address, the logical block address includes a plurality of logical pages, and the data corresponding to the software stream is stored in the logical pages; The estimating the life cycle of each software flow comprises: estimating the life cycle of all logical pages corresponding to each of the software flows; The average value of the life cycles of all the logical pages corresponding to each of the software flows is calculated to determine the life cycle of each of the software flows.

4. The method according to claim 3, characterized in that The estimating the life cycle of all logical pages corresponding to each of the software flows includes: Counting the timestamp of each access to the logical page, wherein the timestamp includes a first timestamp and a second timestamp, and the first timestamp and the second timestamp are adjacent timestamps; The difference between the first timestamp and the second timestamp is calculated to determine the life cycle of each of the logical pages.

5. The method according to claim 4, characterized in that Each of the hardware flows corresponds to a preset life cycle one by one, and clustering the software flows according to the life cycle of each of the software flows to establish a first mapping relationship between the software flows and the hardware flows includes: If the life cycle of the software stream is within the preset life cycle, the software stream is mapped to the hardware stream corresponding to the preset life cycle to determine a first mapping relationship between the software stream and the hardware stream, wherein each of the hardware streams corresponds to multiple software streams.

6. The method according to claim 1, characterized in that Before moving the valid data in the storage location to the preset storage location, the method further includes: A second mapping relationship between each of the hardware streams and a preset hardware stream is established, wherein the preset hardware stream corresponds to the preset storage location.

7. The method according to claim 6, characterized in that The moving valid data in the physical page corresponding to the storage location to a preset storage location according to the write-back frequency includes: If the write-back frequency is greater than or equal to the frequency threshold, then according to the second mapping relationship, the valid data in the physical page corresponding to the storage location is moved to a preset storage location.

8. A flash memory device, characterized in that: include: A compression module, used to determine a compression algorithm corresponding to the application data according to a data type corresponding to the application data, and compress the application data according to the compression algorithm to obtain a compression ratio of the application data; A first clustering module, configured to cluster the application data according to a compression rate of the application data to generate a plurality of software flows; A life cycle estimation module, used for estimating the life cycle of each of the software flows; A second clustering module, used for clustering the software flows according to the life cycle of each of the software flows, so as to establish a first mapping relationship between each of the software flows and the hardware flow; A flash memory conversion module, configured to store the data corresponding to the software stream to a storage location corresponding to the hardware stream according to the first mapping relationship, wherein the storage location includes a plurality of physical pages; A remapping module, used for recovering valid data in a storage location corresponding to the hardware stream, so as to move the valid data in the storage location to a preset storage location; The remapping module is further used to recycle valid data in the physical page corresponding to the storage location corresponding to the hardware stream; The remapping module is further configured to collect feedback information of a physical page corresponding to a storage location corresponding to each of the hardware streams, wherein the feedback information includes a write-back frequency of the physical page and a hardware stream number of the physical page, and to move valid data in the storage location to a preset storage location according to the feedback information; The remapping module is further specifically used to determine the write-back frequency of the physical page within a period of time according to the write-back frequency of the physical page, and move the valid data in the physical page corresponding to the storage position to the preset storage position according to the write-back frequency; and / or, according to the hardware stream number of the physical page, moving the valid data in the storage location to a preset storage location according to the state machine; The flash memory medium is used to store the application data.

9. A flash memory device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the multi-stream management method for application data according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • File compression storage method, device and equipment and storage medium

    CN112100143A

  • Data storage device for managing memory resources using flash translation layer with condensed mapping information

    CN112114743A

  • Maintenance of nonvolatile memory on host selected namespaces by a common memory controller

    US11249652B1

  • Method of consolidate data streams for multi-stream enabled ssds

    US20180113642A1