SSD devices with dynamic capacity cache acceleration
By introducing a dynamic capacity adjustment mechanism with one-to-one correspondence between cache subspace and storage subspace in SSD devices, the problem of fixed and unadjustable number of cache units in the existing technology is solved, and the cache hit rate is optimized and resource usage is reduced without resetting the device.
Patent Information
- Application Number
- CN202211627624.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-16
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2042-12-16
AI Technical Summary
Existing storage devices cannot dynamically adjust the number of cache units in a storage subspace without resetting it, resulting in the inability to provide optimized cache hit rates for different storage subspaces at the same time, and the operating system needs to occupy additional computing and memory resources to adjust the cache units.
An SSD device with dynamic capacity cache acceleration is introduced. By configuring a one-to-one correspondence between cache subspaces and storage subspaces, the cache executor and cache allocator are used to dynamically adjust the number of cache units, optimize the cache capacity and peak capacity according to external requests, and manage the allocation and status of cache units in combination with metadata structures.
Without resetting the device, the number of cache units can be dynamically adjusted to optimize the cache hit rate, reduce the use of system resources, and improve the read and write performance of the storage device.
Smart Images

Figure CN115904245B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of SSD technology, and in particular to an SSD device with dynamic capacity cache acceleration. Background Art
[0002] This section is intended to provide a background or context to the embodiments of the present application as recited in the claims. No admission is made that the description herein is prior art as disclosed by virtue of its inclusion in this section.
[0003] A storage device divides all storage units into several storage subspaces according to external requirements. Existing storage devices provide high-speed read and write caches for the storage subspaces within the device. To accelerate the read and write bandwidth of the storage unit contents and reduce read and write latency, the storage device configures a certain number of on-device cache units for a certain number of storage units. The number of storage units and the corresponding number of cache units belonging to a storage subspace are fixed or cannot be configured at runtime. That is, unless the device is reset (without the need for resetting the device), the number of corresponding cache units cannot be changed in response to external requests, thereby changing the average cache hit rate of this storage subspace. Due to this limitation, a device that dynamically allocates storage subspace capacity based on external requests at runtime cannot also provide an optional average cache hit rate for the storage subspace.
[0004] Based on this, existing operating systems use system memory to provide off-device high-speed read and write caches for storage subspaces. During runtime, the operating system adjusts the correspondence between cache units and all accessed storage units within the device. Compared to on-device cache adjustment, this method consumes additional off-device computing and memory resources and cannot configure different numbers of cache units for different storage subspaces based on external requirements without resetting the system. Summary of the Invention
[0005] The purpose of this application is to provide an SSD device with dynamic capacity cache acceleration, in which the number of cache units belonging to the cache subspace can be configured and changed without resetting the device.
[0006] This application discloses an SSD device with dynamic capacity cache acceleration, comprising:
[0007] A memory configured to include a plurality of storage subspaces;
[0008] a cache, configured to include a plurality of cache subspaces, wherein the cache subspaces correspond to the storage subspaces in a one-to-one manner;
[0009] The cache executor is configured to, when reading or writing a storage unit, allocate a corresponding cache unit to the storage unit according to the required capacity, read peak capacity, and write peak capacity of the cache subspace corresponding to the storage subspace to which the storage unit belongs, and send allocation information of the cache unit to the cache allocator;
[0010] A cache allocator is configured to set the total capacity of the corresponding cache subspace, as well as initial values of the necessary capacity, read peak capacity and write peak capacity for at least one storage subspace according to an external cache configuration request, and adjust the necessary capacity, read peak capacity and write peak capacity of the cache subspace according to the total capacity of the cache subspace and the allocation information provided by the cache executor.
[0011] In a preferred embodiment, the present invention further comprises: a metadata storage device storing:
[0012] A storage subspace metadata structure for recording metadata of each storage subspace, wherein the metadata of each storage subspace includes an index of a storage unit in each storage subspace;
[0013] A cache subspace metadata structure for recording metadata of each cache subspace, wherein the metadata of each cache subspace includes demand metadata, execution metadata, and search cost data structure;
[0014] A storage unit metadata structure for recording metadata of each storage unit, wherein the metadata of each storage unit includes an index of a cache unit corresponding to the storage unit and an index of a storage subspace to which the storage unit belongs;
[0015] A cache unit metadata structure for recording metadata of each cache unit, wherein the metadata of each cache unit includes an index of a storage unit corresponding to the cache unit, an index of a cache subspace to which the cache unit belongs, and a cache status data structure of the cache unit.
[0016] In a preferred embodiment, the cache allocator is further configured to:
[0017] Reading metadata of all cache subspaces in the cache subspace metadata structure, and calculating a total capacity of the cache subspace according to a configuration request of a cache capacity of the cache subspace corresponding to the storage subspace;
[0018] Allocating a necessary capacity, a read peak capacity, a write peak capacity, a search range, and a cache execution policy option from a total capacity of the cache subspace according to a configuration request of the cache adjustment policy option of the cache subspace;
[0019] The cache capacity configuration request, cache adjustment policy option configuration request, total capacity, required capacity, read peak capacity, write peak capacity, search range, and cache execution policy option of the cache subspace are recorded in the demand metadata of the cache subspace.
[0020] In a preferred embodiment, the cache allocator is further configured to:
[0021] Suspending operations of all storage units in the storage subspace and all cache units in the cache subspace corresponding to the storage subspace;
[0022] Configuring a corresponding cache subspace for the storage subspace and adjusting the required metadata of the corresponding cache subspace;
[0023] Resuming operations initiated by the cache executor involving the storage subspace and the corresponding cache subspace within a selected adjustment time based on the adjusted demand metadata and the execution metadata of the corresponding cache subspace;
[0024] After the selected adjustment time arrives, adjusting the demand metadata of the remaining cache subspaces according to the configuration request of the cache adjustment policy option; and
[0025] Restore all storage units in the storage subspace and all cache unit operations of the cache subspace corresponding to the storage subspace.
[0026] In a preferred embodiment, the cache executor is further configured to:
[0027] Read the metadata of the storage unit, select the corresponding cache unit if one exists, update the cache status data structure of the cache unit, and update the execution metadata and search cost data structure of the cache subspace to which the cache unit belongs;
[0028] If there is no corresponding cache unit, read the demand metadata and execution metadata of the cache subspace to which the cache unit belongs, and calculate the search range, search order and search end condition;
[0029] In the cache unit metadata structure, within the search range, in accordance with the search order, before reaching the search end condition, the search cost function of each candidate cache unit is calculated and recorded in the search cost data structure of the cache subspace to which the cache unit belongs;
[0030] Selecting a cache unit with the smallest search cost function, and updating the metadata of the storage unit, updating the metadata of the original storage unit corresponding to the cache unit, and updating the metadata of the cache unit;
[0031] The search cost data structure of the cache subspace to which the cache unit belongs is returned to the cache allocator.
[0032] In a preferred embodiment, the cache executor is further configured to:
[0033] Read the demand metadata and execution metadata of the cache subspace to which the cache unit belongs, and calculate the search range, search order, and search end condition;
[0034] In the cache unit metadata structure, within the search range, in accordance with the search order, before reaching the search end condition, the search cost function of each candidate cache unit is calculated and recorded in the search cost data structure of the cache subspace to which the cache unit belongs;
[0035] Selecting a cache unit with the smallest search cost function, and updating metadata of the original storage unit corresponding to the cache unit, and updating metadata of the cache unit;
[0036] The search cost data structure of the cache subspace to which the cache unit belongs is returned to the cache allocator.
[0037] In a preferred embodiment, it also includes:
[0038] A cache configuration interface configured to receive an external cache configuration request, wherein the cache configuration request includes a cache capacity and a cache adjustment policy option;
[0039] The external read / write interface is configured to respond to an external read / write request and read out all or part of the content of the corresponding storage unit or write all or part of the content received by the external read / write interface into the corresponding storage unit;
[0040] The internal read-write interface is configured to implement reading and writing between the cache unit and the storage unit.
[0041] In a preferred embodiment, the cache executor is further configured to:
[0042] Searching and selecting a cache unit for the storage unit specified in the external read request;
[0043] If the cache state data structure of the cache unit indicates that the content thereof is inconsistent with the content of the storage unit, the cache unit is handed over to the internal read-write interface, the content of the storage unit is sequentially read out and written into the cache unit, and the cache state data structure of the cache unit and the execution metadata of the cache subspace to which it belongs are changed;
[0044] Deliver part or all of the content specified in the external read request to the external read / write interface.
[0045] In a preferred embodiment, the cache executor is further configured to:
[0046] Searching and selecting a cache unit for the storage unit specified in the external write request;
[0047] If the external write request only writes part of the contents of the storage unit, then based on the contents of the cache status data structure of the cache unit, it is determined whether to hand over the cache unit to the internal read-write interface, sequentially read the contents of the storage unit and write them to the cache unit, and change the cache status data structure of the cache unit and the execution metadata of the cache subspace to which it belongs;
[0048] Obtaining part of the new content of the storage unit from the internal read-write interface, writing it to the cache unit, and changing the cache state data structure of the cache unit and the execution metadata of the cache subspace to which it belongs;
[0049] Deliver part or all of the content specified in the external write request to the external read / write interface.
[0050] In a preferred embodiment, the cache executor is further configured to:
[0051] Traversing the storage unit metadata structure and searching for the storage unit, wherein the search conditions include: the storage unit has no corresponding cache unit;
[0052] For each storage unit found, a cache unit is searched and selected based on the demand metadata and execution metadata of the cache subspace corresponding to the storage unit and the cache execution strategy option of the cache subspace;
[0053] The cache unit is handed over to the internal read-write interface, the content of the storage unit is read out in sequence and written into the cache unit, and the cache status data structure of the cache unit and the execution metadata of the cache subspace to which it belongs are changed.
[0054] In a preferred embodiment, the cache executor is further configured to: 0 traverse the cache unit metadata structure, search the cache unit, and the search conditions include: the cache unit
[0055] The content of is inconsistent with the content of its corresponding storage unit;
[0056] For each cache unit found, based on the demand metadata and execution metadata of the cache subspace to which the cache unit belongs, and based on the cache execution policy option of the cache subspace, decide to search and execute a) or b) for the storage unit, wherein: 5a) the first cache unit is handed over to the internal read / write interface, the storage unit is written in sequence, and the cache state data structure of the cache unit and the execution metadata of the cache subspace to which it belongs are changed;
[0057] After the internal read-write interface completes the writing, the cache unit cache state data structure and the execution metadata of the cache subspace to which it belongs are changed;
[0058] b) searching and selecting a second cache unit for the cache unit;
[0059] 0. Write the contents of the cache unit into the second cache unit and change the cache state data structure of the cache unit and the execution metadata of the cache subspace to which it belongs;
[0060] Handing the second cache unit to the internal read-write interface, writing the data into the storage unit in sequence, and changing the cache state data structure of the cache unit and the execution metadata of the cache subspace to which it belongs;
[0061] After the storage read-write interface completes the writing, the content of the cache state data structure of the cache unit and the content of the execution metadata of the corresponding cache subspace are changed.
[0062] In a preferred embodiment, the cache executor is further configured to:
[0063] Traversing the cache unit metadata structure to search for the cache unit, wherein the search condition includes: the position of the cache unit in the cache unit metadata structure does not meet the search range requirement in the demand metadata of the cache subspace;
[0064] For each cache unit found, determine the search and selection of a second cache unit for the storage unit based on the demand metadata and execution metadata of the cache subspace to which the cache unit belongs and the cache execution policy option of the cache subspace;
[0065] Writing the content of the cache unit into the second cache unit, and changing the cache state data structure of the cache unit and the second cache unit and the execution metadata of the cache subspace to which they belong;
[0066] Change the metadata of the storage unit corresponding to the cache unit.
[0067] In the implementation manner of the present application, an SSD storage device with dynamic capacity cache acceleration within the device is introduced. For the storage subspace within the device, the number of cache units corresponding to each storage subspace can be configured based on the external request received by the device without resetting the device. To this end, a cache subspace will be equipped for each storage subspace, and the cache subspaces share the cache units within the device. Without resetting the system, the number of cache units belonging to this cache subspace can be configured and can be changed. When the configuration changes, new content in the cache unit and not in the storage unit will not be discarded. When the configuration increases, the number of cache units used by the storage subspace will gradually increase until it reaches the configured amount. When the configuration decreases, the number of cache units used by the storage space will gradually decrease until it reaches the configured amount.
[0068] The various technical features disclosed in the above invention content, the various technical features disclosed in the various embodiments and examples below, and the various technical features disclosed in the accompanying drawings can be freely combined with each other to form various new technical solutions (all of which should be deemed to have been recorded in this specification), unless such a combination of technical features is technically infeasible. For example, in one example, feature A+B+C is disclosed, and in another example, feature A+B+D+E is disclosed. Features C and D are equivalent technical means that play the same role. Technically, only one of them needs to be used, and it is impossible to use them at the same time. Feature E can be technically combined with feature C. In this case, the solution of A+B+C+D should not be deemed to have been recorded because it is technically infeasible, while the solution of A+B+C+E should be deemed to have been recorded. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1 It is a structural diagram of an SSD device with dynamic capacity cache acceleration according to an embodiment of the present application. DETAILED DESCRIPTION
[0070] In the following description, many technical details are provided to help readers better understand this application. However, those skilled in the art will understand that even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed in this application can be implemented.
[0071] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0072] One embodiment of the present application relates to an SSD device with dynamic capacity cache acceleration, the structure of which is as follows: Figure 1As shown, the SSD device includes a memory 101, a cache 102, a cache executor 103, and a cache allocator 104. The memory 101 is configured to include multiple storage subspaces. The cache 102 is configured to include multiple cache subspaces, and the cache subspaces correspond one-to-one to the storage subspaces. Specifically, all storage units (Storage Units) in an SSD device are divided into several storage subspaces (Storage Subspaces), each of which contains several storage units. The capacity of a storage subspace is expressed as the number of storage units to which it belongs. All cache units (Cache Units) in an SSD device are divided into several cache subspaces (Cache Subspaces), each of which contains several cache units. The capacity of a cache subspace is expressed as the number of cache subspaces to which it belongs. Each storage subspace corresponds to a cache subspace. Each storage unit corresponds to a cache subspace. Each storage unit corresponds to zero, one, or more cache units. Each cache unit corresponds to one storage unit.
[0073] The cache executor 103 is configured to, when reading or writing a storage unit, allocate a corresponding cache unit to the storage unit based on the required capacity, read peak capacity, and write peak capacity of the cache subspace corresponding to the storage subspace to which the storage unit belongs, and send the cache unit allocation information to the cache allocator 104. The cache allocator 104 is configured to set the total capacity of the corresponding cache subspace, as well as initial values of the required capacity, read peak capacity, and write peak capacity for at least one storage subspace based on an external cache configuration request, and adjust the required capacity, read peak capacity, and write peak capacity of the cache subspace based on the total capacity of the cache subspace and the allocation information provided by the cache executor.
[0074] In one embodiment, the SSD device further includes a metadata storage 105, which stores:
[0075] i) Structured Metadata for Storage Subspaces. This data structure records the metadata for each storage subspace. Each storage subspace's metadata contains the index of the storage unit belonging to that subspace.
[0076] ii) Structured Metadata for Cache Subspaces. This data structure records the metadata for each cache subspace. Each cache subspace's metadata includes the following: requirement metadata, execution metadata, and structured data for search cost. Requirement metadata includes various capacities and boundaries. Boundaries allow for the partitioning of subspaces within a unified overall space, facilitating fast queries and defining overlaps. Execution metadata includes the sum of units in various states (for comparison with the required capacity) and various execution boundaries (for comparison with the required boundaries). Because it needs to be written frequently, a slight delay in reading does not hinder performance, so special locks are required to ensure strong bandwidth. The search cost data structure is a short-term history of search costs.
[0077] iii) Structured Metadata for Storage Units. This data structure records the metadata for each storage unit. Each storage unit's metadata includes the index of the cache unit to which it corresponds and the index of the storage subspace to which it belongs.
[0078] iv) Structured Metadata for Cache Units. This data structure records the metadata for each cache unit. Each cache unit's metadata includes: the index of the storage unit to which the cache unit corresponds, the index of the cache subspace to which the cache unit belongs, and the cache state data structure (Structured Data for Cache States) for the cache unit.
[0079] The SSD device also includes an external read / write interface (Read / Write Interface) 107 that connects the inside and outside of the SSD. In response to a request from an external initiator, the interface 107 initiates a read request to read the contents of a storage unit and feeds back part or all of the contents of the unit that arrives at the interface to the external request initiator. Alternatively, in response to a request from an external initiator, the interface 107 initiates a write request to write the contents of a storage unit, writes part or all of the contents sent to the read / write interface to the unit, and feeds back the result to the external request initiator.
[0080] The SSD device also includes a configuration interface 106 that connects the SSD internally and externally. Interface 106 responds to a request from an external initiator to configure a new cache subspace for a storage subspace, or responds to a request from an external initiator to change the configuration of an existing cache subspace for a storage subspace. The cache subspace configuration request includes cache capacity and cache adjustment policy options.
[0081] The SSD device also includes an internal read / write interface 108 connected to an internal storage reader / writer (not shown). The interface 108 writes the contents of a cache unit to a storage unit and feeds back the execution result, or reads the contents of a storage unit to a cache unit and feeds back the execution result.
[0082] The cache allocator 104 may configure a corresponding cache subspace for a storage subspace, configure a new cache subspace for a storage subspace, change the configuration of an existing cache subspace for a storage subspace, and adjust the content in the demand metadata of a cache subspace.
[0083] It should be noted that configuring a new cache subspace for a storage subspace means configuring a non-functional cache subspace that has no allocated cache units into a functional cache subspace that has allocated cache units. Changing the configuration of an existing cache subspace for a storage subspace means changing the configuration of a working cache subspace that has already been allocated cache units to a new cache subspace with a new number and a new caching strategy.
[0084] The cache executor 103 can execute the following action sequence in order:
[0085] (1) A sequence of actions to respond to a storage content read request initiated from an external read / write interface.
[0086] (21) A sequence of actions to respond to a storage content write request initiated from an external read / write interface.
[0087] (3) The action sequence of initiating a storage content read request.
[0088] (4) The action sequence of the storage content write request initiated by oneself.
[0089] (5) An action sequence that notifies the internal read / write interface connected to the storage reader / writer to read the contents of a certain storage unit into a certain cache unit.
[0090] (6) An action sequence that notifies the internal read / write interface connected to the storage reader / writer to write the contents of a cache unit into a storage unit.
[0091] (7) An action sequence for searching and selecting a cache unit for a storage unit.
[0092] (8) An action sequence for searching and selecting a new cache unit for a cache unit.
[0093] (9) A sequence of actions that read or change the metadata of a cache subspace.
[0094] (10) A sequence of actions to read or change the metadata of a cache unit.
[0095] (11) A sequence of actions that reads or changes the metadata of a storage unit.
[0096] (12) An action sequence that writes the contents of a cache unit into another cache unit.
[0097] In order to better understand the technical solution of the present application, the above functions and action sequences of the cache allocator and cache executor are described in detail below.
[0098] The cache allocator 104 configures a corresponding cache subspace for a storage subspace including the following steps:
[0099] (1) Read the metadata of all cache subspaces recorded in the cache subspace metadata structure, and calculate the total capacity of the cache subspace according to the cache capacity request of the cache subspace.
[0100] (2) According to the cache adjustment strategy option request, the necessary capacity, read peak capacity, write peak capacity, search range, and cache execution strategy option are allocated from the total capacity of this cache subspace.
[0101] (3) Record in the demand metadata of the cache subspace: cache capacity request, cache adjustment policy options, total capacity, required capacity, read peak capacity, write peak capacity, search range, and cache execution policy options.
[0102] (4) Feedback the configuration results to the configuration interface.
[0103] The cache allocator 104 configures a new cache subspace for a storage subspace including the following steps:
[0104] (1) Allocate a cache subspace for this storage subspace and record it in the storage subspace metadata and the cache subspace metadata.
[0105] (2) Configure the cache subspace corresponding to this storage subspace.
[0106] The cache allocator 104 changes the configuration of an existing cache subspace for a storage subspace by:
[0107] (1) Suspend the actions of all storage units and cache units belonging to the storage subspace and the corresponding cache subspace.
[0108] (2) According to the configuration of the new cache subspace, configure the cache subspace corresponding to this storage subspace.
[0109] (3) Based on the adjusted demand metadata in the cache subspace, the existing execution metadata in the cache subspace, and the adjusted cache execution policy option, within the adjustment time selected by the cache execution policy option, restore the actions initiated from the cache executor involving the storage subspace and the cache subspace.
[0110] (4) After the adjustment time arrives, the demand metadata of other cache subspaces are adjusted according to the cache adjustment strategy option request.
[0111] (5) Recovering actions involving all storage units and cache units belonging to the storage subspace and the corresponding cache subspace.
[0112] The cache allocator 104 adjusts the content of the demand metadata of a cache subspace including the following steps:
[0113] (1) receiving feedback from the cache executor on the update of the search cost data structure of a cache subspace,
[0114] (2) According to the cache adjustment strategy option of this cache subspace, adjust the content in the demand metadata of this cache subspace.
[0115] The cache executor 103 searches and selects a cache unit for a storage unit including the following steps:
[0116] (1) Read the metadata of this storage unit. If the corresponding cache unit is found in it, select this cache unit, update the cache status data structure of this cache unit, update the execution metadata and search cost data structure of the corresponding cache subspace, and return. If not found, continue with the following actions:
[0117] (2) Read the cache requirement metadata and execution metadata of the cache subspace corresponding to this storage unit, and calculate the search range, search order, and search end condition.
[0118] (3) Within the content of the cache unit metadata structure, within the search range, in the search order, and before the search end condition is reached, a cost function is calculated for each candidate cache unit, and each result is recorded in the search cost data structure of this cache subspace. The input of the cost function is the demand metadata and execution metadata of the cache subspace corresponding to this storage unit, and the metadata of this candidate cache unit. The output is a numerical value that can be compared.
[0119] (4) Among all the cache units to be selected, the one with the lowest cost is selected as the result.
[0120] (5) Change the content of the metadata of this storage unit and save the index of this selected cache unit.
[0121] (6) Read the content of the metadata of the selected cache unit, and if there is a corresponding storage unit, invalidate the corresponding cache unit record in the metadata of the storage unit.
[0122] (7) Change the content of the selected cache unit metadata, save the index of the storage unit, and update the cache status data structure.
[0123] (8) The search cost data structure of the cache subspace to which the cache unit belongs is fed back to the cache allocator 104 .
[0124] The cache executor 103 searches for and selects a new cache unit for a cache unit, including the following steps:
[0125] (1) Read the cache requirement metadata and execution metadata of the cache subspace to which the target cache unit belongs, and calculate the search range, search order, and search end condition.
[0126] (2) Calculate the cost function result for each candidate cache unit in the content of the cache unit metadata structure within the search range and in the search order before reaching the search end condition, and record each result in the search cost data structure of this cache subspace. The search range excludes this cache unit itself.
[0127] (3) The input of the cost function is the demand metadata and execution metadata of the cache subspace corresponding to the storage unit, and the metadata of the candidate cache unit. The output is a numerical value that can be compared.
[0128] (4) Among all the cache units to be selected, the one with the lowest cost is selected as the result.
[0129] (5) Read the content of the metadata of the selected cache unit, and if there is a corresponding storage unit, invalidate the corresponding cache unit record in the metadata of the storage unit.
[0130] (6) Change the content of the selected cache unit metadata, save the index of the storage unit, and update the cache status data structure.
[0131] (7) The search cost data structure of the cache subspace to which the target cache unit belongs is fed back to the cache allocator 104 .
[0132] In response to a storage content read request initiated by the external read / write interface 107, the cache executor 103 performs the following steps:
[0133] (1) Search and select a cache unit for the storage unit specified in the request.
[0134] (2) If the cache status data structure of the cache unit indicates that the content thereof is inconsistent with the content of the storage unit, the cache unit is handed over to the internal read-write interface 108 of the storage reader / writer, the content of the storage unit is read out in sequence and written into the cache unit, and the content of the cache status data structure of the cache unit and the content of the execution metadata of the cache subspace to which it belongs are changed.
[0135] (3) Send part or all of the content specified in the request to the read-write interface and notify the read-write interface that the request has been completed.
[0136] In response to a storage content write request initiated by the external read / write interface 107, the cache executor 103 performs the following steps:
[0137] (1) Search and select a cache unit for the storage unit specified in the request.
[0138] (2) If the write request only writes part of the contents of the storage unit, then based on the contents of the cache status data structure of the cache unit, decide whether to perform the following actions:
[0139] (2.1) The cache unit is handed over to the internal read-write interface 108 of the storage reader, the contents of the storage unit are read out in order and written into the cache unit, and the cache status data structure content of the cache unit and the execution metadata content of the cache subspace to which it belongs are changed.
[0140] (3) After the previous step is completed, some new contents of the storage unit are obtained from the read-write interface 107 and written to the cache unit, and the cache status data structure content of the cache unit and the execution metadata content of the cache subspace to which it belongs are changed.
[0141] (4) Notify the read / write interface 107 that the request has been completed.
[0142] In response to a storage content read request initiated by the cache executor 103, the cache executor 103 continuously and autonomously performs the following sequence of actions:
[0143] (1) Traverse the contents of the storage unit metadata structure and search for the storage unit. If a storage unit that meets the conditions is not found in one traversal, pause for a period of time and then traverse again. The search conditions include: the storage unit does not have a corresponding cache unit
[0144] (2) For each searched storage unit, based on the demand metadata and execution metadata of the cache subspace corresponding to the storage unit, and based on the cache execution policy options of the cache subspace, decide whether to perform the following actions:
[0145] (2.1) Search and select a cache unit for this storage unit.
[0146] (2.2) The cache unit is handed over to the internal read / write interface 108 of the storage reader / writer, and the contents of the storage unit are read out in sequence and written into the cache unit. The cache status data structure content of the cache unit and the execution metadata content of the cache subspace to which it belongs are also changed.
[0147] (3) The above actions and the actions initiated in response to the read / write interface 107 are simultaneously scheduled by the cache executor into an ordered action sequence and executed in sequence.
[0148] In response to a storage content write request initiated by the cache executor 103, the cache executor 103 continuously and autonomously executes the following sequence of actions:
[0149] (1) Traverse the contents of the cache unit metadata structure and search for the cache unit. If a storage unit that meets the conditions is not found in one traversal, pause for a period of time and then traverse again. The search conditions include: the contents of the cache unit are inconsistent with the contents of the corresponding storage unit;
[0150] (2) For each cache unit found, based on the demand metadata and execution metadata of the cache subspace corresponding to the storage unit and the cache execution policy options of the cache subspace, decide whether to perform one of the following two sets of actions:
[0151] (2.1) Group 1:
[0152] (2.1.1) The first cache unit is handed over to the internal read / write interface 108 of the storage reader / writer, and the data is written into the storage unit in sequence, and the content of the cache state data structure of the cache unit and the content of the execution metadata of the cache subspace to which it belongs are changed.
[0153] (2.1.2) After the storage read-write interface completes the writing, the content of the cache state data structure of the cache unit and the content of the execution metadata of the corresponding cache subspace are changed.
[0154] (2.2) Second Group:
[0155] (2.2.1) Search and select a second cache unit for the cache unit.
[0156] (2.2.2) Write the content of the first cache unit into the second cache unit, and change the content of the cache state data structure of the cache unit and the content of the execution metadata of the cache subspace to which it belongs.
[0157] (2.2.3) The second cache unit is handed over to the internal read / write interface 108 of the storage reader / writer, and the data is written into the storage unit in sequence. In addition, the content of the cache state data structure of the cache unit and the content of the execution metadata of the cache subspace to which it belongs are changed.
[0158] (2.2.4)) After the storage read-write interface completes the writing, the content of the cache unit cache status data structure and the content of the execution metadata of the corresponding cache subspace are changed.
[0159] (3) The above actions and the actions initiated in response to the read / write interface 107 are simultaneously scheduled by the cache executor into an ordered action sequence and executed in sequence.
[0160] In response to a cache content copy request initiated by the cache executor 103, the cache executor 103 continuously and autonomously performs the following sequence of actions:
[0161] (1) Traverse the contents of the cache unit metadata structure and search for cache units. If a matching storage unit is not found in one traversal, pause for a period of time and then traverse again. The search conditions include: the location of the cache unit in the cache unit metadata structure does not meet the search range requirements in the demand metadata of the cache subspace;
[0162] (2) For each cache unit found, based on the demand metadata and execution metadata of the cache subspace corresponding to the storage unit and the cache execution policy options of the cache subspace, decide whether to perform the following actions:
[0163] (2.1) Search and select a second cache unit for the cache unit.
[0164] (2.2) Write the content of the first cache unit into the second cache unit, and change the contents of the cache status data structures of the two cache units and the execution metadata of the corresponding cache subspaces.
[0165] (2.3) Change the content of the metadata of the storage unit corresponding to the first cache unit.
[0166] (3) The above actions and the actions initiated in response to the read / write interface 107 are simultaneously scheduled by the cache executor into an ordered action sequence and executed in sequence.
[0167] The cache executor's action sequence is ordered by the cache executor's action scheduler (not shown). In other words, there's a natural order for initiating these actions, but execution doesn't follow this natural order. Instead, the optimal execution order is calculated based on the content coherence between the storage units involved in these actions and the cache units, as well as resource contention (locking) relationships between the actions themselves. This order is then used for execution.
[0168] It should be noted that, in this application, relational terms such as first and second are merely used to distinguish one entity or operation from another, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprise," "include," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article, or device. Without further restriction, an element defined by the phrase "comprising a" does not exclude the presence of other identical elements in the process, method, article, or device comprising the element. In this application, if it is mentioned that an action is performed according to a certain element, it means that the action is performed at least according to that element, including two situations: performing the action only according to that element, and performing the action according to that element and other elements. Expressions such as "multiple," "multiple," and "multiple" include 2, 2 times, 2 kinds, and more than 2, more than 2 times, and more than 2 kinds.
[0169] The serial numbers used when describing method steps do not, in themselves, limit the order of those steps. For example, a higher-numbered step does not necessarily have to be executed after a lower-numbered step; the higher-numbered step can be executed before the lower-numbered step, or they can be executed in parallel, as long as the execution order is reasonable to those skilled in the art. For another example, having multiple steps with consecutive serial numbers does not limit the execution of other steps in between.
[0170] All documents mentioned in this specification are considered to be included in their entirety in the disclosure of this application so that they can be used as a basis for modification when necessary. In addition, it should be understood that the above description is only a preferred embodiment of this specification and is not intended to limit the scope of protection of this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of this specification should be included in the scope of protection of one or more embodiments of this specification.
[0171] In some cases, the actions or steps recited in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. Additionally, the processes depicted in the accompanying drawings do not necessarily require the particular order shown or sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
Claims
1. An SSD device with dynamic capacity cache acceleration, characterized in that: include: A memory configured to include a plurality of storage subspaces; a cache, configured to include a plurality of cache subspaces, wherein the cache subspaces correspond to the storage subspaces in a one-to-one manner; The cache executor is configured to, when reading or writing a storage unit, allocate a corresponding cache unit to the storage unit according to the required capacity, read peak capacity, and write peak capacity of the cache subspace corresponding to the storage subspace to which the storage unit belongs, and send allocation information of the cache unit to the cache allocator; A cache allocator is configured to set the total capacity of the corresponding cache subspace, as well as initial values of the necessary capacity, read peak capacity and write peak capacity for at least one storage subspace according to an external cache configuration request, and adjust the necessary capacity, read peak capacity and write peak capacity of the cache subspace according to the total capacity of the cache subspace and the allocation information provided by the cache executor.
2. The SSD device with dynamic capacity cache acceleration according to claim 1, characterized in that: Also includes: Metadata storage, which stores: A storage subspace metadata structure for recording metadata of each storage subspace, wherein the metadata of each storage subspace includes an index of a storage unit in each storage subspace; A cache subspace metadata structure for recording metadata of each cache subspace, wherein the metadata of each cache subspace includes demand metadata, execution metadata, and search cost data structure; A storage unit metadata structure for recording metadata of each storage unit, wherein the metadata of each storage unit includes an index of a cache unit corresponding to the storage unit and an index of a storage subspace to which the storage unit belongs; A cache unit metadata structure for recording metadata of each cache unit, wherein the metadata of each cache unit includes an index of a storage unit corresponding to the cache unit, an index of a cache subspace to which the cache unit belongs, and a cache status data structure of the cache unit.
3. The SSD device with dynamic capacity cache acceleration according to claim 2, characterized in that: The cache allocator is further configured to: Reading metadata of all cache subspaces in the cache subspace metadata structure, and calculating a total capacity of the cache subspace according to a configuration request of a cache capacity of the cache subspace corresponding to the storage subspace; Allocating a necessary capacity, a read peak capacity, a write peak capacity, a search range, and a cache execution policy option from a total capacity of the cache subspace according to a configuration request of the cache adjustment policy option of the cache subspace; The cache capacity configuration request, cache adjustment policy option configuration request, total capacity, required capacity, read peak capacity, write peak capacity, search range, and cache execution policy option of the cache subspace are recorded in the demand metadata of the cache subspace.
4. The SSD device with dynamic capacity cache acceleration according to claim 2, characterized in that: The cache allocator is further configured to: Suspending operations of all storage units in the storage subspace and all cache units in the cache subspace corresponding to the storage subspace; Configuring a corresponding cache subspace for the storage subspace and adjusting the required metadata of the corresponding cache subspace; Resuming operations initiated by the cache executor involving the storage subspace and the corresponding cache subspace within a selected adjustment time based on the adjusted demand metadata and the execution metadata of the corresponding cache subspace; After the selected adjustment time arrives, adjusting the demand metadata of the remaining cache subspaces according to the configuration request of the cache adjustment policy option; as well as Restore all storage units in the storage subspace and all cache unit operations of the cache subspace corresponding to the storage subspace.
5. The SSD device with dynamic capacity cache acceleration according to claim 2, characterized in that: The cache executor is further configured to: Read the metadata of the storage unit, select the corresponding cache unit if one exists, update the cache status data structure of the cache unit, and update the execution metadata and search cost data structure of the cache subspace to which the cache unit belongs; If there is no corresponding cache unit, read the demand metadata and execution metadata of the cache subspace to which the cache unit belongs, and calculate the search range, search order and search end condition; In the cache unit metadata structure, within the search range, in accordance with the search order, before reaching the search end condition, the search cost function of each candidate cache unit is calculated and recorded in the search cost data structure of the cache subspace to which the cache unit belongs; Selecting a cache unit with the smallest search cost function, and updating the metadata of the storage unit, updating the metadata of the original storage unit corresponding to the cache unit, and updating the metadata of the cache unit; The search cost data structure of the cache subspace to which the cache unit belongs is returned to the cache allocator.
6. The SSD device with dynamic capacity cache acceleration according to claim 2, characterized in that: The cache executor is further configured to: Read the demand metadata and execution metadata of the cache subspace to which the cache unit belongs, and calculate the search range, search order, and search end condition; In the cache unit metadata structure, within the search range, in accordance with the search order, before reaching the search end condition, the search cost function of each candidate cache unit is calculated and recorded in the search cost data structure of the cache subspace to which the cache unit belongs; Selecting a cache unit with the smallest search cost function, and updating metadata of the original storage unit corresponding to the cache unit, and updating metadata of the cache unit; The search cost data structure of the cache subspace to which the cache unit belongs is returned to the cache allocator.
7. The SSD device with dynamic capacity cache acceleration according to claim 2, characterized in that: Also includes: A cache configuration interface configured to receive an external cache configuration request, wherein the cache configuration request includes a cache capacity and a cache adjustment policy option; The external read / write interface is configured to respond to an external read / write request and read out all or part of the content of the corresponding storage unit or write all or part of the content received by the external read / write interface into the corresponding storage unit; The internal read-write interface is configured to implement reading and writing between the cache unit and the storage unit.
8. The SSD device with dynamic capacity cache acceleration according to claim 7, characterized in that: The cache executor is further configured to: Searching and selecting a cache unit for the storage unit specified in the external read request; If the cache state data structure of the cache unit indicates that the content thereof is inconsistent with the content of the storage unit, the cache unit is handed over to the internal read-write interface, the content of the storage unit is sequentially read out and written into the cache unit, and the cache state data structure of the cache unit and the execution metadata of the cache subspace to which it belongs are changed; Deliver part or all of the content specified in the external read request to the external read / write interface.
9. The SSD device with dynamic capacity cache acceleration according to claim 7, characterized in that: The cache executor is further configured to: Searching and selecting a cache unit for the storage unit specified in the external write request; If the external write request only writes part of the contents of the storage unit, then based on the contents of the cache status data structure of the cache unit, it is determined whether to hand over the cache unit to the internal read-write interface, sequentially read the contents of the storage unit and write them to the cache unit, and change the cache status data structure of the cache unit and the execution metadata of the cache subspace to which it belongs; Obtaining part of the new content of the storage unit from the internal read-write interface, writing it to the cache unit, and changing the cache state data structure of the cache unit and the execution metadata of the cache subspace to which it belongs; Deliver part or all of the content specified in the external write request to the external read / write interface.
10. The SSD device with dynamic capacity cache acceleration according to claim 7, characterized in that: The cache executor is further configured to: Traversing the storage unit metadata structure and searching for the storage unit, wherein the search conditions include: the storage unit has no corresponding cache unit; For each searched storage unit, based on the demand metadata and execution metadata of the cache subspace corresponding to the storage unit and the cache execution strategy option of the cache subspace, decide to search and select a cache unit for the storage unit; The cache unit is handed over to the internal read-write interface, the content of the storage unit is read out in sequence and written into the cache unit, and the cache status data structure of the cache unit and the execution metadata of the cache subspace to which it belongs are changed.
11. The SSD device with dynamic capacity cache acceleration according to claim 7, characterized in that: The cache executor is further configured to: Traversing the cache unit metadata structure, searching for the cache unit, wherein the search condition includes: the content of the cache unit is inconsistent with the content of the corresponding storage unit; For each cache unit found, based on the demand metadata and execution metadata of the cache subspace to which the cache unit belongs, and based on the cache execution policy options of the cache subspace, decide whether to search and execute a) or b) for the storage unit, where: a) delivering the first cache unit to the internal read / write interface, writing the data into the storage unit in sequence, and changing the cache state data structure of the cache unit and the execution metadata of the cache subspace to which it belongs; After the internal read-write interface completes the writing, the cache unit cache state data structure and the execution metadata of the cache subspace to which it belongs are changed; b) searching and selecting a second cache unit for the cache unit; Writing the content of the cache unit into the second cache unit, and changing the cache state data structure of the cache unit and the execution metadata of the cache subspace to which it belongs; Handing the second cache unit to the internal read-write interface, writing the data into the storage unit in sequence, and changing the cache state data structure of the cache unit and the execution metadata of the cache subspace to which it belongs; After the storage read-write interface completes the writing, the content of the cache state data structure of the cache unit and the content of the execution metadata of the corresponding cache subspace are changed.
12. The SSD device with dynamic capacity cache acceleration according to claim 7, characterized in that: The cache executor is further configured to: Traversing the cache unit metadata structure to search for the cache unit, wherein the search condition includes: the position of the cache unit in the cache unit metadata structure does not meet the search range requirement in the demand metadata of the cache subspace; For each cache unit found, determine the search and selection of a second cache unit for the storage unit based on the demand metadata and execution metadata of the cache subspace to which the cache unit belongs and the cache execution policy option of the cache subspace; Writing the content of the cache unit into the second cache unit, and changing the cache state data structure of the cache unit and the second cache unit and the execution metadata of the cache subspace to which they belong; Change the metadata of the storage unit corresponding to the cache unit.
Citation Information
Patent Citations
Cache space distribution method and device
CN103778071A
Data storage device and method and distributed data storage system
CN113868192A