Data block management method and device, equipment and medium

Through heat index calculation and binary heap management strategy, the problem of low efficiency in identifying hot and cold data in solid-state drives is solved, and storage performance and device life are improved.

CN118535092AActive Publication Date: 2024-08-23CHENGDU BIWIN STORAGE TECHNOLOGY CO LTD
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202410621819.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-20
Publication Date
2024-08-23
Estimated Expiration
2044-05-20

AI Technical Summary

Technical Problem

In existing SSD technology, the hot and cold identification strategy of data is inefficient and cannot accurately assess the degree of hot and cold data, resulting in insufficient storage performance and short device life.

Method used

The heat index calculation formula (HI=f×(ωr·R+ωw·W)×e-λt×(1-en) is used to evaluate the heat index of the data block, and through the binary heap structure (hot heap and cold heap) Perform dynamic management, migrate data blocks in real time based on the heat index, and optimize garbage collection and wear leveling strategies.

Benefits of technology

It improves data block search efficiency and storage performance, extends the service life of solid-state drives, and enables smarter data management and performance optimization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535092A
    Figure CN118535092A
Patent Text Reader

Abstract

The embodiment of the invention provides a data block management method and device, equipment and a medium, and belongs to the technical field of solid state disks. The method comprises the following steps: determining an initial popularity index of each data block according to a popularity index calculation formula; updating each initial popularity index in a preset updating period to obtain a plurality of updated popularity indexes; comparing each updated popularity index with a cold and hot threshold value of the data block to obtain a plurality of comparison results; determining the sorting position of each data block in the binary heap according to each comparison result and each updated popularity index; putting each data block into a corresponding binary heap according to each sorting position; and executing a garbage collection program by periodically accessing the data blocks at the top of the binary heap. According to the scheme provided by the invention, the cold and hot degree of the data can be accurately evaluated, and the search efficiency is improved and the service life of the solid state disk is prolonged by accurately classifying the data blocks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of solid state hard disks, and in particular to a data block management method, device, equipment and medium. Background Art

[0002] In the development of SSD technology, the optimization of data hot and cold identification strategies plays a vital role in improving storage performance and extending device life. In SSD firmware technology, it is often necessary to perform differentiated garbage collection and wear leveling strategies on storage units with different temperatures, which requires unified management of all storage units based on temperature.

[0003] The traditional hot and cold block management solution uses an unordered linear table to store the heat information of all data blocks in order of the unique index of the storage unit. With the continuous growth of data volume and the increasing complexity of application scenarios, higher requirements are placed on the hot and cold identification strategy of data. In solid-state drives, data is usually organized in blocks and pages, and each erase and write operation will cause physical damage to the storage unit. Existing technologies cannot accurately evaluate the hot and cold degree of data, and the search efficiency is low. Summary of the invention

[0004] In order to solve the above technical problems, the embodiments of the present application provide a data block management method, apparatus, system, device and medium.

[0005] In a first aspect, an embodiment of the present application provides a data block management method, the method comprising:

[0006] Determine the initial heat index of each data block according to the heat index calculation formula;

[0007] Updating each of the initial heat indexes within a preset update period to obtain a plurality of updated heat indexes;

[0008] Comparing each of the update heat indexes with the cold and hot thresholds of the data block to obtain a plurality of comparison results;

[0009] Determine the sorting position of each data block in the binary heap according to each comparison result and each update heat index;

[0010] Put each of the data blocks into the corresponding binary heap according to each of the sorting positions;

[0011] A garbage collection procedure is performed by periodically accessing the data block at the top of the binary heap.

[0012] In one embodiment, the heat index calculation formula is:

[0013] HI-f×(ω r ·R|ωw ·W)×e -λt ×(1-e n )

[0014] Where HI is the heat index, f is the access frequency, R is the number of reads, W is the number of writes, ω r To read the weight factor, ω w is the write weight factor, λ is the time decay constant, t is the historical time, e n is the normalized number of erase and write cycles.

[0015] In one implementation, the binary stack includes: a hot stack and a cold stack, and each of the data blocks is placed in the cold stack.

[0016] In one implementation, each of the data blocks is placed into the corresponding binary heap according to each of the comparison results, and the corresponding data blocks are sorted in the binary heap according to the order of the update heat index.

[0017] In one embodiment, determining whether each of the update heat indexes is greater than the cold and hot thresholds;

[0018] If the update heat index is greater than the cold and hot thresholds, moving each of the data blocks corresponding to each of the update heat indexes from the cold pile to the hot pile;

[0019] If the update heat index is less than the cold / hot threshold, the corresponding data blocks are placed in the cold pile according to the update heat index.

[0020] In one implementation, each of the data blocks to be moved is determined to obtain data nodes of a plurality of thermal stack data blocks;

[0021] Deleting the data nodes of each of the hot stack data blocks in the cold stack;

[0022] The data nodes of each of the thermal pile data blocks are added to the end of the thermal pile, and a floating operation is performed on the data nodes of each of the thermal pile data blocks.

[0023] In one embodiment, each of the thermal pile data blocks is sorted according to the thermal index;

[0024] Determining whether each of the thermal pile data blocks is the thermal pile data block with the lowest thermal index;

[0025] If so, the thermal pile data block does not need to perform the float operation.

[0026] In a second aspect, an embodiment of the present application provides a data block management device, the data block management device comprising:

[0027] A determination module, used to determine the initial heat index of each data block according to a heat index calculation formula;

[0028] An updating module, used to update each of the initial heat indexes within a preset update period to obtain a plurality of updated heat indexes;

[0029] A comparison module, used for comparing each of the update heat indexes with the cold and hot thresholds of the data block to obtain a plurality of comparison results;

[0030] A sorting module, used to determine the sorting position of each data block in the binary heap according to each comparison result and each update heat index;

[0031] An inserting module, used for inserting each of the data blocks into the corresponding binary heap according to each of the sorting positions;

[0032] An execution module is used to execute a garbage collection program by periodically accessing the data block at the top of the binary heap.

[0033] In a third aspect, an embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is run by the processor, the data block management method provided in the first aspect is executed.

[0034] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which executes the data block management method provided in the first aspect when running on a processor.

[0035] The data block management method, device, equipment and medium provided by the present application above determine the initial heat index of each data block according to the heat index calculation formula; update each of the initial heat indexes within a preset update cycle to obtain multiple updated heat indexes; compare each of the updated heat indexes with the hot and cold thresholds of the data block to obtain multiple comparison results; determine the sorting position of each of the data blocks in the binary heap according to each of the comparison results and each of the updated heat indexes; put each of the data blocks into the corresponding binary heap according to each of the sorting positions; and execute the garbage collection program by periodically accessing the data blocks at the top of the binary heap. The heat index is obtained by calculation, and the data blocks are dynamically migrated in the binary heap in real time according to the heat index. The heat index can be searched by managing the binary heap, thereby improving the overall read and write speed and overall performance, and extending the service life of the solid-state hard disk. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present application and should not be regarded as limiting the scope of protection of the present application. In each of the drawings, similar components are numbered similarly.

[0037] Figure 1 A schematic diagram of a process of a data block management method is shown;

[0038] Figure 2 A schematic diagram of cold and hot stack management provided by an embodiment of the present application is shown;

[0039] Figure 3 A schematic diagram of the structure of a data block management device provided in an embodiment of the present application is shown;

[0040] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown.

[0041] Icons: 300 - data block management device, 301 - determination module, 302 - update module, 303 - comparison module, 304 - sorting module, 305 - insertion module, 306 - execution module, 400 - electronic device, 401 - transceiver, 402 - processor, 403 - memory. DETAILED DESCRIPTION

[0042] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.

[0043] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0044] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present application, are intended only to indicate specific features, numbers, steps, operations, elements, components, or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing items or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations of the foregoing items.

[0045] Furthermore, the terms “first”, “second”, “third”, etc. are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.

[0046] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.

[0047] Example 1

[0048] An embodiment of the present application provides a data block management method.

[0049] See also Figure 1 , the data block management method includes:

[0050] S101, determining the initial heat index of each data block according to a heat index calculation formula.

[0051] It should be noted that traditional data hotness and coldness assessment solutions either use the LRU (Least Recently Used) algorithm or are based on the principle of temporal locality. Some of these solutions do not consider the different effects of data operation types on hardware life, some lack effective implementation mechanisms, and some have problems with insufficiently refined data management.

[0052] In this embodiment, in order to optimize the traditional dimension of evaluating the hotness and coldness of data and comprehensively evaluate the hotness and coldness of data, this solution uses super blocks as management units and combines the cold pile and hot pile in the dual binary heap structure to dynamically manage the hotness and coldness of super blocks. Super blocks are all data blocks with the same offset in different physical layers of all logical units in the medium of the solid-state drive.

[0053] In addition, this scheme proposes a data block heat index to linearly measure the activity of each super block to guide data migration and erase and write allocation, thereby optimizing storage performance and extending the service life of the SSD.

[0054] In one embodiment, the heat index calculation formula is:

[0055] HI=f×(ω r ·R+ω w ·W)×e -λt ×(1-e n )

[0056] Where HI is the heat index, f is the access frequency, R is the number of reads, W is the number of writes, ω r To read the weight factor, ω w is the write weight factor, λ is the time decay constant, t is the historical time, e n is the normalized number of erase and write cycles.

[0057] It should be noted that the heat index calculation formula can linearly reflect the heat index (HeatIndex, HI) of the data block. Since the write operation causes greater wear and tear on the SSD, the write operation needs to be given a higher weight than the read operation. The determination of the time decay constant needs to be determined based on factors such as the particle type used by the SSD and the load during use.

[0058] Combining these factors, the heat index is designed to provide a balanced and comprehensive measure of data heat that is not only based on frequency, but also takes into account the newness of the data, the type of operation, and the impact on the hardware life. This multi-dimensional scoring approach can help the SSD's firmware manage data more intelligently, for example, by retaining hot data in faster storage areas while migrating cold data to higher-endurance storage areas, thereby extending the overall life of the device and improving performance.

[0059] For example, to calculate the heat index of a data block, read the weight factor ω r =1; write weight factor ω w = 8; time decay constant λ = 0.1; number of reads of the data block R = 200, number of writes W = 1, access frequency f = 0.01, time since the last access to the unit t = 20s, normalized normalized erase and write times e n =0.5. The access frequency is the total number of times the medium is accessed divided by the number of times the data block is accessed.

[0060] In summary, HI spb 1 =0.01×(1×200+8×1)×e -2 ×(1-0.5)=0.14.

[0061] In one implementation, the binary stack includes: a hot stack and a cold stack, and each of the data blocks is placed in the cold stack.

[0062] It should be noted that in the firmware technology of solid-state drives, it is often necessary to implement differentiated garbage collection and wear leveling strategies for storage units with different temperatures, which requires unified management of all storage units based on temperature.

[0063] The traditional hot and cold block management solution uses an unordered linear table to store the heat information of all data blocks in order of the unique index of the storage unit. This traditional solution has the following limitations: 1. Low search efficiency: In order to find the coldest or hottest information, the entire table may need to be traversed in the worst case, with a time complexity of O(n). 2. Priority operations are not supported. The unordered linear table cannot support calls based on the hot and cold priorities of data blocks.

[0064] In order to solve the problems of the traditional unordered linear table solution, a hot / cold heap management strategy (Hot / Cold Heaps, HCH) based on heat index is designed. This strategy can improve the management efficiency of SSD for all storage units with different heat indexes, optimize the search speed of cold blocks and hot blocks, more conveniently find the data blocks with the highest or lowest heat, and support priority-based garbage collection and wear leveling strategies.

[0065] The hot and cold heap management strategy uses two binary heaps, namely the hot heap and the cold heap, to manage the hotter and colder data blocks respectively. The two heaps are organized in the form of a maximum heap and a minimum heap respectively. The nodes in the heap store the unique index and heat index of the data block.

[0066] S102, updating each of the initial heat indexes within a preset update period to obtain a plurality of updated heat indexes.

[0067] In this embodiment, each time a data block is accessed, the following operations are performed: the number of reads or writes, the time since the last access to the unit, and the number of accesses to the data block are updated by 1. When a controller is relatively idle, the controller calculates the access frequency of each data block through the previously updated number of reads, historical time, and number of accesses, and updates the heat index of each data block.

[0068] It should be noted that the update cycle of the heat index needs to be set according to the actual usage scenario, for example, the update cycle of the garbage collection program and the heat index table should be synchronized, and the garbage collection program should be started after the heat index table is updated.

[0069] S103, comparing each of the update heat indexes with the cold and hot thresholds of the data block to obtain a plurality of comparison results.

[0070] It should be noted that the setting of the hot and cold thresholds needs to be tested and determined in combination with the main usage scenarios of the SSD. The black box test method can be used to find the hot and cold thresholds that optimize the hot and cold data management performance. For example, if the heat index of a data block after update is 0.14 and the hot and cold threshold is 10, the updated data block should be placed in the cold pile.

[0071] It is further explained that when the entire thermal index table is updated, the update of the cold and hot piles should be completed synchronously, and the timestamp of the most recent update should be recorded after the update is completed.

[0072] S104: Determine the sorting position of each data block in the binary heap according to each comparison result and each update heat index.

[0073] It should be noted that when a data block needs to be adjusted in the heap, the heap is maintained by sinking and floating operations. For example, if the heat index of a data block in the hot heap increases, it will move up in the hot heap, and vice versa. The same is true for the case of a decrease in heat index.

[0074] In one implementation, each of the data blocks is placed into the corresponding binary heap according to each of the comparison results, and the corresponding data blocks are sorted in the binary heap according to the order of the update heat index.

[0075] In one embodiment, it is determined whether each of the update heat indexes is greater than the cold and hot thresholds; if the update heat index is greater than the cold and hot thresholds, each of the data blocks corresponding to each of the update heat indexes is moved from the cold pile to the hot pile; if the update heat index is less than the cold and hot thresholds, each of the corresponding data blocks is placed in the cold pile according to each of the update heat indexes.

[0076] It should be noted that if Figure 2 As shown, the hot heap is a maximum heap, where the top of the heap holds the hottest data blocks, i.e., those with the highest heat index. The data blocks in the hot heap are arranged according to their heat index, and the data blocks with high heat index move to the top of the heap.

[0077] A cold heap is a minimum heap where the top of the heap holds the coldest data blocks, i.e. the ones with the lowest heat index. The data blocks in the cold heap are arranged according to their heat index, and the data blocks with low heat index move to the top of the heap.

[0078] S105, putting each of the data blocks into the corresponding binary heap according to the sorting position.

[0079] It should be noted that by monitoring the performance of the hot and cold piles, the parameter size for calculating the thermal index and the cold and hot thresholds for distinguishing between the hot and cold piles are dynamically adjusted according to the workload and wear of the SSD.

[0080] It is further explained that the present application has the following features and advantages: (1) Performance optimization: Through the hot and cold pile management strategy, rapid heat index search can be performed, so that the solid-state drive can implement a priority-based dynamic garbage collection program under high load, improving the read and write speed and the overall performance of the solid-state drive. (2) Wear balance: By reasonably allocating the weight of write operations in the data hot and cold evaluation, the wear of the solid-state drive is balanced and the service life is extended. (3) Adaptability: The parameters such as hot and cold thresholds and weight factors can be dynamically adjusted according to the actual usage mode, which can improve the ability of the solid-state drive to adapt to different workloads.

[0081] In summary, this solution provides an intelligent data management solution for SSDs, which optimizes the physical layout and access efficiency of data by comprehensively analyzing data usage patterns and predicting future access trends.

[0082] In one embodiment, each of the data blocks to be moved is determined to obtain data nodes of multiple hot pile data blocks; the data nodes of each of the hot pile data blocks in the cold pile are deleted; the data nodes of each of the hot pile data blocks are added to the end of the hot pile, and a floating operation is performed on the data nodes of each of the hot pile data blocks.

[0083] For example, the heat index of a data block node in the cold pile rises and exceeds the cold and hot thresholds, and needs to be moved from the cold pile to the hot pile; delete the node from the cold pile: swap the node with the last node in the cold pile and delete the node, and perform a sinking operation on the new node that is now at the original node position, which maintains the integrity of the pile while simplifying the deletion operation; add the node to the hot pile: add the node to the end of the hot pile and perform a floating operation. After the operation is completed, the hot pile will be rebuilt according to the properties of the maximum heap to ensure that the heat index of all parent nodes is higher than the heat index of their child nodes.

[0084] In one embodiment, the thermal pile data blocks are sorted according to the thermal index; and it is determined whether each thermal pile data block is the thermal pile data block with the lowest thermal index; if so, the thermal pile data block does not need to perform the floating operation.

[0085] S106, executing a garbage collection program by periodically accessing the data block at the top of the binary heap.

[0086] It should be noted that the data block management method proposed in this solution can integrate machine learning algorithms, automatically adjust scoring parameters, predict future data types and load conditions, and continuously optimize performance based on historical data and future predictions. The strategy can identify different workload patterns, such as database operations and file server operations, and optimize parameters to adapt to specific patterns.

[0087] It is further explained that by executing the garbage collection procedure from the top of the binary heap, the present application can always obtain the hottest or coldest data at the fastest speed (time complexity is O(1)).

[0088] The data block management method provided in this embodiment determines the initial heat index of each data block according to the heat index calculation formula; updates each of the initial heat indexes within a preset update cycle to obtain multiple updated heat indexes; compares each of the updated heat indexes with the hot and cold thresholds of the data block to obtain multiple comparison results; determines the sorting position of each of the data blocks in the binary heap according to each of the comparison results and each of the updated heat indexes; puts each of the data blocks into the corresponding binary heap according to each of the sorting positions; and executes a garbage collection program by periodically accessing the data blocks at the top of the binary heap. The heat index is obtained by calculation, and the data blocks are dynamically migrated in the binary heap in real time according to the heat index. The heat index search can be performed by managing the binary heap, thereby improving the overall read and write speed and overall performance, and extending the service life of the solid-state hard disk.

[0089] Example 2

[0090] In addition, an embodiment of the present application provides a data block management device.

[0091] like Figure 3 As shown, the data block management device 300 includes:

[0092] A determination module 301 is used to determine the initial heat index of each data block according to a heat index calculation formula;

[0093] An updating module 302, configured to update each of the initial heat indexes within a preset update period to obtain a plurality of updated heat indexes;

[0094] A comparison module 303 is used to compare each of the update heat indexes with the cold and hot thresholds of the data block to obtain a plurality of comparison results;

[0095] A sorting module 304, configured to determine a sorting position of each data block in the binary heap according to each comparison result and each update heat index;

[0096] The placing module 305 is used to place each of the data blocks into the corresponding binary heap according to each of the sorting positions;

[0097] The execution module 306 is used to execute a garbage collection program by periodically accessing the data block at the top of the binary heap.

[0098] The data block management device 300 provided in this embodiment can implement the data block management method provided in Embodiment 1, and will not be described again here to avoid repetition.

[0099] The data block management device provided in this embodiment determines the initial heat index of each data block according to the heat index calculation formula; updates each of the initial heat indexes within a preset update cycle to obtain multiple updated heat indexes; compares each of the updated heat indexes with the hot and cold thresholds of the data block to obtain multiple comparison results; determines the sorting position of each of the data blocks in the binary heap according to each of the comparison results and each of the updated heat indexes; puts each of the data blocks into the corresponding binary heap according to each of the sorting positions; and executes a garbage collection program by periodically accessing the data blocks at the top of the binary heap. The heat index is obtained by calculation, and the data blocks are dynamically migrated in the binary heap in real time according to the heat index. The heat index search can be performed by managing the binary heap, thereby improving the overall read and write speed and overall performance, and extending the service life of the solid-state hard disk.

[0100] Example 3

[0101] In addition, an embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program runs on the processor, the data block management method provided in Embodiment 1 is executed.

[0102] For details, see Figure 4 The electronic device 400 includes: a transceiver 401, a bus interface and a processor 402, wherein the processor 402 is used to: determine the initial heat index of each data block according to a heat index calculation formula; update each of the initial heat indexes within a preset update period to obtain multiple updated heat indexes; compare each of the updated heat indexes with the cold and hot thresholds of the data block to obtain multiple comparison results; determine the sorting position of each of the data blocks in the binary heap according to each of the comparison results and each of the updated heat indexes; put each of the data blocks into the corresponding binary heap according to each of the sorting positions; and execute a garbage collection program by periodically accessing the data blocks at the top of the binary heap.

[0103] In one embodiment, the processor 402 is further configured to: the heat index calculation formula is:

[0104] HI=f×(ω r ·R+ω w ·W)×e -λt ×(1-e n )

[0105] Where HI is the heat index, f is the access frequency, R is the number of reads, W is the number of writes, ω r To read the weight factor, ω w is the write weight factor, λ is the time decay constant, t is the historical time, e nis the normalized number of erase and write cycles.

[0106] In one implementation, the processor 402 is further configured to: the binary pile includes a hot pile and a cold pile, and each of the data blocks is placed in the cold pile.

[0107] In one embodiment, the processor 402 is further configured to: place each of the data blocks into the corresponding binary heap according to each of the comparison results, and sort the corresponding data blocks in the binary heap in order of the update heat index.

[0108] In one embodiment, the processor 402 is also used to: determine whether each of the update heat indexes is greater than the cold and hot thresholds; if the update heat index is greater than the cold and hot thresholds, move each of the data blocks corresponding to each of the update heat indexes from the cold pile to the hot pile; if the update heat index is less than the cold and hot thresholds, place each of the corresponding data blocks in the cold pile according to each of the update heat indexes.

[0109] In one embodiment, the processor 402 is further used to: determine each of the data blocks to be moved to obtain data nodes of multiple hot pile data blocks; delete the data nodes of each of the hot pile data blocks in the cold pile; add the data nodes of each of the hot pile data blocks to the end of the hot pile, and perform a floating operation on the data nodes of each of the hot pile data blocks.

[0110] In one embodiment, the processor 402 is further used to: sort the thermal pile data blocks according to the thermal index; determine whether each thermal pile data block is the thermal pile data block with the lowest thermal index; if so, the thermal pile data block does not need to perform the floating operation.

[0111] In the embodiment of the present application, the electronic device 400 further includes a memory 403. Figure 4 In the embodiment, the bus architecture may include any number of interconnected buses and bridges, specifically linking various circuits of one or more processors represented by processor 402 and memory represented by memory 403. The bus architecture may also link various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface. The transceiver 401 may be a plurality of components, i.e., including a transmitter and a receiver, providing a unit for communicating with various other devices on a transmission medium. The processor 402 is responsible for managing the bus architecture and general processing, and the memory 403 may store data used by the processor 402 when performing operations.

[0112] The electronic device 400 provided in the embodiment of the present application can execute the steps of the data block management method provided in the above method embodiment 1, which will not be described again here to avoid repetition.

[0113] The electronic device provided in this embodiment determines the initial heat index of each data block according to the heat index calculation formula; updates each of the initial heat indexes within a preset update cycle to obtain multiple updated heat indexes; compares each of the updated heat indexes with the hot and cold thresholds of the data block to obtain multiple comparison results; determines the sorting position of each of the data blocks in the binary heap according to each of the comparison results and each of the updated heat indexes; puts each of the data blocks into the corresponding binary heap according to each of the sorting positions; and executes a garbage collection program by periodically accessing the data blocks at the top of the binary heap. The heat index is obtained by calculation, and the data blocks are dynamically migrated in the binary heap in real time according to the heat index. The heat index search can be performed by managing the binary heap, thereby improving the overall read and write speed and overall performance, and extending the service life of the solid-state hard disk.

[0114] Example 4

[0115] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the data block management method provided in Example 1 is implemented.

[0116] In this embodiment, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0117] The computer-readable storage medium provided in this embodiment can implement the data block management method provided in Embodiment 1, and will not be described again here to avoid repetition.

[0118] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or terminal including the element.

[0119] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0120] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A data block management method, characterized in that: The method comprises: Determine the initial heat index of each data block according to the heat index calculation formula; Updating each of the initial heat indexes within a preset update period to obtain a plurality of updated heat indexes; Comparing each of the update heat indexes with the cold and hot thresholds of the data block to obtain a plurality of comparison results; Determine the sorting position of each data block in the binary heap according to each comparison result and each update heat index; Put each of the data blocks into the corresponding binary heap according to each of the sorting positions; A garbage collection procedure is performed by periodically accessing the data block at the top of the binary heap.

2. The data block management method according to claim 1, characterized in that: Determining the heat index of each data block includes: The heat index calculation formula is: HI=f×(ω r ·R+ω w ·W)×e -λt ×(1-e n ) Where HI is the heat index, f is the access frequency, R is the number of reads, W is the number of writes, ω r To read the weight factor, ω w is the write weight factor, λ is the time decay constant, t is the historical time, e n is the normalized number of erase and write cycles.

3. The data block management method according to claim 1, characterized in that: The binary heap includes: a hot heap and a cold heap. Before determining the initial heat index of each data block according to the heat index calculation formula, the following steps are performed: Each of the data blocks is placed in the cold stack.

4. The data block management method according to claim 3, characterized in that: Determining the sorting position of each data block in the binary heap according to each comparison result and each update heat index includes: According to each comparison result, each data block is placed in the corresponding binary heap, and the corresponding data blocks are sorted in the binary heap according to the order of the update heat index.

5. The data block management method according to claim 4, characterized in that: The step of placing each of the data blocks into the corresponding binary heap according to each of the comparison results includes: Determine whether each of the update heat indexes is greater than the cold and hot thresholds; If the update heat index is greater than the cold and hot thresholds, moving each of the data blocks corresponding to each of the update heat indexes from the cold pile to the hot pile; If the update heat index is less than the cold / hot threshold, the corresponding data blocks are placed in the cold pile according to the update heat index.

6. The data block management method according to claim 5, characterized in that: The step of moving each of the data blocks corresponding to each of the updated heat indexes from the cold stack to the hot stack includes: Determine each of the data blocks to be moved, and obtain data nodes of multiple thermal pile data blocks; Deleting the data nodes of each of the hot stack data blocks in the cold stack; The data nodes of each of the thermal pile data blocks are added to the end of the thermal pile, and a floating operation is performed on the data nodes of each of the thermal pile data blocks.

7. The data block management method according to claim 6, characterized in that: The performing a floating operation on the data nodes of each of the thermal pile data blocks includes: sorting each of the thermal pile data blocks according to the thermal index; Determining whether each of the thermal pile data blocks is the thermal pile data block with the lowest thermal index; If so, the thermal pile data block does not need to perform the float operation.

8. A data block management device, characterized in that: The device comprises: A determination module, used to determine the initial heat index of each data block according to a heat index calculation formula; An updating module, used to update each of the initial heat indexes within a preset update period to obtain a plurality of updated heat indexes; A comparison module, used for comparing each of the update heat indexes with the cold and hot thresholds of the data block to obtain a plurality of comparison results; A sorting module, used to determine the sorting position of each data block in the binary heap according to each comparison result and each update heat index; An inserting module, used for inserting each of the data blocks into the corresponding binary heap according to each of the sorting positions; An execution module is used to execute a garbage collection program by periodically accessing the data block at the top of the binary heap.

9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the method for managing data blocks according to any one of claims 1 to 7 is executed.

10. A computer-readable storage medium, characterized in that: The computer program stores a computer program, which executes the data block management method according to any one of claims 1 to 7 when running on a processor.

Citation Information

Patent Citations

  • Method and device to migrate resource data

    CN108228110A

  • Cold and hot data management method and device, electronic equipment and computer readable medium

    CN109407995A

  • Data processing method, device, equipment and medium

    CN112286459A

  • Abrasion balancing method and device for solid state disk and computer readable storage medium

    CN112328169A

  • Solid state disk, wear balancing method thereof and terminal equipment

    CN112817880A