Data defragmentation method and device and computer readable storage medium

By calculating the fragmentation degree and access probability of the target business object and determining the defragmentation yield rate, it is possible to perform defragmentation at the appropriate time, solve the problem of read performance degradation caused by data fragmentation, and improve the read efficiency of the storage system.

CN120669926APending Publication Date: 2025-09-19JINAN INSPUR DATA TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510898982.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-30
Publication Date
2025-09-19

AI Technical Summary

Technical Problem

In the prior art, the log append writing mechanism causes serious data fragmentation, resulting in degraded reading performance. There is a lack of effective data defragmentation methods, which may lead to unnecessary or delayed defragmentation.

Method used

By determining the degree of fragmentation of the target business object's data to be sorted and the probability of future access, and comprehensively considering the degree of fragmentation and access probability, the yield rate of defragmentation is calculated. Defragmentation is performed when the yield rate meets the standard to avoid unnecessary or late defragmentation.

Benefits of technology

Accurately determine defragmentation timing to avoid unnecessary or delayed defragmentation and improve storage system read performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120669926A_ABST
    Figure CN120669926A_ABST
Patent Text Reader

Abstract

The invention discloses a data defragmentation method and device and a computer readable storage medium, belongs to the field of storage systems, and aims to defragmentize data to be defragmented of a target business object at a proper opportunity, firstly, the defragmentation degree of the data to be defragmented of the target business object can be determined, and then the access probability of the data to be defragmented in the future is estimated; the method comprises the following steps of: firstly, determining a yield rate of defragmentation of to-be-defragmented data by integrating a fragmentation degree and an accessed probability of the to-be-defragmented data, and finally, defragmenting the to-be-defragmented data when the yield rate reaches the standard. Decision contribution is made to the'defragmentation work 'from two dimensions of fragmentization degree and accessed probability, so that accurate and appropriate defragmentation opportunity is determined, and the situation of'unnecessary or too late' defragmentation is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of storage systems, and in particular to a data defragmentation method, device, equipment and computer-readable storage medium. Background Art

[0002] In storage systems, the log append write mechanism can aggregate random write requests at the cache layer, merging originally discrete write operations with small write data into continuous write operations with large write data. However, due to the existence of the log append write mechanism, as business objects are frequently updated, the data of the same business object will be stored in multiple discrete internal objects, resulting in severe data fragmentation. However, the related technology lacks a mature data defragmentation method, which may lead to unnecessary defragmentation or too late defragmentation.

[0003] This means that when reading the business object, data needs to be read separately from a large number of internal objects, which degrades the read performance of the storage system.

[0004] Therefore, how to provide a solution to the above technical problems is a problem that those skilled in the art need to solve at present. Summary of the Invention

[0005] The purpose of the present invention is to provide a data defragmentation method, device, equipment and computer-readable storage medium, which can first determine the degree of fragmentation of the data to be defragmented of the target business object, then estimate the probability of the data to be defragmented being accessed in the future, and then comprehensively consider the degree of fragmentation and the access probability of the data to be defragmented to determine the rate of return of defragmenting the data to be defragmented. Finally, when the rate of return meets the standard, the data to be defragmented is defragmented. The rate of return judgment index of the present invention makes a decision-making contribution to the "defragmentation work" from the two dimensions of the degree of fragmentation and the access probability, thereby determining the precise and appropriate time for defragmentation and avoiding the situation where the defragmentation is "unnecessary or too late".

[0006] To solve the above technical problems, the present invention provides a data defragmentation method, comprising:

[0007] Determining a degree of fragmentation of data to be defragmented of a target business object, wherein the target business object is a business object to be defragmented;

[0008] estimating the probability of the data to be sorted being accessed in the future;

[0009] Determining the rate of return of defragmenting the data to be defragmented based on the degree of fragmentation and access probability of the data to be defragmented;

[0010] When the rate of return reaches the target, the data to be sorted is defragmented.

[0011] On the other hand, determining the degree of fragmentation of the target business object's data to be sorted includes:

[0012] Determine preset indicators of the target business object's data to be sorted, wherein the preset indicators include the number of associated internal objects and the total volume of data. The number of associated internal objects is: the number of internal objects that have data in the data to be sorted;

[0013] The degree of fragmentation of the data to be sorted is determined according to the preset indicator and the minimum allocation unit of the storage system.

[0014] On the other hand, determining the fragmentation degree of the to-be-organized data according to the preset indicator and the minimum allocation unit of the storage system includes:

[0015] Based on the first corresponding relationship, determining the degree of fragmentation of the data to be sorted according to the preset indicator and the minimum allocation unit of the storage system;

[0016] The first corresponding relationship includes:

[0017] ;

[0018] Where FI is the degree of fragmentation, n is the number of associated internal objects of the data to be sorted, L is the total volume of the data to be sorted, and s is the minimum allocation unit of the storage system.

[0019] On the other hand, estimating the probability of the data to be sorted being accessed in the future includes:

[0020] The ratio of the number of times the data to be sorted is accessed to the total number of read and write accesses in the past preset time length or preset number of read and write requests is determined as the probability of the data to be sorted being accessed in the future.

[0021] On the other hand, according to the fragmentation degree and access probability of the data to be sorted, determining the rate of return of defragmenting the data to be sorted includes:

[0022] Based on the second corresponding relationship, determining the rate of return of defragmenting the data to be defragmented according to the degree of fragmentation and access probability of the data to be defragmented;

[0023] The second corresponding relationship includes:

[0024] ;

[0025] Among them, R is the rate of return of defragmenting the data to be defragmented, FI is the degree of fragmentation of the data to be defragmented, and f is the probability of the data to be defragmented being accessed in the future.

[0026] On the other hand, defragmenting the data to be defragmented when the rate of return reaches the target includes:

[0027] When the yield rate reaches the target, the data to be sorted is added to the buffer area to be flushed;

[0028] Determining whether the total amount of data in the to-be-flushed buffer area reaches the standard size of the internal object;

[0029] If it is reached, a new internal object is applied for, and the data with a volume equal to the standard volume of the internal object in the buffer area to be flushed is written into the newly applied internal object.

[0030] On the other hand, determining the degree of fragmentation of the target business object's data to be sorted includes:

[0031] Determine whether defragmentation will affect the normal operation of the storage system;

[0032] If not, an unscanned business object in the storage system is used as the target business object, and all data of the target business object is used as data to be sorted;

[0033] After determining the rate of return of defragmenting the data to be defragmented based on the degree of fragmentation and access probability of the data to be defragmented, the data defragmentation method further includes:

[0034] Increment the number of scanned business objects by one, and determine whether the current number of scanned business objects reaches a first preset threshold;

[0035] If not, return to the execution step: take an unscanned business object in the storage system as the target business object, and take all data of the target business object as data to be sorted;

[0036] If it is reached, the scan ends;

[0037] Defragmenting the data to be defragmented when the rate of return reaches the target includes:

[0038] Determining whether the yield rate of defragmentation of the data to be defragmented reaches a second preset threshold;

[0039] If it is reached, the target business object is added to the queue to be sorted;

[0040] The data to be sorted of the target business objects in the to-be-sorted queue are defragmented in descending order of the yield rate.

[0041] On the other hand, after determining whether the defragmentation work will affect the normal operation of the storage system, the data defragmentation method further includes:

[0042] If yes, determining whether the volume of the to-be-read data of the read request currently received by the storage system reaches a preset volume;

[0043] If it is reached, the business object to which the data to be read in the currently received read request belongs is used as the target business object, and the data to be read in the currently received read request is used as the data to be sorted of the target business object.

[0044] To solve the above technical problems, the present invention further provides a data defragmentation device, comprising:

[0045] memory for storing computer programs;

[0046] The processor is configured to implement the steps of the data defragmentation method described above when executing the computer program.

[0047] To solve the above technical problems, the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above data defragmentation method are implemented.

[0048] Beneficial effects: The present invention provides a data defragmentation method. In order to perform defragmentation at an appropriate time, the present invention can first determine the degree of fragmentation of the data to be defragmented of the target business object, then estimate the probability of the data to be defragmented being accessed in the future, and then determine the rate of return of defragmenting the data to be defragmented based on the degree of fragmentation and the probability of access. Finally, the data to be defragmented is defragmented when the rate of return meets the standard. The rate of return judgment index of the present invention makes a decision-making contribution to the "defragmentation work" from the two dimensions of the degree of fragmentation and the probability of access, thereby determining a precise and appropriate time for defragmentation and avoiding the situation where defragmentation is "unnecessary or too late".

[0049] The present invention also provides a data defragmentation device and a computer-readable storage medium, which have the same beneficial effects as the above data defragmentation method. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the relevant technologies and the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0051] Figure 1 A schematic flow chart of a first data defragmentation method provided by the present invention;

[0052] Figure 2 A schematic flow chart of a second data defragmentation method provided by the present invention;

[0053] Figure 3 A schematic flow chart of a third data defragmentation method provided by the present invention;

[0054] Figure 4 A schematic flow chart of a fourth data defragmentation method provided by the present invention;

[0055] Figure 5 A schematic structural diagram of a data defragmentation device provided by the present invention;

[0056] Figure 6 A schematic structural diagram of a computer-readable storage medium provided by the present invention. DETAILED DESCRIPTION

[0057] The core of the present invention is to provide a data defragmentation method, device, equipment and computer-readable storage medium. First, the degree of fragmentation of the target business object's data to be defragmented can be determined, and then the probability of access to the data to be defragmented in the future can be estimated. Then, the degree of fragmentation and the access probability of the data to be defragmented can be comprehensively considered to determine the rate of return of defragmenting the data to be defragmented. Finally, the data to be defragmented can be defragmented when the rate of return meets the standard. The rate of return judgment index of the present invention makes a decision-making contribution to the "defragmentation work" from the two dimensions of the degree of fragmentation and the access probability, thereby determining the precise and appropriate time for defragmentation and avoiding the situation where defragmentation is "unnecessary or too late".

[0058] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.

[0059] Please refer to Figure 1 , Figure 1 This is a flow chart of a first data defragmentation method provided by the present invention, which includes:

[0060] S101: Determine the degree of fragmentation of data to be defragmented of a target business object, wherein the target business object is the business object to be defragmented;

[0061] Specifically, taking into account the technical problems in the above background technology, and considering the decision on "defragmentation work" from the two dimensions of "fragmentation degree and access probability", the accurate and appropriate defragmentation time can be determined. Therefore, in the embodiment of the present invention, the degree of fragmentation of the data to be defragmented is to be determined first, and considering that the defragmentation work can be carried out not only for the complete business object, but also for part of the data in the business object, the degree of fragmentation of the data to be defragmented of the target business object can be determined in this step.

[0062] S102: estimating the probability of the data to be sorted being accessed in the future;

[0063] Specifically, considering that the probability of the data to be sorted being accessed in the future affects the rate of return of "defragmenting the data to be sorted", that is, when the probability of being accessed is high, the rate of return is high, and when the probability of being accessed is low, the rate of return is low, therefore, in this step, the probability of the data to be sorted being accessed in the future can be estimated so as to use it as the data basis for subsequent steps.

[0064] S103: Determine the rate of return of defragmenting the data to be defragmented based on the degree of fragmentation and access probability of the data to be defragmented;

[0065] Specifically, after determining the above two indicators, the yield rate of defragmentation of the data to be defragmented can be determined based on the degree of fragmentation and access probability of the data to be defragmented, so as to serve as the data basis for subsequent steps.

[0066] S104: Defragment the data to be sorted when the yield rate reaches the target.

[0067] Specifically, after determining the rate of return, the defragmentation work can be decided based on the rate of return, that is, the data to be defragmented will be defragmented when the rate of return meets the standard.

[0068] The present invention provides a data defragmentation method. In order to perform defragmentation at an appropriate time, the present invention can first determine the fragmentation degree of the to-be-defragmented data of the target business object, then estimate the probability of the to-be-defragmented data being accessed in the future, and then determine the rate of return of defragmenting the to-be-defragmented data by comprehensively considering the fragmentation degree and the access probability of the to-be-defragmented data. Finally, the to-be-defragmented data is defragmented when the rate of return meets the standard. The rate of return judgment index of the present invention makes a decision-making contribution to the "defragmentation work" from the two dimensions of the fragmentation degree and the access probability, thereby determining a precise and appropriate defragmentation time, and avoiding the situation where the defragmentation is "unnecessary or too late".

[0069] Based on the above embodiment:

[0070] As an optional embodiment, determining the degree of fragmentation of the target business object's to-be-organized data includes:

[0071] Determine preset indicators of the target business object's data to be sorted, wherein the preset indicators include the number of associated internal objects and the total volume of data. The number of associated internal objects is: the number of internal objects that have data in the data to be sorted;

[0072] Determine the degree of fragmentation of the data to be sorted based on preset indicators and the minimum allocation unit of the storage system.

[0073] Specifically, considering that for the data to be sorted of the target business object, its two indicators of "number of associated internal objects" and "total data volume" are both associated with the degree of fragmentation, and the minimum allocation unit of the storage system is also associated with the degree of fragmentation of the data to be sorted, therefore, in an embodiment of the present invention, the preset indicators of the data to be sorted of the target business object (including the number of associated internal objects and the total data volume) can be determined, and then the degree of fragmentation of the data to be sorted can be determined based on the preset indicators and the minimum allocation unit of the storage system, thereby improving the accuracy of the determined degree of fragmentation.

[0074] Of course, in addition to this method, determining the degree of fragmentation of the to-be-organized data of the target business object may also be achieved through other methods, which are not limited in the embodiment of the present invention.

[0075] As an optional embodiment, determining the degree of fragmentation of the data to be sorted based on a preset indicator and a minimum allocation unit of the storage system includes:

[0076] Based on the first corresponding relationship, determining the degree of fragmentation of the data to be sorted according to a preset indicator and a minimum allocation unit of the storage system;

[0077] The first correspondence includes:

[0078] ;

[0079] Where FI is the degree of fragmentation, n is the number of associated internal objects of the data to be sorted, L is the total volume of the data to be sorted, and s is the minimum allocation unit of the storage system.

[0080] Specifically, considering that the number of associated internal objects of the data to be sorted is proportional to the degree of fragmentation, the total data volume of the data to be sorted is inversely proportional to the degree of fragmentation, the minimum allocation unit of the storage system is proportional to the degree of fragmentation, and the degree of fragmentation can be determined efficiently and accurately through the preset correspondence relationship, the embodiment of the present invention can be based on the first correspondence relationship, according to the preset indicators and the minimum allocation unit of the storage system, to determine the degree of fragmentation of the data to be sorted, thereby improving the efficiency and accuracy of determining the degree of fragmentation.

[0081] Of course, in addition to this specific method, the degree of fragmentation of the data to be sorted may be determined in other ways according to the preset indicators and the minimum allocation unit of the storage system, and the embodiment of the present invention does not limit this.

[0082] As an optional embodiment, estimating the probability of future access to the data to be sorted includes:

[0083] The ratio of the number of times the data to be sorted is accessed to the total number of read and write accesses in the past preset time length or preset number of read and write requests is determined as the probability of the data to be sorted being accessed in the future.

[0084] Specifically, considering that "the access frequency of the data to be sorted in historical read and write requests" can more accurately represent the probability of the data to be sorted being accessed in the future, the embodiment of the present invention can determine the ratio of the number of times the data to be sorted is accessed to the total number of read and write accesses in the past preset time length or preset number of read and write requests, and use it as the probability of the data to be sorted being accessed in the future. The calculation amount is small, so that the access probability can be estimated efficiently and accurately.

[0085] Specifically, there are many methods for determining the access probability of the data to be sorted in the future. For example, the probability can be calculated based on the historical access of the data to be sorted by using the LFU (Least Frequently Used) algorithm, which is not limited in the embodiment of the present invention.

[0086] The preset time length and the preset number of read and write requests can be set independently, and the embodiment of the present invention does not limit them here.

[0087] Of course, in addition to this specific method, other methods can also be used to “estimate the probability of the data to be sorted being accessed in the future”, which is not limited in the embodiment of the present invention.

[0088] As an optional embodiment, determining the rate of return of defragmenting the data to be defragmented based on the degree of fragmentation and access probability of the data to be defragmented includes:

[0089] Based on the second corresponding relationship, the rate of return of defragmenting the data to be defragmented is determined according to the degree of fragmentation and access probability of the data to be defragmented;

[0090] The second correspondence includes:

[0091] ;

[0092] Where R is the rate of return of defragmenting the data to be defragmented, FI (Fragmentation Index) is the degree of fragmentation of the data to be defragmented, and f is the probability of the data to be defragmented being accessed in the future.

[0093] Specifically, considering that the "yield rate of defragmentation of the data to be sorted" is usually proportional to the "fragmentation degree of the data to be sorted" and is also proportional to the "access probability", and the determination of the degree of fragmentation can be achieved efficiently and accurately through the preset correspondence relationship, the embodiment of the present invention can be based on the second correspondence relationship. According to the fragmentation degree of the data to be sorted and the access probability, the yield rate of defragmentation of the data to be sorted can be determined, and the specific form of the second correspondence is given, which improves the accuracy and efficiency of determining the degree of fragmentation.

[0094] Of course, in addition to this specific form, the step of "determining the rate of return of defragmenting the data to be defragmented based on the degree of fragmentation and access probability of the data to be defragmented" can also be implemented in other forms, which are not limited in the embodiment of the present invention.

[0095] As an optional embodiment, defragmenting the data to be defragmented when the rate of return reaches the target includes:

[0096] S201: When the rate of return reaches the target, the data to be sorted is added to the buffer area to be flushed;

[0097] S202: Determine whether the total amount of data in the buffer area to be flushed reaches the standard size of the internal object;

[0098] S203: If the limit is reached, a new internal object is requested, and the data in the buffer area to be flushed, which has a volume equal to the standard volume of the internal object, is written into the newly requested internal object.

[0099] Specifically, to better illustrate the embodiments of the present invention, please refer to Figure 2 , Figure 2 This is a flow chart of the second data defragmentation method provided by the present invention, wherein, since the internal objects storing the business object data are changed after defragmentation, the correspondence between the business objects and the internal objects can be updated in S204.

[0100] Specifically, considering that the amount of data to be sorted of a single business object may not reach the standard volume of a single internal object, if the data to be sorted that is less than the standard volume is directly flushed, it will cause write amplification. Therefore, in an embodiment of the present invention, a cache area to be flushed can be set, and when the yield rate reaches the standard, the data to be sorted can be added to the cache area to be flushed, and it is determined whether the total amount of data in the cache area to be flushed reaches the standard volume of the internal object. If it reaches the standard volume, a new internal object can be applied for, and the data in the cache area to be flushed with a volume of the standard volume of the internal object can be written into the newly applied internal object.

[0101] The standard volume is a parameter of the storage system and can be flexibly set, for example, it can be 1MB or 4MB, etc., and the embodiment of the present invention does not limit this.

[0102] As an optional embodiment, determining the degree of fragmentation of the target business object's to-be-organized data includes:

[0103] Determine whether defragmentation will affect the normal operation of the storage system;

[0104] If not, an unscanned business object in the storage system is used as the target business object, and all data of the target business object is used as data to be sorted;

[0105] After determining the rate of return of defragmenting the data to be defragmented based on the degree of fragmentation and access probability of the data to be defragmented, the data defragmentation method further includes:

[0106] Increment the number of scanned business objects by one, and determine whether the current number of scanned business objects reaches a first preset threshold;

[0107] If not, return to the execution step: take an unscanned business object in the storage system as the target business object, and take all data of the target business object as data to be sorted;

[0108] If it is reached, the scan ends;

[0109] Defragmenting the data to be sorted when the yield rate reaches the target includes:

[0110] Determining whether the yield rate of defragmentation of the data to be defragmented reaches a second preset threshold;

[0111] If it is reached, the target business object will be added to the queue to be sorted;

[0112] Defragment the data to be sorted of the target business objects in the sorting queue in descending order of yield.

[0113] Specifically, to better illustrate the embodiments of the present invention, please refer to Figure 3, Figure 3 This is a flow chart of the third data defragmentation method provided by the present invention. Figure 3 As shown in the figure, a certain number (first preset threshold) of target business objects can be scanned first and the yield rate calculated. Then, the target business objects with the yield rate meeting the standard (reaching the second preset threshold) are added to the queue to be sorted. Then, the data of the target business object with the highest yield rate in the queue to be sorted is read and defragmented. Then, it is determined whether there are any unsorted objects in the queue to be sorted. If so, the step of "reading the data of the target business object with the highest yield rate in the queue to be sorted and defragmenting" is executed again. Otherwise, the process ends.

[0114] Specifically, considering that defragmentation work will not affect the normal operation of the storage system, defragmentation can be performed efficiently by "scanning a large number of business objects". Therefore, in an embodiment of the present invention, it is possible to determine whether the defragmentation work will affect the normal operation of the storage system. If it does not affect the system, "an unscanned business object in the storage system can be used as the target business object, and all data of the target business object can be used as the data to be defragmented", thereby starting the work of determining the yield of the current target business object. In order to be able to perform "business object scanning" appropriately, in an embodiment of the present invention, after determining the yield corresponding to a target business object, the number of scanned business objects can be increased by one, and it can be determined whether the current number of scanned business objects has reached a first preset threshold. If so, the scan can be ended, otherwise the next business object can be scanned.

[0115] Specifically, in order to balance the difference between the "scanning speed of business objects" and the "defragmentation speed of target business objects", a queue to be sorted is also set up in the embodiment of the present invention. The target business objects whose yield reaches a second preset threshold can be added to the queue to be sorted. At the same time, the data to be sorted of the target business objects in the queue to be sorted are defragmented in order of yield from high to low.

[0116] The first preset threshold and the second preset threshold can be set flexibly and autonomously, and are not limited in this embodiment of the present invention.

[0117] In addition, as an optional embodiment, determining whether the defragmentation operation will affect the normal operation of the storage system includes:

[0118] Based on the current load rate and / or capacity level of the storage system, determine whether defragmentation will affect the normal operation of the storage system.

[0119] In addition, as an optional embodiment, judging whether the defragmentation operation will affect the normal operation of the storage system according to the current load rate and / or the current capacity level of the storage system includes:

[0120] Determine whether either the current load rate or the current capacity level of the storage system is greater than the corresponding high-level threshold;

[0121] If any one of them is greater than the corresponding preset threshold, it is determined that the defragmentation work will affect the normal operation of the storage system;

[0122] If both are not greater than the corresponding preset thresholds, determine whether the current load rate and current capacity level of the storage system are both higher than the corresponding low-level thresholds;

[0123] If both are higher than the corresponding low-level threshold, it is determined that the defragmentation work will affect the normal operation of the storage system;

[0124] If it is not higher than the corresponding low-level threshold, it is determined that the defragmentation work will not affect the normal operation of the storage system.

[0125] Specifically, considering that the current load rate and / or current capacity level of the storage system can be used to evaluate "whether the normal operation of the storage system will be affected" from different angles, the embodiments of the present invention can judge whether the defragmentation work will affect the normal operation of the storage system based on the current load rate and / or current capacity level of the storage system; and considering that if "either of the current load rate and the current capacity level" is too high, it will directly lead to "the storage system being unsuitable for defragmentation", and when "the current load rate and the current capacity level are both high", the storage system is also not suitable for defragmentation. Therefore, in the embodiments of the present invention, two thresholds (a high-level threshold and a low-level threshold) are set for "the current load rate and the current capacity level", that is, when "either of the current load rate and the current capacity level of the storage system is higher than the corresponding low-level threshold" and "the current load rate and the current capacity level of the storage system are both higher than the corresponding low-level threshold", it can be determined that the defragmentation work will not affect the normal operation of the storage system.

[0126] As an optional embodiment, after determining whether the defragmentation operation will affect the normal operation of the storage system, the data defragmentation method further includes:

[0127] If yes, determining whether the volume of the to-be-read data of the read request currently received by the storage system reaches a preset volume;

[0128] If it is reached, the business object to which the data to be read in the currently received read request belongs is used as the target business object, and the data to be read in the currently received read request is used as the data to be sorted of the target business object.

[0129] Specifically, to better illustrate the embodiments of the present invention, please refer to Figure 4 , Figure 4This is a flow chart of the fourth data defragmentation method provided by the present invention. Figure 4 As shown in the figure, it is possible to first determine whether the volume of the data to be read of the read request currently received by the storage system has reached the preset volume. If it has reached the preset volume, it is possible to "take the business object to which the data to be read of the read request currently received belongs as the target business object, and take the data to be read of the read request currently received as the data to be defragmented of the target business object", and then calculate the yield rate of defragmenting the data to be processed, and then defragment the data to be defragmented when the yield rate reaches the standard.

[0130] Specifically, considering that the triggering method of "making defragmentation decisions along with read requests for large-block data" has a relatively low impact on the normal operation of the storage system, the embodiment of the present invention intends to adopt the triggering method of "making defragmentation decisions along with read requests for large-block data" when "the normal operation of the storage system is easily affected". Therefore, in the embodiment of the present invention, when "defragmentation work may affect the normal operation of the storage system", it can be determined whether the volume of the to-be-read data of the read request currently received by the storage system has reached the preset volume (that is, whether it is a read request for large-block data). If it has reached the preset volume, the business object to which the to-be-read data of the currently received read request belongs can be used as the target business object, and the to-be-read data of the currently received read request can be used as the to-be-defragmented data of the target business object; so that the to-be-read data read by the read request can be directly used to make the yield judgment, avoiding the data reading action of the "defragmentation decision".

[0131] The preset volume can be set independently, and the embodiment of the present invention does not limit this.

[0132] Please refer to Figure 5 , Figure 5 This is a structural diagram of a data defragmentation device provided by the present invention, the data defragmentation device comprising:

[0133] Memory 51, for storing computer programs;

[0134] The processor 52 is configured to implement the steps of the data defragmentation method in the aforementioned embodiment when executing a computer program.

[0135] For an introduction to the data defragmentation device provided by an embodiment of the present invention, please refer to the aforementioned embodiment of the data defragmentation method, and the embodiment of the present invention will not be described in detail here.

[0136] Please refer to Figure 6 , Figure 6 This is a structural diagram of a computer-readable storage medium provided by the present invention. A computer program 62 is stored on the computer-readable storage medium 61. When the computer program 62 is executed by a processor, the steps of the data defragmentation method in the aforementioned embodiment are implemented.

[0137] For an introduction to the computer-readable storage medium provided in an embodiment of the present invention, please refer to the aforementioned embodiment of the data defragmentation method, and the embodiment of the present invention will not be described in detail here.

[0138] The present invention also provides a computer program product, comprising a computer program / instruction, which implements the steps of the data defragmentation method in the aforementioned embodiment when executed by a processor.

[0139] For an introduction to the computer program product provided by the embodiment of the present invention, please refer to the aforementioned embodiment of the data defragmentation method, and the embodiment of the present invention will not be described in detail here.

[0140] In this specification, the various embodiments are described in a progressive manner, with each embodiment focusing on the differences from the other embodiments. Similar or identical parts between the various embodiments may be referred to in conjunction with each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and for relevant parts, reference may be made to the method description. It should also be noted that, in this specification, relational terms such as first and second, etc., are used solely to distinguish one entity or operation from another, and do not necessarily require or imply any actual relationship or order between these entities or operations. Furthermore, the terms "comprise," "include," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprises a..." does not exclude the presence of other identical elements in the process, method, article, or device comprising that element.

[0141] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention is not limited to the embodiments shown herein but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A data defragmentation method, characterized in that: include: Determining a degree of fragmentation of data to be defragmented of a target business object, wherein the target business object is a business object to be defragmented; estimating the probability of the data to be sorted being accessed in the future; Determining the rate of return of defragmenting the data to be defragmented based on the degree of fragmentation and access probability of the data to be defragmented; When the rate of return reaches the target, the data to be sorted is defragmented.

2. The data defragmentation method according to claim 1, wherein: Determining the degree of fragmentation of the target business object's data to be sorted includes: Determine preset indicators of the target business object's data to be sorted, wherein the preset indicators include the number of associated internal objects and the total volume of data. The number of associated internal objects is: the number of internal objects that have data in the data to be sorted; The degree of fragmentation of the data to be sorted is determined according to the preset indicator and the minimum allocation unit of the storage system.

3. The data defragmentation method according to claim 2, wherein: Determining the degree of fragmentation of the data to be sorted based on the preset indicator and the minimum allocation unit of the storage system includes: Based on the first corresponding relationship, determining the degree of fragmentation of the data to be sorted according to the preset indicator and the minimum allocation unit of the storage system; The first corresponding relationship includes: ; Where FI is the degree of fragmentation, n is the number of associated internal objects of the data to be sorted, L is the total volume of the data to be sorted, and s is the minimum allocation unit of the storage system.

4. The data defragmentation method according to claim 1, wherein: The estimated probability of the data to be sorted being accessed in the future includes: The ratio of the number of times the data to be sorted is accessed to the total number of read and write accesses in the past preset time length or preset number of read and write requests is determined as the probability of the data to be sorted being accessed in the future.

5. The data defragmentation method according to claim 1, wherein: Determining the rate of return of defragmenting the data to be defragmented based on the degree of fragmentation and access probability of the data to be defragmented includes: Based on the second corresponding relationship, determining the rate of return of defragmenting the data to be defragmented according to the degree of fragmentation and access probability of the data to be defragmented; The second corresponding relationship includes: ; Among them, R is the rate of return of defragmenting the data to be defragmented, FI is the degree of fragmentation of the data to be defragmented, and f is the probability of the data to be defragmented being accessed in the future.

6. The data defragmentation method according to claim 1, wherein: Defragmenting the data to be defragmented when the rate of return reaches the target includes: When the yield rate reaches the target, the data to be sorted is added to the buffer area to be flushed; Determining whether the total amount of data in the to-be-flushed buffer area reaches the standard size of the internal object; If it is reached, a new internal object is applied for, and the data with a volume equal to the standard volume of the internal object in the buffer area to be flushed is written into the newly applied internal object.

7. The data defragmentation method according to any one of claims 1 to 6, characterized in that: Determining the degree of fragmentation of the target business object's data to be sorted includes: Determine whether defragmentation will affect the normal operation of the storage system; If not, an unscanned business object in the storage system is used as the target business object, and all data of the target business object is used as data to be sorted; After determining the rate of return of defragmenting the data to be defragmented based on the degree of fragmentation and access probability of the data to be defragmented, the data defragmentation method further includes: Increment the number of scanned business objects by one, and determine whether the current number of scanned business objects reaches a first preset threshold; If not, return to the execution step: take an unscanned business object in the storage system as the target business object, and take all data of the target business object as data to be sorted; If it is reached, the scan ends; Defragmenting the data to be defragmented when the rate of return reaches the target includes: Determining whether the yield rate of defragmentation of the data to be defragmented reaches a second preset threshold; If it is reached, the target business object is added to the queue to be sorted; The data to be sorted of the target business objects in the to-be-sorted queue are defragmented in descending order of the yield rate.

8. The data defragmentation method according to claim 7, wherein: After determining whether the defragmentation work will affect the normal operation of the storage system, the data defragmentation method further includes: If yes, determining whether the volume of the to-be-read data of the read request currently received by the storage system reaches a preset volume; If it is reached, the business object to which the data to be read in the currently received read request belongs is used as the target business object, and the data to be read in the currently received read request is used as the data to be sorted of the target business object.

9. A data defragmentation device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the data defragmentation method according to any one of claims 1 to 8 when executing the computer program.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the data defragmentation method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Defragmentation method, terminal device and computer readable storage medium

    CN107145452A

  • Disk data defragmentation method and device

    CN115599702A

  • Intelligent defragmentation for data storage systems

    CN117916726A

  • Self-governed contention-aware approach to scheduling file defragmentation

    US20140156610A1