Method and device for hierarchical data storage
By using multi-layer storage structures and scheduling threads in data hierarchical storage technology to optimize channel migration and new creation, traditional storage performance limitations and cost issues are solved, and efficient hot and cold data separation and performance improvement are achieved.
Patent Information
- Application Number
- CN202111081201.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-15
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2041-09-15
AI Technical Summary
In the existing hierarchical data storage technology, traditional external storage devices lead to storage performance limitations, and simultaneous writing to the upper and lower layers increases storage costs.
Adopt a hierarchical storage structure with at least two storage layers, perform migration operations and create new channel operations by scheduling threads, migrate or create new channels according to the usage threshold of each layer, and optimize data storage between the high-performance layer and the low-performance layer to achieve Separate hot and cold data.
It improves data storage performance, avoids significant storage cost increases, and maximizes hierarchical storage effects.
Smart Images

Figure CN113741819B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data storage, and more specifically, to a method and device for hierarchical data storage. Background Art
[0002] Data hierarchical storage is a storage strategy in which the system executes data storage according to the hierarchy of storage performance under the computer architecture. Typical hierarchical storage includes two storage layers, the upper layer has higher speed and lower latency than the lower layer, and the upper layer has a smaller capacity due to factors such as cost. The speed of the central processing unit is relatively fast, and most of the workload requires access to (e.g., reading or writing) the memory. The storage device used in hierarchical storage in the prior art is a traditional external storage device, such as an HDD or SSD, and therefore adopts a two-level storage architecture, and the storage performance is greatly limited due to the storage medium used. In addition, in the prior art, data is usually written to the upper and lower layers at the same time, which increases the storage cost. Summary of the invention
[0003] The purpose of the present disclosure is to provide a method and system for hierarchical data storage.
[0004] According to one or more aspects of the present disclosure, a method for hierarchical data storage is provided, the method being applied to a hierarchical storage structure provided with at least two storage layers, wherein the read and write performance of the at least two storage layers decreases from top to bottom, including a current layer and a next layer directly adjacent to the current layer, the method comprising: executing a scheduling thread. Wherein, if the usage of the current layer is equal to or greater than a first threshold, a first migration operation is performed; if the usage of the current layer is less than the first threshold, a second migration operation is performed. Wherein, the first migration operation migrates at least one channel at the front of the first channel list to the next layer and appends it to the second channel list; the second migration operation migrates at least one channel at the back of the second channel list to the current layer and inserts it to the front of the first channel list. Wherein, the first channel list represents the channels included in the current layer, and the second channel list represents the channels included in the next layer.
[0005] Optionally, the method may further include: performing a channel creation operation. If the usage of the current layer is less than a second threshold, a new channel is created in the current layer, the new channel is added to the first channel list, and the storage state corresponding to the new channel is set to be located in the current layer; if the usage of the current layer is equal to or greater than the second threshold, a new channel is created in the next layer, the new channel is added to the second channel list, and the storage state corresponding to the new channel is set to be located in the next layer, wherein the second threshold is greater than or equal to the first threshold.
[0006] Optionally, the first migration operation may include: when the usage of the next layer is less than a third threshold, creating a new target channel in the next layer; copying at least one channel at the front of the first channel list to the target channel; updating the storage status corresponding to the target channel to be located in the next layer; and deleting at least one channel at the front of the first channel list.
[0007] Optionally, the second migration operation may include: when the usage of the current layer is less than a third threshold, creating a new target channel in the current layer; copying at least one channel at the end of the second channel list to the target channel; updating the storage status corresponding to the target channel to be located in the current layer; and deleting at least one channel at the end of the second channel list.
[0008] Optionally, the method may further include: when it is determined that none of the channels to be migrated have been written, executing at least one of the corresponding first migration operation and the second migration operation, the channel to be migrated being at least one of the frontmost channel in the first channel list and at least one of the backmost channel in the second channel list.
[0009] Optionally, the first migration operation may further include: when it is determined that at least one of the frontmost channels in the first channel list has not been read, executing a step of deleting at least one of the frontmost channels in the first channel list.
[0010] Optionally, the second migration operation may further include: when it is determined that at least one of the last channels in the second channel list has not been read, executing the step of deleting at least one of the last channels in the second channel list.
[0011] Optionally, the at least two storage layers include a first layer with the highest read / write performance and a second layer directly adjacent to the first layer, and the method may further include: performing a channel creation operation. If the usage of the first layer is less than a second threshold, a new channel is created in the first layer, the new channel is added to the channel list of the first layer, and the storage state corresponding to the new channel is set to be located in the first layer; if the usage of the first layer is equal to or greater than the second threshold, a new channel is created in the second layer, the new channel is added to the channel list of the second layer, and the storage state corresponding to the new channel is set to be located in the second layer, wherein the second threshold is greater than or equal to the first threshold.
[0012] Optionally, the at least two storage tiers may include at least one of a non-volatile memory, an NVMe SSD, a SATA SSD, a HDD RAID, and a HDD.
[0013] According to one or more aspects of the present disclosure, a device for hierarchical data storage is provided, the device comprising: a hierarchical storage structure, configured to include at least two storage layers, wherein the read and write performance of the at least two storage layers decreases from top to bottom, including a current layer and a next layer directly adjacent to the current layer; and a scheduling unit, configured to execute a scheduling thread. Wherein, if the usage of the current layer is equal to or greater than a first threshold, the scheduling unit performs a first migration operation; if the usage of the current layer is less than the first threshold, the scheduling unit performs a second migration operation. Wherein, the first migration operation migrates at least one channel at the front of the first channel list to the next layer and appends it to the second channel list; the second migration operation migrates at least one channel at the back of the second channel list to the current layer and inserts it to the front of the first channel list. Wherein, the first channel list represents the channels included in the current layer, and the second channel list represents the channels included in the next layer.
[0014] Optionally, the device may further include: a channel creation unit configured to perform a channel creation operation. If the usage of the current layer is less than a second threshold, the channel creation unit creates a new channel in the current layer, appends the new channel to the first channel list, and sets the storage state corresponding to the new channel to be located in the current layer; if the usage of the current layer is equal to or greater than the second threshold, the channel creation unit creates a new channel in the next layer, appends the new channel to the second channel list, and sets the storage state corresponding to the new channel to be located in the next layer, wherein the second threshold is greater than or equal to the first threshold.
[0015] Optionally, the device further includes: a migration unit configured to receive an instruction from the scheduling unit to perform a first migration operation or a second migration operation. For example, when the migration unit is configured to perform the first migration operation, the following steps are performed: when the usage of the next layer is less than the third threshold, a new target channel is created in the next layer; at least one channel at the front of the first channel list is copied to the target channel; the storage state corresponding to the target channel is updated to be located in the next layer; and at least one channel at the front of the first channel list is deleted. The migration unit is also configured to: when performing the first migration operation, when it is determined that at least one channel at the front of the first channel list has not been read, the step of deleting at least one channel at the front of the first channel list is performed. For another example, when the migration unit is configured to perform the second migration operation, the following steps are performed: when the usage of the current layer is less than the third threshold, a new target channel is created in the current layer; at least one channel at the back of the second channel list is copied to the target channel; the storage state corresponding to the target channel is updated to be located in the current layer; and at least one channel at the back of the second channel list is deleted. The migration unit is further configured to: when performing the second migration operation, if it is determined that at least one of the last channels in the second channel list has not been read, perform a step of deleting at least one of the last channels in the second channel list. The third threshold is less than or equal to the second threshold.
[0016] Optionally, the migration unit can also be configured to execute at least one of the corresponding first migration operation and the second migration operation when it is determined that none of the channels to be migrated have been written, and the channels to be migrated are at least one of the frontmost channel in the first channel list and the backmost channel in the second channel list.
[0017] Optionally, at least two storage layers may include a first layer with the highest read / write performance and a second layer directly adjacent to the first layer, and the device may further include: a channel creation unit configured to perform a channel creation operation. If the usage of the first layer is less than a second threshold, the channel creation unit creates a new channel in the first layer, appends the new channel to the channel list of the first layer, and sets the storage state corresponding to the new channel to be located in the first layer; if the usage of the first layer is equal to or greater than the second threshold, the channel creation unit creates a new channel in the second layer, appends the new channel to the channel list of the second layer, and sets the storage state corresponding to the new channel to be located in the second layer, wherein the second threshold is greater than or equal to the first threshold.
[0018] Optionally, the at least two storage tiers may include at least one of a non-volatile memory, an NVMe SSD, a SATA SSD, a HDD RAID, and a HDD.
[0019] Another aspect of the present disclosure provides a computer-readable storage medium storing instructions, wherein when the instructions are executed by at least one computing device, the at least one computing device is prompted to perform the method for hierarchical data storage as described above.
[0020] Another aspect of the present disclosure provides an electronic device including at least one processor and at least one memory storing instructions, wherein the instructions, when executed by the at least one processor, cause the at least one processor to perform the method for hierarchical data storage as described above.
[0021] According to one or more aspects of the present disclosure, a method for data hierarchical storage achieves better performance than existing solutions by using non-volatile memory as the first layer of non-volatile hierarchical storage. In addition, a scheduling thread implements data migration between different storage layers according to a data migration strategy, thereby maximizing the hierarchical storage effect without incurring significant additional storage costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] These and / or other aspects and advantages of the present disclosure will become more clear and easier to understand from the following detailed description of the embodiments of the present disclosure in conjunction with the accompanying drawings, in which:
[0023] Figure 1 is an application scenario diagram showing a method for hierarchical data storage according to an embodiment of the present disclosure;
[0024] Figure 2 is a flow chart showing a method for hierarchical data storage according to an embodiment of the present disclosure;
[0025] Figure 3 is a flow chart showing a new channel creation according to an embodiment of the present disclosure;
[0026] Figure 4 is a flow chart illustrating a migration thread according to an embodiment of the present disclosure;
[0027] Figure 5 is a block diagram illustrating an apparatus for hierarchical storage of data according to an exemplary embodiment of the present disclosure; and
[0028] Figure 6 is a block diagram illustrating an electronic device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0029] Embodiments of the present disclosure are described in detail below with reference to the accompanying drawings. Examples of the embodiments are shown in the accompanying drawings, wherein the same reference numerals refer to the same components throughout. The embodiments will be described below with reference to the accompanying drawings in order to explain the present disclosure.
[0030] Figure 1It is a diagram showing an application scenario of a method for hierarchical data storage according to an embodiment of the present disclosure.
[0031] Data hierarchical storage is a storage strategy in which the system performs data storage according to the hierarchy of storage performance under the computer architecture. Generally, the CPU is relatively fast, and most of the workload requires accessing (e.g., reading or writing) the memory. Since the storage performance between storage tiers varies due to the hierarchy, it actually limits the processing speed, causing the CPU to spend a lot of time waiting for the memory to be written or read to complete the work.
[0032] like Figure 1 As shown, in a hierarchical storage architecture with multiple storage layers, the storage media can be sorted according to their read and write performance. For example, the hierarchical storage architecture may include first-level storage, second-level storage, third-level storage, ..., and N-level storage. In an embodiment, the first-level storage has the highest read and write performance. For example, the first-level storage, the second-level storage, the third-level storage, ..., and the N-level storage may use at least one of non-volatile memory, NVMe SSD, SATA SSD, HDD RAID, and HDD. For example, the first-level storage may be non-volatile memory, that is, persistent memory. The second-level storage may be NVMeSSD. The third-level storage may be SATA SSD. The fourth-level storage may be HDD RAID. Generally, the first-level storage has a higher cost due to its higher read and write performance. In this case, the first-level storage has a relatively small capacity. In the prior art, non-volatile memory technology enables data in memory to be persistent, and compared with traditional memory, it has the advantages of large capacity and low cost; compared with traditional external memory (HDD / SSD), it also has the characteristics of high-speed persistence. The capacity, price, and performance of non-volatile memory are between traditional memory DRAM and external storage NVMe SSD. Therefore, it is suitable to be used as the first-level storage in a hierarchical storage architecture.
[0033] In an embodiment, when it is necessary to implement efficient and reliable processing of data streams, a Kafka distributed event stream / message queue system (e.g., Figure 1 The Kafka log application scenario shown in the figure). Under high pressure, the storage and reading of log files will cause performance bottlenecks. Therefore, how to improve the persistence performance (including reading and writing) is the key to improving Kafka's latency and throughput performance. On the other hand, Kafka's data has a natural hot and cold nature. Generally speaking, newly written data has a greater probability of being read. Therefore, the data hierarchical storage method disclosed in the present invention is used to separate hot and cold data, thereby improving the overall system performance of Kafka.
[0034] Figure 2is a flowchart illustrating a method for hierarchical data storage according to an embodiment of the present disclosure.
[0035] In the embodiments of the present disclosure, the method for hierarchical data storage can be applied to Figure 1 The hierarchical storage architecture shown in FIG. The hierarchical storage architecture may be provided with a hierarchical storage structure having at least two storage layers, and the read and write performance of the hierarchical storage structure decreases from top to bottom. For the convenience of description, the current layer and the next layer directly adjacent to the current layer refer to two directly adjacent storage layers in the hierarchical storage structure. The read and write performance of the current layer is higher than the read and write performance of the next layer. For example, the current layer may be as follows: Figure 1 The first level of storage is shown, in this case, the next level is as follows Figure 1 As another example, the current layer may be the N-1th layer of storage, in which case the next layer is as follows Figure 1 The Nth level storage shown. In an embodiment, data may be stored in a hierarchical storage structure in the form of channels, for example, a channel may be a file channel (FileChannel) or a persistent memory channel (PMemChannel). In an embodiment, a channel may have two attributes: a channel ID (Channel ID) and a storage status (MixChannel). The channel ID may be used to identify the channel, and the storage status may be used to indicate the location where the channel is stored. For example, the storage status may be "located in the current layer" or "located in the next layer". In an embodiment, the channel ID and storage status of the channel may be stored in a storage medium separate from the hierarchical storage structure, for example, may be stored in a volatile memory. In another embodiment, the channel ID and storage status of the channel may be stored in the first level storage of the hierarchical storage structure or may be stored in a partition of the first level storage. The first channel list represents the channels included in the current layer, and the second channel list represents the channels included in the next layer.
[0036] like Figure 2 As shown, the data hierarchical storage method may include executing a scheduling thread. For example, the scheduling thread may be executed at a predetermined period (e.g., once every 10 seconds), or the scheduling thread may also monitor in real time. The scheduling thread described here may refer to a daemon process running in a single thread in the system background to schedule data stored in a hierarchical storage structure. For example, data is scheduled between different storage layers in a hierarchical storage structure. In another embodiment, the scheduling thread may be a thread executed on demand. The scheduling thread may maintain a migration task queue, for example, the migration task queue may include a high-low migration task queue and a low-high migration task queue. The scheduling thread may add the created migration task to the migration task queue.
[0037] In step S10, it is determined whether the usage of the current layer is equal to or greater than a first threshold.
[0038] If the usage of the current layer is equal to or greater than the first threshold, then in step S20, a first migration operation is performed. The first migration operation migrates at least one channel at the front of the first channel list to the next layer and appends it to the second channel list. When the usage of the next layer reaches a predetermined threshold of the next layer (for example, the remaining capacity is not enough to accept the channel to be migrated, or the capacity is full), the first migration operation is terminated.
[0039] If the usage of the current layer is less than the first threshold, then in step S30, a second migration operation is performed. The second migration operation migrates at least one channel at the end of the second channel list to the current layer and inserts it to the front of the first channel list. When the usage of the current layer reaches a predetermined threshold of the current layer (for example, the remaining capacity is not enough to accept the channel to be migrated, or the capacity is full), the second migration operation is terminated.
[0040] In an embodiment, the first threshold may represent a preset usage or storage percentage. The first threshold may be set according to actual needs. For example, the first threshold may be 60% to 95%.
[0041] Figure 3 is a flow chart illustrating the creation of a new channel according to an embodiment of the present disclosure.
[0042] like Figure 3 As shown, the data hierarchical storage method may further include executing a channel creation operation.
[0043] For example, in step S301, it is determined whether the usage of the current layer is less than a second threshold.
[0044] If the usage of the current layer is less than the second threshold, in step S302, a new channel is created in the current layer, the new channel is added to the first channel list, and the storage state corresponding to the new channel is set to be in the current layer.
[0045] If the usage of the current layer is equal to or greater than the second threshold, then in step S303, a new channel is created in the next layer, the new channel is added to the second channel list, and the storage state corresponding to the new channel is set to be located in the next layer.
[0046] In an embodiment, the second threshold is greater than or equal to the first threshold. The second threshold may be a preset value used to indicate an upper limit of the usage of the current layer, or may be used to ensure that the current layer has sufficient capacity to store a newly created channel.
[0047] In a preferred embodiment, before step S301, it may also include: when the usage of each storage layer above the current layer reaches the new channel threshold corresponding to each storage layer, executing S301 to determine whether the usage of the current layer is less than the second threshold.
[0048] In a more specific embodiment, the current layer may be the first layer with the highest read / write performance, and the next layer may be the second layer directly adjacent to the first layer. In this case, the channel creation operation may be preferentially performed in the first layer.
[0049] For example, if the usage of the first layer is less than the second threshold, in step S302, a new channel is preferentially created in the first layer, the new channel is added to the channel list of the first layer, and the storage state corresponding to the new channel is set to be located in the first layer.
[0050] If the usage of the first layer is equal to or greater than the second threshold, in step S303, a new channel is created in the second layer, the new channel is added to the channel list of the second layer, and the storage state corresponding to the new channel is set to be located in the second layer.
[0051] Taking the Kafka application scenario as an example, newly written data has a greater probability of being read. Therefore, according to the embodiments of the present disclosure, newly written data is preferentially stored in a storage layer with higher storage performance, so that cold and hot data are separated and the overall system performance is improved.
[0052] Figure 4 is a flow chart illustrating a migration thread according to an embodiment of the present disclosure.
[0053] The migration thread is a multi-threaded background thread used to implement data migration. Figure 4 In step S401, the migration thread can determine whether the channel to be migrated has been written. A channel that has not been written can be called a migratable channel. Only migratable channels will be considered for migration tasks. Therefore, migration tasks and write tasks will not occur on the same channel at the same time. Because the migration task is only executed when the channels are not written, write errors caused by migration can be avoided.
[0054] In step S402, the migration thread may determine whether the usage of the target layer is less than a third threshold. The third threshold may be less than or equal to the second threshold. For example, the third threshold may be a pre-set value for indicating the usage percentage or upper limit of the usage of the target layer. The third threshold may be used to ensure that the target layer has sufficient capacity to store the channels to be migrated.
[0055] In step S403, a target channel is newly created in the target layer. For example, the size of the target channel is the same as or similar to the size of the channel to be migrated.
[0056] In step S404, the channel to be migrated is copied to the target channel.
[0057] In step S405, the storage state corresponding to the target channel is updated to "located at the target layer". For example, after the channel to be migrated is copied to the target channel, the channel ID corresponding to the channel to be migrated is updated to the channel ID of the target channel, and the storage state corresponding to the channel to be migrated is updated to "located at the target layer". In an embodiment, the update is an atomic update. In this case, the next read operation will be directly executed on the target channel, thereby bypassing the original channel to be migrated.
[0058] In step S406, it is determined whether the channel to be migrated is being read. If it is being read, the process returns to wait until it is no longer being read and then executes the subsequent steps.
[0059] In an embodiment, in order to determine the read status of the channel to be migrated, a read counter may be set for each channel (for example, readCounter may be set, and the initial value of readCounter is 0). When a channel is accessed by a read task, the read counter is incremented by 1 (readCounter++), and when the read task is completed, the read counter is decremented by 1 (readCounter--). Therefore, when the read counter of the channel to be migrated is 0, it can be determined that the channel to be migrated has not been read.
[0060] In step S407, when it is determined that none of the channels to be migrated have been read, the channels to be migrated are deleted. Because the deletion task is executed only when none of the channels to be migrated have been read, the reading error caused by the deletion task is avoided.
[0061] Reference Figure 2 and Figure 4 , according to the scheduling thread of the embodiment of the present disclosure, the migration thread can be called. For example, when the scheduling thread determines in step S20 that at least one of the front channels in the first channel list is to be migrated to the next layer, the at least one front channel in the first channel list can be determined as the channel to be migrated, and the next layer can be determined as the target layer, and the channel to be migrated and the target layer can be transmitted as input to the migration thread. Alternatively, when the scheduling thread determines in step S30 that at least one of the last channels in the second channel list is to be migrated to the current layer, the at least one last channel in the second channel list can be determined as the channel to be migrated, and the current layer can be determined as the target layer, and the channel to be migrated and the target layer can be transmitted as input to the migration thread. For example, the scheduling thread can create a migration task based on the channel to be migrated and the target layer, and place it in the migration task queue.
[0062] In a specific embodiment, in step S20 (see Figure 2), the scheduling thread can create a migration task from the current layer to the next layer, and place it at the end of the high-low migration task queue (H2L task queue). Thereafter, the migration thread reads the H2L task queue (pop H2L task queue), and if a task exists, the following steps are performed: determine whether at least one of the front channels in the first channel list has been written (S401); when the usage of the next layer is less than the third threshold (S402), create a new target channel in the next layer (S403); copy at least one of the front channels in the first channel list to the target channel (S404); update the storage status corresponding to the target channel to be located in the next layer (S405); determine that at least one of the front channels in the first channel list has not been read (S406) and delete at least one of the front channels in the first channel list (S407).
[0063] In a specific embodiment, in step S30 (see Figure 2 ), the scheduling thread can create a migration task from the next layer to the current layer, and place it at the front of the low-high migration task queue (L2H task queue). Thereafter, the migration thread reads the L2H task queue (pop L2H task queue). If a task exists, the following steps are performed: determine whether at least one of the last channels in the second channel list is written (S401); when the usage of the current layer is less than a third threshold value (S402), create a new target channel in the current layer (S403); copy at least one of the last channels in the second channel list to the target channel (S404); update the storage state corresponding to the target channel to be located in the current layer (S405); determine that at least one of the last channels in the second channel list has not been read (S406) and delete at least one of the last channels in the second channel list (S407).
[0064] According to one or more aspects of the present disclosure, a method for data hierarchical storage uses non-volatile memory as the first layer of non-volatile hierarchical storage, thereby achieving better performance than existing solutions. In addition, according to one or more aspects of the present disclosure, a migration strategy for data migration is implemented by scheduling threads and migration threads, thereby effectively avoiding read errors or write errors caused by migration. Thus, the hierarchical storage effect is maximized without incurring significant additional storage costs.
[0065] Figure 5 is a block diagram of an apparatus 10 for hierarchical data storage according to the present disclosure.
[0066] According to one or more aspects of the present disclosure, the present disclosure provides a device 10 for hierarchical data storage, the device 10 comprising: a hierarchical storage structure 110 , a scheduling unit 120 , a channel creation unit 130 and a migration unit 140 .
[0067] The hierarchical storage structure 110 is configured to include at least two storage layers, wherein the at least two storage layers include a current layer and a next layer directly adjacent to the current layer, and the read and write performance of the current layer is higher than the read and write performance of the next layer. Figure 2 The described hierarchical storage structures are the same or similar, so redundant descriptions are omitted here.
[0068] The scheduling unit 120 is configured to execute a scheduling thread. For example, if the usage of the current layer is equal to or greater than a first threshold, the scheduling unit 120 executes a first migration operation, which migrates at least one channel at the front of the first channel list to the next layer and appends it to the second channel list. If the usage of the current layer is less than the first threshold, the scheduling unit 120 executes a second migration operation, which migrates at least one channel at the back of the second channel list to the current layer and inserts it to the front of the first channel list. The scheduling unit 120 may be configured to execute a reference Figure 2 The method described in steps S10 to S30 in , so redundant description is omitted here.
[0069] The channel creation unit 130 is configured to perform a channel creation operation. For example, if the usage of the current layer is less than the second threshold, the channel creation unit creates a new channel in the current layer, appends the new channel to the first channel list, and sets the storage state corresponding to the new channel to be located in the current layer; if the usage of the current layer is equal to or greater than the second threshold, the channel creation unit creates a new channel in the next layer, appends the new channel to the second channel list, and sets the storage state corresponding to the new channel to be located in the next layer, wherein the second threshold is greater than or equal to the first threshold. The channel creation unit 130 can be configured to perform a reference operation. Figure 3 The method described in steps S301 to S303 in , so redundant description is omitted here.
[0070] The migration unit 140 is configured to receive an instruction from the scheduling unit 120 to perform a first migration operation or a second migration operation. For example, when the migration unit 140 is configured to perform the following steps when performing the first migration operation: when the usage of the next layer is less than the third threshold, a new target channel is created in the next layer; at least one channel at the front of the first channel list is copied to the target channel; the storage state corresponding to the target channel is updated to be located in the next layer; and at least one channel at the front of the first channel list is deleted. The migration unit 140 is also configured to: when performing the first migration operation, when it is determined that at least one channel at the front of the first channel list has not been read, the step of deleting at least one channel at the front of the first channel list is performed. For another example, when the migration unit 140 is configured to perform the following steps when performing the second migration operation: when the usage of the current layer is less than the third threshold, a new target channel is created in the current layer; at least one channel at the back of the second channel list is copied to the target channel; the storage state corresponding to the target channel is updated to be located in the current layer; and at least one channel at the back of the second channel list is deleted. The migration unit 140 is further configured to: when performing the second migration operation, when it is determined that at least one of the last channels in the second channel list has not been read, perform a step of deleting at least one of the last channels in the second channel list. The third threshold is less than or equal to the second threshold. The migration unit 140 may be configured to perform a reference operation. Figure 4 The method described in steps S401 to S407 in , so redundant description is omitted here.
[0071] Regarding the device in the above embodiment, the specific manner in which each module / unit performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0072] Figure 6 is a block diagram illustrating an electronic device 600 according to an exemplary embodiment of the present disclosure.
[0073] Reference Figure 6 The electronic device 600 includes at least one memory 601 and at least one processor 602, wherein the at least one memory 601 stores computer executable instructions. When the computer executable instructions are executed by the at least one processor 602, the at least one processor 602 is prompted to execute the method for hierarchical data storage according to an embodiment of the present disclosure.
[0074] As an example, the electronic device 600 may be a PC, a tablet device, a personal digital assistant, a smart phone, or other device capable of executing the above instructions. Here, the electronic device 600 is not necessarily a single electronic device, but may also be any device or circuit capable of executing the above instructions (or instruction sets) individually or in combination. The electronic device 600 may also be part of an integrated control system or system manager, or may be configured as a portable electronic device interconnected with a local or remote (e.g., via wireless transmission) interface.
[0075] In the electronic device 600, the processor 602 may include a central processing unit (CPU), a graphics processing unit (GPU), a programmable logic device, a dedicated processor system, a microcontroller or a microprocessor. As an example and not limitation, the processor may also include an analog processor, a digital processor, a microprocessor, a multi-core processor, a processor array, a network processor, etc.
[0076] The processor 602 may execute instructions or codes stored in the memory 601, which may also store data. Instructions and data may also be sent and received over a network via a network interface device, which may employ any known transmission protocol.
[0077] The memory 601 may be integrated with the processor 602, for example, by placing RAM or flash memory within an integrated circuit microprocessor or the like. In addition, the memory 601 may include a separate device, such as an external disk drive, a storage array, or any other storage device that can be used by a database system. The memory 601 and the processor 602 may be operatively coupled, or may communicate with each other, such as through an I / O port, a network connection, etc., so that the processor 602 can read files stored in the memory.
[0078] In addition, the electronic device 600 may further include a video display (such as a liquid crystal display) and a user interaction interface (such as a keyboard, a mouse, a touch input device, etc.) All components of the electronic device 600 may be connected to each other via a bus and / or a network.
[0079] According to an embodiment of the present disclosure, a computer-readable storage medium may also be provided, wherein when the instructions stored in the computer-readable storage medium are executed by at least one processor, the at least one processor is prompted to execute the method for hierarchical data storage according to an embodiment of the present disclosure. Examples of computer-readable storage media here include: read-only memory (ROM), random access programmable read-only memory (PROM), electrically erasable programmable read-only memory (EEPROM), random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), flash memory, non-volatile memory, CD-ROM, CD-R, CD+R, CD-RW, CD+RW, DVD-ROM, DVD-R, DVD+R, DVD-RW, DVD+RW, DVD-RAM, BD-ROM, BD-R, BD-R LTH, BD-RE, Blu-ray or optical disk storage, hard disk drive (HDD), solid state drive (SSD), card storage (such as, multimedia card, secure digital (SD) card or extreme digital (XD) card), magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid state disk and any other device, any other device is configured to store computer programs and any associated data, data files and data structures in a non-transitory manner and provide the computer programs and any associated data, data files and data structures to a processor or computer so that the processor or computer can execute the computer program. The computer program in the above-mentioned computer-readable storage medium can be run in an environment deployed in a computer device such as a client, a host, an agent device, a server, etc. In addition, in one example, the computer program and any associated data, data files and data structures are distributed on a networked computer system, so that the computer program and any associated data, data files and data structures are stored, accessed and executed in a distributed manner by one or more processors or computers.
[0080] According to an embodiment of the present disclosure, a computer program product may also be provided, including computer instructions, which, when executed by at least one processor, implement the method for hierarchical data storage according to an embodiment of the present disclosure.
[0081] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0082] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for hierarchical data storage, characterized in that: The method is applied to a hierarchical storage structure provided with at least two storage layers, wherein the read and write performance of the at least two storage layers decreases from top to bottom, including a current layer and a next layer directly adjacent to the current layer, and the method comprises: Execute the scheduling thread, If the usage of the current layer is equal to or greater than a first threshold, a first migration operation is performed, wherein the first migration operation migrates at least one channel at the front of the first channel list to the next layer and appends it to the second channel list; and If the usage of the current layer is less than the first threshold, a second migration operation is performed, wherein the second migration operation migrates at least one channel at the end of the second channel list to the current layer and inserts it to the front of the first channel list. The first channel list represents channels included in the current layer, and the second channel list represents channels included in the next layer. A channel creation operation is performed, wherein if the usage of the current layer is less than a second threshold, a channel is created in the current layer; if the usage of the current layer is equal to or greater than the second threshold, a channel is created in the next layer, and the second threshold is greater than or equal to the first threshold.
2. The method according to claim 1, characterized in that The execution channel creation operation further includes: If the usage of the current layer is less than a second threshold, the newly created channel is added to the first channel list, and the storage state corresponding to the newly created channel is set to be located in the current layer; and If the usage of the current layer is equal to or greater than the second threshold, the newly created channel is added to the second channel list, and the storage state corresponding to the newly created channel is set to be located in the next layer.
3. The method according to claim 2, characterized in that The first migration operation includes: When the usage of the next layer is less than a third threshold, creating a new target channel in the next layer; Copying the first at least one channel in the first channel list to the target channel; Updating the storage state corresponding to the target channel to be located at the next layer; and deleting at least one of the first channels in the first channel list, The third threshold is less than or equal to the second threshold.
4. The method according to claim 2, characterized in that: The second migration operation includes: When the usage of the current layer is less than a third threshold, creating a new target channel in the current layer; Copying at least one of the last channels of the second channel list to the target channel; updating the storage state corresponding to the target channel to be located at the current layer; and deleting at least one of the last channels of the second channel list, The third threshold is less than or equal to the second threshold.
5. The method according to claim 3 or 4, characterized in that: The method further includes: when it is determined that none of the channels to be migrated have been written, executing at least one of the corresponding first migration operation and the second migration operation, the channels to be migrated being at least one of the frontmost at least one channel in the first channel list and the rearmost at least one channel in the second channel list.
6. The method according to claim 3, characterized in that The first migration operation further includes: when it is determined that the at least one channel at the front of the first channel list has not been read, executing the step of deleting the at least one channel at the front of the first channel list.
7. The method according to claim 4, characterized in that The second migration operation further includes: when it is determined that the at least one last channel of the second channel list has not been read, executing the step of deleting the at least one last channel of the second channel list.
8. The method according to claim 1, characterized in that The at least two storage layers include a first layer with the highest read / write performance and a second layer directly adjacent to the first layer, and the performing of the channel creation operation further includes: If the usage of the first layer is less than the second threshold, a new channel is created in the first layer, the new channel is added to the channel list of the first layer, and the storage state corresponding to the new channel is set to be located in the first layer; and If the usage of the first layer is equal to or greater than the second threshold, a new channel is created in the second layer, the new channel is added to the channel list of the second layer, and the storage state corresponding to the new channel is set to be located in the second layer.
9. The method according to claim 1, characterized in that: The at least two storage layers include at least one of non-volatile memory, NVMe SSD, SATA SSD, HDD RAID and HDD.
10. A device for hierarchical data storage, characterized in that: The device comprises: A hierarchical storage structure is configured to include at least two storage layers, wherein the read and write performance of the at least two storage layers decreases from top to bottom, including a current layer and a next layer directly adjacent to the current layer; and The scheduling unit is configured to execute the scheduling thread, If the usage of the current layer is equal to or greater than the first threshold, the scheduling unit performs a first migration operation, wherein the first migration operation migrates at least one channel at the front of the first channel list to the next layer and appends it to the second channel list, If the usage of the current layer is less than the first threshold, the scheduling unit performs a second migration operation, wherein the second migration operation migrates at least one channel at the end of the second channel list to the current layer and inserts it to the front of the first channel list, and The first channel list represents channels included in the current layer, and the second channel list represents channels included in the next layer. A channel creation unit is configured to perform a channel creation operation, wherein if the usage of the current layer is less than a second threshold, a channel is created in the current layer; if the usage of the current layer is equal to or greater than the second threshold, a channel is created in the next layer, and the second threshold is greater than or equal to the first threshold.
11. The device according to claim 10, characterized in that The channel creation unit is further configured as follows: If the usage of the current layer is less than a second threshold, adding the newly created channel to the first channel list, and setting the storage state corresponding to the newly created channel to be located in the current layer; and If the usage of the current layer is equal to or greater than the second threshold, the newly created channel is added to the second channel list, and the storage state corresponding to the newly created channel is set to be located in the next layer.
12. The device according to claim 11, characterized in that The apparatus further includes: a migration unit configured to receive an instruction from the scheduling unit to perform the first migration operation, When the usage of the next layer is less than a third threshold, a new target channel is created in the next layer; at least one of the first channels in the first channel list is copied to the target channel; the storage state corresponding to the target channel is updated to be located in the next layer; and at least one of the first channels in the first channel list is deleted, and The third threshold is less than or equal to the second threshold.
13. The device according to claim 11, characterized in that The apparatus further includes: a migration unit configured to receive an instruction from the scheduling unit to perform the second migration operation, When the usage of the current layer is less than a third threshold, a new target channel is created in the current layer; at least one of the last channels in the second channel list is copied to the target channel; the storage state corresponding to the target channel is updated to be located in the current layer; and at least one of the last channels in the second channel list is deleted, and The third threshold is less than or equal to the second threshold.
14. The device according to claim 12 or 13, characterized in that The migration unit is further configured to, when it is determined that none of the channels to be migrated have been written, perform at least one of the corresponding first migration operation and the second migration operation, and the channels to be migrated are at least one of the frontmost at least one channel in the first channel list and the rearmost at least one channel in the second channel list.
15. The device according to claim 12, characterized in that The migration unit is further configured to, when performing the first migration operation, further include: when it is determined that the front at least one channel of the first channel list has not been read, perform the step of deleting the front at least one channel of the first channel list.
16. The device according to claim 13, characterized in that The migration unit is further configured to, when performing the second migration operation, further include: when it is determined that the last at least one channel of the second channel list has not been read, perform the step of deleting the last at least one channel of the second channel list.
17. The device according to claim 10, characterized in that The at least two storage layers include a first layer having the highest read / write performance and a second layer directly adjacent to the first layer, and the channel creation unit is further configured as follows: If the usage of the first layer is less than the second threshold, the channel creation unit creates a new channel in the first layer, adds the new channel to the channel list of the first layer, and sets the storage state corresponding to the new channel to be located in the first layer; and If the usage of the first layer is equal to or greater than the second threshold, the channel creation unit creates a new channel in the second layer, appends the new channel to the channel list of the second layer, and sets the storage state corresponding to the new channel to be located in the second layer.
18. The device according to claim 10, characterized in that The at least two storage layers include at least one of non-volatile memory, NVMe SSD, SATA SSD, HDD RAID and HDD.
19. An electronic device comprising at least one processor and at least one memory storing instructions, wherein: When the instructions are executed by the at least one processor, the at least one processor is prompted to perform the data hierarchical storage method according to any one of claims 1 to 9.
20. A computer-readable storage medium storing instructions, wherein: When the instructions are executed by at least one computing device, the at least one computing device is prompted to perform the data hierarchical storage method according to any one of claims 1 to 9.
