Cold data migration method and device, storage medium and electronic device

By precisely controlling the speed and duration of cold data migration in the solid-state drive, the impact of cold data storms on SSD performance during static wear leveling is resolved, achieving a balance between wear leveling and performance stability.

CN116301586BActive Publication Date: 2026-02-17INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310019579.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-06
Publication Date
2026-02-17
Estimated Expiration
2043-01-06

AI Technical Summary

Technical Problem

In the static wear leveling process, the impact of cold data storms on the read and write performance of solid-state drives (SSDs) is uncontrollable, and some algorithms achieve wear leveling at the expense of NAND lifespan.

Method used

By obtaining the number of erases and the average number of erases in the storage cells of the solid-state drive, the migration time and speed of cold data can be determined, and the migration speed of cold data can be precisely controlled to migrate it to other storage cells in order to achieve static wear leveling.

Benefits of technology

By spreading out cold data migration reasonably over a longer period of time, the impact on SSD read and write performance is reduced, achieving wear leveling without compromising NAND lifespan.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116301586B_ABST
    Figure CN116301586B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a cold data migration method and device, a storage medium and an electronic device, wherein the method comprises: obtaining a first erasing frequency of a first storage unit in a solid state disk for storing first cold data and a first average erasing frequency of all storage units in the solid state disk; determining a first migration time length of the first cold data by the first erasing frequency and the first average erasing frequency; determining a first migration speed of the first cold data according to the first migration time length, and migrating the first cold data from the first storage unit to a second storage unit in the solid state disk at the first migration speed; by using the above technical solution, the problem that in the related art, in the process of static wear leveling, cold data storm affects the read-write performance of the SSD is solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the computer field, in particular, to a cold data migration method and device, a storage medium and an electronic device. BACKGROUND

[0002] A solid state disk (SSD) is a bottommost component in an entire storage system, which mainly receives input / output (IO) data from an upper layer application and stores the IO data in a non-volatile NAND medium of the SSD. FTL is the most important algorithm module of the SSD, which is mainly used for mapping a Host logical address to a NAND physical location, garbage collection, wear leveling and the like.

[0003] Since the update frequency of Host data is different, cold data blocks and hot data blocks are generated for the SSD. The data on the cold data blocks is not updated for a long time, so the erase times PE of the cold data blocks are small. The data on the hot data blocks is frequently updated, so the erase times PE of the hot data blocks are large. In order to balance the PE of all blocks in the SSD, a wear leveling algorithm is needed.

[0004] Wear leveling is divided into dynamic wear leveling and static wear leveling. The dynamic wear leveling is to place hot data in blocks with small PE. The static wear leveling is to move cold data to blocks with large PE. The dynamic wear leveling is relatively simple to implement, which mainly provides idle blocks with small PE to Host data. The static wear leveling is relatively complex to implement, which not only considers cold data identification, but also considers the triggering condition of cold data moving.

[0005] The common static wear leveling of the SSD in the industry includes Dual-Pool, TrueFFS, BET and the like. The main idea is to trigger cold and hot data exchange when the PE difference exceeds a certain threshold. These algorithms solve the problem of uneven wear and tear, and can control the PE within a certain range. However, the influence of cold data storm on the read / write performance of the SSD during static wear leveling is uncontrollable, and some algorithms sacrifice the life of NAND to achieve wear leveling.

[0006] In the related art, during the process of static wear leveling, the cold data storm affects the read / write performance of the SSD, and an effective solution has not been proposed. SUMMARY

[0007] Embodiments of the present application provide a cold data migration method and device, a storage medium and an electronic device to at least solve the problem of cold data storm affecting the read-write performance of an SSD in the process of static wear leveling in the related art.

[0008] According to an embodiment of the present application, a cold data migration method is provided, comprising: obtaining a first erase count of a first storage unit in a solid state disk for storing first cold data and a first average erase count of all storage units in the solid state disk; determining a first migration duration of the first cold data by the first erase count and the first average erase count; determining a first migration speed of the first cold data according to the first migration duration, and migrating the first cold data from the first storage unit to a second storage unit in the solid state disk at the first migration speed.

[0009] In an example embodiment, determining the first migration duration of the first cold data by the first erase count and the first average erase count comprises: determining a target difference value of the first erase count and the first average erase count; and determining the first migration duration corresponding to the target difference value according to a target function relationship, wherein the target function relationship is used to indicate the corresponding relationship between the difference value and the migration duration.

[0010] In an example embodiment, before determining the first migration duration corresponding to the target difference value according to the target function relationship, the method further comprises: determining a slowest migration duration of migrating the first cold data from the first storage unit to the second storage unit, and determining a fastest migration duration of migrating the first cold data from the first storage unit to the second storage unit; determining a minimum erase count difference value and a maximum erase count difference value for triggering the cold data migration, wherein the minimum erase count difference value is used to indicate the minimum erase count difference value for triggering the first cold data migration, and the maximum erase count difference value is used to indicate the maximum erase count difference value for triggering the first cold data migration; and establishing the target function relationship according to the minimum erase count difference value, the maximum erase count difference value, the slowest migration duration and the fastest migration duration, wherein the target function relationship is used to indicate the relationship between the minimum erase count difference value and the slowest migration duration, and the relationship between the maximum erase count difference value and the fastest migration duration.

[0011] In one example embodiment, determining the slowest migration time length for migrating the first cold data from the first storage unit to the second storage unit comprises: determining a user capacity of the solid state disk, a reserved space capacity of the solid state disk, and a maximum write speed of the solid state disk; determining a total capacity of the solid state disk according to the user capacity and the reserved space capacity of the solid state disk; and determining the slowest migration time length for migrating the first cold data from the first storage unit to the second storage unit in the solid state disk according to the total capacity and the maximum write speed.

[0012] In one example embodiment, determining the total capacity of the solid state disk according to the user capacity and the reserved space capacity of the solid state disk comprises: determining a product of the user capacity and the reserved space capacity; and determining the total capacity of the solid state disk as a sum of the product and the user capacity.

[0013] In one example embodiment, determining the slowest migration time length for migrating the first cold data from the first storage unit to the second storage unit in the solid state disk according to the total capacity and the maximum write speed of the solid state disk comprises: determining a quotient of the total capacity and the maximum write speed; and determining the slowest migration time length as the quotient of the total capacity and the maximum write speed.

[0014] In one example embodiment, determining the fastest migration time length for migrating the first cold data from the first storage unit to the second storage unit in the solid state disk comprises: determining a migration speed corresponding to any migration time length in a plurality of migration time lengths; determining a read speed of the solid state disk corresponding to the migration speed in a case that the first cold data is migrated from the first storage unit to the second storage unit according to the migration speed; and performing the determining step cyclically until a read speed corresponding to each migration time length in the plurality of migration time lengths is determined; and determining the fastest migration time length according to the read speed corresponding to each migration time length.

[0015] In one example embodiment, determining the fastest migration time length according to the read speed corresponding to each migration time length comprises: determining a ratio of the read speed of the solid state disk corresponding to each migration speed to a maximum read speed of the solid state disk; determining a target ratio greater than or equal to a third preset threshold value in a plurality of the ratios; determining a migration speed corresponding to the target ratio, and determining the fastest migration time length according to the migration speed.

[0016] In an example embodiment, determining the first migration speed of the first cold data according to the first migration time length comprises: determining a first number of flash memory pages occupied by the first cold data in the first storage unit; determining a quotient value of the first migration time length and the first number, and taking the quotient value of the first migration time length and the first number as the first migration speed.

[0017] In an example embodiment, after migrating the first cold data from the first storage unit to a second storage unit in the solid state disk at the first migration speed, the method further comprises: obtaining a second erase count of a third storage unit in the solid state disk for storing second cold data and a second average erase count of all storage units in the solid state disk; determining a second migration time length of the second cold data through the second erase count and the second average erase count; determining a second migration speed of the second cold data according to the second migration time length, and migrating the second cold data from the third storage unit to a fourth storage unit in the solid state disk at the second migration speed.

[0018] According to another embodiment of the present application, a cold data migration device is provided, comprising: an obtaining module configured to obtain a first erase count of a first storage unit in a solid state disk for storing first cold data and a first average erase count of all storage units in the solid state disk; a determining module configured to determine a first migration time length of the first cold data through the first erase count and the first average erase count; and a migration module configured to determine a first migration speed of the first cold data according to the first migration time length, and migrate the first cold data from the first storage unit to a second storage unit in the solid state disk at the first migration speed.

[0019] According to yet another embodiment of the present application, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program, wherein the computer program is configured to execute the steps in any of the method embodiments described above when running.

[0020] According to yet another embodiment of the present application, an electronic device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the computer program to perform the steps in any of the method embodiments described above.

[0021] According to the embodiment of the present application, the first erasing times of the first storage unit for storing the first cold data in the solid state disk and the first average erasing times of all storage units in the solid state disk are acquired, the first migration time length of the first cold data is determined according to the first erasing times and the first average erasing times, the first migration speed of the first cold data is determined according to the first migration time length, and the first cold data is migrated from the first storage unit to the second storage unit in the solid state disk at the first migration speed. That is, according to the first erasing times of the storage unit and the first average erasing times of the solid state disk, the speed of the cold data migration is accurately controlled, the migration of the cold data is reasonably distributed in a longer time, the static wear leveling is realized at a slow and stable speed, and the influence on the read-write performance of the SSD is reduced. Therefore, the problems that the cold data storm influences the read-write performance of the SSD during the static wear leveling process can be solved. BRIEF DESCRIPTION OF DRAWINGS

[0022] Figure 1 is a hardware structure block diagram of a computer terminal of a cold data migration method according to an embodiment of the present application;

[0023] Figure 2 is a flowchart of a cold data migration method according to an embodiment of the present application;

[0024] Figure 3 is a read-write performance diagram of an SSD during static wear leveling in the prior art;

[0025] Figure 4 is a flowchart of a cold data migration method according to an optional embodiment of the present application;

[0026] Figure 5 is a flowchart of a cold data migration method according to another optional embodiment of the present application;

[0027] Figure 6 is a function relationship diagram of the difference value of erasing times and the migration time length according to an optional embodiment of the present application;

[0028] Figure 7 is a structure diagram of a cold data migration device according to an embodiment of the present application. DETAILED DESCRIPTION

[0029] Hereinafter, the embodiments of the present application will be described in detail with reference to the accompanying drawings and in combination with the embodiments.

[0030] It should be noted that the terms “first”, “second” and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence.

[0031] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a computer terminal for a cold data migration method according to an embodiment of this application. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0032] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the cold data migration method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thus implementing the above-described method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0033] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0034] This embodiment provides a method that runs on a computer terminal. Figure 2 This is a flowchart of a cold data migration method according to an embodiment of this application, such as... Figure 2As shown, the flow includes the following steps:

[0035] In step S202, the first erase count of a first storage unit in the solid state disk for storing the first cold data and the first average erase count of all storage units in the solid state disk are obtained.

[0036] In step S204, the first migration duration of the first cold data is determined according to the first erase count and the first average erase count.

[0037] It should be noted that in the case where the absolute value of the difference between the first erase count and the first average erase count is greater than a preset threshold, the migration of the first cold data is triggered.

[0038] In step S206, the first migration speed of the first cold data is determined according to the first migration duration, and the first cold data is migrated from the first storage unit to a second storage unit in the solid state disk at the first migration speed.

[0039] Through the above steps, since the first erase count of a first storage unit in the solid state disk for storing the first cold data and the first average erase count of all storage units in the solid state disk are obtained, the first migration duration of the first cold data is determined according to the first erase count and the first average erase count, and the first migration speed of the first cold data is determined according to the first migration duration, and the first cold data is migrated from the first storage unit to a second storage unit in the solid state disk at the first migration speed, that is, according to the first erase count of the storage unit and the first average erase count of the solid state disk, the speed of the cold data migration is accurately controlled, the migration of the cold data is reasonably spread in a longer time, and the static wear leveling is realized in a slow and stable speed, thereby reducing the influence on the read-write performance of the SSD. Therefore, the problem of cold data storm affecting the read-write performance of the SSD in the process of static wear leveling can be solved.

[0040] The above step S204 has many implementation manners, and in the embodiment of the present application, an implementation manner is given, specifically: determining a target difference value of the first erase count and the first average erase count; determining the first migration duration corresponding to the target difference value according to a target function relationship, wherein the target function relationship is used to indicate the corresponding relationship between the difference value and the migration duration.

[0041] That is, the target function relationship for indicating the corresponding relationship between the difference value and the migration duration is determined, and the first migration duration corresponding to the target difference value is determined according to the target function relationship. It should be noted that in the case where the function relationship is a linear function relationship, the first migration duration corresponding to the target difference value is determined according to the linear function relationship.

[0042] It should be noted that if the migration speed of the cold data is too fast, the erase times of the first storage unit for storing the first cold data and the first average erase times can tend to be balanced in a short time, but the read performance of the solid state disk can be sharply reduced in a short time; if the migration speed of the cold data is slow, the limited migration of the cold data can be spread over a longer time dimension, reducing the impact on the read performance of the solid state disk, but the erase time difference (equivalent to the target difference in the above embodiment) can be larger and larger, so it is necessary to determine the cold data migration speed to ensure that the migration is slow and the erase times are balanced. According to the function relationship, the first migration speed of the cold data corresponding to the target difference between the erase times of the first storage unit and the first average erase times is determined, and then the migration speed of the cold data can be accurately and dynamically adjusted, so that the migration of the cold data is reasonably spread over a longer period of time, and the stability of the read and write performance of the solid state disk is ensured on the premise of wear leveling.

[0043] In one example embodiment, before determining the first migration time corresponding to the target difference according to the target function relationship, the target function relationship needs to be determined. The specific way of determining the target function relationship is as follows: determining the slowest migration time of migrating the first cold data from the first storage unit to the second storage unit, and determining the fastest migration time of migrating the first cold data from the first storage unit to the second storage unit; determining the minimum erase time difference and the maximum erase time difference for triggering the migration of the first cold data, wherein the minimum erase time difference is used to indicate the minimum erase time difference for triggering the migration of the first cold data, and the maximum erase time difference is used to indicate the maximum erase time difference for triggering the migration of the first cold data; establishing the target function relationship according to the minimum erase time difference, the maximum erase time difference, the slowest migration time and the fastest migration time, wherein the target function relationship is used to indicate the relationship between the minimum erase time difference and the slowest migration time, and the relationship between the maximum erase time difference and the fastest migration time.

[0044] That is, the function relationship between the erase time difference and the migration time is established. First, the slowest migration time and the fastest migration time of migrating the first cold data from the first storage unit to the second storage unit are determined. Second, the maximum erase time difference and the minimum erase time difference for triggering the migration of the first cold data are determined. According to the corresponding relationship between the maximum erase time difference and the fastest migration time, and the corresponding relationship between the minimum erase time difference and the slowest migration time, the target function relationship is determined. Since the two coordinate points of the target function relationship can be determined according to the corresponding relationship between the maximum erase time difference and the fastest migration time, and the corresponding relationship between the minimum erase time difference and the slowest migration time, the target function relationship can be determined.

[0045] It should be noted that the greater the difference in erasing times, the faster the migration speed, and the smaller the difference in erasing times, the slower the migration speed. The above target function relationship provides theoretical algorithm support for the migration speed of cold data, and the migration speed of cold data can be simply determined according to the above target function relationship. In addition, the migration speed of cold data can be accurately controlled according to the above target function relationship, that is, the migration of cold data is reasonably spread over a longer period of time, and the stability of the read-write performance of the solid state disk is ensured on the premise of wear leveling.

[0046] Optionally, the slowest migration time length for migrating the first cold data from the first storage unit to the second storage unit can be determined in the following manner: determining the user capacity of the solid state disk, the reserved space capacity of the solid state disk, and the maximum write speed of the solid state disk; determining the total capacity of the solid state disk according to the user capacity of the solid state disk and the reserved space capacity of the solid state disk; and determining the slowest migration time length for migrating the first cold data from the first storage unit to the second storage unit in the solid state disk according to the total capacity and the maximum write speed.

[0047] Optionally, the specific manner of determining the total capacity of the solid state disk is as follows: determining the product of the user capacity and the reserved space capacity, and taking the product and the sum of the user capacity as the total capacity of the solid state disk.

[0048] Optionally, the specific manner of determining the slowest migration time length for migrating the first cold data from the first storage unit to the second storage unit in the solid state disk is as follows: determining the quotient of the total capacity and the maximum write speed, and taking the quotient of the total capacity and the maximum write speed as the slowest migration time length.

[0049] That is, the slowest migration time length for migrating the first cold data from the first storage unit to the second storage unit is determined by the following formula:

[0050] T_migrate_slow=SSD_CAP*(1+OP) / max_bw; where SSD_CAP is the user capacity of the solid state disk, OP is the reserved space capacity of the solid state disk, and Max_bw is the maximum write speed of the solid state disk. SSD_CAP*(1+OP) calculates the total NAND capacity of the solid state disk. That is, the slowest migration time length for migrating the first cold data from the first storage unit to the second storage unit is the time for writing the full disk at the maximum write speed, and thus the cold data migration period can be realized without continuing to widen the average PE.

[0051] It should be noted that when the data of a solid state disk is full, additional space is needed to accept new data before starting garbage collection, and this additional space is the reserved space, wherein the reserved space is invisible to the user.

[0052] In an example embodiment, determining the fastest migration time length of migrating the first cold data from the first storage unit to the second storage unit in the solid state disk comprises: determining step: determining the migration speed corresponding to any migration time length in the plurality of migration time lengths; determining the read speed of the solid state disk corresponding to the migration speed in the case of migrating the first cold data from the first storage unit to the second storage unit according to the migration speed; the determination step is executed circularly until the read speed corresponding to each migration time length in the plurality of migration time lengths is determined; the fastest migration time length is determined according to the read speed corresponding to each migration time length.

[0053] That is, respectively determining a plurality of migration time lengths, respectively determining the read speed of the solid state disk in the case of migrating the first cold data from the first storage unit to the second storage unit in the solid state disk with the migration time length being any migration time length in the plurality of migration time lengths; and determining the read performance of the solid state disk according to the read speed of the solid state disk, and determining the fastest migration time length according to the read performance of the solid state disk.

[0054] Specifically, the fastest migration time length is determined by: determining the ratio of the read speed of the solid state disk corresponding to each migration speed to the maximum read speed of the solid state disk; determining a target ratio greater than or equal to a third preset threshold value in a plurality of ratios; determining the migration speed corresponding to the target ratio, and determining the fastest migration time length according to the migration speed.

[0055] It should be noted that the read performance of the solid state disk is determined according to the ratio of the read speed of the solid state disk corresponding to each migration speed to the maximum read speed of the solid state disk, the higher the ratio, the less the impact on the determination of the read performance of the solid state disk; the higher the ratio, the greater the impact on the determination of the read performance of the solid state disk, so the migration speed corresponding to the target ratio greater than or equal to the third preset threshold value is taken as the fastest migration speed of the first cold data, and then the fastest migration time length is determined according to the fastest migration speed and the size of the first cold data.

[0056] For example, the read speed of the solid state disk is respectively determined when the migration time length is 1.5, 2 and 2.5 minutes, and then the impact on the read performance of the solid state disk is respectively determined when the migration time length is 1.5, 2 and 2.5 minutes, and the migration time length which does not produce 10% jitter on performance is determined as the fastest migration time length.

[0057] In an example embodiment, determining the first migration speed of the first cold data according to the first migration time length comprises: determining a first number of flash memory pages of the first storage unit occupied by the first cold data; determining a quotient value of the first migration time length and the first number, and taking the quotient value of the first migration time length and the first number as the first migration speed.

[0058] It should be noted that the solid state disk is divided into many storage units block, and the storage segment unit is divided into many flash memory pages page, and the read and write of the solid state disk are in units of page; therefore, when determining the first migration speed of the first cold data, it is necessary to first determine the first number of flash memory pages of the first storage unit written with the first cold data; and taking the quotient value of the first migration time length and the first number as the first migration speed.

[0059] Through the above embodiment, the read speed of garbage collection in a unit of time is strictly controlled to realize the control of the first migration speed of the first cold data.

[0060] In an example embodiment, after migrating the first cold data from the first storage unit to the second storage unit in the solid state disk at the first migration speed, a second erase number of a third storage unit in the solid state disk for storing second cold data and a second average erase number of all storage units in the solid state disk are obtained; a second migration time length of the second cold data is determined through the second erase number and the second average erase number; a second migration speed of the second cold data is determined according to the second migration time length, and the second cold data is migrated from the third storage unit to a fourth storage unit in the solid state disk at the second migration speed.

[0061] It should be noted that after the first storage unit is migrated to the second storage unit in the solid state disk, the average erase number of all storage units in the solid state disk changes from the first average erase number to the second average erase number, and then the second migration speed of the second cold data is determined again according to the second erase number and the second average erase number, and the second cold data is migrated according to the second migration speed, thereby realizing the technical effect of dynamically adjusting the migration speed of cold data.

[0062] In order to better understand the process of the above cold data migration method, the process of the above cold data migration method will be described in combination with optional embodiments below, but not used to limit the technical scheme of the embodiments of the present application.

[0063] The strategy of the traditional wear leveling algorithm is to exchange cold data and hot data when the PE gap reaches a certain threshold, and put the cold data on the block with high PE (equivalent to the storage unit in the above embodiment) and the hot data on the block with low PE. Since this process involves a large amount of cold data migration, it directly increases the write amplification of the SSD and reduces the write performance of the SSD, as shown in Figure 3 Figure 3 The abscissa is used to indicate time, in seconds S, and the ordinate is used to indicate write performance, in IOPS. Figure 3

[0064] The SSD will have a sharp increase in garbage collection in a certain period of time, and the read-write performance will decrease sharply. This process is called cold data migration storm. And this process is periodic, that is, it occurs once every certain period of time. The specific reasons are as follows:

[0065] The minimum PE and the average PE gap are 50, which triggers wear leveling. In the wear leveling, a cold data migration storm occurs, and the migration time is 2h, so the performance within 2h is sharply decreased, and the performance after 2h returns to normal. The next time the PE gap is 50, wear leveling is triggered again, and a cold data migration storm occurs in wear leveling. The performance within 2h is sharply decreased again, so the performance fluctuates periodically.

[0066] Further, by controlling the migration speed of the cold data, the influence of the cold data migration in wear leveling on the performance is reduced, and the specific reasons are as follows:

[0067] 1) The PE of the cold data block is relative to the average PE of all blocks of the solid state disk, so as long as the PE of the cold data block increases synchronously with the average PE, the PE of the cold data block and the average PE will not continue to increase;

[0068] 2) The difference between the PE of the cold data block and the average PE is accumulated over a period of time, so the time for the PE of the cold data block to catch up with the average PE can also be a long period of time;

[0069] The embodiment of the present application provides a cold data migration method, as shown in Figure 4 , and the specific steps are as follows:

[0070] Step S401, determining the functional relationship (equivalent to the target function relationship in the above embodiment) between the PE gap (equivalent to the difference in the above embodiment) and the migration time (equivalent to the migration time in the above embodiment);

[0071] ​​Step S402, determining a first PE (equivalent to the first erase number in the above embodiment) of a first storage unit in the solid state drive SSD for storing target cold data (equivalent to the first cold data in the above embodiment) and an average PE (equivalent to the first average erase number in the above embodiment) of all storage units in the solid state drive;

[0072] Step S403, determining a PE gap (equivalent to the target difference value in the above embodiment) of the first PE and the average PE;

[0073] Step S404, determining a target migration time length T migrate (equivalent to the first migration time length in the above embodiment) corresponding to the PE gap according to a target function relationship;

[0074] Step S405, determining a target migration speed (equivalent to the first migration speed in the above embodiment) of the target cold data according to the T migrate, and migrating the target cold data from the first storage unit to a second storage unit in the solid state drive at the target migration speed.

[0075] Specifically, the number of 4K (equivalent to one flash page in the above embodiment) read by garbage collection (GC) per unit time = the total number of 4K in one block / T migrate; the speed of GC reading per unit time is strictly controlled to achieve the control of the cold data migration speed.

[0076] It should be noted that there are many implementation manners of the step S401, such as Figure 5 As shown in the figure, in an exemplary embodiment, the specific steps are as follows:

[0077] Step S501, determining a slowest migration time length of migrating the target cold data from the first storage unit to the second storage unit;

[0078] Time calculation principle: according to the time of moving the target cold data, at least the average PE and the PE of the current block will not continue to widen.

[0079] The slowest migration time length is determined by the following formula:

[0080] T migrate_slow = SSD CAP * (1 + OP) / max_bw; SSD CAP is the user capacity of the SSD; Max_bw is the maximum write bandwidth (equivalent to the maximum write speed in the above embodiment) of the SSD; SSD CAP * (1 + OP) calculates the NAND capacity of the whole SSD (equivalent to the total capacity of the solid state drive in the above embodiment); OP is the reserved space capacity of the SSD;

[0081] Step S502: determine the fastest migration completion time T_migrate_fast of the block; the value is obtained by experiment. The principle of data determination: the cold data does not produce 10% jitter on performance within the fastest migration time.

[0082] Step S503: determine the PE gap of wear leveling control, i.e. PE_dis_min and PE_dis_max;

[0083] Wherein, the PE gap is the average PE of the current cold data block-all blocks;

[0084] PE_dis_min is the minimum PE gap triggering the cold data migration;

[0085] PE_dis_max is the maximum PE gap triggering the cold data migration;

[0086] Step S504: establish the functional relationship between the PE gap and the migration time according to T_migrate_slow, T_migrate_fast, PE_dis_min, PE_dis_max. As shown in Figure 6 .

[0087] Through the above embodiment, the performance decline problem caused by the cold data storm migration in the static wear leveling is solved. By establishing the functional relationship between the PE gap and the data migration, the speed of the cold data migration is accurately dynamically adjusted, the migration of the cold data is reasonably spread in a longer time, the performance stability of the SSD is ensured on the premise of realizing the wear leveling.

[0088] Through the description of the above implementation, those skilled in the art can clearly understand that the method according to the above embodiment can be realized by means of software and the necessary general hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better implementation. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a plurality of instructions for making a terminal device (which can be a mobile phone, computer, server, or network device, etc.) execute the method described in each embodiment of the present application.

[0089] In the present embodiment, a cold data migration device is also provided, which is used to realize the above embodiment and preferred implementation, and will not be described again. As used below, the term "module" can be a combination of software and / or hardware that realizes a predetermined function. Although the device described in the following embodiments is preferably realized in software, hardware, or a combination of software and hardware is also possible and is conceived.

[0090] Figure 7 is a structural block diagram of a cold data migration device according to an embodiment of the present application, as shown in the figure, the device comprises: Figure 7

[0091] an acquisition module 72, configured to acquire a first erase count of a first storage unit for storing first cold data in a solid state disk and a first average erase count of all storage units in the solid state disk;

[0092] a determination module 74, configured to determine a first migration time length of the first cold data by using the first erase count and the first average erase count;

[0093] a migration module 76, configured to determine a first migration speed of the first cold data according to the first migration time length, and migrate the first cold data from the first storage unit to a second storage unit in the solid state disk at the first migration speed.

[0094] According to the above device, since the first erase count of the first storage unit for storing the first cold data in the solid state disk and the first average erase count of all storage units in the solid state disk are acquired, the first migration time length of the first cold data is determined by using the first erase count and the first average erase count, the first migration speed of the first cold data is determined according to the first migration time length, and the first cold data is migrated from the first storage unit to the second storage unit in the solid state disk at the first migration speed, that is, according to the first erase count of the storage unit and the first average erase count of the solid state disk, the speed of cold data migration is accurately controlled, the migration of the cold data is reasonably spread in a longer time, static wear leveling is realized in a slow and stable speed, and the influence on the read-write performance of the SSD is reduced, and therefore, the problems such as the influence of cold data storm on the read-write performance of the SSD in the process of static wear leveling can be solved.

[0095] In one example embodiment, the determination module 74 is further configured to determine a target difference value of the first erase count and the first average erase count, and determine the first migration time length corresponding to the target difference value according to a target function relationship, wherein the target function relationship is used to indicate the corresponding relationship between the difference value and the migration time length.

[0096] That is, the target function relationship used to indicate the corresponding relationship between the difference value and the migration time length is determined, and the first migration time length corresponding to the target difference value is determined according to the target function relationship. It should be noted that in the case of a linear function relationship, the first migration time length corresponding to the target difference value is determined according to the linear function relationship.

[0097] ​It should be noted that if the migration speed of the cold data is too fast, the erase times of the first storage unit for storing the first cold data and the first average erase times can tend to be balanced in a short time, but the read performance of the solid state disk can be sharply reduced in a short time; if the migration speed of the cold data is slow, the limited migration of the cold data can be spread over a longer time dimension, reducing the impact on the read performance of the solid state disk, but the difference value of the erase times (equivalent to the target difference value in the above embodiment) can be larger and larger, so it is necessary to determine the migration speed of the cold data, which not only ensures that the migration is slow, but also ensures that the erase times are balanced. According to the function relationship in the above embodiment, the first migration speed of the cold data corresponding to the target difference value of the erase times of the first storage unit and the first average erase times is determined, and then the migration speed of the cold data can be accurately and dynamically adjusted, so that the migration of the cold data can be reasonably spread over a longer time, and the stability of the read and write performance of the solid state disk can be ensured on the premise of wear leveling.

[0098] In one example embodiment, the determining module 74 is further configured to determine a slowest migration time length for migrating the first cold data from the first storage unit to the second storage unit, and determine a fastest migration time length for migrating the first cold data from the first storage unit to the second storage unit; determine a minimum erase times difference value and a maximum erase times difference value for triggering the migration of the first cold data, wherein the minimum erase times difference value is used to indicate a minimum erase times difference value for triggering the migration of the first cold data, and the maximum erase times difference value is used to indicate a maximum erase times difference value for triggering the migration of the first cold data; and establish the target function relationship according to the minimum erase times difference value, the maximum erase times difference value, the slowest migration time length and the fastest migration time length, wherein the target function relationship is used to indicate the relationship between the minimum erase times difference value and the slowest migration time length, and the relationship between the maximum erase times difference value and the fastest migration time length.

[0099] That is, the function relationship between the erase times difference value and the migration time is established, first, the slowest migration time length and the fastest migration time length for migrating the first cold data from the first storage unit to the second storage unit are determined; second, the maximum erase times difference value and the minimum erase times difference value for triggering the migration of the first cold data are determined; and the target function relationship is determined according to the corresponding relationship between the maximum erase times difference value and the fastest migration time length, and the corresponding relationship between the minimum erase times difference value and the slowest migration time length. Since the two coordinate points of the target function relationship can be determined according to the corresponding relationship between the maximum erase times difference value and the fastest migration time length, and the corresponding relationship between the minimum erase times difference value and the slowest migration time length, the target function relationship can be determined.

[0100] It should be noted that the greater the difference in erasing times, the faster the migration speed, and the smaller the difference in erasing times, the slower the migration speed. The above target function relationship provides theoretical algorithm support for the migration speed of cold data, and the migration speed of cold data can be simply determined according to the above target function relationship. In addition, the migration speed of cold data can be accurately controlled according to the above target function relationship, that is, the migration of cold data is reasonably spread over a longer period of time, which ensures the stability of the read-write performance of the solid state disk under the premise of wear leveling.

[0101] In an example embodiment, the determining module 74 is further configured to determine a user capacity of the solid state disk, a reserved space capacity of the solid state disk, and a maximum write speed of the solid state disk; determine a total capacity of the solid state disk according to the user capacity and the reserved space capacity of the solid state disk; and determine a slowest migration time length for migrating the first cold data from the first storage unit to a second storage unit in the solid state disk according to the total capacity and the maximum write speed.

[0102] In an example embodiment, the determining module 74 is further configured to determine a product of the user capacity and the reserved space capacity, and take the product and a sum of the user capacity as the total capacity of the solid state disk.

[0103] In an example embodiment, the determining module 74 is further configured to determine the slowest migration time length for migrating the first cold data from the first storage unit to the second storage unit in the solid state disk in the following manner: determine a quotient of the total capacity and the maximum write speed, and take the quotient of the total capacity and the maximum write speed as the slowest migration time length.

[0104] That is, the slowest migration time length for migrating the first cold data from the first storage unit to the second storage unit is determined by the following formula:

[0105] T_migrate_slow = SSD_CAP * (1 + OP) / max_bw; where SSD_CAP is the user capacity of the solid state disk, OP is the reserved space capacity of the solid state disk, and Max_bw is the maximum write speed of the solid state disk. SSD_CAP * (1 + OP) calculates the total NAND capacity of the solid state disk. That is, the slowest migration time length for migrating the first cold data from the first storage unit to the second storage unit = the time for writing full disk at the maximum write speed, and thus the cold data migration period can be further prevented from continuing to widen the average PE.

[0106] It should be noted that when the data of a solid state disk is full, additional space is needed to accept new data written before starting garbage collection, and this additional space is the reserved space, wherein the reserved space is invisible to the user.

[0107] In an example embodiment, the determining module 74 is further configured to determine the fastest migration time length for migrating the first cold data from the first storage unit to a second storage unit in the solid state disk, including: determining a migration speed corresponding to any migration time length in a plurality of migration time lengths; determining a read speed of the solid state disk corresponding to the migration speed in a case of migrating the first cold data from the first storage unit to the second storage unit according to the migration speed; and performing the determining step cyclically until determining a read speed corresponding to each migration time length in the plurality of migration time lengths; and determining the fastest migration time length according to the read speed corresponding to each migration time length.

[0108] That is, a plurality of migration time lengths are determined respectively, a read speed of the solid state disk in a case of migrating the first cold data from the first storage unit to a second storage unit in the solid state disk at any migration time length in the plurality of migration time lengths is determined respectively, and the read performance of the solid state disk is determined according to the read speed of the solid state disk, and the fastest migration time length is determined according to the read performance of the solid state disk.

[0109] Specifically, in an example embodiment, the determining module 74 is further configured to determine the fastest migration time length by: determining a ratio of a read speed of the solid state disk corresponding to each migration speed to a maximum read speed of the solid state disk; determining a target ratio greater than or equal to a third preset threshold value in a plurality of the ratios; determining a migration speed corresponding to the target ratio, and determining the fastest migration time length according to the migration speed.

[0110] It should be noted that the read performance of the solid state disk is determined according to the ratio of the read speed of the solid state disk corresponding to each migration speed to the maximum read speed of the solid state disk, the higher the ratio, the less the influence on the determination of the read performance of the solid state disk; the higher the ratio, the greater the influence on the determination of the read performance of the solid state disk, so the migration speed corresponding to the target ratio greater than or equal to the third preset threshold value is taken as the fastest migration speed of the first cold data, and then the fastest migration time length is determined according to the fastest migration speed and the size of the first cold data.

[0111] For example, the read speed of the solid state disk is determined when the migration time length is 1.5, 2 and 2.5 minutes respectively, and then the influence of the read performance of the solid state disk when the migration time length is 1.5, 2 and 2.5 minutes respectively is determined, and the migration time length that does not produce a 10% jitter on the performance is the fastest migration time length.

[0112] In an example embodiment, the determining module 74 is further configured to determine the first migration speed of the first cold data according to the first migration time length, including: determining a first number of flash pages of the first storage unit occupied by the first cold data; determining a quotient value of the first migration time length and the first number, and taking the quotient value of the first migration time length and the first number as the first migration speed.

[0113] It should be noted that the solid state disk is divided into many storage units (blocks), and the storage segment is divided into many flash pages, and the read and write of the solid state disk are in units of pages; therefore, when determining the first migration speed of the first cold data, the first number of flash pages of the first storage unit written with the first cold data needs to be determined first; and the quotient value of the first migration time length and the first number is taken as the first migration speed.

[0114] Through the above embodiment, the read speed of the garbage collection in a unit of time is strictly controlled to achieve the control of the first migration speed of the first cold data.

[0115] In an example embodiment, the obtaining module is configured to obtain a second erase number of a third storage unit in a solid state disk for storing second cold data and a second average erase number of all storage units in the solid state disk; the determining module is configured to determine a second migration time length of the second cold data through the second erase number and the second average erase number; and the migration module is configured to determine a second migration speed of the second cold data according to the second migration time length, and migrate the second cold data from the third storage unit to a fourth storage unit in the solid state disk at the second migration speed.

[0116] It should be noted that the above modules can be implemented by software or hardware, and for the latter, the following implementation manners can be used, but are not limited thereto: the above modules are located in the same processor; or the above modules are located in different processors in any combination.

[0117] Embodiments of the present application also provide a computer readable storage medium, which stores a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when running.

[0118] Optionally, in the embodiment, the storage medium can be configured to store program code for performing the following steps:

[0119] S1, obtaining a first erase number of a first storage unit in a solid state disk for storing first cold data and a first average erase number of all storage units in the solid state disk;

[0120] S2, determining a first migration time length of the first cold data by the first erase number and the first average erase number;

[0121] S3, determining a first migration speed of the first cold data according to the first migration time length, and migrating the first cold data from the first storage unit to a second storage unit in the solid state disk at the first migration speed.

[0122] In an example embodiment, the computer readable storage medium can include, but is not limited to, a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store computer programs.

[0123] Embodiments of the present application also provide an electronic device including a memory and a processor, the memory storing a computer program, and the processor being configured to execute the computer program to perform the steps in any of the above method embodiments.

[0124] Optionally, in the embodiment, the processor can be configured to perform the following steps by the computer program:

[0125] S1, obtaining a first erase number of a first storage unit in a solid state disk for storing first cold data and a first average erase number of all storage units in the solid state disk;

[0126] S2, determining a first migration time length of the first cold data by the first erase number and the first average erase number;

[0127] S3, determining a first migration speed of the first cold data according to the first migration time length, and migrating the first cold data from the first storage unit to a second storage unit in the solid state disk at the first migration speed.

[0128] In an example embodiment, the electronic device can further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0129] The specific examples in the present embodiment can refer to the examples described in the above embodiments and exemplary embodiments, which will not be repeated here.

[0130] Obviously, those skilled in the art should understand that the modules or steps of the present application described above can be realized by general computing devices, which can be centralized on a single computing device or distributed on a network composed of multiple computing devices, which can be realized by program codes executable by the computing devices, so that they can be stored in storage devices and executed by the computing devices, and in some cases, the steps shown or described can be executed in different order, or they can be respectively manufactured into individual integrated circuit modules, or multiple modules or steps among them can be manufactured into a single integrated circuit module to realize. Thus, the present application is not limited to any specific combination of hardware and software.

[0131] The above only describes the preferred embodiments of the present application and is not intended to limit the present application. For those skilled in the art, the present application can have various modifications and changes. Any modification, equivalent replacement, improvement, etc. within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for migrating cold data, characterized by, The method comprises: obtaining a first erase count of a first storage unit in a solid state disk for storing first cold data and a first average erase count of all storage units in the solid state disk; determining a first migration time length of the first cold data through the first erase count and the first average erase count; determining a first migration speed of the first cold data according to the first migration time length, and migrating the first cold data from the first storage unit to a second storage unit in the solid state disk at the first migration speed; wherein determining the first migration time length of the first cold data through the first erase count and the first average erase count comprises: determining a target difference value of the first erase count and the first average erase count; determining the first migration time length corresponding to the target difference value according to a target function relationship, wherein the target function relationship is used to indicate a corresponding relationship between a difference value and a migration time length; wherein before determining the first migration time length corresponding to the target difference value according to the target function relationship, the method further comprises: determining a slowest migration time length of migrating the first cold data from the first storage unit to the second storage unit, and determining a fastest migration time length of migrating the first cold data from the first storage unit to the second storage unit; determining a minimum erase count difference value and a maximum erase count difference value for triggering cold data migration, wherein the minimum erase count difference value is used to indicate a minimum erase count difference value for triggering the first cold data migration, and the maximum erase count difference value is used to indicate a maximum erase count difference value for triggering the first cold data migration; establishing the target function relationship according to the minimum erase count difference value, the maximum erase count difference value, the slowest migration time length, and the fastest migration time length, wherein the target function relationship is used to indicate a relationship between the minimum erase count difference value and the slowest migration time length, and a relationship between the maximum erase count difference value and the fastest migration time length.

2. The method of claim 1, wherein, determining the slowest migration time length of migrating the first cold data from the first storage unit to the second storage unit comprises: determining a user capacity of the solid state disk, a reserved space capacity of the solid state disk, and a maximum write speed of the solid state disk; determining a total capacity of the solid state disk according to the user capacity of the solid state disk and the reserved space capacity of the solid state disk; determining the slowest migration time length of migrating the first cold data from the first storage unit to the second storage unit in the solid state disk according to the total capacity and the maximum write speed.

3. The method of claim 2, wherein, determining the total capacity of the solid state disk according to the user capacity of the solid state disk and the reserved space capacity of the solid state disk comprises: determining a product of the user capacity and the reserved space capacity, and taking the product and a sum of the user capacity as the total capacity of the solid state disk.

4. The method of claim 2, wherein, determining the slowest migration time length of migrating the first cold data from the first storage unit to the second storage unit in the solid state disk according to the total capacity and the maximum write speed comprises: determining a quotient value of the total capacity and the maximum write speed, and taking the quotient value of the total capacity and the maximum write speed as the slowest migration duration.

5. The method of claim 1, wherein, determining a fastest migration duration of migrating the first cold data from the first storage unit to a second storage unit in the solid state disk, comprising: a determining step of determining a migration speed corresponding to any migration duration in a plurality of migration durations; and determining a read speed of the solid state disk corresponding to the migration speed in a case of migrating the first cold data from the first storage unit to the second storage unit according to the migration speed; cyclically performing the determining step until determining a read speed corresponding to each migration duration in the plurality of migration durations; determining a fastest migration duration according to the read speed corresponding to each migration duration.

6. The method of claim 5, wherein, determining a fastest migration duration according to the read speed corresponding to each migration duration, comprising: determining a ratio of the read speed of the solid state disk corresponding to each migration speed to the maximum read speed of the solid state disk; determining a target ratio greater than or equal to a third preset threshold value in a plurality of the ratios; determining a migration speed corresponding to the target ratio, and determining the fastest migration duration according to the migration speed.

7. The method of claim 1, wherein, determining a first migration speed of the first cold data according to the first migration duration, comprising: determining a first number of flash pages of the first storage unit occupied by the first cold data; determining a quotient value of the first migration duration and the first number, and taking the quotient value of the first migration duration and the first number as the first migration speed.

8. The method of claim 1, wherein, After migrating the first cold data from the first storage unit to a second storage unit in the solid state disk at the first migration speed, the method further comprises: obtaining a second erase count of a third storage unit in the solid state disk for storing second cold data and a second average erase count of all storage units in the solid state disk; determining a second migration duration of the second cold data through the second erase count and the second average erase count; determining a second migration speed of the second cold data according to the second migration duration, and migrating the second cold data from the third storage unit to a fourth storage unit in the solid state disk at the second migration speed.

9. A cold data migration apparatus, comprising: comprising: an obtaining module, configured to obtain a first erase count of a first storage unit in a solid state disk for storing first cold data and a first average erase count of all storage units in the solid state disk; a determining module, configured to determine a first migration duration of the first cold data through the first erase count and the first average erase count; a migrating module, configured to determine a first migration speed of the first cold data according to the first migration duration, and migrate the first cold data from the first storage unit to a second storage unit in the solid state disk at the first migration speed; wherein the determining module is further configured to determine a target difference value of the first erase count and the first average erase count, and determine the first migration duration corresponding to the target difference value according to a target function relationship, wherein the target function relationship is used to indicate a corresponding relationship between a difference value and a migration duration. The determining module is further configured to determine a slowest migration time length for migrating the first cold data from the first storage unit to the second storage unit, and determine a fastest migration time length for migrating the first cold data from the first storage unit to the second storage unit; determine a minimum erase times difference and a maximum erase times difference for triggering the cold data migration, wherein the minimum erase times difference is used to indicate a minimum erase times difference for triggering the first cold data migration, and the maximum erase times difference is used to indicate a maximum erase times difference for triggering the first cold data migration; and establish the objective function relationship according to the minimum erase times difference, the maximum erase times difference, the slowest migration time length, and the fastest migration time length, wherein the objective function relationship is used to indicate a relationship between the minimum erase times difference and the slowest migration time length, and a relationship between the maximum erase times difference and the fastest migration time length.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 8.

11. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the method in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Storage devices and data retention methods thereof

    US20190205040A1