Data storage method and device, computer equipment, storage medium and program product
By buffering data in the data storage system to a virtual unit and storing it to physical data blocks according to the hot and cold levels, the write amplification problem caused by frequent cold data transfer is solved, and more efficient storage performance and longer storage media life are achieved.
Patent Information
- Application Number
- CN202411707849.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-04-25
AI Technical Summary
During garbage collection, the frequent transfer of cold data in existing data storage systems leads to write amplification, which shortens the service life of NAND storage media.
By buffering the data to be stored to different virtual units in the target virtual area, and storing the data in the virtual units of the same hot and cold level to different physical units in the corresponding physical data block according to the hot and cold levels of each virtual unit in the hot and cold data policy table, the data in the virtual units of the same hot and cold level are stored in the corresponding physical data block, thereby realizing the refined hot and cold distinction of data and the consistency of the hot and cold levels of the data in the same physical data block.
Reduces write amplification, improves the storage performance of the storage system, and extends the service life of NAND storage media.
Smart Images

Figure CN119883107A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of distributed storage technology, and in particular to a data storage method, apparatus, computer equipment, storage medium and computer program product. Background Art
[0002] In the era of big data, a large amount of data needs to be stored every day, and storage systems play an increasingly important role. Due to the development of the process of non-volatile memory NAND, the life of storage media is getting shorter and shorter, and the number of erases per physical block has dropped from tens of thousands to hundreds of times now. In order to maximize the use efficiency of NAND in its limited life cycle, it is necessary to minimize write amplification and reduce the number of erases of data blocks when designing the storage system. In order to face this challenge, separating hot and cold data is an effective way.
[0003] However, the existing method of dividing cold data and hot data has the problem of unreasonable division, which leads to the frequent movement of cold data during garbage collection in the existing data storage process, thereby causing a certain amount of write amplification and greatly shortening the service life of NAND. Summary of the invention
[0004] Based on this, it is necessary to provide a data storage method, device, computer equipment, storage medium and program product that can reduce some amplification and improve storage performance in response to the above technical problems.
[0005] In a first aspect, the present application provides a data storage method, comprising:
[0006] caching the data to be stored in different virtual units in the target virtual area;
[0007] According to the hot and cold levels of each virtual unit in the hot and cold data strategy table, the data in each virtual unit of the same hot and cold level is stored in different physical units in the corresponding physical data block; the hot and cold level indicates the hot and cold degree of the data in the corresponding virtual unit.
[0008] The method described in the above embodiment defines the hot and cold levels of data by distinguishing the hot and cold degrees of data, thereby refining and distinguishing the hot and cold levels of data in virtual units, and storing data in virtual units of the same hot and cold level in the same physical data block, so that data in different physical units in the same physical data block correspond to the same hot and cold level. When the data in a physical data block is updated, since the hot and cold levels of the entire physical data block are the same, all data in the same physical data block may be invalid in the same time period later. For later garbage management, these physical data blocks do not require data migration and can directly release space, thereby reducing write amplification and improving the storage performance of the storage system.
[0009] In one embodiment, storing data in virtual units at the same hot / cold level to different physical units in the corresponding physical data block according to the hot / cold level of each virtual unit in the hot / cold data strategy table includes:
[0010] According to the hot and cold levels of each virtual unit in the hot and cold data strategy table, the virtual units are divided into a plurality of virtual unit groups; the virtual unit group includes a plurality of virtual units with the same hot and cold level;
[0011] For each virtual unit group, data in different virtual units in the virtual unit group are stored in different physical units in the corresponding physical data block; the hot and cold levels of different virtual unit groups are consistent with the hot and cold levels of corresponding different physical data blocks.
[0012] The method described in the above embodiment writes the data in the virtual units of the same hot / cold level into the same physical data block, so that the hot / cold levels of the data in the physical units contained in the same physical data block are the same, which can reduce the number of write methods for recycling the physical data blocks at a later time, thereby improving the storage performance of the storage system.
[0013] In one embodiment, the method further comprises:
[0014] Determining a hot / cold level of each of the virtual units according to a first life cycle of each of the virtual units;
[0015] The hot and cold data strategy table is generated according to the hot and cold levels of each of the virtual units.
[0016] The method described in the above embodiment determines the hotness or coldness level of the virtual unit through the life cycle of the data in the virtual unit, so as to subdivide the hotness or coldness of the data instead of only using cold or hot to distinguish the hotness or coldness of the data. This can improve the efficiency of space recovery based on the hotness or coldness level of the data in the later stage, and reduce the write amplification operation of space recovery.
[0017] In one embodiment, determining the hot / cold level of each virtual unit according to the first life cycle of each virtual unit includes:
[0018] The hot / cold level of each virtual unit is determined according to the first life cycle of each virtual unit and a preset level division interval; the preset level division interval includes a cycle range corresponding to different hot / cold levels.
[0019] The method described in the above embodiment determines the hotness or coldness level of the virtual unit through the life cycle of the data in the virtual unit, so as to subdivide the hotness or coldness of the data instead of only using cold or hot to distinguish the hotness or coldness of the data. This can improve the efficiency of space recovery based on the hotness or coldness level of the data in the later stage, and reduce the write amplification operation of space recovery.
[0020] In one embodiment, the method further comprises:
[0021] Acquire a first data write time of each of the virtual units; the first data write time is determined according to a write time of a preset number of data in the virtual unit, or is determined according to a write time of all data in the virtual unit;
[0022] The first life cycle of each virtual unit is determined according to the first data writing time of each virtual unit.
[0023] The method described in the above embodiment determines the life cycle of each virtual unit by the write time of each virtual unit, which can improve the accuracy and granularity of the subsequent division of hot and cold levels based on the life cycle, and can store data according to the degree of hot and cold, and put data with the same hot and cold levels into the same physical data block for processing, which can reduce the frequency of data migration and write amplification operations in the later stage, and improve the overall storage performance of the storage system.
[0024] In one embodiment, the method further comprises:
[0025] For each of the physical data blocks, obtaining the second life cycle, the second data writing time and the current system time of each physical unit in the physical data block;
[0026] Determine the end of life time of each of the physical units in the physical data block according to the second life cycle, the second data writing time and the current system time;
[0027] According to the life expiration time of each physical unit in each physical data block, the data in the physical unit with the same life expiration time is written into the same new physical data block.
[0028] The method described in the above embodiment can better put data with the same expiration time together during garbage collection, which can reduce the problems caused by errors in the life cycle and further improve the storage performance of the storage system.
[0029] In a second aspect, the present application also provides a data storage device, comprising:
[0030] A cache module, used for caching data to be stored in different virtual units in the target virtual area;
[0031] The storage module is used to store the data in each virtual unit of the same hot or cold level to different physical units in the corresponding physical data block according to the hot or cold level of each virtual unit in the hot or cold data strategy table; the hot or cold level indicates the hot or cold degree of the data in the corresponding virtual unit.
[0032] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0033] caching the data to be stored in different virtual units in the target virtual area;
[0034] According to the hot and cold levels of each virtual unit in the hot and cold data strategy table, the data in each virtual unit of the same hot and cold level is stored in different physical units in the corresponding physical data block; the hot and cold level indicates the hot and cold degree of the data in the corresponding virtual unit.
[0035] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0036] caching the data to be stored in different virtual units in the target virtual area;
[0037] According to the hot and cold levels of each virtual unit in the hot and cold data strategy table, the data in each virtual unit of the same hot and cold level is stored in different physical units in the corresponding physical data block; the hot and cold level indicates the hot and cold degree of the data in the corresponding virtual unit.
[0038] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0039] caching the data to be stored in different virtual units in the target virtual area;
[0040] According to the hot and cold levels of each virtual unit in the hot and cold data strategy table, the data in each virtual unit of the same hot and cold level is stored in different physical units in the corresponding physical data block; the hot and cold level indicates the hot and cold degree of the data in the corresponding virtual unit. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0042] Figure 1 One of the schematic diagrams of an existing storage process in an embodiment;
[0043] Figure 2 The second schematic diagram of an existing storage process in an embodiment;
[0044] Figure 3 The third schematic diagram of an existing storage process in an embodiment;
[0045] Figure 4 A schematic diagram of the structure of a storage system in one embodiment;
[0046] Figure 5 This is one of the flowcharts of a data storage method in one embodiment;
[0047] Figure 6 is a schematic diagram of a method for integrating a virtual unit in one embodiment;
[0048] Figure 7 This is a second flow chart of a data storage method in an embodiment;
[0049] Figure 8 This is a third flow chart of a data storage method in an embodiment;
[0050] Fig. 9 This is a fourth flow chart of a data storage method in an embodiment;
[0051] Fig.10 is one of the schematic diagrams of a physical data block in one embodiment;
[0052] Fig.11 This is a fifth flow chart of a data storage method in an embodiment;
[0053] Fig.12 FIG2 is a second schematic diagram of a physical data block in an embodiment;
[0054] Fig.13 This is a sixth flow chart of a data storage method in an embodiment;
[0055] Fig.14 is a structural block diagram of a data storage device in one embodiment;
[0056] Fig.15 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0058] In the era of big data, a large amount of data needs to be stored every day, and storage systems play an increasingly important role. Due to the development of NAND technology, the life of storage media is getting shorter and shorter, and the number of erases of each physical block has dropped from tens of thousands to hundreds of times now. In order to maximize the use efficiency of NAND in its limited life cycle, it is necessary to minimize write amplification and reduce the number of erases of data blocks when designing the storage system. In order to face this challenge, separating hot and cold data is an effective way. If cold data and hot data are written together, cold data will be frequently moved during garbage collection, resulting in a certain amount of write amplification.
[0059] Currently, when distinguishing between cold and hot data, the main method is to record the number of write operations of the logical block addressing (LBA) written, and then divide the data into hot and cold according to the value. When performing garbage collection, the hot and cold data are moved to the corresponding heat level storage blocks respectively. And the data will only be divided into two levels, cold or hot. For the business, some data may be written several times a day, such as real-time stock trading records. And some data is updated weekly, monthly, quarterly or annually, such as weekly reports, monthly reports or annual reports. For this kind of data with different life cycles, it is unreasonable to simply divide it into cold or hot data. It will still cause data of different cycles to be put together, increasing the invalid movement of data. Thereby increasing write amplification and reducing the life of the storage medium. For example, see Figure 1 In the existing data storage process shown in FIG. 1 , when writing data, hot data and cold data are first placed in the same data block (see Figure 1 and Figure 2 The first Data Block table in the table), and then update the correspondence table between the data write address and the logical address (see Figure 1 The second Meta Tablek in ). Finally, the write time corresponding to the write LBA is recorded and the write frequency is updated. When the update frequency reaches a certain level, a data heat table is generated (see Figure 1The third Lba heat table in the table). Since the data writing time information is recorded separately, it will increase the management complexity. After the heat information is sent to the data migration module, the data migration module passively initiates the data migration and separates the cold data and hot data by migration. Write all the cold data to the same data block, keep the hot data unchanged, and wait for the hot data to gradually become invalid data. See the cold data migration diagram Figure 2 Among them, when moving cold data, the cold and hot strategy table (see Figure 2 The hot and cold levels of LBA in the LBA heat policy table in the table are either cold or hot, so data of different temperatures are put together. Assume that data with an LBA overwrite interval of less than 5 days is considered hot data, and data with an LBA overwrite interval of more than 5 days is considered cold data. When data of different temperatures with a period of 1 to 4 days exist in the same data block at the same time. The data of different temperatures in the data block will gradually become invalid at different time periods, such as Figure 3 When garbage collection is performed, data blocks with more invalid data are often selected for garbage collection. Therefore, on the third or fourth day, the data in the data block may be moved away, resulting in frequent cold data movement, increased write amplification, and reduced service life of the storage medium.
[0060] In view of this, the embodiments of the present application propose a data storage method, apparatus, computer device, storage medium and program product, which refine the hotness and coldness level of data by calculating the hotness and coldness of each LBA, reduce the write amplification caused by garbage collection during data storage, and thus increase the service life of the storage medium.
[0061] It should be noted that the beneficial effects brought about by the embodiments of the present application or the technical problems solved are not limited to this one, but may also include other implicit or related problems. For details, please refer to the description of the following embodiments.
[0062] The data storage method provided in the embodiment of the present application can be applied to Figure 4 The storage system shown in FIG. 1 includes multiple virtual areas 102, hot and cold data strategy areas 104, address mapping areas 106, and multiple physical data blocks 108 (Data Block) in the host side; the virtual area 102 includes multiple virtual units 1021 (Lba), the physical data block 108 includes multiple physical units 1081 (Vba), the hot and cold data strategy area 104 includes the hot and cold levels corresponding to each virtual unit 1021; the address mapping area 106 includes the address mapping relationship between each virtual unit 1021 and each physical unit 1081. The storage system can be a storage system on a computer device, or a storage system corresponding to a distributed storage server cluster. Figure 1 The number of virtual units 1021, physical units 1081, and physical data blocks 108 is only an example, and there is no limit on the number of virtual units 1021 and physical data blocks 108. There is no limit on the number of virtual areas 102. Figure 4 Only one virtual area is shown for illustration purposes only.
[0063] In an exemplary embodiment, Figure 5 As shown, a data storage method is provided, which is applied to Figure 4 The following is an example of the storage system in Figure 1.
[0064] S201, caching data to be stored into different virtual units in a target virtual area.
[0065] The target virtual area is located in the memory of the storage system and is divided into multiple virtual units for temporarily storing data sent by the host. The data in different virtual units corresponds to different degrees of hotness and coldness. Virtual units are usually marked as Lba, see Figure 4 In the storage system, the target virtual area 102 includes n virtual units Lba1021.
[0066] In an embodiment of the present application, when the host side in the storage system pre-writes data, the data to be stored can be temporarily stored in the target virtual area. Specifically, the received data to be stored can be cached in each virtual unit in the target virtual area according to different write times, or different life cycles, or different business types, so that the storage system can then extract the data to be stored from each virtual unit for persistence operations.
[0067] S202 , according to the hot and cold levels of the virtual units in the hot and cold data strategy table, storing the data in the virtual units at the same hot and cold level into different physical units in the corresponding physical data blocks.
[0068] Among them, the hot and cold levels indicate the hotness or coldness of the data in the corresponding virtual unit. The hot and cold levels can be represented by the life cycle of the data or the business type of the data. For example, the hot and cold levels can be divided into several intervals: [0-1 day), [1-7 days), [3-30 days), [30-90 days), [greater than 90 days); optionally, the hot and cold levels can be distinguished by different levels. For example, the hot and cold levels include the first level, the second level, the third level, ..., the Nth level, and each level corresponds to the same type of business data, or data with the same life cycle. For another example, the first level may correspond to data of [greater than 90 days), the second level corresponds to data of [30-90 days), the third level corresponds to data of [3-30 days), the fourth level corresponds to data of [1-7 days), and the fifth level corresponds to data of [0-1 day). The hot and cold data policy table records the hot and cold levels corresponding to different virtual units, and the hot and cold data policy table is pre-configured and exists in the cache. For example, see Figure 4 The hot and cold data strategy area 104 records the hot and cold level (1 day) corresponding to the virtual unit Lba 0, the hot and cold level (2 day) corresponding to the virtual unit Lba 1, the hot and cold level (1 day) corresponding to the virtual unit Lba 2, the hot and cold level (7 day) corresponding to the virtual unit Lba 3, ..., the hot and cold level (30 day) corresponding to the virtual unit Lba n. Optionally, the hot and cold data strategy table can also record the address mapping relationship between different virtual units and physical data blocks, and the address mapping relationship between different virtual units and different physical units. Physical data blocks are usually marked as Data Block, and physical units are usually marked as Vba.
[0069] In the embodiment of the present application, when the storage system caches the data to be stored in different virtual units in the target virtual area based on the above steps, different hot and cold levels can be configured in advance for different virtual units. Specifically, the storage system can determine the hot and cold level of the virtual unit where the data is located by analyzing the hot and cold degree of the data in the virtual unit, or determine the hot and cold level of the virtual unit where the data is located by analyzing the business type of the data in the virtual unit or the life cycle of the data. Based on the above method, the storage system determines the hot and cold level corresponding to each virtual unit in the target virtual area, forms a corresponding relationship with each virtual unit, and then records them, and generates a hot and cold data strategy table (see Figure 4When the storage system has data to write, that is, when the data to be stored is cached in the target virtual area, the storage system can directly call the hot and cold data strategy table, query the hot and cold levels of each virtual unit, and store the data in the virtual units with the same hot and cold levels in the corresponding physical data block, and distribute them to different physical units, so that the hot and cold levels of the data in each physical unit in the same physical data block are the same, so as to realize the persistent storage of data. Optionally, when the storage system stores data in virtual units at the same hot or cold level in the corresponding same physical data block, the specific execution steps are as follows: if the hot and cold data policy table also records the address mapping relationships between different virtual units and physical data blocks, as well as the address mapping relationships between different virtual units and different physical units, the storage system can query the records in the hot and cold data policy table, and determine the addresses of the physical data blocks and the addresses of the physical units corresponding to each virtual unit based on the address mapping relationships between different virtual units and physical data blocks, as well as the address mapping relationships between different virtual units and different physical units, and then write the data in each virtual unit into the corresponding physical data block and into each corresponding physical unit based on the addresses of the physical data blocks and the addresses of the physical units corresponding to each virtual unit; if the hot and cold data policy table does not record the address mapping relationships between different virtual units and physical data blocks, as well as the address mapping relationships between different virtual units and different physical units, query the address mapping table (corresponding to Figure 4 According to the records in the address mapping area 106 in the address mapping table, the address of the physical data block and the address of the physical unit corresponding to each virtual unit are determined according to the address mapping relationship between different virtual units and physical data blocks, and the address mapping relationship between different virtual units and different physical units recorded in the address mapping table, and then according to the address of the physical data block and the address of the physical unit corresponding to each virtual unit, the data in each virtual unit is written into the corresponding physical data block and into each corresponding physical unit.
[0070] It should be noted here that the storage system can be pre-divided into multiple physical data blocks (see Figure 4The physical data blocks 108 in the embodiment of the present invention correspond to different virtual units, and different physical units in the same physical data block correspond to different virtual units. The address mapping relationship between different physical data blocks and different virtual units can be pre-defined or identified, and the address mapping relationship between different physical units and different virtual units can be pre-defined or identified. The address mapping relationship between different physical data blocks and different virtual units can be pre-recorded in the hot and cold data strategy table, or pre-recorded in the address mapping table. The address mapping relationship between different physical units and different virtual units can be pre-defined or identified, and can be pre-recorded in the hot and cold data strategy table, or pre-recorded in the address mapping table. Here, the addresses of different virtual units of the same hot and cold level must correspond to the address of the same physical data block. When the storage system is preparing to store data in virtual units of the same hot or cold level into the corresponding physical data block, it can first determine which virtual units of the same hot or cold level are based on the hot or cold levels of each virtual unit in the hot or cold data strategy table, and then query the hot or cold data strategy table or call the address mapping table to query, determine the addresses of the physical data blocks and the addresses of the physical units corresponding to the virtual units of the same hot or cold level, and finally write the data of the virtual units of the same hot or cold level into the same physical data block according to the addresses of the physical data blocks, and write the data in each virtual unit into different physical units in the physical data block in sequence according to the addresses of the physical units.
[0071] Optionally, when the storage system writes all data in the target virtual area to the corresponding physical data blocks according to the above method, the hot and cold levels of each physical data block can be marked and recorded in each physical data block for use in subsequent operations on the data in each physical data block.
[0072] Optionally, after the storage system stores the data in each virtual unit of the same hot / cold level into different physical units in the corresponding physical data block, the storage system may further execute the step of: determining whether each physical data block is valid when garbage collection is performed on the storage system, and performing garbage collection on the physical data blocks that are determined to be invalid. Since the hot / cold levels of each physical unit in each physical data block are consistent, the validity of each physical unit in each physical data block is also consistent. For example, if each physical data block is invalid, then the physical unit in each physical data block is also invalid. If each physical data block is valid, then the physical unit in each physical data block is also valid.
[0073] Optionally, when writing data, each virtual unit Lba needs to record the data to be stored (metadata) for persistence. In order to improve the writing speed of the data to be stored, the data to be stored cannot be modified directly on the previous data to be stored, but the data to be stored is directly appended. Based on this, the storage system includes multiple virtual areas. When the storage system executes step S201, that is, caches the data to be stored to different virtual units in the target virtual area, it can also timely or regularly integrate the data in the same virtual units in different virtual areas. For example, see Figure 6 The schematic diagram shown in the figure includes a virtual area Meta table 1, a virtual area Meta table 2 and a virtual area Meta table 3. When the virtual area Meta table 1 and the virtual area Meta table 2 are integrated, the data in the virtual unit Lba 0 in the virtual area Meta table 1 and the data in the virtual unit Lba 0 in the virtual area Meta table 2 are merged and integrated together, and the integrated data is put into the virtual unit Lba 0 in the virtual area Meta table 3; the data in the virtual unit Lba 1 in the virtual area Meta table 1 and the data in the virtual unit Lba 1 in the virtual area Meta table 2 are merged and integrated together, and the integrated data is put into the virtual unit Lba 1 in the virtual area Meta table 3; the data in the virtual unit Lba 2 in the virtual area Meta table 1 and the data in the virtual unit Lba 2 in the virtual area Meta table 2 are merged and integrated together, and the integrated data is put into the virtual unit Lba 2 in the virtual area Meta table 3; the virtual unit Lba 1 in the virtual area Meta table 1 3 and the data in the virtual unit Lba 3 in the virtual area Metatable2 are merged and integrated together, and the integrated data is put into the virtual unit Lba 3 in the virtual area Meta table3; ....; the data in the virtual unit Lba n in the virtual area Meta table1 and the data in the virtual unit Lba n in the virtual area Meta table2 are merged and integrated together, and the integrated data is put into the virtual unit Lba n in the virtual area Meta table3.
[0074] The method described in the above embodiment caches the data to be stored in different virtual units in the target virtual area, and according to the hot and cold levels of each virtual unit in the hot and cold data strategy table, stores the data in each virtual unit at the same hot and cold level in different physical units in the corresponding physical data block, wherein the hot and cold level indicates the hot and cold degree of the data in the corresponding virtual unit. The above method defines the hot and cold level of the data by distinguishing the hot and cold degree of the data, thereby refining and distinguishing the hot and cold degree of the data in the virtual unit, and stores the data in the virtual units at the same hot and cold level in the same physical data block, so that the data in different physical units in the same physical data block correspond to the same hot and cold level. When the data in a physical data block is updated, since the hot and cold levels of the entire physical data block are the same, all the data in the same physical data block can be invalidated in the same time period in the later period. For the later garbage management, these physical data blocks do not need data migration, and space can be directly released, thereby reducing write amplification and improving the storage performance of the storage system.
[0075] In an exemplary embodiment, a method for storing data according to a cold and hot data strategy table is provided, such as Figure 7 As shown, the above S202 "stores the data in each virtual unit of the same hot or cold level into different physical units in the corresponding physical data block according to the hot or cold level of each virtual unit in the hot or cold data strategy table", includes:
[0076] S301 , dividing each virtual unit into a plurality of virtual unit groups according to the hot / cold level of each virtual unit in the hot / cold data strategy table.
[0077] The virtual unit group includes multiple virtual units of the same hot / cold level.
[0078] In an embodiment of the present application, when the storage system is preparing to store data in virtual units of the same hot or cold level into the corresponding same physical data block, it can first extract or determine multiple virtual units of the same hot or cold level from different virtual units in the target virtual area according to the hot or cold level of each virtual unit in the hot or cold data policy table, and divide the multiple virtual units of the same hot or cold level into a virtual unit group, so that each virtual unit in the same virtual unit group has the same hot or cold level, so that the data in the virtual units can be written into the corresponding physical data blocks simultaneously or sequentially in groups later.
[0079] S302 : For each virtual unit group, store data in different virtual units in the virtual unit group to different physical units in the corresponding physical data block.
[0080] The hot / cold level of each virtual unit group is consistent with the hot / cold level of the corresponding physical data block.
[0081] In an embodiment of the present application, the storage system can be pre-divided into multiple physical data blocks, and different physical data blocks correspond to different virtual unit groups, and different physical units in the same physical data block correspond to different virtual units in the virtual unit group, and the address mapping relationship between different physical data blocks and different virtual unit groups can be pre-defined or identified, and the address mapping relationship between different physical units and different virtual units can be pre-defined or identified. The address mapping relationship between different physical data blocks and different virtual unit groups, and the address mapping relationship between different physical units and different virtual units can be pre-defined or identified, and can be pre-recorded in the hot and cold data strategy table, or pre-recorded in the address mapping table, where the address of the virtual unit group corresponds to the address of the physical data block. After the storage system divides the virtual units at the same hot and cold level into the same virtual unit group, the hot and cold level of each virtual unit group can be determined, and then the hot and cold data strategy table is queried or the address mapping table is retrieved for query to determine which physical data blocks at the same hot and cold level are, and the physical data block addresses corresponding to each virtual unit group are determined, and finally the data in each virtual unit group is written into the corresponding physical data block according to each physical data block address, and specifically, the data in each virtual unit in the virtual unit group can be sequentially written into different physical units in the physical data block. All virtual unit groups can use the above method to realize the writing of data from the virtual unit group into the physical data block.
[0082] The method described in the above embodiment writes the data in the virtual units of the same hot / cold level into the same physical data block, so that the hot / cold levels of the data in the physical units contained in the same physical data block are the same, which can reduce the number of write methods for recycling the physical data blocks at a later time, thereby improving the storage performance of the storage system.
[0083] In an exemplary embodiment, a method for generating a cold and hot data strategy table is provided, such as Figure 8 As shown, Figure 5 Based on the embodiment, the method further includes:
[0084] S401 : Determine the hot / cold level of each virtual unit according to the first life cycle of each virtual unit.
[0085] Among them, the first life cycle of the virtual unit refers to the life cycle of the data in the virtual unit, that is, the period from valid to invalid of the data. For example, the life cycle of the data can be divided into several period intervals: [0-1 day), [1-7 days), [3-30 days), [30-90 days), [greater than 90 days).
[0086] In an embodiment of the present application, when the storage system is preparing to determine the hot and cold levels of each virtual unit, it can first determine the first life cycle of the data in each virtual unit. The method for determining the first life cycle can be determined according to the business type of the data in each virtual unit. For example, when the data is short-term valid data, its first life cycle can be determined to be 0-1 days. When the data is long-term valid data, its first life cycle can be determined to be 30 days. After the first life cycle of each virtual unit is determined, the corresponding hot and cold level can be determined according to the length of the first life cycle. The length of the first life cycle corresponds to the level of the hot and cold level. For example, the longer the first life cycle, the higher the corresponding hot and cold level. The higher the hot and cold level, the hotter the data. On the contrary, the shorter the first life cycle, the lower the corresponding hot and cold level. The lower the hot and cold level, the colder the data. In this way, the hot and cold levels can be determined. For example, the hot and cold levels corresponding to virtual units with first life cycles of [0-1 days), [1-7 days), [3-30 days), [30-90 days), and [greater than 90 days) can be divided into: first level, second level, third level, fourth level, and fifth level; among which the first level corresponds to [0-1 days), the second level corresponds to [1-7 days), the third level corresponds to [30-90 days), and the fourth level corresponds to [30-90 days).
[0087] Optionally, the method for the storage system to determine the hot and cold levels of each virtual unit according to the first life cycle of each virtual unit specifically includes: determining the hot and cold levels of each virtual unit according to the first life cycle of each virtual unit and the preset level division interval. Among them, the preset level division interval includes the period range corresponding to different hot and cold levels. The method described in the embodiment of the present application is essentially to directly use the first life cycle to represent the hot and cold levels. In this method, it is necessary to pre-define the preset level division interval, and then directly use the period of the divided interval to represent the hot and cold levels. For example, the storage system can also directly use the first life cycle to represent the hot and cold levels. The preset level division interval is [0-1 day), [1-7 days), [3-30 days), [30-90 days), [greater than 90 days), then the hot and cold levels can directly represent: [0-1 day) level, [1-7 days) level, [3-30 days) level, [30-90 days) level, [greater than 90 days) level.
[0088] S402: Generate a hot and cold data strategy table according to the hot and cold levels of each virtual unit.
[0089] In the embodiment of the present application, after the storage system determines the hot and cold levels of each virtual unit based on the above steps, the hot and cold levels of each virtual unit can be formed into a corresponding relationship with each virtual unit, and then recorded, and a hot and cold data strategy table can be generated (see Figure 4). Optionally, if the hot and cold data strategy table also records mapping relationships between different virtual units and different physical data blocks, and mapping relationships between different virtual units and different physical units, in this case, the storage system can pre-match the addresses of virtual units of the same hot and cold level with the addresses of physical data blocks, match the addresses of each virtual unit with the addresses of each physical unit, and record the address mapping relationship between virtual units of the same hot and cold level and physical data blocks, and the address mapping relationship between each virtual unit and each physical unit in the hot and cold data strategy table.
[0090] The method described in the above embodiment determines the hotness or coldness level of the virtual unit through the life cycle of the data in the virtual unit, so as to subdivide the hotness or coldness of the data instead of only using cold or hot to distinguish the hotness or coldness of the data. This can improve the efficiency of space recovery based on the hotness or coldness level of the data in the later stage, and reduce the write amplification operation of space recovery.
[0091] In an exemplary embodiment, a method for determining a first life cycle of a virtual unit is provided, such as Fig. 9 As shown, the method includes:
[0092] S501, obtaining the first data writing time of each virtual unit.
[0093] The first data writing time is determined according to the writing time of a preset number of data in the virtual unit, or according to the writing time of all data in the virtual unit. The preset number can be determined according to actual conditions, for example, it can be 10, 20, etc., and there is no limitation on this.
[0094] In the embodiment of the present application, a lot of data will be written into each virtual unit accordingly. When determining the first data writing time of each virtual unit, it can be determined according to the writing time of some of the data. For example, for the data in a virtual unit, the writing time of a preset number (for example, 10) of data is taken from the newest to the oldest, and the writing time of the virtual unit is determined according to the writing time of the preset number of data. The specific method for determining the first data writing time is to perform an average operation on the extracted writing time to obtain the first data writing time; optionally, when determining the first data writing time of each virtual unit, it can be determined according to the writing time of all data in the virtual unit. The specific determination method is to perform an average operation on the writing time of all data to obtain the first data writing time of the virtual unit. It should be noted that when data is written into the virtual unit, the writing time of the data can also be recorded at the same time. When the first data writing time of each virtual unit is determined, the first data writing time corresponding to each virtual unit can also be recorded in each virtual unit, so that the first life cycle of each virtual unit can be calculated based on the first data writing time of each virtual unit.
[0095] S502 : Determine a first life cycle of each virtual unit according to a first data writing time of each virtual unit.
[0096] In an embodiment of the present application, when the storage system obtains the first data write time of each virtual unit based on the aforementioned steps, it can calculate the first life cycle of each virtual unit in combination with a certain algorithm; optionally, when the storage system obtains the first data write time of each virtual unit, it can also calculate the first life cycle of each virtual unit in combination with the business type of the data in each virtual unit and a certain algorithm, so as to then perform cold and hot level classification based on the first life cycle of each virtual unit, and then generate a cold and hot data policy table in the memory.
[0097] Optionally, when the storage system writes all the data in the target virtual area to the corresponding physical data blocks according to the above method, the hot / cold level of each physical data block can be marked. When the hot / cold level is determined based on the first life cycle of each virtual unit, the second life cycle of each physical data block can also be marked and recorded in each physical data block for use in subsequent operations on the data in each physical data block. Here, since the hot / cold level of the data in the physical units in each physical data block is consistent, that is, the life cycle is consistent, the hot / cold level of a physical data block is the hot / cold level of the data in each physical unit, or the life cycle of a physical data block is the life cycle of the data in each physical unit. See Fig.10 The life cycle or hot / cold level recorded in the physical data block Data Block.
[0098] The method described in the above embodiment determines the life cycle of each virtual unit by the write time of each virtual unit, which can improve the accuracy and granularity of the subsequent division of hot and cold levels based on the life cycle, and can store data according to the degree of hot and cold, and put data with the same hot and cold levels into the same physical data block for processing, which can reduce the frequency of data migration and write amplification operations in the later stage, and improve the overall storage performance of the storage system.
[0099] In an exemplary embodiment, there are often errors in the life cycle. Some data may be updated in advance, while some data may be updated later. This will result in that when garbage collection is performed on these data, if they are still distinguished according to the hot and cold strategy table, data with different life cycles will be written separately to different data blocks. However, although their life cycles are different, their expiration times are similar. Data may not be generated on the same day, but expire on the same day. Based on this, the embodiment of the present application also provides a method for storing data. Figure 5 Based on the example, Fig.11 As shown, the method also includes:
[0100] S601, for each physical data block, obtaining the second life cycle, second data writing time and current system time of each physical unit in the physical data block.
[0101] Among them, since the hot and cold levels of the data in the physical units in each physical data block are consistent, the life cycles are also consistent, and the data in each physical unit comes from the corresponding virtual unit, so the second life cycle of the physical unit is consistent with the first life cycle of the corresponding virtual unit. The second data write time of the physical unit refers to the write time when the data is written to the physical unit. The second life cycle and second data write time of each physical unit can be recorded in the physical data block.
[0102] In the embodiment of the present application, when the storage system stores the data in each virtual unit at the same hot and cold level into different physical units in the corresponding physical data block based on the method described in the above embodiment, the data in each physical data block can be further adjusted according to the expiration time or life end time of the data to obtain the adjusted physical data block, and the expiration time or life end time of the data in each physical unit in the adjusted physical data block is the same, so as to ensure that the data with the same expiration time or life end time is stored in different physical units in a physical data block. Therefore, the storage system needs to first obtain the second life cycle, the second data write time and the current system time of each physical unit in each physical data block. Specifically, for each physical data block, the storage system can determine the second life cycle of each physical unit according to the first life cycle of the virtual unit corresponding to each physical unit in the physical data block; and can determine the second data write time of each physical unit according to the time when the data is written to each physical unit in the physical data block, and can also determine the second data write time of each physical unit according to the first data write time of the virtual unit corresponding to each physical unit, because the data in each physical unit comes from the corresponding virtual unit, so the second data write time of each physical unit is basically consistent with the first data write time of the corresponding virtual unit.
[0103] S602: Determine the life end time of each physical unit in the physical data block according to the second life cycle, the second data writing time and the current system time.
[0104] The end of life time also refers to the expiration time of the data.
[0105] In the embodiment of the present application, when the storage system obtains the second life cycle, the second data write time and the current system time of each physical unit in each physical data block based on the method described in the above embodiment, the end of life time of each physical unit in each physical data block can be calculated based on the three parameters of the second life cycle, the second data write time and the current system time, so as to adjust the data in the physical data block based on the end of life time of each physical unit. The calculation time of the end of life time can be specifically determined according to the following relationship (1):
[0106] Td=|Tp-Tc-Tw| (1);
[0107] Wherein, Td represents the end time of the life of the physical unit; Tp represents the second life cycle of the physical unit; Tw represents the second data writing time of the physical unit; and Tc represents the current system time.
[0108] S603, according to the life expiration time of each physical unit in each physical data block, write the data in the physical units with the same life expiration time into the same new physical data block.
[0109] The new physical data block is a newly applied physical data block.
[0110] In the embodiment of the present application, when the storage system determines the life end time of each physical unit in each physical data block based on the above steps, the physical units with the same life end time can be extracted from each physical data block, and then a new physical data block is applied for, and the data in the extracted physical units with the same life end time is written to the new physical data block. For example, see Fig.12 As shown in the diagram, the second life cycle of physical data block Data block1 is 30 days, but vba0, vba2 and vba3 all expire on the 29th day. Only vba1 and vba4 are valid. The second life cycle of physical data block Data block2 is 7 days. However, on the same day that vba0 in physical data block Data block1 expires, vba9 and vba 12 in physical data block Data block2 also expire. At this time, the remaining data in the two data blocks has only one day left in its life cycle. The remaining valid data should be moved to the same data block, as shown in the figure below. Figure 7 That is, physical units with the same life span end time (1 day) are extracted from the two physical data blocks and placed in the same physical data block Data block3. Then, the life span end time of each physical unit in the physical data block Data block3 is consistent.
[0111] Optionally, after the storage system writes the data in the physical units with the same end-of-life time into the same new physical data block, the storage system may further execute the steps of: determining whether each physical data block is valid when garbage collection is performed on the storage system, and performing garbage collection on the physical data blocks that are determined to be invalid. Since the end-of-life time of each physical unit in each physical data block is consistent, each physical unit in each physical data block is invalid at the same time. For example, if each physical data block is invalid, then the physical unit in each physical data block is also invalid. If each physical data block is valid, then the physical unit in each physical data block is also valid.
[0112] The method described in the above embodiment can better put data with the same expiration time together during garbage collection, which can reduce the problems caused by errors in the life cycle and further improve the storage performance of the storage system.
[0113] Based on the methods described in all the above embodiments, a data storage method is provided, such as Fig.13 As shown, the method includes:
[0114] S701, caching data to be stored into different virtual units in the target virtual area.
[0115] S702: Obtain the first data writing time of each of the virtual units.
[0116] S703: Determine a first life cycle of each of the virtual units according to a first data writing time of each of the virtual units.
[0117] S704: Determine the hot / cold level of each virtual unit according to the first life cycle of each virtual unit and the preset level division interval.
[0118] S705 , generating a hot and cold data strategy table according to the hot and cold levels of each virtual unit.
[0119] S706 , according to the hot and cold levels of the virtual units in the hot and cold data strategy table, storing the data in the virtual units at the same hot and cold level into different physical units in the corresponding physical data blocks.
[0120] S707: For each physical data block, obtain the second life cycle, the second data writing time and the current system time of each physical unit in the physical data block.
[0121] S708, determining the end time of life of each physical unit in the physical data block according to the second life cycle, the second data writing time and the current system time;
[0122] S709, according to the life expiration time of each physical unit in each physical data block, write the data in the physical units with the same life expiration time into the same new physical data block.
[0123] The above steps are all described in the above content. Please refer to the above description for details, which will not be repeated here. The method described in this embodiment can realize the separation of hot and cold data by directly writing by the host, and put the relatively fixed data around the life cycle into the same physical data block area. When the data of a physical data block of a certain life cycle is updated, since the life cycle of the entire physical data block is the same, the entire physical data block will be invalid in the same time period. For the garbage management module, these data blocks do not need to be moved, and the space can be released directly. Thereby reducing write amplification.
[0124] The beneficial effects brought about by the methods described in all the above embodiments include: First, without increasing the complexity of management, the write time of the virtual unit LBA is stored together with the data to be stored, and the hotness or coldness of each virtual unit LBA can be calculated more accurately by recording multiple times. Second, by adjusting the range of cold and hot data cycles and the number of hot and cold levels, it is possible to better adapt to situations where the data life cycle varies greatly. By separating data of various life cycles into data partitions of different hotness, the write amplification caused by garbage collection is reduced. Third, by updating the hot and cold data strategy table in real time, the data is naturally separated into hot and cold data from the source, reducing the probability of hot and cold data being written to the same partition. Fourth, during garbage collection, data with the same expiration time can be better put together, which can reduce the impact of errors in the life cycle.
[0125] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0126] Based on the same inventive concept, the embodiment of the present application also provides a data storage device for implementing the data storage method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more data storage device embodiments provided below can refer to the limitations on the data storage method above, and will not be repeated here.
[0127] In an exemplary embodiment, Fig.14 As shown, a data storage device is provided, including: a cache module 141, used to cache data to be stored in different virtual units in the target virtual area.
[0128] The storage module 142 is used to store the data in each virtual unit of the same hot / cold level to different physical units in the corresponding physical data block according to the hot / cold level of each virtual unit in the hot / cold data strategy table; the hot / cold level indicates the hot / cold degree of the data in the corresponding virtual unit.
[0129] In an exemplary embodiment, the storage module 142 includes:
[0130] A division unit, used to divide the virtual units into a plurality of virtual unit groups according to the cold and hot levels of the virtual units in the cold and hot data strategy table; the virtual unit group includes a plurality of virtual units of the same cold and hot level;
[0131] The storage unit is used to store data in different virtual units in each virtual unit group to different physical units in the corresponding physical data block; the hot and cold levels of different virtual unit groups are consistent with the hot and cold levels of corresponding different physical data blocks.
[0132] In an exemplary embodiment, the data storage device further includes:
[0133] A first determining module, configured to determine a cold or hot level of each of the virtual units according to a first life cycle of each of the virtual units;
[0134] A generating module is used to generate the hot and cold data strategy table according to the hot and cold levels of each of the virtual units.
[0135] In an exemplary embodiment, the determination module is specifically used to determine the hot / cold level of each virtual unit according to the first life cycle of each virtual unit and a preset level division interval; the preset level division interval includes a cycle range corresponding to different hot / cold levels.
[0136] In an exemplary embodiment, the data storage device further includes:
[0137] A first acquisition module, used for acquiring a first data writing time of each of the virtual units; the first data writing time is determined according to a writing time of a preset number of data in the virtual unit, or according to a writing time of all data in the virtual unit;
[0138] The second determining module is used to determine the first life cycle of each virtual unit according to the first data writing time of each virtual unit.
[0139] In an exemplary embodiment, the data storage device further includes:
[0140] A second acquisition module is used to acquire, for each of the physical data blocks, a second life cycle, a second data writing time, and a current system time of each physical unit in the physical data block;
[0141] A third determining module, configured to determine the end of life time of each of the physical units in the physical data block according to the second life cycle, the second data writing time and the current system time;
[0142] The writing module is used to write the data in the physical units with the same life end time into the same new physical data block according to the life end time of each physical unit in each physical data block.
[0143] Each module in the above data storage device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0144] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Fig.15 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data storage method is implemented.
[0145] Those skilled in the art will understand that Fig.15 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0146] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0147] caching the data to be stored in different virtual units in the target virtual area;
[0148] According to the hot and cold levels of each virtual unit in the hot and cold data strategy table, the data in each virtual unit of the same hot and cold level is stored in different physical units in the corresponding physical data block; the hot and cold level indicates the hot and cold degree of the data in the corresponding virtual unit.
[0149] The computer device provided in the above embodiment has an implementation principle and technical effects similar to those of the above method embodiment, which will not be described in detail here.
[0150] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0151] caching the data to be stored in different virtual units in the target virtual area;
[0152] According to the hot and cold levels of each virtual unit in the hot and cold data strategy table, the data in each virtual unit of the same hot and cold level is stored in different physical units in the corresponding physical data block; the hot and cold level indicates the hot and cold degree of the data in the corresponding virtual unit.
[0153] The above embodiment provides a computer-readable storage medium, whose implementation principle and technical effect are similar to those of the above method embodiment, and will not be repeated here.
[0154] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0155] caching the data to be stored in different virtual units in the target virtual area;
[0156] According to the hot and cold levels of each virtual unit in the hot and cold data strategy table, the data in each virtual unit of the same hot and cold level is stored in different physical units in the corresponding physical data block; the hot and cold level indicates the hot and cold degree of the data in the corresponding virtual unit.
[0157] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0158] According to the hot and cold levels of each virtual unit in the hot and cold data strategy table, the virtual units are divided into a plurality of virtual unit groups; the virtual unit group includes a plurality of virtual units with the same hot and cold level;
[0159] For each virtual unit group, data in different virtual units in the virtual unit group are stored in different physical units in the corresponding physical data block; the hot and cold levels of different virtual unit groups are consistent with the hot and cold levels of corresponding different physical data blocks.
[0160] The above embodiment provides a computer program product, whose implementation principle and technical effect are similar to those of the above method embodiment, and will not be repeated here.
[0161] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0162] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0163] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A data storage method, characterized in that: The method comprises: caching the data to be stored in different virtual units in the target virtual area; According to the hot and cold levels of each virtual unit in the hot and cold data strategy table, the data in each virtual unit of the same hot and cold level is stored in different physical units in the corresponding physical data block; the hot and cold level indicates the hot and cold degree of the data in the corresponding virtual unit.
2. The method according to claim 1, characterized in that According to the hot and cold levels of each virtual unit in the hot and cold data strategy table, storing the data in each virtual unit at the same hot and cold level to different physical units in the corresponding physical data block includes: According to the hot and cold levels of each virtual unit in the hot and cold data strategy table, the virtual units are divided into a plurality of virtual unit groups; the virtual unit group includes a plurality of virtual units with the same hot and cold level; For each virtual unit group, data in different virtual units in the virtual unit group are stored in different physical units in the corresponding physical data block; the hot and cold levels of different virtual unit groups are consistent with the hot and cold levels of corresponding different physical data blocks.
3. The method according to claim 1, characterized in that The method further comprises: Determine the hot / cold level of each virtual unit according to the first life cycle of each virtual unit; The hot and cold data strategy table is generated according to the hot and cold levels of each of the virtual units.
4. The method according to claim 3, characterized in that The determining the hot / cold level of each virtual unit according to the first life cycle of each virtual unit includes: The hot / cold level of each virtual unit is determined according to the first life cycle of each virtual unit and a preset level division interval; the preset level division interval includes a cycle range corresponding to different hot / cold levels.
5. The method according to claim 3, characterized in that: The method further comprises: Acquire a first data write time of each of the virtual units; the first data write time is determined according to a write time of a preset number of data in the virtual unit, or is determined according to a write time of all data in the virtual unit; The first life cycle of each of the virtual units is determined according to the first data writing time of each of the virtual units.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: For each of the physical data blocks, obtaining the second life cycle, the second data writing time and the current system time of each physical unit in the physical data block; Determine the end time of life of each of the physical units in the physical data block according to the second life cycle, the second data writing time and the current system time; According to the life expiration time of each physical unit in each physical data block, the data in the physical units with the same life expiration time are written into the same new physical data block.
7. A data storage device, characterized in that: The device comprises: A cache module, used for caching data to be stored in different virtual units in the target virtual area; The storage module is used to store the data in each virtual unit of the same hot or cold level to different physical units in the corresponding physical data block according to the hot or cold level of each virtual unit in the hot or cold data strategy table; the hot or cold level indicates the hot or cold degree of the data in the corresponding virtual unit.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.