Data storage management method and device, medium and electronic equipment
By filtering and updating hot data and cold data in the storage space, and dynamically adjusting its expiration time, the problem of low storage space utilization in the existing technology is solved, and more efficient data management and storage space utilization are achieved.
Patent Information
- Application Number
- CN202310343343.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-31
- Publication Date
- 2024-10-01
AI Technical Summary
In the existing technology, the expiration time of storage space is set unreasonably, resulting in low cache space utilization and inability to effectively distinguish and manage hot data and cold data.
By obtaining the access information of the target data set in the storage space, data sets with high and low access popularity are filtered out, the expiration time is updated according to the access fluctuations, and the storage management strategy is dynamically adjusted.
It improves the accuracy and rationality of expiration time updates, improves storage space utilization, and ensures reasonable storage and cleaning of hot and cold data.
Smart Images

Figure CN118732925A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of electronic information technology, and in particular, to a data storage management method, device, medium and electronic device. Background Art
[0002] Some data can be stored in a storage space. However, different data have different access popularity. For data with lower access popularity, it can be stored for a shorter time, while for data with higher access popularity, it can be stored for a relatively longer time. Therefore, in the related art, for the stored data, an expiration time can be set for management, so as to clean up the stored data and save storage space.
[0003] However, in the related art, there is a problem of unreasonable expiration time setting, which reduces the utilization rate of cache space. Summary of the invention
[0004] This summary is provided to introduce concepts in a brief form that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0005] In a first aspect, the present disclosure provides a data storage management method, the method comprising:
[0006] For a target data set to be updated in the storage space, obtaining access information about the target data set within a preset historical time period;
[0007] Based on the access information, screening a first candidate data set having an access heat index greater than a first threshold from the target data set, and screening a second candidate data set having an access heat index less than a second threshold, wherein the first threshold is greater than the second threshold;
[0008] Determine a first fluctuation of access information corresponding to the first candidate data set, and select first target data from the first candidate data set according to the first fluctuation, and determine a second fluctuation of access information corresponding to the second candidate data set, and select second target data from the second candidate data set according to the second fluctuation;
[0009] The expiration times corresponding to the first target data and the second target data are updated based on the data expiration time update strategy, and the first target data and the second target data are stored and managed based on the updated expiration times.
[0010] In a second aspect, the present disclosure provides a data storage management device, the device comprising:
[0011] A first acquisition module, configured to acquire access information about a target data set to be updated in a storage space within a preset historical time period;
[0012] A first screening module is used to screen a first candidate data set whose access heat index is greater than a first threshold value from the target data set based on the access information, and screen a second candidate data set whose access heat index is less than a second threshold value, wherein the first threshold value is greater than the second threshold value;
[0013] a second screening module, configured to determine a first fluctuation of access information corresponding to the first candidate data set, and screen first target data from the first candidate data set according to the first fluctuation, and to determine a second fluctuation of access information corresponding to the second candidate data set, and screen second target data from the second candidate data set according to the second fluctuation;
[0014] The management module is used to update the expiration time corresponding to each of the first target data and the second target data based on the data expiration time update strategy, and to store and manage the first target data and the second target data based on the updated expiration time.
[0015] In a third aspect, the present disclosure provides a computer-readable medium having a computer program stored thereon, which implements the steps of the method described in the first aspect when the program is executed by a processing device.
[0016] In a fourth aspect, the present disclosure provides an electronic device, including:
[0017] a storage device having a computer program stored thereon;
[0018] A processing device is used to execute the computer program in the storage device to implement the steps of the method in the first aspect.
[0019] Through the above technical scheme, for the target data set to be updated in the storage space, access information about the target data set within a preset historical time period is obtained; based on the access information, a first candidate data set whose access heat index is greater than a first threshold is screened from the target data set, and a second candidate data set whose access heat index is less than a second threshold is screened; a first fluctuation of the access information corresponding to the first candidate data set is determined, and the first target data is screened from the first candidate data set according to the first fluctuation, and a second fluctuation of the access information corresponding to the second candidate data set is determined, and the second target data is screened from the second candidate data set according to the second fluctuation; based on the data expiration time update strategy, the expiration time corresponding to each of the first target data and the second target data is updated, and the first target data and the second target data are stored and managed based on the updated expiration time. Since the data type can be screened for the first time according to the access information of the target data set to obtain the first candidate data set and the second candidate data set, and the first target data is further screened from the first candidate data set according to the first fluctuation of the access information corresponding to the first candidate data set, and the first target data is screened from the first candidate data set according to the second fluctuation of the access information corresponding to the second candidate data set, it is equivalent to performing a secondary screening on the data with expiration time updated, thereby improving the classification accuracy of the data with expiration time updated, and further improving the accuracy and rationality of the expiration time update, and further improving the utilization rate of the storage space.
[0020] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale. In the drawings:
[0022] Figure 1 The figure is a flow chart of a data storage management method according to an exemplary embodiment of the present disclosure.
[0023] Figure 2 is a block diagram of a storage system according to an exemplary embodiment of the present disclosure.
[0024] Figure 3 It is a block diagram showing a data storage management device according to an exemplary embodiment of the present disclosure.
[0025] Figure 4It is a schematic structural diagram of an electronic device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0026] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0027] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0028] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0029] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0030] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0031] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0032] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0033] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0034] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0035] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0036] At the same time, it is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0037] The scenario of storing data in the storage space in the embodiment of the present disclosure may be a scenario of storing cached data in a cache area, or a scenario of storing data in a hard disk or memory space.
[0038] Caching technology is one of the important means to ensure high system performance. For scenarios with low requirements for data real-time performance, relevant data can be cached, that is, the same type of data belonging to the same business is cached in the same storage, and relevant configuration parameters are set for the data. Among them, the expiration time configuration is a common configuration parameter. The expiration time is used to mark the time after which the data expires and becomes invalid. The expired data will be deleted from the cache.
[0039] However, the applicant has found in long-term research that in the related art, the expiration time setting is relatively simple, and usually a unified expiration time setting is made for all data in the cache. The advantage of this approach is that the expiration time of the data can be set uniformly and simply.
[0040] However, a unified expiration time is set for all data. The disadvantage is that the data in the cache is not differentiated. For example, in a C-end system, there is hot data that most users will request, and cold data that users rarely request and will not request for a long time. The consequence of this may be that a large amount of data that is rarely requested by users is cached in the cache, which may occupy most of the storage space in the cache, but is rarely accessed by users, resulting in unreasonable use of the cache space and low utilization efficiency.
[0041] To address this problem, the embodiments of the present disclosure provide a data storage management method, device, storage medium and electronic device to propose a reasonable and dynamic expiration time update method to update the expiration time of stored data and improve the utilization of storage space.
[0042] See also Figure 1 , Figure 1 is a flowchart of a data storage management method according to an exemplary embodiment of the present disclosure. The data storage management method can be applied to electronic devices, referring to Figure 1 , the data storage management method comprises the following steps:
[0043] S110 , for a target data set to be updated in a storage space, obtaining access information about the target data set within a preset historical time period.
[0044] In the embodiment of the present disclosure, the target data set to be updated can be understood as a set consisting of part or all of the data stored in the storage space and set with an expiration time. It can be understood that any data in the target data set can have its expiration time updated.
[0045] In the embodiments of the present disclosure, there may be various types of access information, for example, the access information may be the access frequency of data or the number of access times of data.
[0046] The access frequency of data can be determined according to the ratio of the number of accesses to the data and the length of the corresponding time period.
[0047] In the embodiment of the present disclosure, the access information about the target data set within the preset historical time period can be understood as the access information about each data in the target data set within the preset time period.
[0048] Exemplarily, in the embodiments of the present disclosure, for data k_i in the target data set, the access frequency of data k_i within a preset historical time period can be obtained. After obtaining the access frequency of all data in the target data set within the preset time period, the access information about the target data set within the preset historical time period can be obtained.
[0049] In the embodiment of the present disclosure, the preset historical time period can be understood as a preset time period before the time when the expiration time is determined to be updated. Since the subsequent steps are executed from the time when the expiration time is determined to be updated, for the convenience of description, the time when the expiration time is determined to be updated can be referred to as the current time.
[0050] Thus, in some implementations, the preset historical time period may be, for example, a time period of a preset length before the current time.
[0051] In some implementations, the preset historical time period may include a first preset number of consecutive time periods before the current time, and the first preset number of consecutive time periods may be understood as each sub-time period included in the preset historical time period. In this case, the access information about the target data set in the preset historical time period may be the access information about each data in the target data set in the first preset number of sub-time periods.
[0052] Exemplarily, in the disclosed embodiment, for data k_i in the target data set, the access frequencies of the data k_i in each Ts sub-time period of n Ts sub-time periods before the current time can be obtained. After obtaining the access information of all data in the target data set within the first preset number of sub-time periods, the access information about the target data set within the preset historical time period can be obtained.
[0053] In some implementations, the time length of each sub-time period in the first preset number of sub-time periods may be the same.
[0054] S120, based on the access information, screening from the target data set a first candidate data set whose access popularity index is greater than a first threshold, and screening a second candidate data set whose access popularity index is less than a second threshold, wherein the first threshold is greater than the second threshold.
[0055] In the disclosed embodiment, the access heat index of a data in the target data set can be determined based on the access information. For example, when the access information is the access frequency or the number of accesses, the value corresponding to the access frequency or the value corresponding to the number of accesses can be directly determined as the access heat index.
[0056] Among them, the access popularity index can represent the access popularity of a certain data in the target data set.
[0057] Therefore, the first candidate data set can be understood as a set of data with high access popularity within a preset historical time period, that is, a hot data set, and the second candidate data set can be understood as a set of data with low access popularity within a preset historical time period, that is, a cold data set.
[0058] Thus, in the embodiment of the present disclosure, a first candidate data set whose access heat index is greater than a first threshold value can be screened from the target data set based on the access information, and a second candidate data set whose access heat index is less than a second threshold value can be screened. That is, in the embodiment of the present disclosure, hot data can be determined from each data to form a first candidate data set, and cold data can be determined to form a second candidate data set according to the value corresponding to the access information of each data in the target data set.
[0059] S130, determining a first fluctuation of access information corresponding to the first candidate data set, filtering first target data from the first candidate data set according to the first fluctuation, and determining a second fluctuation of access information corresponding to the second candidate data set, filtering second target data from the second candidate data set according to the second fluctuation.
[0060] Among them, the first fluctuation of the access information corresponding to the first candidate data set can be understood as the stability of the access information corresponding to each hot data in the first candidate data set within the preset historical time period. For example, if the access frequency corresponding to a certain hot data fluctuates within the preset historical time period, then the stability is poor; if the access frequency corresponding to a certain hot data continues to maintain a high level within the preset historical time period, then the stability is high. Similarly, the second fluctuation of the access information corresponding to the second candidate data set can be understood as the stability of the access information corresponding to each cold data in the second candidate data set within the preset historical time period.
[0061] In the disclosed embodiment, the first target data can be understood as data with high access popularity and high access stability within a preset historical time period, that is, hot data with high access stability, and the second target data can be understood as data with low access popularity and high access stability within a first preset number of historical time periods, that is, cold data with high access stability.
[0062] In the disclosed embodiment, it is taken into account that there may be large fluctuations in access within the preset historical time period. For example, for a hot data k_i in the first candidate data set, it is assumed that the preset historical time period is divided into 4 consecutive sub-time periods, which are time period 1, time period 2, time period 3 and time period 4 in order, and it is assumed that the number of accesses corresponding to time period 1 is 100, the number of accesses corresponding to time period 2 is 0, the number of accesses corresponding to time period 3 is 80, and the number of accesses corresponding to time period 4 is 0. Therefore, the hot data k_i has large volatility within the preset historical time period, and it is impossible to determine whether the hot data k_i is universal hot data. Therefore, the stability of the data needs to be considered.
[0063] Therefore, in the embodiment of the present disclosure, after determining the first candidate data set, the first target data can be screened from the first candidate data set according to the first fluctuation of the access information corresponding to the first candidate data set. Similarly, after determining the second candidate data set, the second target data can be screened from the second candidate data set according to the second fluctuation of the access information corresponding to the second candidate data set.
[0064] S140, updating the expiration times corresponding to the first target data and the second target data respectively based on the data expiration time update strategy, and performing storage management on the first target data and the second target data based on the updated expiration times.
[0065] In the embodiment of the present disclosure, after determining the first target data and the second target data, the expiration time corresponding to the first target data can be updated according to the data expiration time update strategy, and the expiration time corresponding to the second target data can be updated, and the first target data and the second target data can be further stored and managed based on the updated expiration time.
[0066] In some implementations, the data expiration time update policy may be a policy for increasing the expiration time currently set for the first target data, and a policy for decreasing the expiration time currently set for the second target data.
[0067] Thus, by adopting the above method, for the target data set to be updated in the storage space, the access information about the target data set within a preset historical time period is obtained; based on the access information, a first candidate data set whose access heat index is greater than a first threshold is screened from the target data set, and a second candidate data set whose access heat index is less than a second threshold is screened; a first fluctuation of the access information corresponding to the first candidate data set is determined, and the first target data is screened from the first candidate data set according to the first fluctuation, and a second fluctuation of the access information corresponding to the second candidate data set is determined, and the second target data is screened from the second candidate data set according to the second fluctuation; based on the data expiration time update strategy, the expiration time corresponding to the first target data and the second target data is updated, and the first target data and the second target data are stored and managed based on the updated expiration time. Since the data type can be screened for the first time according to the access information of the target data set to obtain the first candidate data set and the second candidate data set, and the first target data is further screened from the first candidate data set according to the first fluctuation of the access information corresponding to the first candidate data set, and the first target data is screened from the first candidate data set according to the second fluctuation of the access information corresponding to the second candidate data set, it is equivalent to performing a secondary screening on the data with expiration time updated, thereby improving the classification accuracy of the data with expiration time updated, and further improving the accuracy and rationality of the expiration time update, and further improving the utilization rate of the storage space.
[0068] In some implementations, the method of the embodiment of the present disclosure may further include the following steps:
[0069] Sort the data in the target data set to be updated in descending order based on the access heat index, select the target data with a sorting position N in a forward sorting order, and set the access heat index of the target data with a sorting position N to the first threshold;
[0070] Selecting the target data whose sorting position is M in reverse order, and setting the access heat index of the target data whose sorting position is M to the second threshold;
[0071] Wherein, both M and N are positive integers.
[0072] In the disclosed embodiment, the access heat indexes corresponding to the respective data can be sorted in descending order from large to small, thereby, the target data with a sorting position of N can be selected in the forward sorting order, and the access heat index of the target data with a sorting position of N can be set to the first threshold, and the target data with a sorting position of M can be selected in the reverse sorting order, and the access heat index of the target data with a sorting position of M can be set to the second threshold, that is, the Nth target data with a high ranking in terms of access heat index and the Mth target data with a low ranking can be obtained, and then, the access heat index of the Nth target data with a high ranking can be further determined as the first threshold, and the access heat index of the Mth target data with a low ranking can be determined as the second threshold.
[0073] That is, in the embodiment of the present disclosure, when a first candidate data set whose access popularity index is greater than a first threshold is filtered out from the target data set, it is equivalent to filtering N-1 data with a higher access popularity index from the target data set, and when a second candidate data set whose access popularity index is less than a second threshold is filtered out from the target data set, it is equivalent to filtering M-1 data with a lower access popularity index from the target data set.
[0074] In addition, in some other implementations, the first threshold and the second threshold may also be determined based on experience.
[0075] It can be seen that the first threshold and the second threshold can be obtained by both of the above two methods. However, considering that data in different storage spaces or data for different purposes have large access differences, therefore, by determining the access heat index of the top Nth target data as the first threshold, and determining the access heat index of the bottom Mth target data as the second threshold, the versatility of the data storage management method of the disclosed embodiment can be improved. If there is a certain understanding of the parameter range of the data access heat index, the accuracy of the selection can be improved by setting the first threshold and the second threshold through experience.
[0076] In some implementations, the preset historical time period includes a first preset number of sub-time periods. In this case, step S130, determining a first fluctuation of access information corresponding to the first candidate data set, screening the first target data from the first candidate data set according to the first fluctuation, and determining a second fluctuation of access information corresponding to the second candidate data set, screening the second target data from the second candidate data set according to the second fluctuation, may include the following steps:
[0077] For any first candidate data in the first candidate data sets, according to the access heat index of the first candidate data in the first preset number of sub-time periods, the standard deviation of the access heat index corresponding to the first candidate data in the first preset number of sub-time periods is determined, and the first target data whose corresponding standard deviation is less than a third threshold is screened out from each of the first candidate data;
[0078] For any second candidate data in the second candidate data set, determine the standard deviation of the access heat index corresponding to the second candidate data in the first preset number of sub-time periods according to the access heat index of the second candidate data in the first preset number of sub-time periods, and screen out the second target data whose corresponding standard deviation is less than the fourth threshold value from each of the second candidate data.
[0079] In the embodiment of the present disclosure, the fluctuation situation can be represented by calculating the standard deviation.
[0080] Thus, for any first candidate data, the first mean value of the access heat index for the first candidate data within the first preset number of sub-time periods can be obtained. Then, the standard deviation of the access heat index corresponding to the first candidate data can be determined based on the access heat index for the first candidate data within the first preset number of sub-time periods and the first mean value of the first candidate data. In the same way, the standard deviation of the access heat index corresponding to each first candidate data in the first candidate data set can be determined. Then, among each first candidate data, the first candidate data whose corresponding standard deviation is less than the third threshold can be determined as the first target data.
[0081] In addition, for any second candidate data, the second mean of the access heat index for the second candidate data within the first preset number of sub-time periods can be obtained. Then, the standard deviation of the access heat index corresponding to the second candidate data can be determined based on the access heat index for the second candidate data within the first preset number of sub-time periods and the second mean of the second candidate data. In the same way, the standard deviation of the access heat index corresponding to each second candidate data in the second candidate data set can be determined. Then, in each second candidate data, the second candidate data whose corresponding standard deviation is less than the fourth threshold value can be determined as the second target data. In some embodiments, the third threshold value can be set to v1 times the first mean value, and the fourth threshold value can be set to v2 times the second mean value. Among them, v1 and v2 are respectively understood as weight factors, which can be the same or different. Setting the third threshold value and the fourth threshold value in this way is universal.
[0082] In other implementations, the third threshold and the fourth threshold may also be selected based on access information of actual business to stored data.
[0083] In addition, considering that the access frequency does not accumulate with the length of time compared to the number of visits, in some embodiments, when the access information is the access frequency, the time length of each sub-time period in the first preset number of sub-time periods can be set to be different, and, among any two sub-time periods included in the first preset number of sub-time periods, the time length of the sub-time period close to the current time is greater than the time length of the sub-time period far from the current time.
[0084] That is, the closer the time period is to the current time, the longer the time length can be set relatively. This can make the determined access information and access heat index more meaningful, closer to the recent actual access situation, and make the final determined expiration time more accurate.
[0085] In some implementations, step S140, updating the expiration time corresponding to the first target data and the second target data based on the data expiration time update strategy, may include the following steps:
[0086] When the expiration time currently set for the first target data is less than the preset maximum expiration time, the expiration time currently set for the first target data is increased to obtain an updated expiration time corresponding to the first target data;
[0087] When the expiration time currently set for the second target data is greater than the preset minimum expiration time, the expiration time currently set for the second target data is reduced to obtain an updated expiration time corresponding to the second target data.
[0088] In combination with the foregoing content, it can be known that the first target data can be understood as hot data with higher access stability, and the second target data can be understood as cold data with higher access stability. For hot data, it is hoped that the expiration will be slowed down, and for cold data, it is hoped that the expiration will be accelerated. Therefore, in the embodiment of the present disclosure, a maximum expiration time and a minimum expiration time can be set in advance, so that when the expiration time currently set for the first target data is less than the preset maximum expiration time, the expiration time currently set for the first target data is increased, and when the expiration time currently set for the second target data is greater than the preset minimum expiration time, the expiration time currently set for the second target data is reduced, and the maximum expiration time of the first target data does not exceed the preset maximum expiration time, and the minimum expiration time of the second target data is not less than the minimum expiration time.
[0089] In some implementations, increasing the expiration time currently set for the first target data to obtain an updated expiration time corresponding to the first target data may include the following steps:
[0090] Based on the preset expiration time increase ratio, the expiration time currently set for the first target data is increased to obtain an updated expiration time corresponding to the first target data.
[0091] In an embodiment of the present disclosure, when the expiration time currently set for the first target data is less than the maximum expiration time, the expiration time currently set for the first target data can be adjusted based on a preset expiration time increase ratio to obtain an updated expiration time corresponding to the first target data.
[0092] The increase ratio of the expiration time can also be understood as the update step percentage corresponding to the first target data, for example, set to p%. Then, the above process can be expressed by the following formula:
[0093] Thot_exp` = Thot_exp*(1+p%)
[0094] Among them, Thot_exp` represents the updated expiration time corresponding to the first target data, Thot_exp represents the expiration time before the update corresponding to the first target data, for example, the expiration time currently set for the first target data, and p% represents the increase ratio of the expiration time, wherein Thot_exp` and Thot_exp are both less than or equal to the maximum expiration time.
[0095] In some implementations, reducing the expiration time currently set for the second target data to obtain an updated expiration time corresponding to the second target data may include the following steps:
[0096] When the expiration time currently set for the second target data is greater than the maximum expiration time, based on the preset expiration time reduction ratio, adjustments are made on the basis of the expiration time currently set for the second target data to obtain an updated expiration time corresponding to the second target data.
[0097] In an embodiment of the present disclosure, when the expiration time currently set for the second target data is greater than the maximum expiration time, the expiration time currently set for the second target data can be adjusted based on a preset expiration time reduction ratio to obtain an updated expiration time corresponding to the second target data.
[0098] The expiration time reduction ratio can also be understood as the update step percentage corresponding to the second target data, for example, set to q%. Then, the above process can be expressed by the following formula:
[0099] Tcold_exp`=Tcold_exp*(1+q%)
[0100] Among them, Tcold_exp` represents the updated expiration time corresponding to the second target data, Tcold_exp represents the expiration time before the update corresponding to the second target data, such as the expiration time currently set for the second target data, and q% represents the increase ratio of the expiration time, wherein Tcold_exp` and Tcold_exp are both greater than or equal to the minimum expiration time.
[0101] In some implementations, in S110 of the embodiment of the present disclosure, for a target data set to be updated in the storage space, obtaining access information about the target data set within a preset historical time period may include the following steps:
[0102] Based on a preset time starting point, access information about a target data set within a preset historical time period is obtained at every preset time interval.
[0103] In the embodiment of the present disclosure, in order to obtain the access information about the target data set within the preset historical time period, the preset time starting point may be a time point after the storage service is started and the preset historical time period has passed. For example, after the storage service is started and runs for the preset historical time period, the first expiration time update can be determined, that is, the first access information about the target data set within the preset historical time period is obtained, and the access information about the target data set within the preset historical time period can be obtained at each preset time interval thereafter.
[0104] Combine the following Figure 2 The block diagram of the storage system shown in the figure uses an embodiment of a scenario in which a business caller in a storage system requests cached data to describe in detail the data storage management method of the embodiment of the present disclosure: wherein the storage system includes a business caller and a data service module, wherein the data service module includes a sliding time window statistics module and a cache. wherein the sliding time window statistics module is used to execute the following points 1, 2, and 3.
[0105] 1. The sliding time window statistics module counts and analyzes the data keys accessed by the business caller to the cache:
[0106] The sliding time window is set to n*Ts, where Ts is a statistical period, i.e., a sub-time period (which can be dynamically set according to actual conditions).
[0107] In each Ts period, the business caller counts each request to access the cached data key: k_i, and the cumulative count Ck_i of the request for each k_i, so that the statistical k_i and the cumulative count Ck_i corresponding to each request can be obtained. Among them, the data that has not been accessed can also be recorded, and the number of times is 0. Therefore, i can represent all cached data.
[0108] Based on the above statistical data, the access frequency fk_i within each K_i unit time Ts can be calculated as: fk_i=Ck_i / Ts.
[0109] Calculate the statistical frequency set list_freq corresponding to [k_0, k_1…k_i] within a single statistical period Ts: [fk_0, fk_1…fk_i].
[0110] And as above, perform the above calculation for each Ts in the n*Ts time window. You can get the fk_i_n corresponding to k_i_n in the nth Ts, and calculate the mean value of k_i on n*Ts: fk_i_arg = (fk_i_1 + ... fk_i_n) / n, and the sum of the frequencies of k_i on n*Ts: fk_i_sum = fk_i_1 + ... + fk_i_n.
[0111] By performing the above calculation for all k_i, we can obtain the set list_fk:[fk_o_sum,…,fk_i_sum] of the sum of the frequency values corresponding to different k_i in the n*Ts time window and sort them from large to small in frequency:
[0112] Take the largest first x% (x can be set according to actual situation) in the set, and get the first x% maximum frequency set corresponding to different Keys on n*Ts, which is the first candidate data set:
[0113] list_max_x%: [fk_m_sum,…,fk_l_sum], where m and l are cached data respectively.
[0114] Take the smallest first y% (y can be set according to actual conditions) in the set to obtain the first y% minimum frequency set corresponding to different Keys on n*Ts, which is the second candidate data set:
[0115] list_min_y%: [fk_s_sum,…,fk_t_sum], where s and t are cached data respectively.
[0116] 2. The sliding time window statistics module calculates the standard deviation of list_max_x% and list_min_y% respectively:
[0117] The data key set with the top x% maximum frequency corresponding to the top x% maximum frequency set list_max_x% is: list_key_max_x%: [k_m,…,k_l].
[0118] From the previous calculation, we know the frequency of k_m on n Ts [fk_m_1, .., fk_m_n] and the mean fk_m_arg, so we can calculate the standard deviation Fmax of the frequency of k_m on n Ts as:
[0119]
[0120] If the standard deviation Fmax < v1 * fk_m_arg, it indicates that the frequency fluctuation corresponding to k_m is small, and it can be considered as a first target data within n * Ts time.
[0121] Similarly, it can be determined whether any data in list_key_max_x%: [k_m,..., k_l] is the first target data.
[0122] The data key set corresponding to the first y% maximum frequencies of the first y% maximum frequency set list_max_y% is: list_key_min_y%[k_s,..., k_t].
[0123] And from the previous calculations, the frequencies [fk_s_1,.., fk_s_n] and the mean value fk_s_arg of k_s over n Ts are known. Therefore, the frequency standard deviation Fmix of k_s over n Ts can be calculated as:
[0124]
[0125] If the standard deviation Fmix < v2 * fk_s_arg, it indicates that the frequency fluctuation corresponding to k_s is small, and it can be considered as a second target data within n * Ts time.
[0126] Similarly, it can be determined whether any data in list_key_min_y%[k_s,..., k_t] is the second target data.
[0127] Assume that finally the first target data set list_hot_k: [k_h,..., k_0] and the second target data set list_cold_k: [k_c,..., k_0] can be obtained.
[0128] 3. The sliding time window statistics module updates the expiration time:
[0129] Update the expiration time for the first target data and the second target data respectively, and set the update step percentage p% for the first target data and the update step percentage q% for the second target data. Thus, the updated expiration time corresponding to the first target data can be obtained through Thot_exp` = Thot_exp * (1 + p%), and the updated expiration time corresponding to the second target data can be obtained through Tcold_exp` = Tcold_exp * (1 + q%). In addition, set that the maximum expiration time of the first target data does not exceed Thot_exp_max, and the minimum expiration time of the second target data is not lower than Tcold_exp_min.
[0130] By adopting the above method, the hot data and cold data are distinguished from each other in the stored data, the expiration time of the hot data is dynamically increased, and the expiration time of the cold data is dynamically reduced. In addition, the sliding time window algorithm is used to dynamically calculate the hotter data and the colder data in the cache. In addition, the standard deviation algorithm is used to determine the stable hot data and the stable cold data in the hotter data and the colder data within the n statistical cycles within the time window. Thus, the cold and hot data in the cache can be dynamically and accurately determined, and a specific expiration time can be dynamically generated for each data. The expiration time of hot data can be dynamically increased, and the expiration time of cold data can be dynamically reduced. It can expire and be cleared faster, which can make the storage space more reasonably and efficiently used, and improve the efficiency and utilization of resources.
[0131] Figure 3 is a block diagram of a data storage management device according to an exemplary embodiment of the present disclosure, referring to Figure 3 , the data storage management device 300 comprises:
[0132] A first acquisition module 310 is used to acquire access information about a target data set to be updated in a storage space within a preset historical time period;
[0133] A first screening module 320, configured to screen, from the target data set, a first candidate data set whose access heat index is greater than a first threshold, and screen a second candidate data set whose access heat index is less than a second threshold, based on the access information, wherein the first threshold is greater than the second threshold;
[0134] The second screening module 330 is used to determine a first fluctuation of the access information corresponding to the first candidate data set, and screen the first target data from the first candidate data set according to the first fluctuation, and to determine a second fluctuation of the access information corresponding to the second candidate data set, and screen the second target data from the second candidate data set according to the second fluctuation;
[0135] The management module 340 is used to update the expiration time corresponding to each of the first target data and the second target data based on the data expiration time update strategy, and to store and manage the first target data and the second target data based on the updated expiration time.
[0136] Optionally, the apparatus 300 further includes:
[0137] A first setting module is used to sort the data in the target data set to be updated in descending order based on the access heat index, select the target data with a sorting position N in a forward sorting order, and set the access heat index of the target data with a sorting position N to the first threshold;
[0138] The second setting module is used to select the target data with a sorting position of M in reverse order of sorting, and set the access heat index of the target data with a sorting position of M as the second threshold; both M and N are positive integers.
[0139] Optionally, the preset historical time period includes a first preset number of sub-time periods, and the second screening module includes:
[0140] A first screening submodule is used to determine, for any first candidate data in the first candidate data sets, a standard deviation of the access heat index corresponding to the first candidate data in the first preset number of sub-time periods according to the access heat index of the first candidate data in the first preset number of sub-time periods, and screen out first target data whose corresponding standard deviation is less than a third threshold value from each of the first candidate data;
[0141] The second screening submodule is used to determine, for any second candidate data in the second candidate data set, the standard deviation of the access heat index corresponding to the second candidate data within the first preset number of sub-time periods according to the access heat index of the second candidate data within the first preset number of sub-time periods, and screen out the second target data whose corresponding standard deviation is less than a fourth threshold value from each of the second candidate data.
[0142] Optionally, the access information is an access frequency, the time length of each sub-time period in a first preset number of sub-time periods is different, and, among any two sub-time periods included in the first preset number of sub-time periods, the time length of the sub-time period close to the current time is greater than the time length of the sub-time period far from the current time.
[0143] Optionally, the management module 340 includes:
[0144] A first updating submodule, configured to increase the expiration time currently set for the first target data when the expiration time currently set for the first target data is less than a preset maximum expiration time, to obtain an updated expiration time corresponding to the first target data;
[0145] The second updating submodule is used to reduce the expiration time currently set for the second target data when the expiration time currently set for the second target data is greater than a preset minimum expiration time, so as to obtain an updated expiration time corresponding to the second target data.
[0146] Optionally, the first updating submodule is further used to increase the expiration time currently set for the first target data based on a preset expiration time increase ratio, so as to obtain an updated expiration time corresponding to the first target data.
[0147] Optionally, the second updating submodule is further used to reduce the expiration time currently set for the second target data based on a preset expiration time reduction ratio, so as to obtain an updated expiration time corresponding to the second target data.
[0148] Optionally, the first acquisition module 310 is further configured to acquire access information about the target data set within a preset historical time period at every preset time interval based on a preset time starting point.
[0149] Reference below Figure 4 , which shows a schematic diagram of the structure of an electronic device 400 suitable for implementing the embodiment of the present disclosure. The electronic device in the embodiment of the present disclosure may be a server. Figure 4 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0150] like Figure 4 As shown, the electronic device 400 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage device 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0151] Typically, the following devices may be connected to the I / O interface 405: an input device 406 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 408 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 409. The communication device 409 may allow the electronic device 400 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 4 The electronic device 400 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0152] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 409, or installed from the storage device 408, or installed from the ROM 402. When the computer program is executed by the processing device 401, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0153] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0154] In some embodiments, the electronic device can communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0155] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0156] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: when determining to update the expiration time, for each storage data to be updated in the storage space, obtain the access information for the storage data to be updated in a first preset number of historical time periods; based on the access information of each storage data to be updated, determine the first candidate data and the second candidate data from the each storage data to be updated, wherein the access frequency to the first candidate data in the first preset number of historical time periods is greater than the access frequency to the second candidate data; determine the first target data from the first candidate data according to the access stability to the first candidate data in each of the historical time periods, and determine the second target data from the second candidate data according to the access stability to the second candidate data in each of the historical time periods; according to the corresponding update strategy, update the expiration time of the first target data and the second target data respectively.
[0157] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0158] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0159] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a module does not, in some cases, limit the module itself.
[0160] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0161] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0162] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0163] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0164] Although the subject matter has been described in language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Claims
1. A data storage management method, characterized in that: The method comprises: For a target data set to be updated in the storage space, obtaining access information about the target data set within a preset historical time period; Based on the access information, screening a first candidate data set having an access heat index greater than a first threshold from the target data set, and screening a second candidate data set having an access heat index less than a second threshold, wherein the first threshold is greater than the second threshold; Determine a first fluctuation of access information corresponding to the first candidate data set, and select first target data from the first candidate data set according to the first fluctuation, and determine a second fluctuation of access information corresponding to the second candidate data set, and select second target data from the second candidate data set according to the second fluctuation; The expiration times corresponding to the first target data and the second target data are updated based on the data expiration time update strategy, and the first target data and the second target data are stored and managed based on the updated expiration times.
2. The method according to claim 1, characterized in that: The method further comprises: Sort the data in the target data set to be updated in descending order based on the access heat index, select the target data with a sorting position N in a forward sorting order, and set the access heat index of the target data with a sorting position N to the first threshold; Selecting the target data whose sorting position is M in reverse order, and setting the access heat index of the target data whose sorting position is M to the second threshold; Wherein, both M and N are positive integers.
3. The method according to claim 1, characterized in that: The preset historical time period includes a first preset number of sub-time periods, and the determining a first fluctuation of access information corresponding to the first candidate data set, filtering first target data from the first candidate data set according to the first fluctuation, and determining a second fluctuation of access information corresponding to the second candidate data set, filtering second target data from the second candidate data set according to the second fluctuation includes: For any first candidate data in the first candidate data sets, according to the access heat index of the first candidate data in the first preset number of sub-time periods, the standard deviation of the access heat index corresponding to the first candidate data in the first preset number of sub-time periods is determined, and the first target data whose corresponding standard deviation is less than a third threshold is screened out from each of the first candidate data; For any second candidate data in the second candidate data set, determine the standard deviation of the access heat index corresponding to the second candidate data in the first preset number of sub-time periods according to the access heat index of the second candidate data in the first preset number of sub-time periods, and screen out the second target data whose corresponding standard deviation is less than the fourth threshold value from each of the second candidate data.
4. The method according to claim 3, characterized in that The access information is the access frequency, the time length of each sub-time period in the first preset number of sub-time periods is different, and, among any two sub-time periods included in the first preset number of sub-time periods, the time length of the sub-time period close to the current time is greater than the time length of the sub-time period far from the current time.
5. The method according to claim 1, characterized in that The updating of the expiration time corresponding to each of the first target data and the second target data based on the data expiration time update strategy includes: When the expiration time currently set for the first target data is less than the preset maximum expiration time, increasing the expiration time currently set for the first target data to obtain an updated expiration time corresponding to the first target data; When the expiration time currently set for the second target data is greater than the preset minimum expiration time, the expiration time currently set for the second target data is reduced to obtain an updated expiration time corresponding to the second target data.
6. The method according to claim 1, characterized in that The step of increasing the expiration time currently set for the first target data to obtain an updated expiration time corresponding to the first target data includes: Based on a preset expiration time increase ratio, the expiration time currently set for the first target data is increased to obtain an updated expiration time corresponding to the first target data; The step of reducing the currently set expiration time of the second target data to obtain an updated expiration time corresponding to the second target data includes: Based on the preset expiration time reduction ratio, the expiration time currently set for the second target data is reduced to obtain an updated expiration time corresponding to the second target data.
7. The method according to claim 1, characterized in that The step of obtaining access information about a target data set to be updated in the storage space within a preset historical time period includes: Based on a preset time starting point, access information about the target data set within a preset historical time period is obtained at every preset time interval.
8. A data storage management device, characterized in that: The device comprises: A first acquisition module, configured to acquire access information about a target data set to be updated in a storage space within a preset historical time period; A first screening module is used to screen a first candidate data set whose access heat index is greater than a first threshold value from the target data set based on the access information, and screen a second candidate data set whose access heat index is less than a second threshold value, wherein the first threshold value is greater than the second threshold value; a second screening module, configured to determine a first fluctuation of access information corresponding to the first candidate data set, and screen first target data from the first candidate data set according to the first fluctuation, and to determine a second fluctuation of access information corresponding to the second candidate data set, and screen second target data from the second candidate data set according to the second fluctuation; The management module is used to update the expiration time corresponding to each of the first target data and the second target data based on the data expiration time update strategy, and to store and manage the first target data and the second target data based on the updated expiration time.
9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processing device, the steps of the method described in any one of claims 1 to 7 are implemented.
10. An electronic device, characterized in that: include: a storage device having a computer program stored thereon; A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1 to 7.
Citation Information
Cited By
Cache data optimization method and device based on service information, equipment and storage medium
CN121092582A
Cache data optimization method and device based on service information, equipment and storage medium
CN121092582B
