Control method and device of storage device and storage device
By obtaining the expansion rate and data compression rate of the storage device and dynamically adjusting the media mode, the problem of storage devices being unable to meet the performance requirements of different services is solved, and the processing performance of data operation requests is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2021-08-26
- Publication Date
- 2026-05-19
AI Technical Summary
In existing technologies, the media mode of storage devices is fixed, which cannot effectively meet the data performance requirements of different services.
By obtaining the expansion rate of storage devices and the data compression rate of business data, the media mode is dynamically adjusted to match the performance requirements of the target business.
It enables dynamic switching of storage device media mode according to business needs, improving the processing performance of data operation requests.
Smart Images

Figure CN115729437B_ABST
Abstract
Description
Technical Field
[0001] This application relates to data storage technology and cloud computing technology, and in particular to a control method, apparatus, storage device, and computer-readable storage medium for a storage device. Background Technology
[0002] Cloud computing is a computing model that distributes computing tasks across a resource pool consisting of a large number of computers, enabling various application systems to obtain computing power, storage space, and information services as needed. The network providing these resources is called the "cloud." As the foundational providers of cloud computing capabilities, they establish cloud resource pools (referred to as cloud platforms, generally called Infrastructure as a Service (IaaS) platforms), deploying various types of virtual resources within these pools for external customers to choose from. The cloud resource pool primarily includes: computing devices (virtualized machines containing operating systems), storage devices, and network devices.
[0003] Taking solid-state drives (SSDs) or hard disk drives (HDDs) as storage devices, the media mode in storage devices is fixed in related technologies. However, when different services apply the same media mode, it hinders the fulfillment of the data performance requirements of different services.
[0004] There is a lack of effective solutions in related technologies to meet the data performance requirements of different services through fixed storage devices. Summary of the Invention
[0005] This application provides a method, apparatus, storage device, and computer-readable storage medium for controlling a storage device, which can improve the performance of the storage device in processing data operation requests for target services by dynamically converting the media mode.
[0006] The technical solution of this application embodiment is implemented as follows:
[0007] This application provides a method for controlling a storage device, including:
[0008] Obtain the expansion rate of the storage device;
[0009] Obtain the data compression ratio of the business data corresponding to the target service in the storage device;
[0010] Based on the comparison results of the data compression rate and the expansion rate, the media mode conversion method of the free storage space of the storage device is determined;
[0011] The media mode of the free storage space is converted according to the media mode conversion method described above;
[0012] Based on the media mode of the free storage space after the conversion process, respond to the data operation request of the target service.
[0013] This application provides a control device for a storage device, including:
[0014] The acquisition module is used to acquire the expansion rate of the storage device;
[0015] The acquisition module is used to acquire the data compression rate of the business data corresponding to the target business in the storage device;
[0016] The determination module is used to determine the media mode conversion method of the free storage space of the storage device based on the comparison result of the data compression rate and the expansion rate.
[0017] A conversion module is used to convert the media mode of the free storage space according to the media mode conversion method.
[0018] The response module is used to respond to the data operation request of the target service based on the media mode of the free storage space after the conversion process.
[0019] In the above scheme, the acquisition module is further configured to: perform any one of the following processes: within at least one historical time period of the target service, acquire the data compression rate of the service data corresponding to the target service in the storage device; within at least one historical data write volume period of the target service, acquire the data compression rate of the service data corresponding to the target service in the storage device.
[0020] In the above scheme, the determining module is further configured to: when the data compression rate is greater than the expansion rate, determine the conversion mode of the storage device from the first media mode to the second media mode; when the data compression rate is less than the expansion rate, determine the conversion mode of the storage device from the second media mode to the first media mode; wherein, the performance of the first media mode is lower than that of the second media mode, and the storage density of the first media mode is higher than that of the second media mode.
[0021] In the above scheme, when the media mode conversion method is from a first media mode to a second media mode, where the performance of the first media mode is lower than that of the second media mode, and the storage density of the first media mode is higher than that of the second media mode, the conversion module is further configured to: determine the first free storage space capacity required for the conversion process based on the data compression rate and the expansion rate; wherein, the first free storage space capacity is the capacity of a first free storage space, and the first free storage space is the free storage space in the first media mode used for the conversion process; and mark the first free storage space as the second media mode.
[0022] In the above scheme, the conversion module is further configured to: mark the first free storage space as the second media mode when the capacity of the first free storage space is not greater than the capacity of the free storage space in the first media mode; and reclaim the storage space in the first media mode when the capacity of the first free storage space is greater than the capacity of the free storage space in the first media mode, wherein the updated capacity of the first free storage space after reclamation is not greater than the capacity of the free storage space in the first media mode, and the updated capacity of the first free storage space after reclamation is marked as the second media mode.
[0023] In the above scheme, the conversion module is further configured to: determine the ratio of the data volume of the business data to the expansion rate as the theoretical storage space value of the business data; determine the ratio of the data volume of the business data to the data compression rate as the actual storage space value of the business data; and determine a first free storage space capacity that is positively correlated with the theoretical storage space value and negatively correlated with the actual storage space value.
[0024] In the above scheme, when the media mode conversion method is from the second media mode to the first media mode, the performance of the first media mode is lower than that of the second media mode, and the storage density of the first media mode is higher than that of the second media mode, the conversion module is further configured to: determine the second free storage space capacity required for the conversion process based on the data compression rate and the expansion rate; wherein, the second free storage space capacity is the capacity of the second free storage space, and the second free storage space is the free storage space in the second media mode used for the conversion; and mark the second free storage space as the first media mode.
[0025] In the above scheme, the conversion module is further configured to: mark the second free storage space as the first media mode when the capacity of the second free storage space is not greater than the capacity of the free storage space in the second media mode; and reclaim the storage space in the second media mode when the capacity of the second free storage space is greater than the capacity of the free storage space in the second media mode, wherein the updated capacity of the second free storage space after reclamation is not greater than the capacity of the free storage space in the second media mode, and the free storage space of the second storage space value in the updated second media mode after reclamation is marked as the first media mode.
[0026] In the above scheme, the conversion module is further configured to: determine the ratio of the data volume of the business data to the expansion rate as the theoretical storage space value of the business data; determine the ratio of the data volume of the business data to the data compression rate as the actual storage space value of the business data; determine the ratio of the storage density of the first media mode to the storage density of the second media mode; and determine a second free storage space capacity that is positively correlated with the actual storage space value, negatively correlated with the theoretical storage space value, and negatively correlated with the ratio.
[0027] In the above scheme, the conversion module is further configured to: determine the data to be reclaimed that occupies the storage space of the second media mode; when the data to be reclaimed is invalid data, mark the storage space occupied by the data to be reclaimed as free storage space and discard the data to be reclaimed; when the data to be reclaimed is valid data and the access frequency of the data to be reclaimed is lower than the access frequency threshold, write the data to be reclaimed into the free storage space of the first media mode; when the data to be reclaimed is valid data, the access frequency of the data to be reclaimed is not lower than the access frequency threshold, and the second media mode does not have free storage space, write the data to be reclaimed into the free storage space of the first media mode.
[0028] In the above scheme, when the data operation request is a data read request, the response module is further configured to: determine the access frequency of the target read data of the target service and the media mode of the target storage space, wherein the target storage space is used to store the target read data of the data read request; when the media mode is a first media mode, obtain the free storage space capacity of the second media mode; when the access frequency of the target read data is greater than the access frequency threshold, the media mode is the first media mode, and the free storage space capacity of the second media mode is not less than the free storage space threshold, write the target read data of the data read request into the free storage space of the second media mode; wherein the performance of the first media mode is lower than that of the second media mode, and the storage density of the first media mode is higher than that of the second media mode.
[0029] In the above scheme, when the data operation request is a data write request, the response module is further configured to: when there is free storage space in the storage device in the second media mode, write the target write data of the target service into the free storage space in the storage device in the second media mode according to the write rules corresponding to the second media mode; when there is no free storage space in the storage device in the second media mode, write the target write data of the target service into the free storage space in the storage device in the first media mode according to the write rules corresponding to the first media mode; wherein, the performance of the first media mode is lower than that of the second media mode, and the storage density of the first media mode is higher than that of the second media mode.
[0030] This application provides a storage device, including:
[0031] Memory, used to store executable instructions;
[0032] The processor, when executing executable instructions stored in the memory, implements the control method for the storage device provided in the embodiments of this application.
[0033] This application provides a computer-readable storage medium storing executable instructions, which, when executed by a processor, implement the control method for the storage device provided in this application.
[0034] The embodiments of this application have the following beneficial effects:
[0035] Based on the comparison results of the data compression rate and expansion rate of the target business, the media mode conversion method of the idle storage space of the storage device is determined, and the media mode of the idle storage space is converted. This realizes the process of dynamic conversion of the media mode based on the target business. Therefore, when responding to the data operation request of the target business based on the media mode of the idle storage space after conversion, it can respond in a way that matches the target business, effectively improving the overall performance of the storage device. Attached Figure Description
[0036] Figure 1 This is a schematic diagram of the control system of the storage device provided in the embodiments of this application;
[0037] Figure 2 This is a schematic diagram of the structure of the storage device provided in the embodiments of this application;
[0038] Figure 3 This is a schematic diagram of the logical storage structure of the storage device provided in the embodiments of this application.
[0039] Figures 4A-4C This is a flowchart illustrating the control method for a storage device provided in an embodiment of this application;
[0040] Figure 5 This is a schematic diagram comparing the media modes of the control method for the storage device provided in the embodiments of this application;
[0041] Figure 6 This is a compressed schematic diagram of the control method for the storage device provided in the embodiments of this application;
[0042] Figures 7A-7C This is a logical schematic diagram of the control method for the storage device provided in the embodiments of this application. Detailed Implementation
[0043] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0044] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0045] In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0046] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0047] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0048] 1) Storage devices are devices that store data based on flash memory chips, such as solid-state drives (SSDs).
[0049] 2) A host is a computing device that is electrically connected to a storage device, such as a server or terminal device, and is capable of reading and writing to the storage device.
[0050] 3) A data block, also known as a data unit, is the unit by which the host reads and writes to the storage device.
[0051] 4) Computer flash memory (NAND flash memory), non-volatile flash memory chips, can retain data even after power loss.
[0052] 5) Over-Provisioning (OP): In storage devices, OP refers to the capacity that users cannot operate. Its size is the physical actual capacity minus the user-available capacity. OP is mainly used to improve the random write performance of storage devices and for garbage collection, etc.
[0053] 6) Compression ratio: The proportion of data that can be compressed.
[0054] 7) Expansion ratio: The ratio of the logical space (user space) of a solid-state drive with compression function to the actual physical space of the solid-state drive. The expansion ratio of a solid-state drive without compression function is 1.
[0055] 8) Media mode: Different media modes have different performance and capacity levels. High performance mode refers to low-capacity media mode similar to single-level cell (SLC), while low performance mode refers to high-capacity media mode similar to quad-level cell (QLC).
[0056] There is no method in the relevant technologies to dynamically adjust the performance and capacity of the same NAND medium. The methods for adjusting the performance and capacity of solid-state drives in the relevant technologies include the following two: First, introducing at least one level of cache layer inside the solid-state drive, and using the cache layer with faster storage medium to improve the performance of the solid-state drive; Second, attaching more NAND chips to the solid-state drive and using the extra chips for OP space, which can improve random write performance.
[0057] The drawbacks of the related technologies are: if at least one level of cache is introduced, different types of storage media will exist inside the solid-state drive at the hardware level, which increases the complexity of the solid-state drive hardware design and the product cost; if more NAND chips are attached to the solid-state drive, it will increase the actual physical media, thereby increasing the cost accordingly.
[0058] This application provides a method, apparatus, storage device, and computer-readable storage medium for controlling a storage device. It can improve the performance of the storage device in processing data operation requests for target services by dynamically converting the media mode. The following describes an exemplary application of the storage device control method provided in this application. This method can be implemented by various storage devices, such as hard disk drives (HDDs), solid-state drives (SSDs), and other types of storage devices. The following will describe an exemplary application using storage devices.
[0059] See Figure 1 , Figure 1 This is a schematic diagram of the control system of the storage device provided in the embodiment of this application. The control system of the storage device can be used to support various data storage scenarios. In the control system of the storage device, the storage device 300 is electrically connected to the host device 200, and the terminal 400 is connected to the host device 200 through a network. It should be noted that the storage device 300 can be installed inside the chassis of the host device 200, or the storage device 300 can be connected to the host device 200 from the outside through interfaces such as USB and Thunderbolt.
[0060] In some embodiments, terminal 400 sends a service request to host device 200. The central processing unit (CPU) in host device 200 receives the service request and obtains the write instruction corresponding to the service request. The CPU in host device 200 can also receive read / write instructions sent by the user to the CPU through an input device. Host device 200 sends the write instruction to storage device 300. The processor in storage device 300 obtains the expansion rate of storage device; obtains the data compression rate of service data corresponding to the target service in storage device; determines the media mode conversion method of free storage space of storage device based on the comparison result of data compression rate and expansion rate; performs media mode conversion processing on free storage space according to media mode conversion method; and responds to the data operation request of target service subsequently sent by host device based on the media mode of free storage space after conversion processing. The data operation request includes data read request and data write request, that is, host device 200 can perform corresponding read / write operations on service data based on the media mode of free storage space after conversion processing.
[0061] In some embodiments, the host device 200 may be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The storage device 300 may serve as the storage medium for the cloud server, mounted in a storage directory, where the cloud server stores data. The terminal 400 may be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The terminal 400 and the host device 200 may be directly or indirectly connected via wired or wireless communication, and this embodiment does not impose any limitations.
[0062] Next, the structure of the storage device for implementing the control method of the storage device provided in the embodiments of this application will be described. As mentioned above, the storage device provided in the embodiments of this application can be... Figure 1 Storage device 300. See also Figure 2 , Figure 2 This is a schematic diagram of the structure of the storage device 300 provided in the embodiments of this application. Figure 2 The storage device 300 shown includes: a processor 310, a cache 320, a data memory 330, and an instruction memory 340.
[0063] Processor 310 is the main controller of storage device 300. It can be an embedded microchip, implemented using one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), or field-programmable gate arrays (FPGAs). It stores various executable instructions of the main control algorithm in a programmable manner. Specifically, instruction memory 340 can be integrated with processor 310 using an FPGA, or it can store executable instructions as a physical element independent of processor 310. Processor 310 functions like a command center, issuing all operation requests to the storage device; it can be considered the brain of the storage device.
[0064] The cache 320 is used to cache read / write data. For example, the cache 320 can be a DRAM cache. Some storage devices do not include a cache.
[0065] Data storage 330 is the storage medium of the storage device, used to store data in the storage device, such as business data. Data storage 330 not only determines the lifespan of the storage device, but also has a great impact on the performance of the storage device. For example, data storage 330 can be NAND flash memory.
[0066] In some embodiments, the processor 310 of the storage device 300 sets a task limit for the cache 320 (e.g., DR AM). After receiving data sent by the host device 200, the storage device 300 first stores the data in the cache 320 and performs corresponding read and write operations. When the data in the cache 320 exceeds the set task limit, the processor 310 then stores the data in the cache 320 into the data storage 330 to reduce the processor's burden and improve the efficiency of the storage device in processing data.
[0067] In some embodiments, the control device for the storage device provided in this application can be implemented in software. Figure 2 A control device 331 for a storage device stored in processor 310 is shown. This device can be software in the form of programs and plug-ins, and includes the following software modules: an acquisition module 3311, a determination module 3312, a conversion module 3313, and a response module 3314. These modules are logically linked and can therefore be arbitrarily combined or further separated according to the functions they implement. The functions of each module will be described below.
[0068] Taking a solid-state drive (SSD) as an example, the logical storage structure of the SSD provided in this application embodiment is described below. See also... Figure 3 , Figure 3 This is a schematic diagram of the logical storage structure of a solid-state drive (SSD) provided in this application embodiment. A data page is the smallest unit for reading and writing, and one page includes multiple bytes; a data block is the smallest unit for erasing, and one block includes multiple pages; a data plane is the smallest unit of NAND that can be operated on according to read, write, and erase commands; one plane is a storage matrix, and one plane includes multiple blocks; a die is the smallest independent unit in the memory that can execute commands and report its own status; multiple dies can be packaged in one chip, and one die includes two planes. The SSD is composed of floating gates, which are logic circuits surrounded by silicon dioxide. A floating gate represents 0 when charged to a certain potential and 1 when the potential drops to a certain threshold. Due to the physical characteristics of the SSD, after a prolonged power outage, electrons in the floating gates will overflow, causing a change in potential and resulting in data loss.
[0069] Below, by Figure 1 The following description uses the storage device 300 in the example to illustrate the control method for the storage device provided in the embodiments of this application. See also... Figure 4A , Figure 4A This is a flowchart illustrating a method for controlling a storage device provided in an embodiment of this application, which will be combined with... Figure 4A Steps 101-105 are shown and explained.
[0070] In step 101, the expansion rate of the storage device is obtained.
[0071] As an example, the expansion rate is the ratio of the logical space (user logical space) of a solid-state drive with compression capabilities to the actual physical space of the solid-state drive. The expansion rate of a solid-state drive without compression capabilities is 1. The storage device driver can monitor the expansion rate of the storage device itself.
[0072] In step 102, the data compression rate of the business data corresponding to the target business in the storage device is obtained.
[0073] As an example, when writing business data for a target business to a storage device, the data compression rate of the corresponding business data for the target business in the storage device is obtained.
[0074] In some embodiments, see Figure 4B , Figure 4BThis is a flowchart illustrating a control method for a storage device provided in an embodiment of this application. In step 102, the data compression rate of the service data corresponding to the target service in the storage device is obtained, which can be achieved by executing step 1021 or step 1022.
[0075] In step 1021, within at least one historical time period of the target service, the data compression rate of the service data corresponding to the target service in the storage device is obtained.
[0076] As an example, there is at least one historical time period for the current time node. The business data used to calculate the data compression rate can come from one historical time period or multiple consecutive historical time periods. For example, taking 1 minute as a historical time period, the data compression rate of the business data from 2:59 to 3:00 is obtained at 3:00. The subsequent steps are performed based on the obtained data compression rate. The data compression rate of the business data from 3:00 to 3:00 is obtained at 3:01. The subsequent steps are performed based on the obtained data compression rate, thereby realizing the dynamic adjustment of the entire solution.
[0077] In step 1022, within at least one historical data write cycle of the target service, the data compression rate of the service data corresponding to the target service on the storage device is obtained.
[0078] As an example, the historical data write volume period is a certain amount of data, such as 100GB. For the current time point, there is at least one historical data write volume period. The business data used to calculate the data compression rate can come from one historical data write volume period or multiple consecutive historical data write volume periods. For example, taking 100GB as a historical data write volume period, when the cumulative data write volume is 500GB, the data compression rate of the 100GB of business data written after the cumulative data write volume is 400GB is obtained, and subsequent steps are performed based on the obtained data compression rate. When the cumulative data write volume is 600GB, the data compression rate of the 100GB of business data written after the cumulative data write volume is 500GB is obtained, and subsequent steps are performed based on the obtained data compression rate, thereby realizing the dynamic adjustment of the entire solution.
[0079] In step 103, the media mode conversion method for the free storage space of the storage device is determined based on the comparison results of data compression rate and expansion rate.
[0080] In some embodiments, see Figure 4C , Figure 4C This is a flowchart illustrating a control method for a storage device provided in an embodiment of this application. In step 103, the data compression rate of the service data corresponding to the target service in the storage device is obtained, which can be achieved by executing steps 1031-1032.
[0081] In step 1031, when the data compression rate is greater than the expansion rate, the storage device will switch from the first media mode to the second media mode.
[0082] As an example, data compression ratio is the ratio between the amount of data before compression and the amount of data after compression. For example, a 4-kilobyte logical data block becomes 2 kilobytes in size after transparent compression within the hard drive. That is, the 4 kilobytes of data in the logical space only occupy 2 kilobytes of physical space, and the data compression ratio is 2. The expansion ratio is the ratio between the logical capacity of the solid-state drive and the physical capacity of the solid-state drive.
[0083] In step 1032, when the data compression rate is less than the expansion rate, the storage device will switch from the second media mode to the first media mode.
[0084] As an example, the access speed of the first media mode (low-performance media mode) is lower than that of the second media mode (high-performance media mode), and the storage density of the first media mode is higher than that of the second media mode. The performance of the first media mode is lower than that of the second media mode. The higher performance is reflected in the higher access speed, higher durability, and higher reliability. The higher storage density is accompanied by lower cost.
[0085] In some embodiments, when the data compression rate equals the expansion rate, it is determined that no conversion processing will be performed.
[0086] In step 104, the media mode of the free storage space is converted according to the media mode conversion method.
[0087] As an example, the conversion process includes conversion between different media modes. For instance, free storage space in a first media mode is marked as being in a second media mode, and free storage space in a second media mode is marked as being in a first media mode. The media modes in a solid-state drive are not limited to two media modes. That is, the conversion process includes conversion between at least two different media modes. More granular divisions can be made, for example, conversion between three media modes. There are differences in access speed and storage density among the three media modes, and storage density is negatively correlated with access speed.
[0088] As an example, storage devices adopt a backward compatible hardware architecture, with different conversion ranges for different hardware architectures. For instance, if the storage device itself uses QLC NAND flash memory, it can convert between SLC, TLC, MLC, and QLC media modes during media mode conversion. If the storage device itself uses TLC NAND flash memory, it can convert between SLC, TLC, and MLC media modes. Storage devices can include various NAND flash memory types in their hardware architecture, and the corresponding conversion range can be determined for different NAND flash memory types.
[0089] In some embodiments, the media mode of the free storage space is converted according to the media mode conversion method, data compression rate, and expansion rate.
[0090] In some embodiments, when the media mode conversion method is from a first media mode to a second media mode, the performance of the first media mode is lower than that of the second media mode, and the storage density of the first media mode is higher than that of the second media mode, the media mode conversion processing of the free storage space in step 104 according to the media mode conversion method can be implemented by the following technical solution: determining the capacity of the first free storage space required for the conversion processing according to the data compression rate and expansion rate; wherein, the capacity of the first free storage space is the capacity of the first free storage space, and the first free storage space is the free storage space in the first media mode and used for the conversion processing; marking the first free storage space as the second media mode.
[0091] In some embodiments, determining the first free storage space capacity required for performing media mode conversion processing based on the data compression rate and expansion rate can be achieved through the following technical solution: determining the ratio of the data volume of the business data to the expansion rate as the theoretical storage space value of the business data; determining the ratio of the data volume of the business data to the data compression rate as the actual storage space value of the business data; and determining the first free storage space capacity that is positively correlated with the theoretical storage space value and negatively correlated with the actual storage space value.
[0092] As an example, when the data compression ratio is greater than the SSD's expansion ratio, the SSD driver can convert a portion of the NAND space from a low-performance media mode (first media mode) to a high-performance media mode (second media mode). The high-performance media mode has lower storage density and faster access speed, while the low-performance media mode has higher storage density and slower access speed. The storage space size of the high-performance media mode converted from the low-performance media mode is calculated as (C1-C2) / R. Here, C1 is the physical space that the data written during the current monitoring period can occupy under the corresponding SSD expansion ratio, C2 is the actual physical space occupied by the data written during the current monitoring period in the SSD, and R is the density ratio between the low-performance and high-performance media modes. For example, QLC NAND can operate in QLC media mode (low-performance media mode), and QLC NAND can also operate in SLC mode (high-performance media mode). For a QLC NAND with a logic space expansion ratio of 1... For a C-type solid-state drive (i.e., the logical capacity of the solid-state drive equals its physical capacity), if a monitoring cycle corresponds to 100GB of data, and the data compression ratio is 2:1 (i.e., 100GB of data is compressed to 50GB), then it can be converted from QLC mode to SLC mode. The storage space capacity of the converted SLC mode is (100-50) / 4 = 12.5GB, and the required storage space capacity of QLC mode is 50GB. The 4 in the denominator represents the storage density ratio of QLC mode to SLC mode as 4. For a QLC solid-state drive with a logical expansion ratio of 2 (i.e., the logical capacity of the solid-state drive equals twice the physical capacity), if 100GB of data is written, and the data compression ratio is 4:1 (i.e., 100GB of data is compressed to 25GB), then it can be converted from QLC mode to SLC mode. The storage space capacity of the converted SLC mode is (100 / 2-100 / 4) / 4 = 6.25GB, and the required storage space capacity of QLC mode is 25GB (R times the storage space capacity of SLC mode).
[0093] In some embodiments, marking the first free storage space as the second media mode can be achieved through the following technical solution: when the capacity of the first free storage space is not greater than the capacity of the free storage space in the first media mode, the first free storage space is marked as the second media mode; when the capacity of the first free storage space is greater than the capacity of the free storage space in the first media mode, the storage space in the first media mode is reclaimed, wherein the updated capacity of the first free storage space after reclamation is not greater than the capacity of the free storage space in the first media mode, and the updated first free storage space after reclamation is marked as the second media mode.
[0094] As an example, during the conversion from a low-performance media mode (first media mode) to a high-performance media mode (second media mode), if the free storage space in the low-performance media mode is sufficient (i.e., the capacity of the first free storage space is no greater than the capacity of the free storage space in the first media mode), then the corresponding amount of free storage space in the low-performance media mode can be directly converted from the low-performance media mode to the high-performance media mode. For example, 25GB of free storage space in the low-performance media mode can be converted to 6.25GB of free storage space in the high-performance media mode. If the free storage space in the low-performance media mode is insufficient (i.e., the capacity of the first free storage space is greater than the capacity of the free storage space in the first media mode), then garbage collection needs to be performed on a portion of the space in the low-performance media mode. After the garbage collection is completed, the corresponding amount of free storage space can be converted to the high-performance media mode.
[0095] As an example, when garbage collecting a portion of the space in the low-performance media mode (first media mode), the data stored in the storage space of the low-performance media mode is first classified to obtain valid data and invalid data. The valid data is discarded, and the valid data stored in the storage space of the low-performance media mode is integrated to integrate the fragmented data into a whole, thereby occupying a contiguous storage space.
[0096] In some embodiments, when the media mode conversion method is from a second media mode to a first media mode, the performance of the first media mode is lower than that of the second media mode, and the storage density of the first media mode is higher than that of the second media mode, the media mode conversion processing of the free storage space in step 104 according to the media mode conversion method can be implemented by the following technical solution: determining the capacity of the second free storage space required for the conversion processing according to the data compression rate and expansion rate; wherein, the capacity of the second free storage space is the capacity of the second free storage space, and the second free storage space is the free storage space in the second media mode and used for conversion; marking the second free storage space as the first media mode.
[0097] In some embodiments, determining the second free storage space capacity required for conversion processing based on the data compression rate and expansion rate can be achieved through the following technical solutions: determining the ratio of the data volume of the business data to the expansion rate as the theoretical storage space value of the business data; determining the actual storage space value of the business data by determining the ratio of the data volume of the business data to the data compression rate; determining the ratio of the storage density of the first media mode to the storage density of the second media mode; and determining the second free storage space capacity that is positively correlated with the actual storage space value, negatively correlated with the theoretical storage space value, and negatively correlated with the ratio.
[0098] As an example, when the data compression rate of the data written within a monitoring cycle is less than the SSD expansion rate, the driver will convert part of the NAND space from high-performance media mode to low-performance media mode. The size of the storage space in the converted low-performance media mode is (C2-C1) / R, where C1 is the physical space that the data written within the current monitoring cycle can occupy under the corresponding SSD expansion rate, C2 is the physical space actually occupied by the data written within the current monitoring cycle in the SSD, and R is the storage density ratio between the low-performance media mode and the high-performance media mode. Taking a QLC SSD with a logical expansion rate of 2 as an example, if a monitoring cycle corresponds to 100GB of data and the data compression rate is 1.5, then the storage space size of the converted low-performance media mode is (100 / 1.5-100 / 2) / 4≈4.2GB, and the required storage space capacity of the high-performance mode is 1.05GB (the storage space capacity of the high-performance mode is 1 / R of the storage space size of the low-performance media mode).
[0099] In some embodiments, marking the second free storage space as the first media mode can be achieved through the following technical solution: when the capacity of the second free storage space is not greater than the capacity of the free storage space in the second media mode, the second free storage space is marked as the first media mode; when the capacity of the second free storage space is greater than the capacity of the free storage space in the second media mode, the storage space in the second media mode is reclaimed, wherein the updated capacity of the second free storage space after reclamation is not greater than the capacity of the free storage space in the second media mode, and the free storage space of the second storage space value in the updated second media mode after reclamation is marked as the first media mode.
[0100] As an example, during the conversion from high-performance media mode (second media mode) to low-performance media mode (first media mode), if the free storage space in the high-performance media mode is sufficient, i.e., the capacity of the second free storage space is not greater than the capacity of the free storage space in the second media mode, then the storage space of the corresponding conversion space size in the free storage space of the high-performance media mode can be directly converted from the high-performance media mode to the low-performance media mode. If the free storage space in the high-performance media mode is insufficient, i.e., the capacity of the second free storage space is greater than the capacity of the free storage space in the second media mode, then garbage collection needs to be performed on part of the space in the high-performance media mode. After the garbage collection is completed, the storage space of the corresponding conversion space size in the free storage space of the high-performance media mode is converted to the low-performance media mode.
[0101] In some embodiments, the above-described recycling process for the storage space of the second media mode can be implemented through the following technical solutions: determining the data to be recycled that occupies the storage space of the second media mode; when the data to be recycled is invalid data, marking the storage space occupied by the data to be recycled as free storage space and discarding the data to be recycled; when the data to be recycled is valid data and the access frequency of the data to be recycled is lower than the access frequency threshold, writing the data to be recycled into the free storage space of the first media mode; when the data to be recycled is valid data, the access frequency of the data to be recycled is not lower than the access frequency threshold, and the second media mode does not have free storage space, writing the data to be recycled into the free storage space of the first media mode.
[0102] As an example, the second media mode does not have free storage space, indicating that the free storage space of the second media mode is less than the sum of the storage space capacity required for the data to be recycled and the second free storage space capacity.
[0103] As an example, during garbage collection in the high-performance media mode (second media mode) storage space, for valid data that needs to be moved, the judgment module determines whether it is hot data based on the access frequency of the data's logical address. If it is not hot data, the corresponding data is written to the low-performance media mode storage space. If it is hot data, the module continues to determine whether there is free storage space in the high-performance media mode. If there is free storage space in the high-performance media mode, the corresponding data is written to the free storage space in the high-performance media mode; otherwise, it is written to the free storage space in the low-performance media mode.
[0104] In step 105, based on the media mode of the free storage space after conversion processing, the data operation request of the target service is responded to.
[0105] In some embodiments, based on the media mode of the free storage space after conversion processing, the host responds to the data operation request of the target service. The data operation request includes at least one of a data read request and a data write request.
[0106] In some embodiments, when the data operation request is a data read request, the response to the data operation request of the target service in step 105 based on the media mode of the free storage space after conversion processing can be achieved through the following technical solution: determining the access frequency of the target read data of the target service and the media mode of the target storage space, wherein the target storage space is used to store the target read data of the data read request; when the media mode is a first media mode, obtaining the free storage space capacity of the second media mode; when the access frequency of the target read data is greater than the access frequency threshold, the media mode is the first media mode, and the free storage space capacity of the second media mode is not less than the free storage space threshold, writing the target read data of the data read request into the free storage space of the second media mode; wherein the performance of the first media mode is lower than that of the second media mode, and the storage density of the first media mode is higher than that of the second media mode.
[0107] As an example, the free storage space capacity of the second media mode is not less than the free storage space threshold, which means that the free storage space capacity of the second media mode is not less than the storage space capacity in the second media mode required to write the target read data. That is, the free storage space threshold is not less than the storage space capacity in the second media mode required to write the target read data.
[0108] As an example, the judgment module determines whether the data belongs to hot data (greater than or equal to the hot data access frequency threshold) based on the access frequency of the data logical address. If it does not belong to hot data, the corresponding data is directly read and returned to the host. If it belongs to hot data, it determines whether the data is in the high-performance media mode space. If it is in the high-performance media mode storage space, the data is directly returned to the host. If it is not in the high-performance media mode storage space, while returning the data, it continues to determine whether there is enough free space in the high-performance media mode. If there is enough free storage space in the high-performance media mode, the data to be read is written to the free storage space in the high-performance media mode.
[0109] In some embodiments, when the data operation request is a data write request, the response to the data operation request of the target service in step 105 based on the media mode of the free storage space after conversion processing can be implemented through the following technical solution: when there is free storage space in the storage device in the second media mode, the target write data of the target service is written to the free storage space in the storage device in the second media mode according to the write rules of the corresponding second media mode; when there is no free storage space in the storage device in the second media mode, the target write data of the target service is written to the free storage space in the storage device in the first media mode according to the write rules of the corresponding first media mode; wherein, the performance of the first media mode is lower than that of the second media mode, and the storage density of the first media mode is higher than that of the second media mode.
[0110] As an example, the existence of free storage space in the second media mode in the storage device indicates that the capacity of the free storage space in the second media mode is not less than the capacity of the storage space in the second media mode required for the target data to be written.
[0111] As an example, the first media mode is a low-performance media mode, and the second media mode is a high-performance media mode. The high-performance media mode has a higher access speed (read and write speed), higher reliability, and higher durability than the low-performance media mode. However, the high-performance media mode has a lower storage density than the low-performance media mode. Therefore, if there is free storage space in the high-performance media mode, the target data to be written will be directly written to the free storage space in the high-performance media mode. Otherwise, the target data to be written will be written to the free storage space in the low-performance media mode. When writing data, the writing rules corresponding to each media mode will be followed when writing to the free storage space of different media modes.
[0112] The above embodiment responds to data operation requests after media conversion has been performed. That is, it responds to the data operation requests of the target business based on the media mode of the free storage space after conversion. However, the steps of responding to data operation requests are not necessarily related to the media conversion process. Responding to data operation requests is the process of writing data to the storage device and reading data from the storage device, while the media conversion process is the process of converting the media mode of the storage space of the storage device. The two do not affect each other.
[0113] In some embodiments, for storage devices that have not yet undergone media mode conversion, when there is free storage space in the storage device in the second media mode, the target write data of the target service is written to the free storage space in the storage device in the second media mode according to the write rules corresponding to the second media mode. When there is no free storage space in the storage device in the second media mode, the target write data of the target service is written to the free storage space in the storage device in the first media mode according to the write rules corresponding to the first media mode. For storage devices that have not yet undergone media mode conversion, the access frequency of the target read data of the target service and the media mode of the target storage space are determined, wherein the target storage space is used to store the target read data of the data read request. When the media mode is the first media mode, the free storage space capacity of the second media mode is obtained. When the access frequency of the target read data is greater than the access frequency threshold, the media mode is the first media mode, and the free storage space capacity of the second media mode is not less than the free storage space threshold, the target read data of the data read request is written to the free storage space of the second media mode. Wherein, the performance of the first media mode is lower than that of the second media mode, and the storage density of the first media mode is higher than that of the second media mode.
[0114] The following will describe an exemplary application of the embodiments of this application in a real-world application scenario.
[0115] In some embodiments, the storage device control method provided in this application can be applied to a business model with good data compression performance and hot data read / write requirements. The terminal sends a business request to the host device, and the central processing unit (CPU) in the host device... The Unit receives service requests and obtains corresponding write instructions. The CPU in the host device can also receive read / write instructions sent by the user to the CPU through an input device. The host device sends the write instructions to the storage device. The processor in the storage device obtains the current expansion rate of the storage device and the data compression rate of the service data corresponding to the target service in the storage device. Based on the comparison between the data compression rate and the expansion rate, it determines the media mode conversion method for the idle storage space of the storage device and performs media mode conversion processing on the idle storage space according to the media mode conversion method. Based on the media mode of the idle storage space after the conversion processing, it responds to the data operation requests of the target service sent by the host device. The data operation requests include data read requests and data write requests. That is, the host device can perform corresponding read / write operations on the service data based on the media mode of the idle storage space after the conversion processing. For services with good data compression, more storage space in the solid-state drive can be converted to the high-performance media mode. At the same time, access to hot data can be diverted to the storage space corresponding to these high-performance media modes, which can improve the overall performance of the solid-state drive for the service.
[0116] In some embodiments, see Figure 5This is a comparative schematic diagram of the media modes of the control method for the storage device provided in the embodiments of this application. In a single-level storage cell (SLC), each storage cell can store 1 bit of data. In a two-level storage cell (MLC), each storage cell can store 2 bits of data. In a three-level storage cell (TLC), each storage cell can store 3 bits of data. In a four-level storage cell (QLC), each storage cell can store 4 bits of data. From single-layer to four-layer storage cell media modes, storage density gradually increases, but performance gradually decreases, including reduced durability, read / write speed, and reliability. Conversely, the resource costs associated with transitioning from single-layer to four-layer storage cell media modes gradually decrease. The industry is increasingly adopting four-layer storage cell SSDs. However, the limitations of four-layer SSDs in terms of performance and cost restrict their application scenarios. The media mode is not limited to single-layer to four-layer media modes; it can be a multi-layer media mode, such as a five-layer media mode where each storage cell stores 5 bits of data.
[0117] In some embodiments, transparent compression refers to compression performed on the data path within the hard drive. That is, the host writes the raw data directly to the hard drive, the hard drive's internal compression engine compresses the data before writing it to the storage medium. When the host reads data, the hard drive first reads the compressed data from the storage medium, then the hard drive's internal decompression engine decompresses it before returning it to the host. In transparent compression, the data compression and decompression processes are completely transparent to the host. Figure 6 , Figure 6 This is a compression diagram of the control method for the storage device provided in this application embodiment. The following explanation uses a data compression ratio of 2:1 as an example (the data before compression is twice the size after compression): A 4-kilobyte logical data block becomes 2 kilobytes in size after transparent compression in the hard disk. That is, the 4 kilobytes of data in the logical space only occupy 2 kilobytes of physical space. Thus, under the premise of the same logical space occupation, the hard disk with transparent compression function only occupies the equivalent of half of the physical space. As the data compression ratio increases, the effect of saving physical space will be more obvious.
[0118] In some embodiments, cold data is read at a low frequency, requires low media performance, and has low lifespan requirements; sufficient capacity is sufficient. Hot data, on the other hand, is read at a high frequency, requires high media performance, and has high lifespan requirements. Typically, hot data has a relatively small data volume and requires a correspondingly smaller capacity. Cold data can be stored in QLC media mode (low-performance media mode), while hot data can be stored in SLC media mode (high-performance media mode). Dynamic performance balancing is achieved by switching between high-performance (SLC) and low-performance (QLC) modes, and can also be extended to PLC solid-state drives. High-performance media mode is not limited to SLC media mode; it can also be other modes. High-performance and low-performance media modes are relative concepts. Combinations of high and low performance media modes include TLC media mode / SLC media mode, QLC media mode / SLC media mode, QLC media mode / MLC media mode, etc.
[0119] In some embodiments, see Figure 7A , Figure 7AThis is a logical schematic diagram of the control method for a storage device provided in this application embodiment. In step 201, the data compression rate of the data in the previous monitoring cycle is calculated. In step 202, the data compression rate and the SSD expansion rate are compared. When the data compression rate is greater than the SSD expansion rate, step 203 is executed. In step 203, the storage space size required to convert from low-performance media mode to high-performance media mode is calculated, i.e., the required storage space size of low-performance media mode. In step 205, it is determined whether the free storage space of low-performance media mode is not less than the required storage space size of low-performance media mode. When the free storage space of low-performance media mode is not less than the required storage space size of low-performance media mode, step 209 is executed. In step 209, the corresponding free storage space of low-performance media mode is marked as high-performance media mode. When the free storage space of low-performance media mode is less than the required storage space size of low-performance media mode, step 207 is executed. In step 207, the storage space of low-performance media mode is... In step 209, the free storage space of the corresponding low-performance media mode is marked as high-performance media mode. When the data compression rate is less than the SSD expansion rate, step 204 is executed to calculate the storage space size required to convert from high-performance media mode to low-performance media mode, i.e., the required storage space size of high-performance media mode. In step 206, it is determined whether the free storage space of high-performance media mode is not less than the required storage space size of high-performance media mode. When the free storage space of high-performance media mode is not less than the required storage space size of high-performance media mode, step 210 is executed. In step 210, the free storage space of the corresponding high-performance media mode is marked as low-performance media mode. When the free storage space of high-performance media mode is less than the required storage space size of high-performance media mode, step 208 is executed. In step 208, garbage collection is performed on the storage space of high-performance media mode. In step 210, the free storage space of the corresponding high-performance media mode is marked as low-performance media mode.
[0120] In some embodiments, the technical solution for dynamically balancing the performance and capacity of a solid-state drive with transparent compression function is as follows: The solid-state drive driver includes a monitoring module, which is responsible for periodically monitoring the compressibility of written data. The solid-state drive driver also includes a detection module, which is used to determine the hotness or coldness of data, including the hotness or coldness of read data and written data. The monitoring cycle of the monitoring module is based on time, for example, every 10 minutes. The monitoring cycle of the monitoring module can also be based on the amount of data written, for example, every 100GB written is one cycle.
[0121] When the compression rate of data written within a monitoring cycle exceeds the expansion rate of the SSD, the SSD driver can convert a portion of the NAND space from low-performance media mode to high-performance media mode. High-performance media mode is characterized by lower storage density and faster access speed, while low-performance media mode is characterized by higher storage density and slower access speed. The storage space size of the high-performance media mode converted from low-performance media mode is calculated as (C1-C2) / R. Here, C1 represents the physical space that the data written within the current monitoring cycle can occupy under the corresponding SSD expansion rate, C2 represents the actual physical space occupied by the data written within the current monitoring cycle on the SSD, and R is the density ratio between low-performance and high-performance media modes. For example, QLC NAND can operate in QLC media mode (low-performance media mode). NAND can also operate in SLC mode (High Performance Media mode). For a QLC solid-state drive with a logical space expansion ratio of 1 (i.e., the logical capacity of the solid-state drive equals its physical capacity), if a monitoring cycle corresponds to 100GB of data, and the data compression ratio is 2:1 (i.e., 100GB of data is compressed to 50GB), then it can be converted from QLC mode to SLC mode. The storage space capacity of the converted SLC mode is (100-50) / 4 = 12.5GB, and the required storage space capacity of the QLC mode is 50GB. The 4 in the denominator represents the difference between QLC mode and SLC mode. The storage density ratio of C mode is 4. For a QLC solid-state drive with a logical expansion ratio of 2 (i.e., the logical capacity of the solid-state drive is equal to twice the physical capacity), if 100GB of data is written and the data compression ratio is 4:1 (i.e., 100GB of data is compressed into 25GB), then the storage space capacity of the converted SLC mode is (100 / 2-100 / 4) / 4 = 6.25GB, and the required storage space capacity of the QLC mode is 25GB.
[0122] In some embodiments, during the conversion from low-performance media mode to high-performance media mode, if there is sufficient free storage space in the low-performance media mode, the corresponding amount of free storage space in the low-performance media mode can be directly converted from the low-performance media mode to the high-performance media mode. For example, 25GB of free storage space in the low-performance media mode can be converted to 6.25GB of free storage space in the high-performance media mode. If there is insufficient free storage space in the low-performance media mode, garbage collection needs to be performed on a portion of the space in the low-performance media mode. After the garbage collection is completed, the corresponding amount of free storage space in the high-performance media mode can be converted to the high-performance media mode.
[0123] In some embodiments, when the data compression rate of the data written within a monitoring cycle is less than the SSD expansion rate, the driver converts part of the NAND space from SLC media mode to QLC media mode. The storage space size of the converted QLC media mode is (C2-C1) / R, where C1 is the physical space that the data written within the current monitoring cycle can occupy under the corresponding SSD expansion rate, C2 is the physical space actually occupied by the data written within the current monitoring cycle in the SSD, and R is the storage density ratio between the low-performance media mode and the high-performance media mode. Taking a QLC SSD with a logical expansion rate of 2 as an example, if a monitoring cycle corresponds to 100GB of data and the data compression rate is 1.5, then the SLC media mode is converted to QLC media mode, and the storage space size of the converted QLC media mode is (100 / 1.5-100 / 2) / 4≈4.2GB. The required SLC mode storage space capacity is 1.05GB.
[0124] In some embodiments, during the conversion from high-performance media mode to low-performance media mode, if there is sufficient free storage space in the high-performance media mode, the corresponding conversion space size in the free storage space of the high-performance media mode can be directly converted from high-performance media mode to low-performance media mode. If there is insufficient free storage space in the high-performance media mode, garbage collection needs to be performed on a portion of the space in the high-performance media mode. After the garbage collection is completed, the corresponding conversion space size in the free storage space of the high-performance media mode is converted to low-performance media mode.
[0125] In some embodiments, see Figure 7B , Figure 7BThis is a logical schematic diagram of the control method for a storage device provided in this application embodiment. In step 301, the logical block address for data reading is received. In step 302, it is determined whether the data to be read is hot data. If the data to be read is not hot data, step 305 is executed. In step 305, the data is directly read and returned to the host. If the data to be read is hot data, step 303 is executed. In step 303, it is determined whether the data is in a high-performance media mode storage space. If the data is in a high-performance media mode storage space, step 305 is executed. In step 305, the data is directly read and returned to the host. The system reads data and returns it to the host. If the data is not in the storage space of the high-performance media mode, in step 304, it determines whether the free storage space of the high-performance media mode is greater than the free storage space threshold. If the free storage space of the high-performance media mode is not greater than the free storage space threshold, step 305 is executed. In step 305, the data is directly read and returned to the host. If the free storage space of the high-performance media mode is greater than the free storage space threshold, step 306 is executed. In step 306, the data is read and returned to the host, and the data is written to the storage space of the high-performance media mode.
[0126] In some embodiments, for reading data, the judgment module determines whether it is hot data (greater than or equal to the hot data access frequency threshold) based on the access frequency of the data logical address. If it is not hot data, the corresponding data is read directly and returned to the host. If it is hot data, it determines whether the data is in the high-performance media mode space. If it is in the high-performance media mode storage space, the data is returned directly to the host. If it is not in the high-performance media mode storage space, it continues to determine whether there is enough free space in the high-performance media mode while returning the data. If there is enough free storage space in the high-performance media mode, the data to be read is written to the free storage space in the high-performance media mode.
[0127] In some embodiments, for writing data, if there is free space in the high-performance media mode, the data to be written is directly written to the storage space in the high-performance media mode; otherwise, the data is written to the storage space in the low-performance media mode.
[0128] In some embodiments, see Figure 7C , Figure 7CThis is a logical schematic diagram of the control method for a storage device provided in this application embodiment. In step 401, a physical interval for garbage collection is selected. In step 402, the data within the physical interval is traversed. In step 403, it is determined whether the data is valid. If the data is invalid, step 405 is executed, in which invalid data is discarded. If the data is valid, step 404 is executed. In step 404, it is determined whether the data is hot data. If the data is not hot data, step 406 is executed, in which the data is written to the storage space in low-performance media mode. If the data is hot data, step 407 is executed, in which high-performance media mode is determined. If the free storage space in the high-performance media mode is less than the free storage space threshold, proceed to step 408. In step 408, determine if the interval traversal has ended. If the interval traversal has ended, proceed to step 410. In step 410, physical space reclamation ends, and the reclaimed storage space is marked as free storage space. If the free storage space in the high-performance media mode is not less than the free storage space threshold, proceed to step 409. In step 409, write the data into the free storage space of the high-performance media mode, and then continue to proceed to step 408. If the interval traversal has not ended, continue to proceed to step 402.
[0129] During garbage collection in the high-performance media mode storage space, for valid data that needs to be moved, the judgment module determines whether it is hot data based on the access frequency of the data's logical address. If it is not hot data, the corresponding data is written to the low-performance media mode storage space. If it is hot data, the module further checks whether there is free storage space in the high-performance media mode. If there is free storage space in the high-performance media mode, the corresponding data is written to the free storage space in the high-performance media mode; otherwise, it is written to the free storage space in the low-performance media mode.
[0130] In some embodiments, when garbage collection is performed on the storage space of the low-performance media mode, valid data that needs to be moved is directly written to the free storage space of the low-performance media mode.
[0131] In some embodiments, the solid-state drive (SSD) periodically monitors the compression rate of the source data and automatically analyzes the hotness / coldness of the data. Based on the compression rate, the matching degree between the current business and the SSD expansion rate can be determined, thereby dynamically converting the media. Furthermore, within the same SSD, media mode conversion can be automatically implemented based on actual storage needs. Based on data hot / cold tags, different data can be intelligently distributed to media in different modes, thus meeting the performance requirements of different business data streams. The storage device control method provided in this application embodiment, while ensuring the storage capacity of the SSD, can dynamically adjust the proportion of the NAND media of the SSD in different media modes in business scenarios where the data source has compression characteristics. This maximizes the proportion of media in high-performance media modes, reduces the impact of the low performance of the QLC SSD itself, thereby expanding the application scope of QLC SSDs and guiding QLC NAND to be applied to different business models.
[0132] In the storage device control method provided in this application embodiment, hot data is moved to a high-performance media mode space, which can improve the performance of applications with hot data reading. For example, the typical read latency of a solid-state drive (SSD) in QLC media mode NAND is 130 microseconds, while the typical read latency of NAND in SLC media mode is 65 microseconds. Migrating hot data to the SLC media mode storage space can reduce the read latency by half. Writing data directly to the high-performance media mode storage space can reduce the write latency and improve the write throughput, thereby improving the performance of the application during writing. For example, the typical write latency of a solid-state drive (SSD) in QLC media mode NAND is 2500 microseconds, while the typical write latency of NAND in SLC media mode is 216 microseconds. By writing data to the SLC media mode storage space, the application will see a significant improvement in both write latency and throughput.
[0133] The following description continues to illustrate the exemplary structure of the control device 331 for the storage device provided in the embodiments of this application as a software module. In some embodiments, such as Figure 2 As shown, the software modules in the control device 331 of the storage device stored in the processor 310 may include: an acquisition module 3311 for acquiring the expansion rate of the storage device; an acquisition module 3311 for acquiring the data compression rate of the business data corresponding to the target service in the storage device; a data compression rate determination module 3312 for determining the media mode conversion method of the free storage space of the storage device based on the comparison result of the data compression rate and the expansion rate; a conversion module 3313 for performing media mode conversion processing on the free storage space according to the media mode conversion method; and a response module 3314 for responding to the data operation request of the target service based on the media mode of the free storage space after the conversion processing.
[0134] In some embodiments, the acquisition module 3311 is further configured to: perform any one of the following processes: within at least one historical time period of the target service, acquire the data compression rate of the service data corresponding to the target service in the storage device; within at least one historical data write volume period of the target service, acquire the data compression rate of the service data corresponding to the target service in the storage device.
[0135] In some embodiments, the determining module 3312 is further configured to: when the data compression rate is greater than the expansion rate, determine the conversion from the first media mode to the second media mode as the media mode conversion method of the storage device; when the data compression rate is less than the expansion rate, determine the conversion from the second media mode to the first media mode as the media mode conversion method of the storage device; wherein the performance of the first media mode is lower than that of the second media mode, and the storage density of the first media mode is higher than that of the second media mode.
[0136] In some embodiments, when the media mode conversion method is from a first media mode to a second media mode, the performance of the first media mode is lower than that of the second media mode, and the storage density of the first media mode is higher than that of the second media mode, the conversion module 3313 is further configured to: determine the first free storage space capacity required for conversion processing based on the data compression rate and the expansion rate; wherein, the first free storage space capacity is the capacity of the first free storage space, and the first free storage space is the free storage space in the first media mode used for conversion processing; and mark the first free storage space as the second media mode.
[0137] In some embodiments, the conversion module 3313 is further configured to: mark the first free storage space as the second media mode when the capacity of the first free storage space is not greater than the capacity of the free storage space in the first media mode; and reclaim the storage space in the first media mode when the capacity of the first free storage space is greater than the capacity of the free storage space in the first media mode, wherein the updated capacity of the first free storage space after reclamation is not greater than the capacity of the free storage space in the first media mode, and the updated capacity of the first free storage space after reclamation is marked as the second media mode.
[0138] In some embodiments, the conversion module 3313 is further configured to: determine the ratio of the data volume of the business data to the expansion rate as the theoretical storage space value of the business data; determine the ratio of the data volume of the business data to the data compression rate as the actual storage space value of the business data; and determine a first free storage space capacity that is positively correlated with the theoretical storage space value and negatively correlated with the actual storage space value.
[0139] In some embodiments, when the media mode conversion method is from a second media mode to a first media mode, the performance of the first media mode is lower than that of the second media mode, and the storage density of the first media mode is higher than that of the second media mode, the conversion module 3313 is further configured to: determine the second free storage space capacity required for conversion processing based on the data compression rate and the expansion rate; wherein, the second free storage space capacity is the capacity of the second free storage space, and the second free storage space is the free storage space in the second media mode and used for conversion; and mark the second free storage space as the first media mode.
[0140] In some embodiments, the conversion module 3313 is further configured to: mark the second free storage space as the first media mode when the capacity of the second free storage space is not greater than the capacity of the free storage space in the second media mode; and reclaim the storage space in the second media mode when the capacity of the second free storage space is greater than the capacity of the free storage space in the second media mode, wherein the updated capacity of the second free storage space after reclamation is not greater than the capacity of the free storage space in the second media mode, and the free storage space of the second storage space value in the updated second media mode after reclamation is marked as the first media mode.
[0141] In some embodiments, the conversion module 3313 is further configured to: determine the ratio of the data volume of the business data to the expansion rate as the theoretical storage space value of the business data; determine the ratio of the data volume of the business data to the data compression rate as the actual storage space value of the business data; determine the ratio of the storage density of the first media mode to the storage density of the second media mode; and determine the second free storage space capacity that is positively correlated with the actual storage space value, negatively correlated with the theoretical storage space value, and negatively correlated with the ratio.
[0142] In some embodiments, the conversion module 3313 is further configured to: determine the data to be reclaimed occupying the storage space of the second media mode; when the data to be reclaimed is invalid data, mark the storage space occupied by the data to be reclaimed as free storage space and discard the data to be reclaimed; when the data to be reclaimed is valid data and the access frequency of the data to be reclaimed is lower than the access frequency threshold, write the data to be reclaimed into the free storage space of the first media mode; when the data to be reclaimed is valid data, the access frequency of the data to be reclaimed is not lower than the access frequency threshold, and the second media mode does not have free storage space, write the data to be reclaimed into the free storage space of the first media mode.
[0143] In some embodiments, when the data operation request is a data read request, the response module 3314 is further configured to: determine the access frequency of the target read data of the target service and the media mode of the target storage space, wherein the target storage space is used to store the target read data of the data read request; when the media mode is a first media mode, obtain the free storage space capacity of the second media mode; when the access frequency of the target read data is greater than the access frequency threshold, the media mode is the first media mode, and the free storage space capacity of the second media mode is not less than the free storage space threshold, write the target read data of the data read request into the free storage space of the second media mode; wherein the performance of the first media mode is lower than that of the second media mode, and the storage density of the first media mode is higher than that of the second media mode.
[0144] In some embodiments, when the data operation request is a data write request, the response module 3314 is further configured to: when there is free storage space in the storage device in the second media mode, write the target write data of the target service into the free storage space in the storage device in the second media mode according to the write rules of the corresponding second media mode; when there is no free storage space in the storage device in the second media mode, write the target write data of the target service into the free storage space in the storage device in the first media mode according to the write rules of the corresponding first media mode; wherein, the performance of the first media mode is lower than that of the second media mode, and the storage density of the first media mode is higher than that of the second media mode.
[0145] This application provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of the storage device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the storage device to perform the storage device control method described in this application.
[0146] This application provides a computer-readable storage medium storing executable instructions. When these executable instructions are executed by a processor, they cause the processor to execute the control method for the storage device provided in this application. For example, ... Figures 4A-4C The control method for the storage device is shown.
[0147] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EP ROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of devices including one or any combination of the above-mentioned memories.
[0148] In some embodiments, executable instructions may take the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a standalone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0149] As an example, executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple collaborating files (e.g., a file that stores one or more modules, subroutines, or code sections).
[0150] As an example, executable instructions can be deployed to execute on a single storage device, or on multiple storage devices located in one location, or on multiple storage devices distributed across multiple locations and interconnected via a communication network.
[0151] In summary, this application embodiment determines the media mode conversion method of the idle storage space of the storage device based on the comparison results of the data compression rate and expansion rate of the target service, and performs media mode conversion processing on the idle storage space. This realizes the process of dynamically converting the media mode based on the target service. Therefore, when responding to the data operation request of the target service based on the media mode of the idle storage space after conversion processing, it can respond in a way that matches the target service, effectively improving the overall working performance of the storage device.
[0152] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.
Claims
1. A method for controlling a storage device, characterized in that, include: Obtain the expansion rate of the storage device, wherein the expansion rate is used to characterize the ratio of the logical space size of the solid-state drive with compression function to the actual physical space size of the solid-state drive; Obtain the data compression ratio of the business data corresponding to the target service in the storage device; Based on the comparison result of the data compression ratio and the expansion ratio, the media mode conversion method of the free storage space of the storage device is determined; wherein, when the data compression ratio is greater than the expansion ratio, the media mode conversion method of the storage device is determined to be from the first media mode to the second media mode; when the data compression ratio is less than the expansion ratio, the media mode conversion method of the storage device is determined to be from the second media mode to the first media mode; the performance of the first media mode is lower than that of the second media mode, and the storage density of the first media mode is higher than that of the second media mode; The media mode of the free storage space is converted according to the media mode conversion method described above; Based on the media mode of the free storage space after the conversion process, respond to the data operation request corresponding to the target service.
2. The method according to claim 1, characterized in that, The step of obtaining the data compression rate of the business data corresponding to the target service in the storage device includes: Perform any of the following processes: Within at least one historical time period of the target service, obtain the data compression rate of the service data corresponding to the target service in the storage device; Within at least one historical data write cycle of the target service, obtain the data compression rate of the service data corresponding to the target service on the storage device.
3. The method according to claim 1, characterized in that, When the media mode conversion method is from the first media mode to the second media mode, the process of converting the media mode of the free storage space according to the media mode conversion method includes: Based on the data compression rate and the expansion rate, determine the first free storage space capacity required for the conversion process; Wherein, the capacity of the first free storage space is the capacity of the first free storage space, and the first free storage space is the free storage space in the first medium mode and used for the conversion process; The first free storage space is marked as the second media mode.
4. The method according to claim 3, characterized in that, The step of marking the first free storage space as the second media mode includes: When the capacity of the first free storage space is not greater than the capacity of the free storage space in the first media mode, the first free storage space is marked as the second media mode; When the capacity of the first free storage space is greater than the capacity of the free storage space in the first media mode, the storage space in the first media mode is reclaimed. The capacity of the first free storage space after reclamation is not greater than the capacity of the free storage space in the first media mode. The first free storage space after reclamation is then marked as the second media mode.
5. The method according to claim 3, characterized in that, Determining the first free storage space capacity required for the conversion process based on the data compression rate and the expansion rate includes: The ratio of the amount of business data to the expansion rate is determined as the theoretical storage space value of the business data. The actual storage space value of the business data is determined by the ratio of the data volume of the business data to the data compression rate; Determine the capacity of a first free storage space that is positively correlated with the theoretical storage space value and negatively correlated with the actual storage space value.
6. The method according to claim 1, characterized in that, When the media mode conversion method is from the second media mode to the first media mode, the process of converting the media mode of the free storage space according to the media mode conversion method includes: Based on the data compression rate and the expansion rate, determine the second free storage space capacity required for the conversion process; Wherein, the capacity of the second free storage space is the capacity of the second free storage space, and the second free storage space is the free storage space in the second medium mode and used for the conversion; The second free storage space is marked as the first media mode.
7. The method according to claim 6, characterized in that, The step of marking the second free storage space as the first media mode includes: When the capacity of the second free storage space is not greater than the capacity of the free storage space in the second media mode, the second free storage space is marked as the first media mode; When the capacity of the second free storage space is greater than the capacity of the free storage space in the second media mode, the storage space in the second media mode is reclaimed. The updated capacity of the second free storage space after reclamation is not greater than the capacity of the free storage space in the second media mode. The free storage space of the second storage space value in the updated second media mode after reclamation is marked as the first media mode.
8. The method according to claim 6, characterized in that, Determining the second free storage space capacity required for the conversion process based on the data compression rate and the expansion rate includes: The ratio of the amount of business data to the expansion rate is determined as the theoretical storage space value of the business data. The actual storage space value of the business data is determined by the ratio of the data volume of the business data to the data compression rate; Determine the ratio of the storage density of the first media mode to the storage density of the second media mode; A second free storage space capacity is determined that is positively correlated with the actual storage space value, negatively correlated with the theoretical storage space value, and negatively correlated with the ratio of the storage density of the first media mode to the storage density of the second media mode.
9. The method according to claim 7, characterized in that, The process of reclaiming the storage space in the second media mode includes: Identify the data to be reclaimed that occupies the storage space in the second media mode; When the data to be reclaimed is invalid data, the storage space occupied by the data to be reclaimed is marked as free storage space, and the data to be reclaimed is discarded. When the data to be recycled is valid data and the access frequency of the data to be recycled is lower than the access frequency threshold, the data to be recycled is written into the free storage space of the first medium mode. When the data to be recycled is valid data, the access frequency of the data to be recycled is not lower than the access frequency threshold, and the second media mode does not have free storage space, the data to be recycled is written to the free storage space in the first media mode.
10. The method according to claim 1, characterized in that, When the data operation request is a data read request, the step of responding to the data operation request corresponding to the target service based on the media mode of the free storage space after the conversion process includes: Determine the access frequency of the target read data of the target service and the media mode of the target storage space, wherein the target storage space is used to store the target read data of the data read request; When the media mode is the first media mode, obtain the free storage space capacity of the second media mode; When the access frequency of the target read data is greater than the access frequency threshold, the media mode is the first media mode, and the free storage space capacity of the second media mode is not less than the free storage space threshold, the target read data of the data read request is written into the free storage space of the second media mode.
11. The method according to claim 1, characterized in that, When the data operation request is a data write request, the step of responding to the data operation request corresponding to the target service based on the media mode of the free storage space after the conversion process includes: When there is free storage space in the storage device in the second media mode, the target write data of the target service is written into the free storage space in the storage device in the second media mode according to the write rules corresponding to the second media mode. When there is no free storage space in the storage device in the second media mode, the target write data of the target service is written to the free storage space in the storage device in the first media mode according to the write rules corresponding to the first media mode.
12. A control device for a storage device, characterized in that, include: An acquisition module is used to acquire the expansion rate of the storage device, wherein the expansion rate is used to characterize the ratio of the logical space size of the solid-state drive with compression function to the actual physical space size of the solid-state drive; The acquisition module is used to acquire the data compression rate of the business data corresponding to the target business in the storage device; A determining module is used to determine the media mode conversion method of the free storage space of the storage device based on the comparison result of the data compression ratio and the expansion ratio; wherein, when the data compression ratio is greater than the expansion ratio, the media mode conversion method of the storage device is determined to be from the first media mode to the second media mode; when the data compression ratio is less than the expansion ratio, the media mode conversion method of the storage device is determined to be from the second media mode to the first media mode; the performance of the first media mode is lower than that of the second media mode, and the storage density of the first media mode is higher than that of the second media mode; A conversion module is used to convert the media mode of the free storage space according to the media mode conversion method. The response module is used to respond to the data operation request of the target service based on the media mode of the free storage space after the conversion process.
13. The apparatus according to claim 12, characterized in that, The acquisition module is further configured to perform any one of the following processes: within at least one historical time period of the target service, acquire the data compression rate of the service data corresponding to the target service in the storage device; within at least one historical data write volume period of the target service, acquire the data compression rate of the service data corresponding to the target service in the storage device.
14. The apparatus according to claim 12, characterized in that, When the media mode conversion method is from the first media mode to the second media mode, the conversion module is further configured to determine the first free storage space capacity required for the conversion process based on the data compression rate and the expansion rate; wherein, the first free storage space capacity is the capacity of the first free storage space, the first free storage space is the free storage space in the first media mode and used for the conversion process; and the first free storage space is marked as the second media mode.
15. The apparatus according to claim 14, characterized in that, The conversion module is further configured to mark the first free storage space as the second media mode when the capacity of the first free storage space is not greater than the capacity of the free storage space in the first media mode; When the capacity of the first free storage space is greater than the capacity of the free storage space in the first media mode, the storage space in the first media mode is reclaimed. The capacity of the first free storage space after reclamation is not greater than the capacity of the free storage space in the first media mode. The first free storage space after reclamation is then marked as the second media mode.
16. The apparatus according to claim 14, characterized in that, The conversion module is further configured to determine the theoretical storage space value of the business data as the ratio of the data volume of the business data to the expansion rate; and to determine the actual storage space value of the business data as the ratio of the data volume of the business data to the data compression rate. Determine the capacity of a first free storage space that is positively correlated with the theoretical storage space value and negatively correlated with the actual storage space value.
17. The apparatus according to claim 12, characterized in that, When the media mode conversion method is from the second media mode to the first media mode, the conversion module is further configured to determine the second free storage space capacity required for the conversion process based on the data compression rate and the expansion rate; wherein, the second free storage space capacity is the capacity of the second free storage space, the second free storage space is the free storage space in the second media mode and used for the conversion; and the second free storage space is marked as the first media mode.
18. A storage device, characterized in that, include: Memory, used to store executable instructions; A processor, when executing executable instructions stored in the memory, implements the control method of the storage device according to any one of claims 1 to 11.
19. A computer-readable storage medium, characterized in that, The device stores executable instructions for implementing the control method of the storage device according to any one of claims 1 to 11 when executed by a processor.
20. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the control method for the storage device according to any one of claims 1 to 11.