A storage management method and device

By monitoring and adjusting the target application's historical storage data and set of free storage blocks, and dynamically adjusting the size of the maximum storage block, the problem of low memory resource utilization is solved, and efficient use of memory space is achieved.

CN115495022BActive Publication Date: 2026-01-30WEBANK (CHINA)
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211270380.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-18
Publication Date
2026-01-30
Estimated Expiration
2042-10-18

AI Technical Summary

Technical Problem

In existing memory management schemes, small data blocks may continue to grow, resulting in a large number of idle slices and low memory resource utilization.

Method used

By monitoring the historical storage data size and free storage block set of the target application, the maximum storage block size is dynamically adjusted to optimize memory resource utilization.

Benefits of technology

It improves the utilization rate of memory resources, solves the problem of low memory resource utilization, and realizes dynamic management of memory space.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115495022B_ABST
    Figure CN115495022B_ABST
Patent Text Reader

Abstract

This application discloses a storage management method, which includes: if a currently running target application is detected to be performing a target operation, obtaining a first set of historical storage data sizes stored by the target application up to the current time; determining a set of free storage blocks corresponding to the target application; wherein the set of free storage blocks includes storage blocks of different sizes distributed where the memory resources corresponding to the target application are free; determining a target storage size for the largest storage block corresponding to the target application based on the first set of historical storage data sizes and the set of free storage blocks; wherein the largest storage block is the largest memory resource block allocated for storing data for the target application; and adjusting the size of the storage blocks included in the set of free storage blocks based on the target storage size and the first current storage size of the largest storage block. This application also discloses a storage management device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a storage management method and device. Background Technology

[0002] With the rapid development of computer technology, more and more technologies are being applied in the financial field, and the traditional financial industry is gradually transforming into Fintech. However, due to the security and real-time requirements of the financial industry, higher demands are being placed on technology. With the rapid development of internet technology, various application services are becoming increasingly abundant. These services generate and exchange large amounts of data during operation, requiring storage and management. A commonly used memory management scheme involves requesting a large amount of memory from the operating system and then dividing it into multiple small blocks. These blocks come in various sizes, such as 96 bytes, 192 bytes, 288 bytes, ..., 1152 bytes. Customer information less than or equal to 96 bytes is stored in a 96-byte block, customer information greater than 96 bytes but less than or equal to 192 bytes is stored in a 192-byte block, and so on. This scheme combines the advantages of fixed-length algorithms (simplicity) and variable-length algorithms (high utilization) and has been widely adopted.

[0003] However, in the application of the above method, as the business continues to develop, small data blocks may continue to grow, resulting in a large number of idle slices and low utilization of memory resources. Detailed Implementation

[0004] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.

[0005] Embodiments of this application provide a storage management method, referring to... Figure 1 As shown, the method is applied to a storage management device, and the method includes the following steps:

[0006] Step 101: If the target application currently running is detected to be performing the target operation, obtain the first set of historical storage data stored by the target application before the current time.

[0007] In this embodiment, the target application is an application currently running on the storage management device. The target operation is a pre-defined specific operation used to trigger the storage management device to dynamically adjust the maximum storage block corresponding to the target application. The storage management device can be a device with memory storage resources and computing capabilities, such as a computer device or a server device.

[0008] During runtime, the target application can store received or generated data in the memory storage resources provided by the target application to the storage management device. This allows the system to retrieve the first set of historical stored data stored by the target application up to the current moment from its corresponding memory storage resources. This first set of historical stored data can be data stored within a period prior to the current moment, or data stored between the last dynamic adjustment of the target application's maximum storage block size and the current moment.

[0009] Step 102: Determine the set of free storage blocks corresponding to the target application.

[0010] The set of free storage blocks includes storage blocks of different sizes distributed where the memory resources corresponding to the target application are free.

[0011] In this embodiment, regarding the memory resources of the target application, the stored data can be divided into storage blocks of different sizes according to requirements, so that the data corresponding to the target application can be stored in the corresponding storage blocks after being divided. Thus, the set of free storage blocks includes: storage blocks divided for the target application that are currently in a free state, i.e., not storing data.

[0012] Step 103: Based on the first set of historical storage data sizes and the set of free storage blocks, determine the target storage size of the maximum storage block corresponding to the target application.

[0013] The largest storage block is the largest memory resource block allocated for storing data for the target application.

[0014] In this embodiment of the application, the first set of historical storage data sizes and the set of free storage blocks are analyzed to determine the target storage size of the maximum storage block of the target application, that is, the target storage size is the theoretically allowed size of the maximum storage block.

[0015] Step 104: Based on the target storage size and the first current storage size of the largest storage block, adjust the size of the storage blocks included in the free storage block set.

[0016] In this embodiment, the first current storage size of the maximum storage block is the actual value of the current maximum storage block corresponding to the target application. Based on the relationship between the target storage size and the first current storage size of the maximum storage block, the sizes of the storage blocks included in the free storage block set are adjusted. This continuously adjusts the storage block size of the target application according to the changing storage block size requirements of the target application's historical storage data, improving storage efficiency for the target application and ensuring the utilization rate of the target application's memory resources.

[0017] In this embodiment, if a target application is detected performing a target operation, after obtaining the first set of historical storage data sizes stored by the target application before the current time, the set of free storage blocks corresponding to the target application is determined. Based on the first set of historical storage data sizes and the set of free storage blocks, the target storage size of the maximum storage block corresponding to the target application is determined. Finally, based on the target storage size and the first current storage size of the maximum storage block, the size of the storage blocks included in the set of free storage blocks is adjusted. Thus, each time a target application is detected performing a target operation, the historical storage data size set and the set of free storage blocks within a historical time period are analyzed to determine the target storage size of the maximum storage block corresponding to the target application. The size of the storage block used for storing data corresponding to the target application is then adjusted according to the target storage size. This achieves dynamic adjustment of the maximum storage block size based on storage conditions during the target application's operation, solving the problem of low memory resource utilization in current memory management schemes, realizing dynamic management of memory space usage, and improving memory resource utilization.

[0018] Based on the foregoing embodiments, embodiments of this application provide a storage management method, referring to... Figure 2 As shown, the method is applied to a storage management device, and the method includes the following steps:

[0019] Step 201: If the target application currently running is detected to be performing the target operation, obtain the first set of historical storage data stored by the target application before the current time.

[0020] Among them, the target operation is a non-first memory request operation, or a statistical operation in which the number of maximum storage blocks used exceeds a first preset number when storing data of the target application.

[0021] In this embodiment, a non-first memory request refers to a request for memory resources from the storage management device during the execution of the target application when the previously requested memory resources are insufficient. The first preset quantity can be an empirical value obtained from a large number of experiments.

[0022] When the target application runs for the first time, it requests corresponding memory resources from the storage management device to meet its operational needs, including storage requirements. After initially obtaining memory resources, the application stores data according to a preset maximum storage size and a specific partitioning rule. It then requests at least one corresponding storage block from the allocated memory resources to store the data. Since some data in the target application needs to be stored for extended periods, the size of historical stored data before the current moment can be collected to obtain a first historical stored data size set. This first historical stored data size set includes the data size of each instance of data storage by the target application within a certain period prior to the current moment.

[0023] For example, when the memory resources initially requested by the target application have been exhausted, and the target application requests memory resources from the storage management device again at the current moment, the storage management device counts the amount of data stored by the target application from the initial request to the current moment, and obtains a first set of historical storage data sizes.

[0024] Step 202: Determine the set of free storage blocks corresponding to the target application.

[0025] The set of free storage blocks includes storage blocks of different sizes distributed where the memory resources corresponding to the target application are free.

[0026] In this embodiment of the application, during the operation of the target application, when storing data, a certain size of storage block can be divided from the memory resources corresponding to the target application for data storage as needed. However, some data is temporary data and will be automatically cleared after a period of storage, or some data is deleted during operation. In this way, after the data in the corresponding storage block is cleared, in order to avoid repeatedly dividing the memory resources, the state of these well-divided but unused storage blocks can be changed to an idle state so that the corresponding size of data can be stored in the corresponding idle storage block. In order to facilitate the management of these idle storage blocks, these idle storage blocks can be recorded in a unified manner to obtain the set of idle storage blocks corresponding to the target application.

[0027] Step 203: Preprocess the elements in the first historical storage data size set to obtain the second historical storage data size set.

[0028] In this embodiment, preprocessing can be a cleaning operation to remove abnormal data from the elements of the first historical storage data set, or other processing operations such as data normalization. For example, cleaning data that suddenly increases in size in the first historical storage data set yields a second historical storage data set. The number of elements in the second historical storage data set is less than or equal to the number of elements in the first historical storage data set. Thus, by preprocessing the elements in the first historical storage data set, the accuracy of the subsequent calculation of the maximum storage block size is effectively guaranteed.

[0029] Step 204: Based on the second set of historical storage data sizes, determine the first reference value corresponding to the largest storage block.

[0030] The largest storage block is the largest memory resource block allocated for storing data for the target application.

[0031] In this embodiment of the application, the elements in the second set of historical storage data sizes are analyzed to determine the first possible reference value for the maximum storage block size.

[0032] Step 205: Based on the set of free storage blocks, determine the second reference value corresponding to the largest storage block.

[0033] In this embodiment of the application, the elements in the set of free storage blocks are analyzed to determine the possible second reference value for the maximum storage block.

[0034] Step 206: Determine the target storage size based on the first reference value and the second reference value.

[0035] In this embodiment, a comprehensive analysis of the first and second reference values ​​is performed to determine the possible target storage size allowed for the final maximum storage block. The target storage size can be determined by randomly selecting a power of 2 from the range of the first and second reference values. In some application scenarios, to ensure the reliability of the target storage size, it can also be determined based on the read performance of the storage management device. For example, if the input / output (I / O) read / write efficiency of the storage management device is low, the target storage block size is selected with a preference for the larger of the first and second reference values; if the I / O read / write efficiency is high, the target storage block size is selected with a preference for the smaller of the first and second reference values.

[0036] Step 207: Adjust the size of the storage blocks included in the free storage block set based on the target storage size and the first current storage size of the largest storage block.

[0037] In this embodiment, the first current storage size of the maximum storage block is the actual allowable size of the maximum storage block determined in the previous adjustment process. Based on the size relationship between the target storage size and the first current storage size of the maximum storage block, the sizes of the storage blocks included in the free storage block set are adjusted, including the size of the maximum storage block, to improve the utilization rate of free storage blocks. Thus, by comprehensively analyzing the size of the historical storage data of the target application and the size of the free storage blocks currently corresponding to the target application, the possible target storage size of the maximum storage block is dynamically determined. This considers both the actual impact of the storage blocks and the impact of historical storage conditions, ensuring the accuracy between the possible target storage size of the maximum storage block and the actual situation, and improving the utilization rate of memory resources.

[0038] Based on the foregoing embodiments, in other embodiments of this application, step 204 can be implemented by steps 204a to 204c:

[0039] Step 204a: Determine the current splicing rate based on the second set of historical stored data sizes.

[0040] In this embodiment, the current splicing rate is the proportion of data stored using the largest storage block during the historical data storage process.

[0041] After executing step 204a, the storage management device can choose to execute either step 204b or step 204c. If the current splicing rate is less than the first preset splicing rate, or the current splicing rate is greater than the second preset splicing rate, step 204b is selected; if the current splicing rate is greater than or equal to the first preset splicing rate and less than or equal to the second preset splicing rate, step 204c is selected.

[0042] Step 204b: If the current splicing rate is less than the first preset splicing rate, or the current splicing rate is greater than the second preset splicing rate, determine the first reference value based on the second historical storage data size set and the current splicing rate.

[0043] The first preset splicing rate is less than the second preset splicing rate.

[0044] In this embodiment, both the first preset splicing rate and the second preset splicing rate are empirical values ​​obtained from numerous experiments, or they can be set by the user based on actual experience and needs. The splicing rate mainly affects the data copying process in memory, and the splicing rates vary among different storage management devices. For example, the first preset splicing rate can be set to 23%, and the second preset splicing rate can be set to 27%.

[0045] When the current splicing rate is less than the first preset splicing rate, or the current splicing rate is greater than the second preset splicing rate, the second historical storage data set and the current splicing rate are analyzed to determine the first reference value.

[0046] Step 204c: If the current splicing rate is greater than or equal to the first preset splicing rate and less than or equal to the second preset splicing rate, determine the first reference value as the first current storage size.

[0047] In this embodiment, when the current splicing rate is within the range of a first preset splicing rate and a second preset splicing rate, the first reference value is directly determined to be the first current storage size of the maximum storage block, meaning the size of the maximum storage block remains unchanged. In this way, the possible allowable value of the maximum storage block is determined by the historical usage rate of the maximum storage block, ensuring the utilization rate of the maximum storage block.

[0048] Based on the foregoing embodiments, in other embodiments of this application, step 204a can be implemented by steps a11 to a14:

[0049] Step a11: Determine the product of the second preset quantity and the first current storage size to obtain the first value.

[0050] In this embodiment, the second preset quantity is an empirical value based on computer storage characteristics. For example, since computers store data in binary format, the second preset quantity can be 2. The first value can be calculated using the formula "first value = second preset quantity * first current storage size".

[0051] Step a12: Count the number of elements in the second historical storage data set whose size is greater than or equal to the first value, and obtain the first number.

[0052] In this embodiment of the application, the elements in the second historical storage data size set are statistically analyzed, and the number of elements whose size is greater than or equal to the first value is counted to obtain the first number.

[0053] Step a13: Count the total number of elements in the second historical storage quantity size set to obtain the second quantity.

[0054] In this embodiment of the application, the second quantity is obtained by counting the total number of all elements included in the second historical storage quantity size set.

[0055] Step a14: Determine the ratio of the first quantity to the second quantity to obtain the current splicing rate.

[0056] In this embodiment, the current splicing rate can be calculated using the formula "current splicing rate = first quantity / second quantity", which represents the proportion of the largest storage block used when storing historical data. By using the actual utilization rate of the largest storage block as the current splicing rate, and considering the generally regular nature of data storage, the reliability of the subsequent determination of the target storage size is ensured.

[0057] Based on the foregoing embodiments, in other embodiments of this application, step 204b can be implemented by steps b11 to b15:

[0058] Step b11: If the current splicing rate is less than the first preset splicing rate, or the current splicing rate is greater than the second preset splicing rate, determine the product of the current splicing rate and the second quantity to obtain the second value.

[0059] The second quantity refers to the total number of all elements included in the second historical storage data size set.

[0060] In this embodiment of the application, when the current splicing rate is less than the first preset splicing rate or greater than the second preset splicing rate, that is, when the current splicing rate is not within the range corresponding to the first preset splicing rate and the second preset splicing rate, the second value is calculated by the formula "second value = current splicing rate * second quantity".

[0061] Step b12: Round the second value up to obtain the third value.

[0062] In this embodiment of the application, the calculated second value is rounded up to obtain the third value.

[0063] Step b13: Sort the elements in the second historical storage data size set according to the sorting method from largest to smallest to obtain the first sorting sequence.

[0064] In this embodiment of the application, the elements in the second historical storage data size set are sorted according to the sorting method from largest to smallest to obtain the first sorting sequence.

[0065] Step b14: Obtain the target value that is sorted as the third value from the first sorted sequence.

[0066] Step b15: Determine the first reference value based on the target value.

[0067] In this embodiment, the target value in the second set of historical stored data sizes is analyzed to determine a first reference value. Since a higher splicing rate indicates more maximum storage blocks in an idle state, a suitable first reference value can be determined based on the current splicing rate, thus improving memory resource utilization.

[0068] Based on the foregoing embodiments, in other embodiments of this application, step b15 can be implemented by steps b151 to b152:

[0069] Step b151: Determine the reference ratio between the target value and the first preset value.

[0070] In this embodiment, the first preset value is an empirical value determined based on the computer's storage characteristics, such as the number system used for storage. Since computers typically use binary for storage, the first preset value is usually 2. The reference ratio can be calculated using the formula "reference ratio = target value / first preset value".

[0071] Step b152: Determine the first reference value as the value of the reference ratio rounded up to the power of the second preset value.

[0072] In this embodiment, the second preset value is an empirical value determined based on the computer's storage characteristics, such as the number system used for storage. Since computers typically use binary for storage, the first preset value is usually 2. For example, when the reference ratio is 1023, the corresponding first reference value is 1023 rounded up to the power of 2, which is 1024. This way, determining the first reference value takes into account the characteristics of numerical storage, ensuring sufficient storage space without wasting excessive storage space.

[0073] Based on the foregoing embodiments, in other embodiments of this application, step 205 can be implemented by steps 205a to 205d:

[0074] Step 205a: Determine the distribution set of storage blocks at different levels for the target application.

[0075] In this embodiment of the application, the storage blocks divided into different categories for the target application are typically divided according to the smallest storage block to the largest storage block. For example, assuming the largest storage block is 1024, the corresponding distribution set can be {2, 4, 8, 16, 32, 64, 128, 256, 512, 1024}.

[0076] Step 205b: Sort the elements in the distribution set according to the preset sorting method to obtain the second sorting sequence.

[0077] Among them, the element with the largest value in the second sorted sequence is the first current storage size.

[0078] In the embodiments of this application, the preset sorting method can be a sorting method from largest to smallest or a sorting method from smallest to largest.

[0079] Step 205c: Determine the first target element with the largest preset ratio value in the second sorting sequence.

[0080] In this embodiment, the preset ratio is an empirical value obtained from a large number of experiments, or it can be an empirical value set by the user based on actual experience. The preset ratio can be, for example, a quartile. When the preset sorting method is a sorting method from largest to smallest, the first target elements with the largest preset ratio value are the first preset ratio elements in the second sorting sequence; when the preset sorting method is a sorting method from smallest to largest, the first target elements with the largest preset ratio value are the last preset ratio elements in the second sorting sequence.

[0081] Step 205d: Determine the second reference value based on the preset ratio of the first target element and the set of free storage blocks.

[0082] In this embodiment, the predetermined preset ratio of the first target element and the set of free storage blocks are analyzed to determine the second reference value. Thus, by determining the first reference value based on the current size of the remaining storage blocks, and by fully considering the actual remaining memory resources, the reliability of the first reference value is ensured.

[0083] Based on the foregoing embodiments, in other embodiments of this application, step 205d can be implemented by steps c11 to c17:

[0084] Step c11: Calculate the sum of the memory resources corresponding to the preset ratio of the first target elements in the free storage block set to obtain the fourth value.

[0085] In this embodiment of the application, assuming that the preset ratio of the first target elements included in the obtained set of free storage blocks is one each of 512 and 1024, the corresponding fourth value is 512 + 1024 = 1536.

[0086] Step c12: Calculate the sum of the memory resources corresponding to all elements in the free storage block set to obtain the fifth value.

[0087] In this embodiment of the application, assuming that the set of free storage blocks includes one each of 2, 4, 8, 16, 32, 64, 128, 256, 512 and 1024, the corresponding fifth value can be calculated by the following formula: 2+4+8+16+32+64+128+256+512+1024=2046.

[0088] Step c13: Determine the ratio of the fourth value to the fifth value to obtain the first current vacancy rate.

[0089] In this embodiment, the first current vacancy rate can be calculated using the formula "first current vacancy rate = fourth value / fifth value". For example, the first current vacancy rate = 1536 / 2046.

[0090] After executing step c13, the storage management device can choose to execute either step c14 or steps c15 to c17. Specifically, if the first current vacancy rate is greater than or equal to the first preset vacancy rate and less than or equal to the second preset vacancy rate, step c14 is executed; if the first current vacancy rate is less than the first preset vacancy rate, or the first current vacancy rate is greater than the second preset vacancy rate, steps c15 to c17 are executed.

[0091] Step c14: If the first current vacancy rate is greater than or equal to the first preset vacancy rate and less than or equal to the second preset vacancy rate, determine the second reference value as the first current storage size.

[0092] The first preset vacancy rate is less than the second preset vacancy rate.

[0093] In this embodiment of the application, the first preset vacancy rate and the second preset vacancy rate are empirical values ​​obtained from a large number of experiments, or they can be empirical values ​​set based on actual user experience. For example, the first preset vacancy rate is 18%, and the second preset vacancy rate is 22%.

[0094] Step c15: If the first current vacancy rate is less than the first preset vacancy rate, or the first current vacancy rate is greater than the second preset vacancy rate, delete the maximum value in the second sorting sequence to obtain the third sorting sequence.

[0095] In this embodiment of the application, if the first current vacancy rate is less than the first preset vacancy rate, or the first current vacancy rate is greater than the second preset vacancy rate, assuming the second sorting sequence is {2, 4, 8, 16, 32, 64, 128, 256, 512, 1024}, then after deleting the maximum value in the second sorting sequence, the third sorting sequence is obtained as {2, 4, 8, 16, 32, 64, 128, 256, 512}.

[0096] Step c16: Determine the second target element with the largest preset ratio value in the third sorting sequence.

[0097] Step c17: Determine the second reference value based on the preset ratio of the second target element and the set of free storage blocks.

[0098] In this embodiment, a corresponding second reference value is determined based on the relationship between the first current vacancy rate and the first preset vacancy rate and the second preset vacancy rate. In this way, the second reference value is determined based on the actual unused storage blocks, taking into account the current actual storage block usage, ensuring the relationship between the determined target storage size and the actual remaining storage blocks, and improving the utilization rate of the remaining memory resources.

[0099] Based on the foregoing embodiments, in other embodiments of this application, step c17 can be implemented by steps c171 to c175:

[0100] Step c171: Calculate the sum of the memory resources corresponding to the preset ratio of second target elements in the free storage block set to obtain the sixth value.

[0101] Step c172: Determine the ratio of the sixth value to the fifth value to obtain the second current vacancy rate.

[0102] After executing step c172, the storage management device can choose to execute either step c173 or steps c174 to c175. If the second current vacancy rate is greater than or equal to the first preset vacancy rate and less than or equal to the second preset vacancy rate, step c173 is executed; if the second current vacancy rate is less than the first preset vacancy rate or greater than the second preset vacancy rate, steps c174 to c175 are executed.

[0103] Step c173: If the second current vacancy rate is greater than or equal to the first preset vacancy rate and less than or equal to the second preset vacancy rate, determine the second reference value as the maximum value in the third sorting sequence.

[0104] In this embodiment of the application, when the second current vacancy rate is within the range of the first preset vacancy rate and the second preset vacancy rate, the maximum value in the third sorting order is used as the second reference value.

[0105] Step c174: If the second current vacancy rate is less than the first preset vacancy rate, or greater than the second preset vacancy rate, update the second sorting sequence to the third sorting sequence.

[0106] Step c175: Repeat step “Delete the maximum value in the second sorting sequence to obtain the third sorting sequence” until it is determined that the second reference value is the maximum value in the third sorting sequence.

[0107] In this embodiment, when the second current vacancy rate is less than the first preset vacancy rate or greater than the second preset vacancy rate, after updating the second sorting sequence to the third sorting sequence, the steps of "deleting the maximum value in the second sorting sequence to obtain the third sorting sequence" in step c15, c16, and c171-c175 are repeated until the current vacancy rate corresponding to the last updated third sorting sequence is within the range of the first and second preset vacancy rates. At this point, the maximum value in the last updated third sorting sequence is used as the second reference value. Thus, by successively reducing the maximum value of the largest storage block, the current vacancy rate is determined, ensuring that the corresponding current vacancy rate falls within the corresponding preset vacancy rate range, thereby improving computational efficiency.

[0108] Based on the foregoing embodiments, in other embodiments of this application, step 207 can be implemented by steps 207a to 207b:

[0109] Step 207a: If the target storage size is smaller than the first current storage size, determine the reference storage block in the free storage block set whose size is larger than the target storage size.

[0110] In this embodiment of the application, if the target storage size is greater than or equal to the first current storage size, the size of the storage blocks in the free storage block set is not changed, that is, the size of the storage blocks in the free storage block set is maintained.

[0111] Step 207b: Divide the corresponding reference storage block according to the partitioning step size of half the storage block, until the size of the partitioned storage block is less than or equal to the target storage size.

[0112] In this embodiment, when the target storage size is less than the first current storage size, reference storage blocks in the free storage block set that are larger than the target storage size are partitioned. The partitioning rule is to partition the blocks by half the size of the reference storage blocks until the size of the resulting partitioned storage blocks is less than or equal to the target storage size. This partitioning of large storage blocks improves storage block utilization and reduces the likelihood of large storage blocks becoming idle.

[0113] Based on the foregoing embodiments, in other embodiments of this application, reference is made to... Figure 3 As shown, after executing step 207, the storage management device is also used to execute steps 208 to 210:

[0114] Step 208: If data to be stored corresponding to the first reference size of the target application is received, determine at least one target size of the storage block used to store the data to be stored based on the first reference size.

[0115] In this embodiment of the application, when the data to be stored corresponding to the target application is received, the size of the data to be stored is determined as a first reference size. At this time, at least one target size of the storage block used to store the data to be stored is determined according to the data storage block partitioning rule.

[0116] Step 209: From the set of free storage blocks, determine at least one first target storage block corresponding to the target size.

[0117] In this embodiment, at least one storage block corresponding to the target size is determined from the set of free storage blocks to obtain at least one first target storage block. It should be noted that in some application scenarios, there may be one or more storage blocks corresponding to the target size that are missing or not present in the set of free storage blocks. In this case, one or more storage blocks corresponding to the target size can be obtained by partitioning from the unallocated memory resources corresponding to the target application to obtain the corresponding first target storage block.

[0118] Step 210: Store the data to be stored into at least one first target storage block.

[0119] In this embodiment, the data to be stored is divided into at least one target storage block according to its size, and then stored in at least one target storage block of the corresponding size. Since at least one first target storage block is determined based on the size of the data to be stored, the utilization rate of the storage blocks can be guaranteed.

[0120] Based on the foregoing embodiments, in other embodiments of this application, step 208 can be implemented by steps 208a to 208e:

[0121] Step 208a: If data to be stored is received, determine the ratio of the first reference size to the third preset value to obtain the second reference size.

[0122] In this embodiment, the third preset value can be determined based on the storage mechanism of the storage management device. Typically, since the storage mechanism of the storage management device is a binary storage mechanism, the third preset value can be 2. The second reference size can be calculated using the formula "Second reference size = First reference size / Third preset value".

[0123] Step 208b: Determine the logarithm of the second reference size with the second preset value as the base, and obtain the first coefficient.

[0124] In this embodiment of the application, the first coefficient can be expressed by the formula "first coefficient = log 第二预设数值 The second reference size is calculated, where log is the mathematical symbol for taking the logarithm.

[0125] Step 208c: Determine the sum of the first coefficient (after rounding) and 1 to obtain the second coefficient.

[0126] In this embodiment of the application, the second coefficient can be calculated by the formula "second coefficient = [first coefficient] + 1", where the [] symbol is the rounding symbol.

[0127] Step 208d: Determine the second coefficient power of the second preset value to obtain the third coefficient.

[0128] In this embodiment, the third coefficient can be expressed by the formula "Third coefficient = Second preset value". 第二系数 "Calculated."

[0129] Step 208e: Determine at least one target size based on the third coefficient and the first reference size.

[0130] In this embodiment, the third coefficient and the first reference size are calculated and analyzed to determine at least one target size. This determines the theoretical third coefficient required for the data to be stored, which is then used to divide the first reference size to obtain at least one target size, thereby improving the utilization rate of storage blocks at each level.

[0131] Based on the foregoing embodiments, in other embodiments of this application, step 208e can be implemented by step d11, or steps d12 to d20:

[0132] Step d11: If the third coefficient is greater than or equal to the first reference size, and the third coefficient is greater than the second current storage size of the largest storage block included in the current free storage block set, the third coefficient is split at least once according to the second current storage size to obtain at least one first target sub-size that is less than or equal to the second current storage size.

[0133] Wherein, at least one target size includes at least one first target sub-size.

[0134] In this embodiment, when the third coefficient is greater than or equal to the first reference size and the third coefficient is greater than the second current storage size of the largest storage block included in the current free storage block set, the third coefficient is directly split according to the second current storage size to obtain at least one first target sub-size less than or equal to the second current storage size. For example, assuming the second current storage size is 1024, if the third coefficient is 2048, then 2048 is split according to 1024 to obtain two 1024 values, thus determining that two first target sub-sizes are 1024.

[0135] Step d12: If the third coefficient is less than the first reference size and the third coefficient is greater than the second current storage size, split the third coefficient at least once according to the second current storage size to obtain at least one second target sub-size equal to the second current storage size.

[0136] In this embodiment, when the third coefficient is less than the first reference size and greater than the second current storage size, the third coefficient is split at least once using the second current storage size to obtain at least one second target sub-size equal to the second current storage size. For example, if the first reference size is 2049, the corresponding third coefficient is 2048, and the second current storage size is 1024, then the third coefficient is split at least once using 1024 to obtain two second target sub-sizes of size 1024.

[0137] Step d13: Determine the first difference between the first reference size and the third coefficient.

[0138] In this embodiment, the first difference can be calculated using the formula "first difference = first reference size - third coefficient". For example, the first difference = 2049 - 2048 = 1.

[0139] Step d14: Determine the ratio of the first difference to the third preset value to obtain the third reference value.

[0140] In the embodiments of this application, the third reference size can be calculated using the formula "third reference size = first difference / third preset value".

[0141] Step d15: Determine the logarithm of the third reference size with the second preset value as the base, and obtain the fourth coefficient.

[0142] In this embodiment of the application, the fourth coefficient can be expressed by the formula "fourth coefficient = log 第二预设数值 The third reference size is calculated.

[0143] Step d16: Determine the sum of the fourth coefficient (after rounding) and 1 to obtain the fifth coefficient.

[0144] In this embodiment of the application, the fifth coefficient can be expressed by the formula "fifth coefficient = [fourth coefficient] + 1 = [log[...]]". 第二预设数值 Third reference size] + 1 = [log 第二预设数值 The coefficient is calculated as [(first difference / third preset value)] + 1. For example, the fifth coefficient = [log2(1 / 2)] + 1 = 1.

[0145] Step d17: Determine the fifth power of the second preset value to obtain the sixth coefficient.

[0146] In this embodiment, the sixth coefficient can be expressed by the formula "Sixth coefficient = Second preset value". 第五系数 "Calculated. For example, the sixth coefficient = 2." 1 =2.

[0147] Step d18: If the sum of the sixth coefficient and the third coefficient is greater than or equal to the first reference size, determine at least one target size as at least one second target size and the sixth coefficient.

[0148] In this embodiment, the sum of the sixth coefficient and the third coefficient is determined, and then this sum is compared with a first reference size. If the sum is greater than or equal to the first reference size, then at least one target size is determined to be at least one second target size and the sixth coefficient. For example, since the sum of the sixth coefficient 2 and the third coefficient 2048 is 2050, which is greater than the first reference size 2049, at least one target size can be determined to be two 1024s and 2.

[0149] Step d19: If the sum of the sixth coefficient and the third coefficient is less than the first reference value, determine the difference between the first difference and the sixth coefficient to obtain the second difference.

[0150] In this embodiment of the application, when the sum of the sixth coefficient and the third coefficient is less than the first reference value, the difference between the first difference and the sixth coefficient is determined, and the second difference is obtained.

[0151] Step d20: After updating the first difference to the second difference, repeat the step "determine the ratio of the first difference to the third preset value to obtain the third reference size" until the sum of the sixth coefficient and the third coefficient obtained from n repetitions is greater than or equal to the first reference size, and determine that at least one target size is obtained as at least one second target size and the sixth coefficient obtained from n repetitions; where n is an integer greater than or equal to 2.

[0152] In this embodiment, the first difference is updated to the second difference, and then steps d14 to d20 are repeated until the sum of the sixth coefficient and the third coefficient obtained after multiple repetitions is greater than or equal to the first reference size, thus obtaining at least one target size. In some application scenarios, to ensure data copy efficiency, the value of n is usually not large, that is, the number of spliced ​​storage blocks cannot be too many. Therefore, to ensure good data copy efficiency, the value of n is usually no more than 4. In this way, after theoretically splitting the size of the data to be stored according to the size distribution of the storage blocks, the required size of the storage blocks is determined, and the corresponding free storage blocks are determined according to the determined size of the storage blocks, thereby improving the utilization rate of the storage blocks.

[0153] It should be noted that in the embodiments corresponding to steps 208-210, 208a-208e and d11-d20, the corresponding splitting operation can also be performed when storing the received data after the storage management device first requests memory resources. In this case, the corresponding second current storage size is the default value preset by the maximum storage block.

[0154] Based on the foregoing embodiments, in other embodiments of this application, reference is made to... Figure 4 As shown, the storage management device can also be used to perform steps 211 to 212:

[0155] Step 211: Monitor the number of storage blocks of different sizes included in the set of free storage blocks.

[0156] In this embodiment of the application, the number of storage blocks of different sizes in the set of free storage blocks is monitored and counted.

[0157] Step 212: If the number of references for the second target storage blocks exceeds the third preset number, and at least one group of third target storage blocks with consecutive storage addresses is obtained from the reference number of second target storage blocks, at least one group of third target storage blocks is released.

[0158] Each group of third target storage blocks includes at least two second target storage blocks with contiguous storage addresses.

[0159] In this embodiment, the third preset number of storage blocks corresponding to different levels is different. Specifically, it can be an empirical value obtained from numerous experiments, or it can be set by the user based on actual conditions. The second target storage block can be any storage block of any size level in the set of free storage blocks. When the reference number of the second target storage blocks exceeds the third preset number, a reference number of second target storage blocks are determined from the set of free storage blocks, and the storage addresses of these reference number of second target storage blocks are analyzed. If it is determined that there is at least one group of third target storage blocks with consecutive storage addresses, at least one group of third target storage blocks is released. This reduces memory gaps, allowing for subsequent reallocation from unallocated memory resources of the target application when needed.

[0160] It should be noted that steps 211 to 212 can be implemented as an independent embodiment, or they can be executed after any step in the foregoing embodiments. The specific execution order can be determined by the actual situation.

[0161] Based on the foregoing embodiments, this application provides a process in a storage management method where a storage management device needs to store data when it receives data to be stored from a target application. The implementation flow can be referred to... Figure 5 As shown, it includes at least the following steps:

[0162] Step e11, Begin.

[0163] Step e12: Obtain the data to be stored.

[0164] Step e13: Based on the size of the data to be stored, calculate the target storage nodes that need to be spliced.

[0165] In this context, the storage node is the carrier of the actual data storage. A node can be a small block of bytes, increasing in size by a factor of two. Assuming the smallest unit is 2 bytes, then the size of a node is 2(2...). 1 ), 4(2 2 ), 8(2) 3 ), 16(2 4 ), 32(2 5 ), 64(2 6 ), 128(2 7 ), 256(2 8 ), 512(2 9 ), 1024(2 10 ..., where the size of the largest storage node is determined by the actual situation.

[0166] Assuming the data to be stored is of length x, x can be divided into multiple smaller segments for storage. Starting from the largest segment, the segments are divided by a factor of 2, with each segment being the size of the remaining length divided by 2 and the next node at the next higher level. If there is no node at the next higher level, the largest node is used to concatenate the segments to reach the storage length. If the number of concatenated small nodes (excluding the largest node) exceeds a certain value, the next node at the next higher level is used to quickly end the length division.

[0167] For example, when x is 100 bytes long, the corresponding calculation can be written as: 100 / 2 = 2 y We can calculate that y ≈ 5.6. Rounding y up, we get y = 6. Therefore, the size of the first Node is 2. 6 = 64 bytes. Since the first Node cannot completely store x, we continue to calculate the size of the second Node. The corresponding calculation process for the size of the second Node is: (100-64) / 2 = 2 y We can calculate that y ≈ 4.2. Rounding y up, we get y = 5. Therefore, the size of the second Node is determined to be 2. 5=32 bytes. Since the size of the first Node and the size of the second Node are still less than the length of x, we continue to calculate the size of the third Node. The calculation process for the size of the third Node is: (100-64-32) / 2 = 2 y We can determine that y = 1. Rounding y up, we get y = 2. Therefore, the size of the third Node is 2. 2 =4. Thus, the combined size and value of the first, second, and third nodes are greater than the length of x and can store x. Therefore, the first, second, and third nodes are chosen as the target storage nodes. Correspondingly, the data structure of x can be decomposed as follows: Figure 6 The structure shown. Specifically, the final determination of y can be achieved using the formula... The specific calculations were performed.

[0168] Step e14: Determine whether the list of free blocks includes all of the above target storage nodes. If it includes all or some of the above target storage nodes, proceed to step e15; otherwise, proceed to step e16.

[0169] The Free Block List (FBL) corresponds to the aforementioned free block storage set and records information about the storage nodes that have been partitioned for the target application but currently do not contain data. It determines whether the Free Block List currently includes the storage node corresponding to the first Node (64 bytes), the second Node (32 bytes), and the third Node (4 bytes).

[0170] Step e15: Obtain all or some of the target storage nodes from the list of free blocks.

[0171] If the list of free blocks includes node information of 64 bytes, 32 bytes, and 4 bytes, then obtain the Node nodes of 64 bytes, 32 bytes, and 4 bytes respectively to get the target storage node.

[0172] Step e16: Split the target storage nodes that are not included in the list of free blocks from the memory storage resources corresponding to the target application.

[0173] If there is no 64-byte node information in the free block list, a 64-byte storage area can be allocated from the unallocated memory resources corresponding to the target application as the target storage node.

[0174] Step e17: Concatenate the obtained target storage nodes and store the data to be stored in the concatenated storage area.

[0175] Among them, such as Figure 7 The diagram shows the data structure corresponding to the data to be stored after the target storage node is calculated, as well as the relationship between the storage nodes in the free block list and the actual memory storage resources.

[0176] Step e18, End.

[0177] In this way, there is no need to use contiguous memory resources during data storage. By using small memory blocks to assemble data, memory management and usage become much more flexible. Memory resources can be used according to the principle of allocating only what is needed. Unused memory resources, i.e., memory resources that have not yet been allocated, are not operated on. The system does not actually allocate physical memory, which improves the utilization rate of memory resources and reduces the possibility of memory resources being wasted.

[0178] In step e13, the size of the maximum storage block can be dynamically adjusted during actual use. The adjustment process includes at least the following implementation steps:

[0179] Step f11: Set up a sentinel to monitor the size of the stored data and record samples.

[0180] Step f12: Set the trigger point. Once the trigger point is detected, remove abnormal samples from all currently recorded samples (abnormal samples are, for example, a sudden surge in stored data, which is pulse data). Calculate the maximum storage block size d1 according to the preset large block splicing rate, and calculate the maximum storage block size d2 according to the preset large block vacancy rate. Determine the target storage size of the final maximum storage block between d1 and d2.

[0181] The trigger point can be a memory request operation that is not the first time to request memory from the operating system, or the stored data always needs to be concatenated with the maximum storage block. For example, if 100 data items are stored, 50 of them need to be concatenated with the maximum block.

[0182] Among them, the maximum storage block size d1 corresponds to the aforementioned first reference value, and the maximum storage block size d2 corresponds to the aforementioned second reference value.

[0183] The process of determining d1 can be as follows: First, determine the sample set after removing outliers. Then, count the number of samples in the sample set whose size is greater than or equal to twice the current size of the maximum storage block. Next, count the number of samples in the sample set as a second sample. The current stitching rate is calculated as: current stitching rate = number of first samples / number of second samples. If the current stitching rate deviates from the preset large block stitching rate ± 2%, the maximum storage block size d1 is recalculated: The sample data in the sample set is sorted in reverse order. The data with the preset large block stitching rate * number of second samples is taken, and the ratio obtained by dividing this ratio by 2 is calculated. d1 is then determined as the nearest power of 2 to this ratio. For example, the preset large block stitching rate could be 25%.

[0184] The process of determining d2 can be as follows: Sort all Nodes corresponding to the target application in ascending order to obtain the first sequence; determine the first target Node in the first sequence that is located after the quartile; sum the memory sizes of the first target Nodes in the FBL to obtain the first target memory size; sum the memory sizes of all Nodes included in the FBL to obtain the first total memory size; calculate the first current vacancy rate using the formula "current vacancy rate = first target memory size / second total memory size"; if the first current vacancy rate is within the range of (preset large block vacancy rate ± 2%), determine d2 as the maximum value in the first sequence; if the first current vacancy rate deviates from (preset large block vacancy rate ± 2%), delete the last Node in the first sequence to obtain the second sequence; determine the... The second target node is arranged in the second sequence after the quartile; the sum of the memory sizes corresponding to the second target nodes in the FBL is used to obtain the second target memory size; the sum of the memory sizes corresponding to all nodes included in the FBL is used to obtain the first total memory size; the second current vacancy rate is calculated using the formula "current vacancy rate = second target memory size / second total memory size"; if the second current vacancy rate is within the range of (preset large block vacancy rate ± 2%), the maximum value of d2 in the second sequence is determined; if the second current vacancy rate deviates from (preset large block vacancy rate ± 2%), the last node in the second sequence is deleted to obtain the third sequence, and this process is repeated until the final calculated current vacancy rate is within the range of (preset large block vacancy rate ± 2%), at which point d2 is determined as the maximum value in the corresponding sequence. The preset large block vacancy rate can be 20%.

[0185] The process of determining the target storage size of the final maximum storage block between d1 and d2 is as follows: if the memory copy of the storage management device is the bottleneck, the target storage size is a power of two randomly selected from the range of d1 and d2, biased towards the maximum value; if the memory size of the storage management device is the bottleneck, the target storage size is a power of two randomly selected from the range of d1 and d2, biased towards the minimum value.

[0186] Step f13: If the target storage size is smaller than the current size of the maximum storage block corresponding to the target application, the nodes in FBL that are larger than the target storage size will be split in steps of 1 / 2 until they are smaller than the target storage size.

[0187] Step f14: If the target storage size is greater than or equal to the current size, maintain the Node size in FBL and do not need to concatenate small Node blocks to the target storage size.

[0188] Based on the foregoing embodiments, this application also provides a method for optimizing free memory blocks, the specific implementation process of which includes the following steps:

[0189] Step g11: Set up a sentinel to monitor the number of blocks at different levels in the FBL.

[0190] Step g12: Set a trigger point. Once the trigger point is met, start merging small blocks.

[0191] The trigger point can be a memory request operation from the operating system, or it can be that the number of nodes at a certain level in the FBL is much greater than the number of nodes at other levels, or the number of nodes at a certain level in the FBL is greater than or equal to the corresponding preset number.

[0192] Step g13: Select the storage block corresponding to the Node at a certain level from FBL, and match it to the left and right to see if there is a storage block of the same level with a memory address that is contiguous with it. If so, merge it and continue to match to the left and right. Otherwise, exit and continue to merge other unanalyzed storage blocks of the same level.

[0193] Step g14: Release the merged memory resources.

[0194] It should be noted that the descriptions of the same steps and contents as in other embodiments in this embodiment can be found in the descriptions in other embodiments, and will not be repeated here.

[0195] In this embodiment, if a target application is detected performing a target operation, after obtaining the first set of historical storage data sizes stored by the target application before the current time, the set of free storage blocks corresponding to the target application is determined. Based on the first set of historical storage data sizes and the set of free storage blocks, the target storage size of the maximum storage block corresponding to the target application is determined. Finally, based on the target storage size and the first current storage size of the maximum storage block, the size of the storage blocks included in the set of free storage blocks is adjusted. Thus, each time a target application is detected performing a target operation, the historical storage data size set and the set of free storage blocks within a historical time period are analyzed to determine the target storage size of the maximum storage block corresponding to the target application. The size of the storage block used for storing data corresponding to the target application is then adjusted according to the target storage size. This achieves dynamic adjustment of the maximum storage block size based on storage conditions during the target application's operation, solving the problem of low memory resource utilization in current memory management schemes, realizing dynamic management of memory space usage, and improving memory resource utilization.

[0196] Based on the foregoing embodiments, embodiments of this application provide a storage management device, referring to... Figure 8 As shown, the storage management device 3 may include: a memory 31, a processor 32, and a communication bus 33; wherein:

[0197] Memory 31 is used to store executable instructions and memory storage resources;

[0198] Communication bus 33 is used to realize the communication connection between the processor and the memory;

[0199] Processor 32 is used to execute the memory management program stored in memory 31 to perform the following steps:

[0200] If the target application currently running is detected to be performing the target operation, obtain the size set of the first historical stored data stored by the target application before the current moment;

[0201] Determine the set of free storage blocks corresponding to the target application; wherein, the set of free storage blocks includes storage blocks of different sizes distributed where the memory resources corresponding to the target application are free;

[0202] Based on the first set of historical stored data sizes and the set of free storage blocks, the target storage size of the maximum storage block corresponding to the target application is determined; where the maximum storage block is the largest memory resource block allocated for storing data for the target application.

[0203] Adjust the size of the storage blocks included in the set of free storage blocks based on the target storage size and the first current storage size of the largest storage block.

[0204] In other embodiments of this application, the target operation is a non-first memory request operation, or a statistical operation in which the number of maximum storage blocks used exceeds a first preset number when storing data of the target application.

[0205] In other embodiments of this application, when the processor executes the step of determining the target storage size of the largest storage block corresponding to the target application based on the first set of historical storage data sizes and the set of free storage blocks, it can be achieved through the following steps:

[0206] The elements in the first historical storage data size set are preprocessed to obtain the second historical storage data size set;

[0207] Based on the second set of historical storage data sizes, determine the first reference value corresponding to the largest storage block;

[0208] Based on the set of free storage blocks, determine the second reference value corresponding to the largest storage block;

[0209] The target storage size is determined based on the first reference value and the second reference value.

[0210] In other embodiments of this application, when the processor performs the step of determining the first reference value corresponding to the largest storage block based on the second set of historical storage data sizes, it can be achieved through the following steps:

[0211] The current splicing rate is determined based on the size set of the second historical stored data.

[0212] If the current splicing rate is less than the first preset splicing rate, or the current splicing rate is greater than the second preset splicing rate, a first reference value is determined based on the second historical storage data size set and the current splicing rate; wherein, the first preset splicing rate is less than the second preset splicing rate;

[0213] If the current splicing rate is greater than or equal to the first preset splicing rate and less than or equal to the second preset splicing rate, the first reference value is determined to be the first current storage size.

[0214] In other embodiments of this application, when the processor executes the step of determining the current splicing rate based on the second set of historical stored data sizes, it can be achieved through the following steps:

[0215] The first value is obtained by multiplying the second preset quantity by the first current storage size;

[0216] The first count is obtained by counting the number of elements in the second historical storage data set whose size is greater than or equal to the first value.

[0217] The second quantity is obtained by counting the total number of elements in the second historical storage quantity size set.

[0218] Determine the ratio of the first quantity to the second quantity to obtain the current splicing rate.

[0219] In other embodiments of this application, when the processor executes the step of determining the first reference value based on the second historical storage data size set and the current splicing rate if the current splicing rate is less than the first preset splicing rate or greater than the second preset splicing rate, the following steps can be used:

[0220] If the current splicing rate is less than the first preset splicing rate, or the current splicing rate is greater than the second preset splicing rate, determine the product of the current splicing rate and the second quantity to obtain the second value; where the second quantity is the total number of all elements included in the second historical storage data size set;

[0221] Round the second value up to obtain the third value;

[0222] The elements in the second historical storage data set are sorted in descending order to obtain the first sorted sequence;

[0223] Obtain the target value that is the third value from the first sorted sequence;

[0224] Based on the target value, a first reference value is determined.

[0225] In other embodiments of this application, when the processor performs the step of determining the first reference value based on the target value, it can be achieved through the following steps:

[0226] Determine the reference ratio between the target value and the first preset value;

[0227] The first reference value is determined by rounding up the reference ratio to the power of the second preset value.

[0228] In other embodiments of this application, when the processor performs the step of determining the second reference value corresponding to the largest storage block based on the set of free storage blocks, it can be achieved through the following steps:

[0229] Determine the distribution set of storage blocks at different levels for the target application;

[0230] The elements in the distribution set are sorted according to a preset sorting method to obtain a second sorting sequence; the element with the largest value in the second sorting sequence is the first current storage size.

[0231] Determine the first target element with the largest preset ratio in the second sorting sequence;

[0232] A second reference value is determined based on a preset ratio of the first target element and the set of free storage blocks.

[0233] In other embodiments of this application, when the processor executes the step of determining the second reference value based on a preset ratio of first target elements and a set of free storage blocks, it can be achieved through the following steps:

[0234] The fourth value is obtained by summing the memory resources corresponding to a predetermined ratio of the first target elements in the set of free storage blocks;

[0235] The fifth value is obtained by summing the memory resources corresponding to all elements in the set of free storage blocks;

[0236] Determine the ratio of the fourth value to the fifth value to obtain the first current vacancy rate;

[0237] If the first current vacancy rate is greater than or equal to the first preset vacancy rate and less than or equal to the second preset vacancy rate, the second reference value is determined to be the first current storage size; wherein the first preset vacancy rate is less than the second preset vacancy rate.

[0238] In other embodiments of this application, the processor is also configured to perform the following steps:

[0239] If the first current vacancy rate is less than the first preset vacancy rate, or the first current vacancy rate is greater than the second preset vacancy rate, delete the maximum value in the second sorting sequence to obtain the third sorting sequence;

[0240] Determine the second target element with the largest preset ratio in the third sorting sequence;

[0241] A second reference value is determined based on a preset ratio of second target elements and a set of free storage blocks.

[0242] In other embodiments of this application, when the processor executes the step of determining the second reference value based on a preset ratio of second target elements and a set of free storage blocks, it can be achieved through the following steps:

[0243] The sixth value is obtained by summing the memory resources corresponding to a predetermined ratio of the second target elements in the set of free storage blocks;

[0244] Determine the ratio of the sixth value to the fifth value to obtain the second current vacancy rate;

[0245] If the second current vacancy rate is greater than or equal to the first preset vacancy rate, and less than or equal to the second preset vacancy rate, the second reference value is determined to be the maximum value in the third sorting sequence;

[0246] If the second current vacancy rate is less than the first preset vacancy rate, or greater than the second preset vacancy rate, update the second sorting sequence to the third sorting sequence;

[0247] Repeat the step "delete the maximum value in the second sorting sequence to obtain the third sorting sequence" until it is determined that the second reference value is the maximum value in the third sorting sequence.

[0248] In other embodiments of this application, when the processor performs the step of adjusting the size of the storage blocks included in the set of free storage blocks based on the target storage size and the first current storage size of the largest storage block, it can be achieved through the following steps:

[0249] If the target storage size is smaller than the first current storage size, determine a reference storage block in the free storage block set whose size is larger than the target storage size;

[0250] The corresponding reference storage block is divided according to the method of dividing the storage block by half the block size, until the size of the divided storage block is less than or equal to the target storage size.

[0251] In other embodiments of this application, after the processor executes the step of adjusting the size of the storage blocks included in the set of free storage blocks based on the target storage size and the first current storage size of the largest storage block, it is further configured to execute the following steps:

[0252] If data to be stored corresponding to a first reference size is received for the target application, at least one target size for the storage block used to store the data to be stored is determined based on the first reference size.

[0253] From the set of free storage blocks, determine at least one first target storage block corresponding to the target size;

[0254] Store the data to be stored into at least one first target storage block.

[0255] In other embodiments of this application, when the processor executes the step of receiving data to be stored of a first reference size corresponding to the target application, and determining at least one target size of the storage block for storing the data to be stored based on the first reference size, this can be achieved through the following steps:

[0256] If data to be stored is received, the ratio of the first reference size to the third preset value is determined to obtain the second reference size;

[0257] The first coefficient is obtained by determining the logarithm of the second reference size with the second preset value as the base;

[0258] The sum of the first coefficient (rounded down) and 1 is used to obtain the second coefficient.

[0259] Determine the second coefficient power of the second preset value to obtain the third coefficient;

[0260] Based on the third coefficient and the first reference size, at least one target size is determined.

[0261] In other embodiments of this application, when the processor performs the step of determining at least one target size based on a third coefficient and a first reference size, it can be achieved through the following steps:

[0262] If the third coefficient is greater than or equal to the first reference size, and the third coefficient is greater than the second current storage size of the largest storage block included in the current free storage block set, the third coefficient is split at least once according to the second current storage size to obtain at least one first target sub-size that is less than or equal to the second current storage size; wherein, at least one target size includes at least one first target sub-size;

[0263] If the third coefficient is less than the first reference size and the third coefficient is greater than the second current storage size, the third coefficient is split at least once according to the second current storage size to obtain at least one second target sub-size equal to the second current storage size;

[0264] Determine the first difference between the first reference size and the third coefficient;

[0265] Determine the ratio of the first difference to the third preset value to obtain the third reference value;

[0266] The fourth coefficient is obtained by determining the logarithm of the third reference size with the second preset value as the base;

[0267] The sum of the fourth coefficient (rounded down) and 1 is used to obtain the fifth coefficient.

[0268] Determine the fifth coefficient power of the second preset value to obtain the sixth coefficient;

[0269] If the sum of the sixth coefficient and the third coefficient is greater than or equal to the first reference size, at least one target size is determined to be at least one second target size and the sixth coefficient.

[0270] In other embodiments of this application, the processor may also be used to perform the following steps:

[0271] If the sum of the sixth coefficient and the third coefficient is less than the first reference value, determine the difference between the first difference and the sixth coefficient to obtain the second difference;

[0272] After updating the first difference to the second difference, repeat the step "determine the ratio of the first difference to the third preset value to obtain the third reference size" until the sum of the sixth coefficient and the third coefficient obtained from n repetitions is greater than or equal to the first reference size, and determine that at least one target size is obtained as at least one second target size and the sixth coefficient obtained from n repetitions; where n is an integer greater than or equal to 2.

[0273] In other embodiments of this application, the processor may also be used to perform the following steps:

[0274] Monitor the number of storage blocks of different sizes included in the set of free storage blocks;

[0275] If the number of references for the second target storage blocks exceeds the third preset number, at least one group of third target storage blocks with consecutive storage addresses is obtained from the reference number of second target storage blocks; wherein each group of third target storage blocks includes at least two second target storage blocks with consecutive storage addresses.

[0276] Release at least one set of third target storage blocks.

[0277] It should be noted that the explanation of the steps in this application embodiment where one or more programs can be processed by one or more processors can be found in the following references. Figures 1-4 The implementation process of the corresponding embodiments is not described in detail here.

[0278] In this embodiment, if a target application is detected performing a target operation, after obtaining the first set of historical storage data sizes stored by the target application before the current time, the set of free storage blocks corresponding to the target application is determined. Based on the first set of historical storage data sizes and the set of free storage blocks, the target storage size of the maximum storage block corresponding to the target application is determined. Finally, based on the target storage size and the first current storage size of the maximum storage block, the size of the storage blocks included in the set of free storage blocks is adjusted. Thus, each time a target application is detected performing a target operation, the historical storage data size set and the set of free storage blocks within a historical time period are analyzed to determine the target storage size of the maximum storage block corresponding to the target application. The size of the storage block used for storing data corresponding to the target application is then adjusted according to the target storage size. This achieves dynamic adjustment of the maximum storage block size based on storage conditions during the target application's operation, solving the problem of low memory resource utilization in current memory management schemes, realizing dynamic management of memory space usage, and improving memory resource utilization.

[0279] Based on the foregoing embodiments, embodiments of this application provide a computer-readable storage medium, simply referred to as a storage medium, which stores one or more programs that can be executed by one or more processors to achieve, as follows: Figures 1-4 The implementation process of the storage management method provided in the corresponding embodiments will not be described in detail here.

[0280] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware aspects. Furthermore, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.

[0281] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable device, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0282] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0283] These computer program instructions may also be loaded onto a computer or other programmable device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable device for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0284] The above are merely preferred embodiments of this application and are not intended to limit the scope of protection of this application.

Claims

1. A storage management method characterized by comprising: The method comprises: If a target application currently running is monitored to perform a target operation, a first historical storage data size set stored by the target application before a current time is acquired; A set of idle storage blocks corresponding to the target application is determined; wherein the set of idle storage blocks includes different size distribution of storage blocks in which memory resources corresponding to the target application are idle; The elements in the first historical storage data size set are preprocessed to obtain a second historical storage data size set; Based on the second historical storage data size set, a current splicing rate is determined; If the current splicing rate is less than a first preset splicing rate, or the current splicing rate is greater than a second preset splicing rate, based on the second historical storage data size set and the current splicing rate, a first reference value corresponding to the maximum storage block is determined; Wherein the first preset splicing rate is less than the second preset splicing rate; If the current splicing rate is greater than or equal to the first preset splicing rate and less than or equal to the second preset splicing rate, the first reference value is determined as a first current storage size; Wherein the maximum storage block is the largest memory resource block for storing data divided for the target application; Based on the set of idle storage blocks, a second reference value corresponding to the maximum storage block is determined; Based on the first reference value and the second reference value, a target storage size is determined; Based on the target storage size and the first current storage size of the maximum storage block, the size of the storage block included in the set of idle storage blocks is adjusted.

2. The method of claim 1, wherein, The target operation is an application operation for the first time or a statistical operation in which the number of maximum storage blocks used for storing data of the target application exceeds a first preset number.

3. The method of claim 1, wherein, The determination of the current splicing rate based on the second historical storage data size set comprises: Determine the product of a second preset number and the first current storage size to obtain a first value; Count the number of elements in the second historical storage data size set that are greater than or equal to the first value to obtain a first number; Count the number of elements in the second historical storage data size set to obtain a second number; Determine the ratio of the first number to the second number to obtain the current splicing rate.

4. The method according to any one of claims 1 to 3, characterized in that, If the current splicing rate is less than the first preset splicing rate, or the current splicing rate is greater than the second preset splicing rate, the first reference value is determined based on the second historical storage data size set and the current splicing rate, comprising: If the current splicing rate is less than the first preset splicing rate, or the current splicing rate is greater than the second preset splicing rate, the product of the current splicing rate and the second number is determined to obtain a second value; wherein the second number is the number of all elements included in the second historical storage data size set; The second value is rounded up to obtain a third value; The elements in the second historical storage data size set are sorted in descending order to obtain a first sorted sequence; From the first sorted sequence, a target value with a third value is obtained; Determine the first reference value based on the target value.

5. The method of claim 4, wherein, The determining the first reference value based on the target value comprises: Determining a reference ratio between the target value and a first preset value; Determining the first reference value as a value obtained by rounding up the reference ratio to a power of a second preset value.

6. The method of claim 1, wherein, The determining the second reference value corresponding to the maximum storage block based on the set of idle storage blocks comprises: Determining a distribution set of storage blocks of different levels divided for the target application program; Sorting elements in the distribution set according to a preset sorting method to obtain a second sorting sequence; wherein, the element with the maximum value in the second sorting sequence is the first current storage size; Determining a preset ratio of first target elements with the maximum value in the second sorting sequence; Determining the second reference value based on the preset ratio of the first target elements and the set of idle storage blocks.

7. The method of claim 6, wherein, The determining the second reference value based on the preset ratio of the first target elements and the set of idle storage blocks comprises: Statistically determining a sum value of memory resources corresponding to the preset ratio of the first target elements in the set of idle storage blocks to obtain a fourth value; Statistically determining a sum value of memory resources corresponding to all elements in the set of idle storage blocks to obtain a fifth value; Determining a ratio of the fourth value to the fifth value to obtain a first current vacancy rate; If the first current vacancy rate is greater than or equal to a first preset vacancy rate and less than or equal to a second preset vacancy rate, determining the second reference value as the first current storage size; wherein, the first preset vacancy rate is less than the second preset vacancy rate.

8. The method of claim 7, wherein, The method further comprises: If the first current vacancy rate is less than the first preset vacancy rate or the first current vacancy rate is greater than the second preset vacancy rate, deleting the maximum value in the second sorting sequence to obtain a third sorting sequence; Determining a preset ratio of second target elements with the maximum value in the third sorting sequence; Determining the second reference value based on the preset ratio of the second target elements and the set of idle storage blocks.

9. The method of claim 8, wherein, The determining the second reference value based on the preset ratio of the second target elements and the set of idle storage blocks comprises: Statistically determining a sum value of memory resources corresponding to the preset ratio of the second target elements in the set of idle storage blocks to obtain a sixth value; Determining a ratio of the sixth value to the fifth value to obtain a second current vacancy rate; If the second current vacancy rate is greater than or equal to the first preset vacancy rate and less than or equal to the second preset vacancy rate, determining the second reference value as the maximum value in the third sorting sequence; If the second current vacancy rate is less than the first preset vacancy rate or greater than the second preset vacancy rate, updating the second sorting sequence as the third sorting sequence; Repeating the step of deleting the maximum value in the second sorting sequence to obtain a third sorting sequence until the second reference value is determined as the maximum value in the third sorting sequence.

10. The method of claim 1, wherein, The adjusting the size of the storage blocks included in the set of free storage blocks based on the target storage size and the first current storage size of the largest storage block comprises: If the target storage size is smaller than the first current storage size, determining a reference storage block in the set of free storage blocks whose size is larger than the target storage size; Splitting the corresponding reference storage block according to a splitting method with a splitting step of half of the size of the storage block, until the size of the split storage block is smaller than or equal to the target storage size.

11. The method of claim 1, wherein, After the adjusting the size of the storage blocks included in the set of free storage blocks based on the target storage size and the first current storage size of the largest storage block, the method further comprises: If the first reference size of the to-be-stored data corresponding to the target application program is received, determining at least one target size of the storage block for storing the to-be-stored data based on the first reference size; Determining at least one first target storage block corresponding to the at least one target size from the set of free storage blocks; Storing the to-be-stored data in the at least one first target storage block.

12. The method of claim 11, wherein, The determining at least one target size of the storage block for storing the to-be-stored data based on the first reference size if the first reference size of the to-be-stored data corresponding to the target application program is received comprises: If the to-be-stored data is received, determining a second reference size by taking the ratio of the first reference size and a third preset value; Determining a first coefficient by taking the logarithm of the second reference size with a second preset value as the base; Determining a second coefficient by taking the sum of the first coefficient after rounding and 1; Determining a third coefficient by raising the second coefficient to the power of the second preset value; Determining at least one target size based on the third coefficient and the first reference size.

13. The method of claim 12, wherein, The determining at least one target size based on the third coefficient and the first reference size comprises: If the third coefficient is greater than or equal to the first reference size, and the third coefficient is greater than a second current storage size of the largest storage block included in the set of free storage blocks, splitting the third coefficient at least once according to the second current storage size to obtain at least one first target sub-size smaller than or equal to the second current storage size; wherein the at least one target size comprises at least one first target sub-size; If the third coefficient is smaller than the first reference size, and the third coefficient is greater than the second current storage size, splitting the third coefficient at least once according to the second current storage size to obtain at least one second target sub-size equal to the second current storage size; Determining a first difference between the first reference size and the third coefficient; Determining a third reference size by taking the ratio of the first difference and the third preset value; Determining a fourth coefficient by taking the logarithm of the third reference size with the second preset value as the base; Determining a fifth coefficient by taking the sum of the fourth coefficient after rounding and 1; Determining a sixth coefficient by raising the fifth coefficient to the power of the second preset value; If the sum of the sixth coefficient and the third coefficient is greater than or equal to the first reference size, it is determined that at least one of the target sizes is at least one of the second target sizes and the sixth coefficient.

14. The method of claim 13, wherein, The method further comprises: If the sum of the sixth coefficient and the third coefficient is less than the first reference size, a second difference value is obtained by determining the difference between the first difference value and the sixth coefficient. After updating the first difference value to the second difference value, the step of "determining a third reference size by determining the ratio of the first difference value and the third preset value" is repeatedly executed until the sum of the sixth coefficient and the third coefficient obtained by n times of repetition is greater than or equal to the first reference size, and it is determined that at least one of the target sizes is at least one of the second target sizes and the sixth coefficient obtained by n times of repetition; wherein n is an integer greater than or equal to 2.

15. The method of claim 1 or 11, wherein, The method further comprises: Monitoring the number of different size storage blocks included in the set of idle storage blocks; If the reference number of the second target storage blocks is monitored to exceed the third preset number, and at least one group of third target storage blocks are obtained from the reference number of the second target storage blocks, the at least one group of third target storage blocks are released; wherein each group of the third target storage blocks includes at least two blocks of the second target storage blocks with continuous storage addresses.

16. A storage management device, characterized by comprising: The device comprises a memory, a processor and a communication bus; wherein: The memory is used to store executable instructions and memory storage resources; The communication bus is used to realize the communication connection between the processor and the memory; The processor is used to execute the storage management program stored in the memory, and realize the steps of the storage management method according to any one of claims 1 to 15.

Citation Information

Patent Citations

  • Database sequence object having a dynamic cache block size

    US20200073869A1