A solid state disk adaptive cache management method and device
By detecting the presence of garbage collection tasks in the solid-state drive and adjusting the size of the host data cache, the performance degradation problem when garbage collection and host data coexist is solved, and more efficient data write performance is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DAPUSTOR CORP
- Filing Date
- 2024-12-05
- Publication Date
- 2026-06-05
AI Technical Summary
In existing technologies, when garbage collection and host data coexist in a solid-state drive (SSD), an excessively large host data cache setting causes data writes to occur via swap between SRAM and DRAM, consuming internal storage bandwidth and reducing performance.
By determining whether there are garbage collection tasks in the current data path, the host data cache size is adjusted to optimize the utilization efficiency of SSD internal storage, reduce the ineffective consumption of internal storage bandwidth, and improve host data write performance.
By adaptively adjusting the cache size, the internal storage utilization efficiency of the SSD is optimized, the internal storage bandwidth consumption is reduced, and the host data write performance is improved.
Smart Images

Figure CN122152206A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data caching, and in particular to a method and apparatus for adaptive cache management of solid-state drives. Background Technology
[0002] Solid State Drive (SSD) is a non-volatile storage device made with integrated circuits. SSDs use NAND Flash as the storage medium and are mainly composed of NAND Flash, a controller chip, and DRAM. There are two important data paths in an SSD: host write and garbage collection. The host write path is where the host writes data to the SSD. Host writes typically begin by writing data to the SSD's internal storage space for caching, usually in Dynamic Random Access Memory (DRAM) or Static Random Access Memory (SRAM), before finally writing to the NAND flash. The garbage collection path is the process of reclaiming data. It requires a GC read to read valid data from a block in the NAND flash into the SSD's internal storage space as a cache, followed by a GC write to write the data to another block in the NAND flash.
[0003] Currently, existing technical solutions set fixed sizes for host data cache and garbage collection data cache. However, when both garbage collection and host data collection occur simultaneously, once the SSD reaches a steady state, the host write rate decreases, causing the host data cache size to exceed the actual required size. In these existing solutions, an excessively large host data cache leads to swapping between SRAM and DRAM during data writes, consuming internal storage bandwidth and ultimately reducing SSD performance. Summary of the Invention
[0004] This application provides a solid-state drive adaptive cache management method and apparatus. By determining whether a garbage collection task is being performed in the current data path, the size of the host data cache is adjusted. Based on the size of the host data cache, the host data corresponding to the write command is written to the host data cache. This application can optimize the utilization efficiency of the internal storage of the SSD, reduce the ineffective consumption of internal storage bandwidth, and thus improve the performance of host data writing.
[0005] The embodiments of this application provide the following technical solutions:
[0006] In a first aspect, embodiments of this application provide a solid-state drive (SSD) adaptive cache management method. The SSD is communicatively connected to a host, and the SSD includes a cache space, which includes a host data cache. The method includes:
[0007] Determine if a host write command exists in the wait queue of the host write data path;
[0008] If there is a host write command in the waiting queue of the host write data path, then determine whether there is a garbage collection task being executed in the current garbage collection data path;
[0009] If there is a garbage collection task in progress in the current garbage collection data path, the host data cache is set to the first cache size, where the first cache size is the size of the host data cache when the write performance of the solid-state drive reaches the optimal write performance.
[0010] If no garbage collection task is currently being performed in the current data path, the host data cache is set to the second cache size, where the second cache size is greater than or equal to the first cache size;
[0011] Based on the size of the host data cache, write the host data corresponding to the host write command into the host data cache.
[0012] In some embodiments, before determining whether a host write command exists in the wait queue of the host write data path, the method further includes:
[0013] Perform performance tests on the solid-state drive (SSD) to obtain its optimal write performance;
[0014] When the SSD's write performance is at its optimal level, obtain the size of the SSD's host data cache and determine the size of the host data cache as the first cache size.
[0015] In some embodiments, performance testing is performed on the solid-state drive (SSD) to obtain its optimal write performance, including:
[0016] Perform performance tests on the solid-state drive (SSD) to obtain its initial write performance and write amplification factor.
[0017] Adjust the ratio of host data cache to garbage collection cache based on the write amplification factor to obtain the adjusted write performance;
[0018] The optimal write performance of the solid-state drive (SSD) is determined based on its initial write performance and adjusted write performance.
[0019] In some embodiments, the solid-state drive (SSD) includes a garbage collection data cache. The initial write performance of the SSD includes a first number of read / write operations per second. Performance testing of the SSD to obtain its initial write performance and write amplification factor includes:
[0020] Set the initial cache size for the host data cache and the initial cache size for the garbage collection data cache, wherein the initial cache size for the host data cache and the initial cache size for the garbage collection data cache are equal;
[0021] After sequentially writing the test data to the solid-state drive (SSD) to fill its cache space, the test data is then randomly written to the SSD's flash memory, and the SSD's read / write speeds per second are obtained.
[0022] Determine whether the current range of read / write operations per second for the solid-state drive is within a preset threshold range;
[0023] If the current SSD's read / write count per second is within a preset threshold range, then the current SSD's read / write count per second and write amplification factor are obtained, and the current SSD's read / write count per second is determined as the first read / write count per second. Here, the write amplification factor is the amount of data written to the flash memory / the amount of data written by the host to the SSD.
[0024] In some embodiments, the ratio of host data cache to garbage collection cache is adjusted according to the write amplification factor to obtain adjusted write performance, including:
[0025] The ratio of the initial cache size of the host data cache to the initial cache size of the garbage collection data cache is determined as the first ratio value;
[0026] Based on the magnification factor, determine the direction of change of the first proportional value, where the direction of change includes either increasing or decreasing;
[0027] Based on the direction of change of the first proportional value, the first proportional value is adjusted to the second proportional value;
[0028] Based on the second ratio value, the solid-state drive is subjected to performance testing to obtain the adjusted write performance, which includes the second read / write count per second.
[0029] In some embodiments, adjusting the first proportional value according to the direction of change of the first proportional value to adjust the first proportional value to a second proportional value includes:
[0030] When the first proportional value changes in the direction of increasing, the first proportional value is increased by one step length to obtain the second proportional value, where the second proportional value = the first proportional value + the first step length;
[0031] When the first proportional value changes in a decreasing direction, the first proportional value is reduced by one step length to obtain the second proportional value, where the second proportional value = the first proportional value - the first step length.
[0032] In some embodiments, determining the optimal write performance of the solid-state drive (SSD) based on its initial write performance and adjusted write performance includes:
[0033] The larger of the first and second read / write counts per second is determined as the maximum read / write count per second.
[0034] Based on the length of the first step, adjust the second ratio value to obtain multiple third ratio values;
[0035] Based on the third ratio value, the solid-state drive performance was tested to obtain the third read / write count per second corresponding to multiple third ratio values;
[0036] Determine whether the maximum number of read / write operations per second is greater than the maximum number of read / write operations per second;
[0037] If the maximum value of the third read / write count per second is greater than the maximum read / write count per second, then the maximum value of the third read / write count per second will be determined as the maximum read / write count per second.
[0038] The write performance corresponding to the maximum number of reads and writes per second is determined as the optimal write performance of the solid-state drive.
[0039] In some embodiments, when the write performance of the solid-state drive (SSD) is at its optimal write performance, the size of the host data cache of the SSD is obtained, and the size of the host data cache is determined as the first cache size, including:
[0040] When the SSD's write performance is at its optimal level, obtain the ratio between the host data cache size and the garbage collection data cache size;
[0041] Based on the ratio and the size of the cache space, the size of the host data cache of the solid-state drive is determined, and the size of the host data cache is determined as the first cache size.
[0042] In some embodiments, the host data corresponding to the host write command is written to the host data cache according to the size of the host data cache, including:
[0043] Determine if the remaining space in the host data cache is greater than the data size corresponding to the write command;
[0044] If the remaining space in the host data cache is greater than the size of the host data corresponding to the write command, then the host data corresponding to the write command will be written to the cache space.
[0045] In some embodiments, the method further includes:
[0046] If the remaining space in the host data cache is less than or equal to the size of the host data corresponding to the write command, then the write command is added to the waiting queue.
[0047] When it is detected that the remaining space in the host data cache is greater than the size of the host data corresponding to the write command, the write command is retrieved from the waiting queue and executed.
[0048] Secondly, embodiments of this application provide a solid-state drive, comprising:
[0049] At least one processor; and
[0050] A memory that is communicatively connected to at least one processor; wherein,
[0051] The memory stores instructions that can be executed by at least one processor, which enables the at least one processor to perform a solid-state drive adaptive cache management method as described in the first aspect.
[0052] Thirdly, embodiments of this application provide a non-volatile computer-readable storage medium storing a computer program or instructions, which, when executed, implements the solid-state drive adaptive cache management method as described in any of the first aspects.
[0053] The beneficial effects of the embodiments of this application are as follows: Unlike the prior art, the embodiments of this application provide a solid-state drive (SSD) adaptive cache management method. The SSD is communicatively connected to a host, and the SSD includes a cache space, which includes a host data cache. The method includes: determining whether a host write command exists in the waiting queue of the host write data path; if a host write command exists in the waiting queue of the host write data path, determining whether a garbage collection task is currently being executed in the current garbage collection data path; if a garbage collection task is currently being executed in the current garbage collection data path, setting the host data cache to a first cache size, wherein the first cache size is the write performance of the SSD. The system determines the size of the host data cache to achieve optimal write performance. If no garbage collection task is currently being executed in the data path, the host data cache is set to a second cache size, where the second cache size is greater than or equal to the first cache size. Based on the size of the host data cache, the host data corresponding to the host write command is written to the host data cache. This application can adjust the size of the host data cache by determining whether a garbage collection task is currently being executed in the data path, and write the host data corresponding to the write command to the host data cache based on the size of the host data cache, thereby optimizing the utilization efficiency of the SSD's internal storage, reducing the ineffective consumption of internal storage bandwidth, and thus improving the performance of host data write. Attached Figure Description
[0054] One or more embodiments are illustrated by way of example with reference to the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements having the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0055] Figure 1 This is a schematic diagram of data interaction between a host and a solid-state drive provided in an embodiment of this application;
[0056] Figure 2 This is a schematic diagram of the exchange between static random access memory and dynamic random access memory in the absence of garbage collection tasks, provided by an embodiment of this application;
[0057] Figure 3 This is a flowchart illustrating an adaptive cache management method for solid-state drives provided in an embodiment of this application;
[0058] Figure 4 This is a schematic diagram of a process for determining the size of a first cache provided in an embodiment of this application;
[0059] Figure 5 yes Figure 4 A detailed flowchart of step S401 in the process;
[0060] Figure 6 yes Figure 5 A detailed flowchart of step S411 in the process;
[0061] Figure 7 yes Figure 6 A detailed flowchart of step S412 in the process;
[0062] Figure 8 yes Figure 7 A detailed flowchart of step S4123 in the process;
[0063] Figure 9 yes Figure 4 A detailed flowchart of step S413 in the process;
[0064] Figure 10 yes Figure 4 A detailed flowchart of step S402 in the process;
[0065] Figure 11 yes Figure 3 A detailed flowchart of step S307 in the process;
[0066] Figure 12 This is a schematic diagram of the structure of a solid-state drive provided in an embodiment of this application.
[0067] Explanation of icon numbers:
[0068] label name label name 10 host 20 Solid State Drive 121 processor 122 memory Detailed Implementation
[0069] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0070] Furthermore, the technical features involved in the various embodiments of this application described below can be combined with each other as long as they do not conflict with each other.
[0071] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. The term "and / or" as used in this specification includes any and all combinations of one or more of the associated listed items.
[0072] The technical solution of this application is described in detail below with reference to the accompanying drawings:
[0073] Please see Figure 1 , Figure 1 This is a schematic diagram of data interaction between a host and a solid-state drive provided in an embodiment of this application;
[0074] like Figure 1 As shown, host 10 is communicatively connected to solid-state drive 20. Solid-state drive 20 includes a cache manager (System Buffer Manager, SBM), static random access memory (SRAM), dynamic random access memory (DRAM), and flash memory. Host 10 is used to write host data to solid-state drive via host write command. Solid-state drive 20 is used to receive host write command sent by host and execute host write command to write host data corresponding to host write command to flash memory.
[0075] In this embodiment, a solid-state drive (SSD) is a non-volatile storage device made of integrated circuits. SSDs use Nand Flash memory as the storage medium. Nand Flash is erased in blocks and read / write in pages. A characteristic of Nand Flash is that it cannot be overwritten; that is, before data is written to a block, it must be erased first. If data has already been written to a physical location, that physical location cannot be directly written to again; it must be erased first. The host writes data to the SSD using logical block addresses (LBAs). Suppose the host writes LBA x and LBA y to block A. After block A is full, the host wants to change the data in LBA x and writes new LBA x data to block B. The data in LBA y remains unchanged. Therefore, the LBA x data previously written to block A becomes invalid, while the LBA y data on block A remains valid because it has not been modified. Before a block is erased, if valid data already exists on the block, it needs to be written to other blocks first. This process is called garbage collection. When the number of writable blocks remaining on the SSD is relatively small, starting a garbage collection task (GC) can release new writable blocks, maintaining good performance of the SSD throughout its lifespan.
[0076] The data pathways of a solid-state drive (SSD) include a host write data pathway and a garbage collection (GC) data pathway. The host write data pathway is where the host writes data to the SSD. Typically, host writes data first to the internal storage space of the SSD for caching; this storage space refers to Dynamic Random Access Memory (DRAM) or Static Random Access Memory (SRAM), and then to the NAND flash. The GC data pathway is used for garbage collection. It requires a GC read to read valid data from a block in the NAND flash into the internal storage space of the SSD as a cache, and then a GC write to write the data to another block in the NAND flash. In this embodiment, a System Buffer Manager (SBM) is set up inside the SSD to manage the internal storage. SBM internally manages a high-speed SRAM space, but the space is limited. When the data written to SBM exceeds the SRAM capacity, SBM will swap some of the old data from the high-speed SRAM to DRAM, so that the new data can be stored in SRAM. DRAM read and write speeds are slower than SRAM. When data swapped to DRAM needs to be written to NAND flash, SBM will first read the data from DRAM into SBM, and then write it to NAND flash.
[0077] Random write performance in steady state is a crucial SSD performance metric. After prolonged read and write cycles, data distribution within the SSD becomes more random, and the trigger frequency of operations like garbage collection and block erasure stabilizes, leading to a stable random write performance. This state is known as steady state. In steady state, both host write and GC (Garbage Collection) data paths exist simultaneously. The SBM (Side Block Machine) contains both host and GC data, making it easy for data to be written to SRAM first, then swapped to slower DRAM before being written to NAND, and then back to SRAM. Frequent swapping consumes significant internal bus bandwidth, reducing overall system data transfer performance. Another SSD metric is write amplification (WA), which is the ratio of data written to NAND flash to data written to the SSD by the host. Because of internal data read / write operations like GC, the amount of data written to NAND flash is greater than the amount written to the SSD by the host. When the SSD is in a steady state, the WA (Write-Ahead) value generally also tends to a stable value. This can be understood as the ratio of the amount of data written to the NAND flash by the GC to the amount of data written to the SSD by the host also tending to a stable value.
[0078] Typically, due to the limited internal storage size of an SSD, there are limitations on the amount of host write data cached, let's say `host_data_size`, and similarly, there are limitations on the amount of GC data cached, let's say `GC_data_size`. These two values are usually fixed. In scenarios without GC, when host data is written, this host data exclusively occupies the NAND flash write bandwidth. Assuming `host_data_size` can meet the system's performance requirements and fully utilize the NAND flash write bandwidth, then the entire SRAM and a portion of DRAM are filled with host data, and there is no GC data in the internal storage. The NAND flash write bandwidth is the maximum data transfer rate that the NAND flash can provide.
[0079] In scenarios where GC and host data coexist, the read / write operations of GC data also consume NAND flash data transfer bandwidth, leading to a decrease in the write rate of host data. In this situation, both GC and host data exist in SRAM and DRAM. Because host data inevitably degrades performance, the host_data_size actually exceeds the available bandwidth of the backend. This means that the large amount of data transmitted by host writes exceeds the backend's processing capacity, resulting in significant caching in internal storage. This causes frequent swapping between SRAM and DRAM due to the inability to promptly write data to NAND flash. Swap itself also consumes internal storage bandwidth, thus reducing overall system performance.
[0080] Please refer to the following: Figure 2 , Figure 2 This is a schematic diagram of the exchange between static random access memory and dynamic random access memory in the absence of garbage collection tasks, provided by an embodiment of this application;
[0081] like Figure 2 As shown, if only host write tasks exist and no garbage collection tasks are present, a buffer will be set up in the host write data path of the current SSD to cache host write data in order to meet the performance requirements when there is no GC. Assuming that the SBM's SRAM can store 12 units of data, the distribution of data in SRAM and DRAM can be divided into the following four stages: Stage 1: The data buffer is not yet full, only 6 units of data are stored, and the host data H1-H6 are all in SRAM at this time; Stage 2: The host data H1-H12 are just full of SRAM; Stage 3: The data in SRAM is swapped to DRAM. When the data of the 13th unit is put into SRAM, the host data H1 that was put into SRAM first will be swapped to DRAM, and then the host data H2 will also be swapped to DRAM; Stage 4: When the performance requirements are met, the host data will be almost stably maintained in a total of 14 units of cache, that is, when there is no garbage collection task being executed, 14 units of host data cache can meet the performance requirements.
[0082] After the fourth stage, assuming the garbage collection task is initiated, once the SSD enters a steady state, the host write data path and the garbage collection data path coexist. G1-G10 represent garbage collection data. At this time, the host write rate will decrease, causing the size of the host data cache to actually exceed the required size. For example, the host cache size set in SRAM is 12 units, but after the garbage collection task is initiated, the actual size of the host data cache occupied by the host data is 4 units. Since an excessively large data buffer will cause the write data to swap between SRAM and DRAM, thereby consuming the internal storage bandwidth and reducing performance, this application proposes an adaptive cache management method for solid-state drives. By determining whether a garbage collection task is currently being executed in the data path, the size of the host data cache is adjusted. Based on the size of the host data cache, the host data corresponding to the write command is written to the host data cache, optimizing the utilization efficiency of the SSD's internal storage, reducing the ineffective consumption of internal storage bandwidth, and thus improving the performance of host data write.
[0083] Please see Figure 3 , Figure 3 This is a flowchart illustrating an adaptive cache management method for solid-state drives provided in an embodiment of this application;
[0084] The adaptive cache management method for solid-state drives (SSDs) is applied to SSDs connected to the host.
[0085] like Figure 3 As shown, the adaptive cache management method for solid-state drives includes:
[0086] Step S301: Obtain the waiting queue of the host write data path;
[0087] Specifically, the host write data path is used to receive host write commands sent by the host. The host write data path includes a waiting queue. After the host write data path receives the host write command sent by the host, it will temporarily store the host write command in the waiting queue. Therefore, before processing the host write command, the waiting queue of the host write data path is obtained first, so as to determine whether there is a host write command in the waiting queue of the host write data path.
[0088] Step S302: Determine whether there is a host write command in the waiting queue of the host write data path;
[0089] Specifically, determine whether there is a host write command in the waiting queue of the host write data path. If there is a host write command in the waiting queue of the host write data path, proceed to step S304; if there is no host write command in the waiting queue of the host write data path, proceed to step S303.
[0090] Step S303: Wait for the host write command to enter the waiting queue of the data path;
[0091] Specifically, if there is no host write command in the waiting queue of the host write data path, it means that there is no host write command waiting to be executed at this time, and the host write command waiting to be executed enters the waiting queue of the data path.
[0092] Step S304: Determine whether there is a garbage collection task currently being executed in the current garbage collection data path;
[0093] Specifically, determine whether there is a garbage collection task being executed in the current garbage collection data path. If there is a garbage collection task being executed in the current garbage collection data path, proceed to step S305; if there is no garbage collection task being executed in the current garbage collection data path, proceed to step S306.
[0094] Step S305: Set the host data cache to the first cache size;
[0095] Specifically, if a garbage collection task is currently being executed in the garbage collection data path, the host data cache is set to the first cache size. The first cache size is the size of the host data cache when the solid-state drive's write performance reaches its optimal write performance. In this embodiment, the write performance of the solid-state drive is measured by the number of read / write operations per second. When the number of read / write operations per second reaches its maximum value, it indicates that the solid-state drive's write performance has reached its optimal write performance. The solid-state drive's cache space includes the host data cache and the garbage collection data cache. This application determines the optimal write performance of the solid-state drive by continuously changing the ratio of the host data cache to the garbage collection data cache during the performance testing process. When the solid-state drive's write performance reaches its optimal write performance, the ratio of the current host data cache to the garbage collection data cache is obtained. For example, assuming the total cache space size is 60KB, when the ratio of the current host data cache to the garbage collection data cache is 1 / 2, the solid-state drive reaches its optimal write performance. This ratio is then obtained. Based on this ratio and the total cache space size, the current host data cache size is obtained, and the size of the current host data cache is determined as the first cache size, which is 20KB.
[0096] Step S306: Set the host data cache to the second cache size;
[0097] Specifically, if there is no garbage collection task currently being executed in the garbage collection data path, the host data cache is set to the second cache size, where the second cache size is greater than or equal to the first cache size. For example, if the first cache size is 10KB, the second cache size can be set according to actual needs, such as 10KB or 20KB.
[0098] Please refer to the following: Figure 4 , Figure 4 This is a schematic diagram of a process for determining the size of a first cache provided in an embodiment of this application;
[0099] like Figure 4 As shown, the process for determining the first cache size includes:
[0100] Step S401: Perform performance testing on the solid-state drive to obtain its optimal write performance;
[0101] For details, please refer to [link / reference]. Figure 5 , Figure 5 yes Figure 4 A detailed flowchart of step S401 in the process;
[0102] Step S411: Perform performance testing on the solid-state drive to obtain its initial write performance and write amplification factor;
[0103] For details, please refer to [link / reference]. Figure 6 , Figure 6 yes Figure 5 A detailed flowchart of step S411 in the process;
[0104] like Figure 6 As shown, step S411: Perform performance testing on the solid-state drive (SSD) to obtain its initial write performance and write amplification factor, including:
[0105] Step S4111: Set the initial cache size of the host data cache and the initial cache size of the garbage collection data cache;
[0106] Specifically, before determining whether a host write command exists in the wait queue of the host write data path, the size of the SSD cache space is obtained. The cache space includes the host data cache and the garbage collection data cache. Then, the initial cache size of the host data cache and the initial cache size of the garbage collection data cache are set. The initial cache size of the host data cache and the initial cache size of the garbage collection data cache are equal. For example, assuming the total size of the cache space is 60KB, the initial cache size of the host data cache and the initial cache size of the garbage collection data cache are each set to 30KB. Then, the ratio of the initial cache size of the host data cache to the initial cache size of the garbage collection data cache is 1.
[0107] Step S4112: After writing the test data sequentially to the solid-state drive to fill the cache space of the solid-state drive, the test data is randomly written to the flash space of the solid-state drive, and the number of read and write operations per second of the solid-state drive is obtained.
[0108] Specifically, in the process of performance testing of SSDs, a large amount of test data needs to be sequentially written to the SSD's cache space using testing tools to fill the DRAM cache, so as to observe the performance changes after cache overflow. These testing tools include, but are not limited to, fio and Iometer. During the sequential writing process, the write speed and response time can be monitored to determine whether the cache is full. When the write speed drops significantly and the response time increases, it indicates that the cache is full. Then, after the SSD's cache space is full, test data is randomly written to the SSD's flash memory space, and the SSD's read and write operations per second are obtained. At this time, since the cache is full, the write operation will directly touch the SSD's flash memory layer, so the performance of the flash memory layer can be observed.
[0109] Step S4113: Determine whether the change range of the current solid-state drive's read / write counts per second is within a preset threshold range;
[0110] Specifically, test data is continuously and randomly written to the flash memory of the solid-state drive (SSD). During the random writing process, the SSD's performance may gradually stabilize at a lower level, which is called steady state. Steady-state performance is an important indicator for evaluating the long-term stability of the SSD. That is, during the random writing process, it is determined whether the change range of the current SSD's read / write count per second is within a preset threshold. If the change range of the current SSD's read / write count per second is within the preset threshold, it means that the current SSD has entered a steady state, and the process proceeds to step S4114. The preset threshold can be set according to the actual situation. For example, the preset threshold can be set to 5 times. This application does not limit this. For example, when the preset threshold is 5 times, if the change value of the current read / write count per second is no more than 5 times compared with the read / write count per second of the previous second, it is considered that the current SSD has entered a steady state. If the change range of the current SSD's read / write count per second is not within the preset threshold, it means that the current SSD has not yet entered a steady state, and the process waits for it to enter a steady state while continuing random writing until the SSD enters a steady state. This may require a waiting period of time, which depends on the SSD model and test conditions.
[0111] Step S4114: Obtain the current read / write count per second and write amplification factor of the solid-state drive, and determine the current read / write count per second of the solid-state drive as the first read / write count per second;
[0112] Specifically, if the current SSD's read / write count per second is within a preset threshold range, then the current SSD's read / write count per second and write amplification factor are obtained, and the current SSD's read / write count per second is determined as the first read / write count per second. The write amplification factor is the amount of data written to flash memory divided by the amount of data written to the SSD by the host. For example, the read / write count per second can be obtained by using the statistical or logging functions provided by the testing tool. By obtaining the amount of data written to flash memory and the amount of data written to the SSD by the host, the write amplification factor can be calculated by dividing the amount of data written to flash memory by the amount of data written to the SSD by the amount of data written to the SSD.
[0113] Step S412: Adjust the ratio of host data cache to garbage collection cache according to the write amplification factor to obtain the adjusted write performance;
[0114] For details, please refer to [link / reference]. Figure 7 , Figure 7 yes Figure 6 A detailed flowchart of step S412 in the process;
[0115] Step S4121: Determine the ratio of the initial cache size of the host data cache to the initial cache size of the garbage collection data cache as the first ratio value;
[0116] Specifically, the ratio of the initial cache size of the host data cache to the initial cache size of the garbage collection data cache is determined as the first ratio value. Since the initial cache size of the host data cache is equal to the initial cache size of the garbage collection data cache, the first ratio value is 1.
[0117] Step S4122: Determine the direction of change of the first scale value based on the magnification factor;
[0118] Specifically, the write amplification factor is the amount of data written to the flash memory divided by the amount of data written by the host to the solid-state drive. The direction of change of the first ratio value can be either increasing or decreasing. Determining the direction of change of the first ratio value based on the write amplification factor includes: First, setting a write amplification threshold, which can be set according to actual needs. Preferably, the write amplification threshold is set to 2. When the write amplification factor is greater than the write amplification threshold, it indicates that the amount of data written by garbage collection in steady state is greater than the amount of data written by the host, so the direction of change of the first ratio value is determined to be decreasing. When the write amplification factor is less than the write amplification threshold, it indicates that the amount of data written by garbage collection in steady state is less than the amount of data written by the host, so the direction of change of the first ratio value is determined to be increasing.
[0119] Step S4123: Adjust the first proportional value according to the direction of change of the first proportional value, so as to adjust the first proportional value to the second proportional value;
[0120] For details, please refer to [link / reference]. Figure 8 , Figure 8 yes Figure 7 A detailed flowchart of step S4123 in the process;
[0121] Step S4231: Obtain the direction of change of the first proportional value;
[0122] Specifically, when the write amplification factor is greater than the write amplification threshold, it indicates that the amount of data written by garbage collection in steady state is greater than the amount of data written to the host, so the direction of change of the first ratio value is determined to be decreasing; when the write amplification factor is less than the write amplification threshold, it indicates that the amount of data written by garbage collection in steady state is less than the amount of data written to the host, so the direction of change of the first ratio value is determined to be increasing.
[0123] Step S4232: Determine whether the direction of change of the first proportional value is increasing;
[0124] Specifically, determine whether the direction of change of the first proportional value is increasing. If the direction of change of the first proportional value is increasing, proceed to step S4233; if the direction of change of the first proportional value is decreasing, proceed to step S4234.
[0125] Step S4233: Increase the first proportional value by the length of the first step to obtain the second proportional value;
[0126] Specifically, a first step length is set, which is used to adjust the first ratio value. Each adjustment is by one first step length. If the first ratio value changes in the direction of increasing, then the first ratio value is increased by one first step length to obtain the second ratio value. For example, assuming the first step length is 0.1 and the first ratio value is 1 / 2, then the second ratio value = the first ratio value + the first step length = 3 / 5.
[0127] Step S4234: Reduce the first proportional value by one step length to obtain the second proportional value;
[0128] Specifically, if the first proportional value changes in the direction of decreasing, then the first proportional value is reduced by one step length to obtain the second proportional value. For example, assuming the first step length is 0.1 and the first proportional value is 1 / 2, then the second proportional value = the first proportional value - the first step length = 2 / 5.
[0129] Step S4124: Perform performance testing on the solid-state drive to obtain the adjusted write performance;
[0130] Specifically, the adjusted write performance includes the second read / write count per second. During SSD performance testing, a large amount of test data is first sequentially written to the SSD's cache space using testing tools to fill the DRAM cache, thus allowing observation of performance changes after cache overflow. These testing tools include, but are not limited to, fio and Iometer. During the sequential write process, the write speed and response time are monitored to determine if the cache is full. A significant decrease in write speed and an increase in response time indicates that the cache is full. Then, after the SSD's cache space is full, test data is continuously and randomly written to the SSD's flash memory. During this random write process, the current SSD performance is assessed. If the range of changes in the disk's read / write counts per second is within a preset threshold, then the current SSD has entered a steady state. The current SSD's read / write counts per second and write amplification factor are then obtained, and this current read / write count is defined as the second read / write count. The write amplification factor is calculated as the amount of data written to flash memory divided by the amount of data written to the SSD by the host. For example, the read / write counts can be obtained using the statistical or logging functions provided by the testing tool. By obtaining the amount of data written to flash memory and the amount of data written to the SSD by the host, the write amplification factor can be calculated.
[0131] Step S413: Determine the optimal write performance of the solid-state drive based on its initial write performance and adjusted write performance.
[0132] For details, please refer to [link / reference]. Figure 9 , Figure 9 yes Figure 4 A detailed flowchart of step S413 in the process;
[0133] like Figure 9 As shown, step S413: Based on the initial write performance and adjusted write performance of the solid-state drive, determine the optimal write performance of the solid-state drive, including:
[0134] Step S4131: Determine the larger of the first read / write count per second and the second read / write count per second as the maximum read / write count per second;
[0135] Specifically, by comparing the first read / write count per second and the second read / write count per second, the larger of the two counts is determined and set as the maximum read / write count per second. For example, if the first read / write count per second is greater than the second read / write count per second, then the first read / write count per second is set as the maximum read / write count per second; if the first read / write count per second is less than the second read / write count per second, then the second read / write count per second is set as the maximum read / write count per second.
[0136] Step S4132: Based on the length of the first step, adjust the second ratio value to obtain multiple third ratio values;
[0137] Specifically, it is determined whether the write amplification factor is greater than the write amplification threshold. If the write amplification factor is greater than the write amplification threshold, it indicates that the amount of data written by garbage collection in steady state is greater than the amount of data written to the host, and the direction of change of the second ratio value is determined to be decreasing. If the write amplification factor is less than the write amplification threshold, it indicates that the amount of data written by garbage collection in steady state is less than the amount of data written to the host, and the direction of change of the second ratio value is determined to be increasing. Based on the direction of change of the second ratio value, a third ratio value is determined. If the direction of change of the second ratio value is increasing, the second ratio value is increased by a first step length to obtain the third ratio value. For example, assuming the first step length is 0.1 and the second ratio value is 1 / 2, then the third ratio value = second ratio value + first step length = 3 / 5. If the direction of change of the second ratio value is decreasing, the second ratio value is decreased by a first step length to obtain the third ratio value. For example, assuming the first step length is 0.1 and the second ratio value is 1 / 2, then the third ratio value = second ratio value - first step length = 2 / 5. It should be noted that the first step length can be set according to actual needs, and this application does not limit it. Preferably, the first step length is set to 0.1.
[0138] Step S4133: Perform a performance test on the solid-state drive based on the third ratio value to obtain the third read / write count per second corresponding to multiple third ratio values;
[0139] Specifically, during the performance testing of the solid-state drive (SSD), a large amount of test data is first sequentially written to the SSD's cache space using testing tools to fill the DRAM cache. Then, after the SSD's cache space is filled, test data is continuously and randomly written to the SSD's flash memory. During the random writing process, it is determined whether the current range of the SSD's read / write operations per second (L / S) is within a preset threshold. If the current range of the SSD's L / S is within the preset threshold, it indicates that the SSD has entered a steady state. The current SSD's L / S and write amplification factor are then obtained, and the current L / S is determined as the third L / S. Based on multiple different third ratio values, the performance test is performed on the SSD in a loop according to the above performance testing steps to obtain the third L / S corresponding to multiple third ratio values.
[0140] Step S4134: Determine whether the maximum value of the third read / write count per second is greater than the maximum read / write count per second;
[0141] Specifically, determine whether the maximum value of the third read / write count per second is greater than the maximum read / write count per second. If the maximum value of the third read / write count per second is greater than the maximum read / write count per second, proceed to step S4135; if the maximum value of the third read / write count per second is less than or equal to the maximum read / write count per second, proceed to step S4136.
[0142] Step S4135: Determine the maximum value of the third read / write count per second as the maximum read / write count per second;
[0143] Specifically, if the maximum value of the third read / write count per second is greater than the maximum read / write count per second, then the maximum value of the third read / write count per second is determined as the maximum read / write count per second, and then proceed to step S4136, whereby the write performance corresponding to the maximum read / write count per second is determined as the optimal write performance of the solid-state drive.
[0144] Step S4136: Determine the write performance corresponding to the maximum number of reads and writes per second as the optimal write performance of the solid-state drive;
[0145] Specifically, optimal write performance includes the maximum number of reads per second. If the maximum value of the third reads per second is less than or equal to the maximum reads per second, then the write performance corresponding to the maximum reads per second is determined as the optimal write performance of the solid-state drive.
[0146] Step S402: When the write performance of the solid-state drive is at its optimal write performance, obtain the size of the host data cache of the solid-state drive and determine the size of the host data cache as the first cache size;
[0147] For details, please refer to [link / reference]. Figure 10 , Figure 10 yes Figure 4 A detailed flowchart of step S402 in the process;
[0148] like Figure 10 As shown, step S402: When the solid-state drive's write performance is at its optimal level, obtain the size of the solid-state drive's host data cache and determine the size of the host data cache as the first cache size, including:
[0149] Step S421: When the solid-state drive's write performance is at its optimal write performance, obtain the ratio of the host data cache size to the garbage collection data cache size;
[0150] Specifically, when the SSD's write performance is at its optimal level, that is, when the SSD's read / write operations per second are at their maximum, the ratio of the host data cache size to the garbage collection data cache size is obtained.
[0151] Step S422: Determine the size of the host data cache of the solid-state drive based on the ratio value and the size of the cache space, and set the size of the host data cache as the first cache size;
[0152] Specifically, the size of the host data cache on the SSD is calculated based on the ratio of the host data cache size to the garbage collection data cache size and the size of the SSD cache space. This host data cache size is then determined as the first cache size. For example, if the SSD cache space size is 60KB and the ratio of the host data cache size to the garbage collection data cache size is 1 / 3, then the host data cache size is calculated to be 15KB, and thus the first cache size is 15KB.
[0153] Step S307: Based on the size of the host data cache, write the host data corresponding to the host write command into the host data cache;
[0154] For details, please refer to [link / reference]. Figure 11 , Figure 11 yes Figure 3 A detailed flowchart of step S307 in the process;
[0155] like Figure 11 As shown, step S307: Based on the size of the host data cache, write the host data corresponding to the host write command into the host data cache, including:
[0156] Step S371: Obtain the remaining space of the host data cache;
[0157] Specifically, the remaining space of the host data cache can be obtained by querying the size of the host data cache.
[0158] Step S372: Determine whether the remaining space in the host data cache is greater than the data size corresponding to the host write command;
[0159] Specifically, it is determined whether the remaining space of the host data cache is greater than the data size corresponding to the host write command. If the remaining space of the host data cache is greater than the data size corresponding to the host write command, then proceed to step S373; if the remaining space of the host data cache is less than or equal to the data size corresponding to the host write command, then proceed to step S374.
[0160] Step S373: Write the host data corresponding to the host write command into the cache space;
[0161] Specifically, if the remaining space in the host data cache is greater than the data size corresponding to the host write command, it means that the remaining space is sufficient to write the host data corresponding to the host write command into the host data cache, and the host data corresponding to the host write command is written into the cache space.
[0162] Step S374: Add the host write command to the waiting queue;
[0163] Specifically, if the remaining space in the host data cache is less than or equal to the data size corresponding to the host write command, it means that the current remaining space is insufficient to write the host data corresponding to the host write command to the host data cache, and the host write command is added to the waiting queue.
[0164] Step S375: When it is detected that the remaining space of the host data cache is greater than the size of the host data corresponding to the host write command, the host write command is retrieved from the waiting queue and executed.
[0165] Specifically, after adding the host write command to the waiting queue, the remaining space of the host data cache is checked at fixed intervals to see if it is greater than the data size corresponding to the host write command. When it is detected that the remaining space of the host data cache is greater than the host data size corresponding to the host write command, the host write command is retrieved from the waiting queue and executed. It should be noted that the fixed time can be set according to actual needs, and this application does not limit it. For example, the fixed time can be set to 2 seconds.
[0166] In this embodiment of the application, a method for testing the optimal write performance of solid-state drives (SSDs) of different capacities is also provided. The method is as follows: assuming the cache size of the first cache space of the current SSD is M, after obtaining the optimal write performance of the current SSD, a second step size S is set. It should be noted that this second step size can be set according to actual needs. For example, the second step size can be set to 1 / 100 of M, and the second cache space of the SSD can be set to MS. When the cache space of the SSD is MS, a performance test is performed on the SSD to obtain the optimal write performance when the cache space is MS. Then, the second cache space of the SSD is set to M-2*S, and a performance test is performed on the SSD when the cache space is M-2*S to obtain the optimal write performance when the cache space is M-2*S. This process is repeated to obtain the optimal write performance of SSDs of different capacities.
[0167] In this embodiment, a solid-state drive (SSD) adaptive cache management method is provided. The SSD is communicatively connected to a host and includes a cache space, which includes a host data cache. The method includes: determining whether a host write command exists in the waiting queue of the host write data path; if a host write command exists in the waiting queue of the host write data path, determining whether a garbage collection task is currently being executed in the current garbage collection data path; if a garbage collection task is currently being executed in the current garbage collection data path, setting the host data cache to a first cache size, wherein the first cache size is the size of the host data cache when the SSD's write performance reaches its optimal write performance; if no garbage collection task is currently being executed in the current data path, setting the host data cache to a second cache size, wherein the second cache size is greater than or equal to the first cache size; and writing the host data corresponding to the host write command into the host data cache according to the size of the host data cache. This application can adjust the size of the host data cache by determining whether a garbage collection task is currently being executed in the current data path, and write the host data corresponding to the write command into the host data cache according to the size of the host data cache, thereby optimizing the utilization efficiency of the SSD's internal storage, reducing the ineffective consumption of internal storage bandwidth, and thus improving the performance of host data writing.
[0168] Please refer to the following: Figure 12 , Figure 12 This is a schematic diagram of the structure of a solid-state drive provided in an embodiment of this application;
[0169] like Figure 12 As shown, the solid-state drive 20 includes one or more processors 121 and memory 122. Wherein, Figure 12 Take a processor 121 as an example.
[0170] Processor 121 and memory 122 can be connected via a bus or other means. Figure 12 Taking the example of a connection between China and Israel via a bus.
[0171] The processor 121 provides computing and control capabilities to control the solid-state drive 20 to perform corresponding tasks, such as controlling the solid-state drive 20 to perform the solid-state drive adaptive cache management method in any of the above method embodiments. This method includes: determining whether a host write command exists in the waiting queue of the host write data path; if a host write command exists in the waiting queue of the host write data path, determining whether a garbage collection task is currently being executed in the current garbage collection data path; if a garbage collection task is currently being executed in the current garbage collection data path, setting the host data cache to a first cache size, wherein the first cache size is the size of the host data cache when the solid-state drive's write performance reaches optimal write performance; if no garbage collection task is currently being executed in the current data path, setting the host data cache to a second cache size, wherein the second cache size is greater than or equal to the first cache size; and writing the host data corresponding to the host write command into the host data cache according to the size of the host data cache.
[0172] By determining whether a garbage collection task is currently being performed in the current data path, adjusting the size of the host data cache, and writing the host data corresponding to the write command to the host data cache according to the size of the host data cache, this application can optimize the utilization efficiency of the SSD's internal storage, reduce the ineffective consumption of internal storage bandwidth, and thus improve the performance of host data writing.
[0173] Processor 121 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), a hardware chip, or any combination thereof; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The aforementioned PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0174] Memory 122, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the solid-state drive adaptive cache management method in the embodiments of this application. Processor 121 can implement the solid-state drive adaptive cache management method in any of the above method embodiments by running the non-transitory software programs, instructions, and modules stored in memory 122. Specifically, memory 122 may include volatile memory (VM), such as random access memory (RAM); memory 122 may also include non-volatile memory (NVM), such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid-state drive (SSD) or other non-transitory solid-state storage devices; memory 122 may also include combinations of the above types of memory.
[0175] Memory 122 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 122 may optionally include memory remotely located relative to processor 121, and such remote memory may be connected to processor 121 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0176] One or more modules are stored in memory 122. When executed by one or more processors 121, they perform the solid-state drive adaptive cache management method in any of the above method embodiments, for example, the method described above. Figure 3 The steps shown.
[0177] In this embodiment, the solid-state drive 20 may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The solid-state drive 20 may also include other components for implementing device functions, which will not be described in detail here.
[0178] This application also provides a non-volatile computer-readable storage medium, such as a memory including program code, which can be executed by a processor to complete the solid-state drive adaptive cache management method in the above embodiments. For example, the non-volatile computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CDROM), magnetic tape, floppy disk, and optical data storage device, etc.
[0179] This application also provides a non-volatile computer-readable storage medium, such as a memory including program code, which can be executed by a processor to complete the solid-state drive adaptive cache management method in the above embodiments. For example, the non-volatile computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CDROM), magnetic tape, floppy disk, and optical data storage device, etc.
[0180] This application also provides a computer program product comprising one or more lines of program code stored in a non-volatile computer-readable storage medium. A processor of a flash memory device reads the program code from the non-volatile computer-readable storage medium and executes the program code to complete the method steps of the solid-state drive adaptive cache management method provided in the above embodiments.
[0181] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware, or by a program or program code related to hardware. The program can be stored in a non-volatile computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0182] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software and a general-purpose hardware platform, or of course, using hardware. Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium. When executed, the program can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0183] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and not to limit them; under the concept of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations as described above in different aspects of this application, which are not provided in detail for the sake of brevity; although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A solid-state drive adaptive cache management method, characterized in that, The solid-state drive (SSD) is communicatively connected to the host, the SSD includes a cache space, the cache space includes a host data cache, and the method includes: Determine if a host write command exists in the wait queue of the host write data path; If there is a host write command in the waiting queue of the host write data path, then determine whether there is a garbage collection task being executed in the current garbage collection data path; If there is a garbage collection task in progress in the current garbage collection data path, the host data cache is set to the first cache size, wherein the first cache size is the size of the host data cache when the write performance of the solid-state drive reaches the optimal write performance; If there is no garbage collection task currently being executed in the current data path, the host data cache is set to the second cache size, wherein the second cache size is greater than or equal to the first cache size; Based on the size of the host data cache, the host data corresponding to the host write command is written into the host data cache.
2. The method according to claim 1, characterized in that, Before determining whether a host write command exists in the waiting queue of the host write data path, the method further includes: The solid-state drive (SSD) was subjected to performance testing to obtain its optimal write performance. When the write performance of the solid-state drive is at its optimal write performance, the size of the host data cache of the solid-state drive is obtained, and the size of the host data cache is determined as the first cache size.
3. The method according to claim 2, characterized in that, The step of performing performance testing on the solid-state drive to obtain its optimal write performance includes: The solid-state drive (SSD) was subjected to performance testing to obtain its initial write performance and write amplification factor. Based on the write amplification factor, adjust the ratio of the host data cache to the garbage collection cache to obtain the adjusted write performance; The optimal write performance of the solid-state drive is determined based on its initial write performance and adjusted write performance.
4. The method according to claim 3, characterized in that, The solid-state drive (SSD) includes a garbage collection data cache. The initial write performance of the SSD includes a first read / write operation per second. The performance test of the SSD to obtain its initial write performance and write amplification factor includes: Set the initial cache size of the host data cache and the initial cache size of the garbage collection data cache, wherein the initial cache size of the host data cache and the initial cache size of the garbage collection data cache are equal; After sequentially writing the test data to the solid-state drive (SSD) to fill its cache space, the test data is randomly written to the flash memory of the SSD, and the read / write count per second of the SSD is obtained. Determine whether the current range of read / write operations per second of the solid-state drive is within a preset threshold range; If the current read / write count per second of the solid-state drive is within a preset threshold range, then the current read / write count per second and write amplification factor of the solid-state drive are obtained, and the current read / write count per second of the solid-state drive is determined as the first read / write count per second, wherein the write amplification factor is the amount of data written to the flash memory / the amount of data written by the host to the solid-state drive.
5. The method according to claim 4, characterized in that, The step of adjusting the ratio of the host data cache to the garbage collection cache according to the write amplification factor to obtain the adjusted write performance includes: The ratio of the initial cache size of the host data cache to the initial cache size of the garbage collection data cache is determined as the first ratio value; Based on the written magnification factor, determine the direction of change of the first ratio value, wherein the direction of change includes increasing or decreasing; Based on the direction of change of the first ratio value, the first ratio value is adjusted to the second ratio value; Based on the second ratio value, the solid-state drive is subjected to performance testing to obtain the adjusted write performance, wherein the adjusted write performance includes the second number of read / write operations per second.
6. The method according to claim 5, characterized in that, The step of adjusting the first proportional value according to the direction of change of the first proportional value to adjust the first proportional value to the second proportional value includes: When the first proportional value changes in the direction of increasing, the first proportional value is increased by a step length to obtain a second proportional value, wherein the second proportional value = the first proportional value + the step length; When the first proportional value changes in a decreasing direction, the first proportional value is reduced by one step length to obtain a second proportional value, wherein the second proportional value = the first proportional value - the first step length.
7. The method according to claim 6, characterized in that, The step of determining the optimal write performance of the solid-state drive (SSD) based on its initial write performance and adjusted write performance includes: The larger of the first read / write count per second and the second read / write count per second is determined as the maximum read / write count per second; Based on the first step length, adjust the second ratio value to obtain multiple third ratio values; Based on the third ratio value, the solid-state drive is subjected to performance testing to obtain the third read / write count per second corresponding to multiple third ratio values; Determine whether the maximum value of the third read / write count per second is greater than the maximum read / write count per second; If the maximum value of the third read / write count per second is greater than the maximum read / write count per second, then the maximum value of the third read / write count per second is determined as the maximum read / write count per second; The write performance corresponding to the maximum number of reads and writes per second is determined as the optimal write performance of the solid-state drive.
8. The method according to claim 2, characterized in that, When the write performance of the solid-state drive is at its optimal write performance, the step of obtaining the size of the host data cache of the solid-state drive and determining the size of the host data cache as the first cache size includes: When the write performance of the solid-state drive is at its optimal write performance, obtain the ratio between the cache size of the host data cache and the cache size of the garbage collection data cache; Based on the ratio value and the size of the cache space, the size of the host data cache of the solid-state drive is determined, and the size of the host data cache is determined as the first cache size.
9. The method according to claim 1, characterized in that, The step of writing the host data corresponding to the host write command into the host data cache according to the size of the host data cache includes: Determine whether the remaining space in the host data cache is greater than the data size corresponding to the write command; If the remaining space in the host data cache is greater than the size of the host data corresponding to the write command, then the host data corresponding to the write command is written into the cache space.
10. The method according to claim 7, characterized in that, The method further includes: If the remaining space of the host data cache is less than or equal to the host data size corresponding to the write command, then the write command is added to the waiting queue; When it is detected that the remaining space of the host data cache is greater than the size of the host data corresponding to the write command, the write command is retrieved from the waiting queue and executed.
11. A solid-state drive, comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the solid-state drive adaptive cache management method as described in claims 1-10.
12. A non-volatile computer-readable storage medium, characterized in that, The non-volatile computer storage medium stores a computer program or instructions, which, when executed, implement the solid-state drive adaptive cache management method as described in any one of claims 1-10.