Cache management method, electronic device, storage medium, and program product

By calculating the current access popularity of data blocks in the storage system and dynamically adjusting the cache resource allocation, the problem of low data access efficiency in the storage system is solved, and the data read and write speed and cache hit rate are improved.

CN119620961BActive Publication Date: 2025-05-30INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510158280.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-13
Publication Date
2025-05-30
Estimated Expiration
2045-02-13

AI Technical Summary

Technical Problem

Due to the complex and changeable demands for accessing data in the storage system, the cached data is not the data to be accessed at present, resulting in data access delays and low data access efficiency in the storage system.

Method used

By obtaining the current running data of the storage system in the current cycle and the historical access popularity of multiple data blocks, the current access popularity of each data block is calculated, and dynamically adjusting the resource allocation of the target cache based on the current access popularity and historical access popularity to update the data blocks in the target cache.

Benefits of technology

It improves the hit rate of cache, improves the data read and write speed, reduces data access delay, and improves the data access efficiency of the storage system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119620961B_ABST
    Figure CN119620961B_ABST
Patent Text Reader

Abstract

The present application discloses a cache management method, an electronic device, a storage medium, and a program product, relating to the technical field of data storage, including obtaining the current operation data of a storage system in the current period, determining the current access popularity corresponding to multiple data blocks according to the current operation data, and dynamically adjusting the resource allocation of a target cache according to the current access popularity, which solves the problem of low data access efficiency in the related art of storage systems and achieves the technical effect of improving the data access efficiency of storage systems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of data storage, and in particular, to a cache management method, an electronic device, a storage medium, and a program product. Background Art

[0002] With the continuous growth of the data volume, the performance requirements for the storage system are also getting higher and higher. The storage system may include a Network Attached Storage (NAS) system, a cloud storage system, a distributed storage system, and so on. Due to the increasing demand for data access in the storage system, it is necessary to optimize the performance of the storage system.

[0003] In the related art, the data access performance of the storage system can be optimized by upgrading the hardware in the storage system, such as increasing the memory capacity in the storage system, upgrading the disk drive, upgrading the network interface card, etc. It is also possible to cache a certain amount of data in the storage system to optimize the data access performance of the storage system. However, due to the complex and variable demand for accessing data, the cached data is not necessarily the data to be accessed currently, resulting in data access latency and low data access efficiency of the storage system. Summary of the Invention

[0004] This application provides a cache management method, an electronic device, a storage medium, and a program product to at least solve the problem of low data access efficiency of the storage system in the related art.

[0005] This application provides a cache management method, including:

[0006] Obtain the current running data of the storage system in the current period and the historical access popularity of multiple data blocks, where the multiple data blocks are stored in the storage system;

[0007] Determine a first weight of the current running data and a second weight of the historical access popularity according to the current running data;

[0008] For any one of the data blocks, determine the current access popularity of the data block in the current period according to the current running data, the historical access popularity, the first weight, and the second weight;

[0009] Update the data blocks in the target cache according to the current access popularity and the historical access popularity of each data block, where the target cache is used to store hot data.

[0010] In a possible implementation manner, updating the data blocks in the target cache according to the current access popularity and the historical access popularity of each data block includes:

[0011] Determine multiple first data blocks among the multiple data blocks according to the current access popularity of each data block;

[0012] Determine multiple second data blocks among multiple data blocks according to the current access popularity and historical access popularity of each data block;

[0013] Determine multiple updated data blocks of the target cache according to multiple first data blocks, multiple second data blocks, and multiple current data blocks in the target cache;

[0014] Update the data blocks in the target cache according to multiple updated data blocks.

[0015] In a possible implementation manner, updating the data blocks in the target cache according to multiple updated data blocks includes:

[0016] Determine the data capacity corresponding to multiple updated data blocks;

[0017] Judge whether the remaining cache capacity corresponding to the target cache is greater than the data capacity;

[0018] If so, store multiple updated data blocks into the cache space corresponding to the target cache;

[0019] If not, obtain the historical access data corresponding to each current data block, determine at least one data block to be deleted among multiple current data blocks according to the historical access data corresponding to each current data block and the current access popularity of each current data block, delete at least one data block to be deleted, and store multiple updated data blocks into the cache space corresponding to the target cache.

[0020] In a possible implementation manner, determining at least one data block to be deleted among multiple current data blocks according to the historical access data corresponding to each current data block and the current access popularity of each current data block includes:

[0021] Obtain the remaining cache capacity corresponding to the target cache;

[0022] Determine the capacity difference between the remaining cache capacity and the data capacity;

[0023] Determine the number of data blocks to be deleted according to the capacity difference;

[0024] Determine the data blocks to be deleted corresponding to the number of data blocks among multiple current data blocks according to the historical access data corresponding to each current data block and the current access popularity of each current data block.

[0025] In a possible implementation manner, determining the data blocks to be deleted corresponding to the number of data blocks among multiple current data blocks according to the historical access data corresponding to each current data block and the current access popularity of each current data block includes:

[0026] Among multiple current data blocks, determine multiple candidate data blocks whose current access popularity is lower than a first threshold;

[0027] According to the historical access data corresponding to each candidate data block, determine the last access time of each candidate data block;

[0028] Sort the multiple candidate data blocks in the order from the farthest to the nearest last access time to obtain a first sequence;

[0029] Determine the first n candidate data blocks in the first sequence as the data blocks to be deleted, where n is the number of data blocks.

[0030] In a possible implementation manner, determining the data blocks to be deleted corresponding to the number of data blocks among multiple current data blocks according to the historical access data corresponding to each current data block and the current access popularity of each current data block includes:

[0031] According to the historical access data corresponding to each current data block, determine the last access time corresponding to each current data block;

[0032] Sort the multiple current data blocks in the order from the farthest to the nearest last access time to obtain a second sequence;

[0033] Determine the first m current data blocks in the second sequence as the third data blocks, where m is the sum of the number of data blocks and a first preset number;

[0034] Sort the multiple third data blocks in the order from the smallest to the largest current access popularity to obtain a third sequence;

[0035] Determine the first n third data blocks in the third sequence as the data blocks to be deleted, where n is the number of data blocks and n is less than m.

[0036] In a possible implementation manner, determining multiple first data blocks among multiple data blocks according to the current access popularity of each data block includes:

[0037] Sort the multiple data blocks in the order from the largest to the smallest current access popularity to obtain a fourth sequence;

[0038] Determine the first a data blocks in the fourth sequence as multiple first data blocks, where a is a second preset number.

[0039] In a possible implementation manner, determining multiple second data blocks among multiple data blocks according to the current access popularity and historical access popularity of each data block includes:

[0040] Predict a second threshold according to the historical access popularity;

[0041] Among multiple data blocks, determine multiple second data blocks whose current access popularity is greater than a second threshold.

[0042] In a possible implementation manner, determining multiple updated data blocks of a target cache according to multiple first data blocks, multiple second data blocks, and multiple current data blocks in the target cache includes:

[0043] Determine a first set, where the first set includes multiple first data blocks and multiple second data blocks;

[0044] In the first set, determine at least one fourth data block that is the same as any one of the current data blocks;

[0045] Delete at least one fourth data block from the first set to obtain a target set;

[0046] Determine multiple updated data blocks according to the target set.

[0047] In a possible implementation manner, determining a first weight of current running data and a second weight of historical access popularity according to current running data includes:

[0048] Determine a first weight of current running data according to current running data;

[0049] Determine a second weight of historical access popularity according to the first weight and a preset value.

[0050] In a possible implementation manner, determining a first weight of current running data according to current running data includes:

[0051] Perform parsing processing on the current running data to obtain a data read / write record, and input the data read / write record into a weight prediction model to determine a first weight of the current running data; or,

[0052] Determine a load value corresponding to the storage system according to the current running data, and determine a first weight of the current running data according to the load value and a preset mapping relationship.

[0053] In a possible implementation manner, where the current running data includes a read / write frequency, determining the current access popularity of a data block in the current cycle according to the current running data, historical access popularity, first weight, and second weight includes:

[0054] Determine a first product between the read / write frequency and the first weight;

[0055] Determine a second product between the historical access popularity and the second weight;

[0056] Determine the sum of the first product and the second product as the current access popularity.

[0057] The present application also provides a cache management device, including:

[0058] An acquisition module, configured to acquire the current operation data of the storage system in the current period and the historical access popularity of multiple data blocks, where the multiple data blocks are stored in the storage system;

[0059] A first determination module, configured to determine a first weight of the current operation data and a second weight of the historical access popularity according to the current operation data;

[0060] A second determination module, configured to determine the current access popularity of any data block in the current period according to the current operation data, the historical access popularity, the first weight, and the second weight;

[0061] An update module, configured to update the data blocks in the target cache according to the current access popularity and the historical access popularity of each data block, where the target cache is used to store hot data.

[0062] In a possible implementation manner, the update module is specifically configured to:

[0063] Determine multiple first data blocks from the multiple data blocks according to the current access popularity of each data block;

[0064] Determine multiple second data blocks from the multiple data blocks according to the current access popularity and the historical access popularity of each data block;

[0065] Determine multiple updated data blocks of the target cache according to the multiple first data blocks, the multiple second data blocks, and the multiple current data blocks in the target cache;

[0066] Update the data blocks in the target cache according to the multiple updated data blocks.

[0067] In a possible implementation manner, the update module is specifically configured to:

[0068] Determine the data capacity corresponding to the multiple updated data blocks;

[0069] Determine whether the remaining cache capacity corresponding to the target cache is greater than the data capacity;

[0070] If so, store the multiple updated data blocks into the cache space corresponding to the target cache;

[0071] If not, acquire the historical access data corresponding to each current data block, determine at least one data block to be deleted from the multiple current data blocks according to the historical access data corresponding to each current data block and the current access popularity of each current data block, delete the at least one data block to be deleted, and store the multiple updated data blocks into the cache space corresponding to the target cache.

[0072] In a possible implementation manner, the update module is specifically configured to:

[0073] Obtain the remaining cache capacity corresponding to the target cache;

[0074] Determine the capacity difference between the remaining cache capacity and the data capacity;

[0075] Determine the number of data blocks to be deleted according to the capacity difference;

[0076] Determine the data blocks to be deleted corresponding to the number of data blocks among multiple current data blocks according to the historical access data corresponding to each current data block and the current access popularity of each current data block.

[0077] In a possible implementation manner, the update module is specifically configured to:

[0078] Determine multiple candidate data blocks with a current access popularity lower than the first threshold among multiple current data blocks;

[0079] Determine the last access time of each candidate data block according to the historical access data corresponding to each candidate data block;

[0080] Sort the multiple candidate data blocks in the order from the farthest to the nearest according to the last access time to obtain a first sequence;

[0081] Determine the first n candidate data blocks in the first sequence as the data blocks to be deleted, where n is the number of data blocks.

[0082] In a possible implementation manner, the update module is specifically configured to:

[0083] Determine the last access time corresponding to each current data block according to the historical access data corresponding to each current data block;

[0084] Sort the multiple current data blocks in the order from the farthest to the nearest according to the last access time of each current data block to obtain a second sequence;

[0085] Determine the first m current data blocks in the second sequence as the third data blocks, where m is the sum of the number of data blocks and the first preset number;

[0086] Sort the multiple third data blocks in ascending order of the current access popularity of each third data block to obtain a third sequence;

[0087] Determine the first n third data blocks in the third sequence as the data blocks to be deleted, where n is the number of data blocks and n is less than m.

[0088] In a possible implementation manner, the update module is specifically configured to:

[0089] Sort multiple data blocks in descending order according to their current access popularity to obtain a fourth sequence;

[0090] Determine the first a data blocks in the fourth sequence as multiple first data blocks, where a is a second preset quantity.

[0091] In a possible implementation manner, the update module is specifically configured to:

[0092] Predict a second threshold according to historical access popularity;

[0093] In multiple data blocks, determine multiple data blocks with current access popularity greater than the second threshold as multiple second data blocks.

[0094] In a possible implementation manner, the update module is specifically configured to:

[0095] Determine a first set, where the first set includes multiple first data blocks and multiple second data blocks;

[0096] In the first set, determine at least one fourth data block, where the fourth data block is the same as any current data block;

[0097] Delete at least one fourth data block in the first set to obtain a target set;

[0098] Determine multiple updated data blocks according to the target set.

[0099] In a possible implementation manner, the first determination module is specifically configured to:

[0100] Determine a first weight of the current running data according to the current running data;

[0101] Determine a second weight of the historical access popularity according to the first weight and a preset value.

[0102] In a possible implementation manner, the first determination module is specifically configured to:

[0103] Perform parsing processing on the current running data to obtain a data read / write record, input the data read / write record into a weight prediction model to determine the first weight of the current running data; or,

[0104] Determine a load value corresponding to the storage system according to the current running data, and determine the first weight of the current running data according to the load value and a preset mapping relationship.

[0105] In a possible implementation manner, the current running data includes a read / write frequency, and the second determination module is specifically configured to:

[0106] Determine a first product between the read / write frequency and the first weight;

[0107] Determine a second product between the historical access popularity and the second weight;

[0108] Determine the sum of the first product and the second product as the current access popularity.

[0109] This application also provides an electronic device, including: a memory for storing a computer program; a processor for implementing the steps of any of the above cache management methods when executing the computer program.

[0110] This application also provides a computer-readable storage medium storing a computer program, wherein the computer program implements the steps of any of the above cache management methods when executed by a processor.

[0111] This application also provides a computer program product including a computer program, and the computer program implements the steps of any of the above cache management methods when executed by a processor.

[0112] Through this application, since the current access popularity of each data block is calculated and the resource allocation of the target cache is dynamically adjusted according to the current access popularity. Therefore, the problem of low data access efficiency in the related art can be solved, the dynamic changes of data access can be better adapted, the cache hit rate can be improved, thereby improving the data reading and writing speed, reducing the data access latency, and improving the data access efficiency of the storage system. BRIEF DESCRIPTION OF THE DRAWINGS

[0113] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with this application, and are used together with the specification to explain the principles of this application.

[0114] Figure 1 It is a schematic diagram of an application scenario provided by an embodiment of this application;

[0115] Figure 2 It is a schematic flowchart of a cache management method provided by an embodiment of this application;

[0116] Figure 3 It is a schematic flowchart of another cache management method provided by an embodiment of this application;

[0117] Figure 4 It is a schematic structural diagram of a cache management device provided by an embodiment of this application;

[0118] Figure 5 It is a schematic structural diagram of the electronic device provided by this application.

[0119] Through the above-mentioned accompanying drawings, specific embodiments of the present application have been shown, and there will be a more detailed description hereinafter. These drawings and the written description are not intended to limit the scope of the concept of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. Detailed Embodiments

[0120] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.

[0121] It should be noted that in the description of the present application, the terms "include", "comprise" or any other variant thereof are intended to cover a non-exclusive inclusion, such that a process, method, article or device including a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present application are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0122] As the amount of data continues to grow, the performance requirements for storage systems are also getting higher and higher. Storage systems can include Network Attached Storage (NAS) systems, cloud storage systems, distributed storage systems, and so on. Due to the increasing demand for data access in storage systems, performance optimization of storage systems is required.

[0123] In the related art, the data access performance of the storage system can be optimized by upgrading the hardware in the storage system, such as increasing the memory capacity in the storage system, upgrading the disk drive, upgrading the network interface card, etc. It is also possible to cache a certain amount of data in the storage system to optimize the data access performance of the storage system. However, due to the complex and variable demand for accessing data, the cached data is not necessarily the data to be accessed currently, resulting in data access latency and low data access efficiency of the storage system.

[0124] To solve the above technical problems, an embodiment of the present application provides a cache management method. By obtaining the current operation data of the storage system in the current period, and determining the current access popularity corresponding to multiple data blocks according to the current operation data, the multiple data blocks are stored in the storage system, and the data blocks in the target cache are updated according to the current access popularity of each data block. The target cache is used to store hot data. In this way, by calculating the current access popularity of each data block and dynamically adjusting the resource allocation of the target cache according to the current access popularity, it can better adapt to the dynamic changes of data access, improve the cache hit rate, thereby enhancing the data read and write speed, reducing the data access latency, and improving the data access efficiency of the storage system.

[0125] To enable those skilled in the art of this technology to better understand the solution of the present application, the following further elaborates on the present application in conjunction with the accompanying drawings and specific embodiments.

[0126] Combined with the specific application environment architecture or specific hardware architecture on which the execution of the cache management method depends, the specific application environment architecture or specific hardware architecture is described herein.

[0127] Next, combined with Figure 1 , taking the NAS system as an example, the storage system is explained.

[0128] Please refer to Figure 1 , Figure 1 , which is a schematic diagram of an application scenario provided by an embodiment of the present application. Figure 1 It may include a NAS system 100. The NAS system 100 may include a NAS controller and a storage subsystem. The NAS controller may include a processor 101, a memory 102, a network interface 103, and a disk interface 104. The storage subsystem may include a hard disk 105 and a storage device 106.

[0129] Among them, the processor 101, the memory 102, the network interface 103, and the disk interface 104 may be connected through a bus, and the disk interface 104 may be connected to the storage subsystem.

[0130] The processor 101 may be used to process data and manage network communication.

[0131] The memory 102 may be used to temporarily store operation data to improve system performance. The target cache may be included in the memory 102.

[0132] The network interface 103 may be used to provide an interface for network connection, so that the NAS system can be connected to the network and data can be transmitted through the network. For example, the network interface is an Ethernet port.

[0133] The disk interface 104 can be used to provide a channel for data transfer between the NAS controller and the storage subsystem to achieve data storage and data access.

[0134] The hard disk 105 can be used to receive and store data from the controller or other network devices. The data can include files, databases, backup data, etc., depending on the usage scenarios and user requirements of the NAS system, which are not limited herein.

[0135] The storage device 106 can be used to store data and is connected to the NAS controller to achieve data reading and writing.

[0136] Figure 2 It is a flowchart of a cache management method provided by an embodiment of the present application. The execution subject of the embodiment of the present application can be the NAS controller or the processor in the NAS controller. As Figure 2 shown, the method is as follows:

[0137] S201: Obtain the current running data of the storage system in the current cycle and the historical access popularity of multiple data blocks.

[0138] The multiple data blocks are stored in the storage system.

[0139] The current cycle can be a cycle determined according to a preset duration.

[0140] The current running data can include resource usage data and performance metric data.

[0141] The resource usage data can include processor utilization rate, memory usage data, disk input / output operation data, etc.

[0142] The performance metric data can include read / write frequency, throughput, and latency, etc.

[0143] Among them, the read / write frequency can be used to represent the number of input / output operations per second of the storage system.

[0144] The historical access popularity can include the access popularity corresponding to the data block in at least one historical cycle respectively.

[0145] The access popularity can be calculated by a preset algorithm.

[0146] The access popularity can be used to represent the access trend corresponding to the data block.

[0147] The higher the access popularity of the data block, the greater the probability that the data block is accessed.

[0148] The storage system can be monitored in real time through a system monitoring tool within a preset duration corresponding to the current cycle to obtain the current operation data of the storage system in the current cycle, as well as the historical access heat of multiple data blocks in the storage space.

[0149] S202: Determine the first weight of the current operation data and the second weight of the historical access heat according to the current operation data.

[0150] The first weight and the second weight can be used to calculate the current access heat.

[0151] The first weight can be used to represent the weight ratio of the current operation data in the current access heat.

[0152] The second weight can be used to represent the weight ratio of the historical access heat in the current access heat.

[0153] The first weight and the second weight can be dynamically determined according to the load condition of the storage system.

[0154] When the load of the storage system is high, the first weight is small and the second weight is large. Through the dynamic adjustment of the first weight and the second weight, the response ability of the preset algorithm to sudden data access situations can be improved.

[0155] When the load of the storage system is low, the first weight is large and the second weight is small. Through the dynamic adjustment of the first weight and the second weight, the stability and prediction accuracy of the preset algorithm can be improved.

[0156] Optionally, the first weight of the current operation data and the second weight of the historical access heat can be determined in the following manner: Determine the first weight of the current operation data according to the current operation data; Determine the second weight of the historical access heat according to the first weight and a preset value.

[0157] Among them, the first weight of the current operation data can be determined in the following manner: The current operation data can be parsed to obtain a data read-write record, and the data read-write record is input into a weight prediction model to determine the first weight of the current operation data; Or, according to the current operation data, determine the load value corresponding to the storage system, and determine the first weight of the current operation data according to the load value and a preset mapping relationship.

[0158] The weight prediction model can be used to predict the first weight of the current operation data.

[0159] The load value can be used to represent the load condition corresponding to the storage system.

[0160] The preset mapping relationship can include multiple load ranges and the weight values corresponding to each load range.

[0161] Optionally, the first weight of the current running data and the second weight of the historical access popularity can be determined in the following manner: The current running data can be input into a preset model to obtain the first weight of the current running data and the second weight of the historical access popularity.

[0162] It should be noted that the first weight of the current running data and the second weight of the historical access popularity can be determined according to any feasible implementation manner, and the embodiments of this application do not make any limitations in this regard.

[0163] S203: For any data block, determine the current access popularity of the data block in the current period according to the current running data, the historical access popularity, the first weight, and the second weight.

[0164] The current access popularity can be used to represent the access trend corresponding to the data block in the current period.

[0165] Optionally, the current running data includes the read-write frequency. The current access popularity of the data block in the current period can be determined in the following manner: Determine the first product between the read-write frequency and the first weight; Determine the second product between the historical access popularity and the second weight; Determine the sum of the first product and the second product as the current access popularity.

[0166] Optionally, the current access popularity of the data block in the current period can be determined in the following manner: Input the current running data, the historical access popularity, the first weight, and the second weight into a heat prediction model to obtain the current access popularity of the data block in the current period.

[0167] Among them, the heat prediction model can be a pre-trained learning model stored in advance in the storage system, and the form of the learning model is not limited here.

[0168] It should be noted that the current access popularity of the data block in the current period can be determined according to any feasible implementation manner, and the embodiments of this application do not make any limitations in this regard.

[0169] S204: Update the data blocks in the target cache according to the current access popularity and the historical access popularity of each data block.

[0170] The target cache is used to store hot data.

[0171] Optionally, the heat value of each data block can be determined according to the current access popularity and the historical access popularity of each data block, and the data blocks in the target cache can be updated according to the heat values of each data block.

[0172] Among them, the heat value can be determined according to the current access popularity and the historical access popularity.

[0173] Optionally, determine a plurality of first data blocks among a plurality of data blocks according to the current access popularity of each data block; determine a plurality of second data blocks among the plurality of data blocks according to the current access popularity and historical access popularity of each data block; determine a plurality of updated data blocks of the target cache according to the plurality of first data blocks, the plurality of second data blocks, and the plurality of current data blocks in the target cache; update the data blocks in the target cache according to the plurality of updated data blocks.

[0174] It should be noted that the data blocks in the target cache can be updated according to any feasible implementation manner, and the embodiments of the present application do not limit this.

[0175] The cache management method provided in this embodiment obtains the current running data of the storage system in the current period and the historical access popularity of a plurality of data blocks, where the plurality of data blocks are stored in the storage system; determines a first weight of the current running data and a second weight of the historical access popularity according to the current running data; for any one data block, determines the current access popularity of the data block in the current period according to the current running data, the historical access popularity, the first weight, and the second weight; updates the data blocks in the target cache according to the current access popularity and historical access popularity of each data block, where the target cache is used to store hot data. In this way, by calculating the current access popularity of each data block and dynamically adjusting the resource allocation of the target cache according to the current access popularity, it better adapts to the dynamic changes of data access, improves the cache hit rate, thereby enhancing the data read / write speed, reducing the data access latency, and improving the data access efficiency of the storage system.

[0176] Next, in combination with Figure 3 , the process (S204) of updating the data blocks in the target cache according to the current access popularity and historical access popularity of each data block will be explained.

[0177] Figure 3 It is a schematic flowchart of another cache management method provided by an embodiment of the present application. On the basis of the above embodiment, refer to Figure 3 , and this method will be described in detail. This method includes:

[0178] S301: Determine a plurality of first data blocks among a plurality of data blocks according to the current access popularity of each data block.

[0179] The first data blocks can be used to represent data blocks with a greater possibility of being frequently accessed.

[0180] The first data blocks can include data blocks with a current access popularity greater than a third threshold, or can include data blocks with a current access popularity value higher than the current access popularity values of some data blocks.

[0181] Optionally, multiple first data blocks can be determined from multiple data blocks according to the current access popularity of each data block in the following manner: sort the multiple data blocks in descending order of the current access popularity to obtain a fourth sequence; determine the first a data blocks in the fourth sequence as the multiple first data blocks.

[0182] Where a is a second preset quantity, which is not limited herein.

[0183] Optionally, multiple first data blocks can be determined from multiple data blocks according to the current access popularity of each data block in the following manner: in the multiple data blocks, determine the data blocks with a current access popularity greater than a third threshold as the multiple first data blocks.

[0184] Where the third threshold is an integer greater than 1.

[0185] It should be noted that multiple first data blocks can be determined according to any feasible implementation manner, and the embodiments of the present application do not limit this.

[0186] S302: Determine multiple second data blocks from multiple data blocks according to the current access popularity and historical access popularity of each data block.

[0187] The second data blocks can be used to represent the data blocks for which prefetch operations are to be performed.

[0188] Optionally, to determine multiple second data blocks from multiple data blocks according to the current access popularity and historical access popularity of each data block: the second threshold can be predicted according to the historical access popularity; in the multiple data blocks, determine the multiple data blocks with a current access popularity greater than the second threshold as the multiple second data blocks.

[0189] Where the second threshold can be obtained by inputting the historical access popularity into a predicted threshold model.

[0190] Optionally, to determine multiple second data blocks from multiple data blocks according to the current access popularity and historical access popularity of each data block: the second threshold can be predicted according to the current access popularity and historical access popularity; in the multiple data blocks, determine the multiple data blocks with a current access popularity greater than the second threshold as the multiple second data blocks.

[0191] Where the second threshold can be obtained by inputting the historical access popularity and current access popularity into a predicted threshold model.

[0192] It should be noted that multiple second data blocks can be determined according to any feasible implementation manner, and the embodiments of the present application do not limit this.

[0193] S303: Determine multiple updated data blocks of the target cache according to multiple first data blocks, multiple second data blocks, and multiple current data blocks in the target cache.

[0194] The updated data blocks can be data blocks to be stored in the target cache.

[0195] Optionally, the multiple updated data blocks can be determined in the following manner: Determine a first set; in the first set, determine at least one fourth data block; delete at least one fourth data block from the first set to obtain a target set; determine multiple updated data blocks according to the target set.

[0196] Among them, the first set includes multiple first data blocks and multiple second data blocks, and the fourth data block is the same as any one of the current data blocks.

[0197] Optionally, the multiple updated data blocks can be determined in the following manner: Determine at least one fifth data block different from any one of the current data blocks among the multiple first data blocks, determine at least one sixth data block different from any one of the current data blocks among the multiple second data blocks, and determine multiple updated data blocks according to at least one fifth data block and at least one sixth data block.

[0198] It should be noted that the multiple updated data blocks of the target cache can be determined according to any feasible implementation manner, and the embodiments of the present application do not limit this.

[0199] S304: Determine the data capacity corresponding to the multiple updated data blocks.

[0200] The data capacity can be used to represent the size of the multiple updated data blocks.

[0201] The first quantity of the multiple updated data blocks can be determined, and the data capacity can be determined according to the first quantity.

[0202] S305: Determine whether the remaining cache capacity corresponding to the target cache is greater than the data capacity.

[0203] If so, execute S306;

[0204] If not, execute S307.

[0205] The remaining cache capacity corresponding to the target cache can be obtained to determine whether the remaining cache capacity corresponding to the target cache is greater than the data capacity.

[0206] S306: Store the multiple updated data blocks into the cache space corresponding to the target cache.

[0207] S307: Obtain the historical access data corresponding to each current data block. Based on the historical access data corresponding to each current data block and the current access popularity of each current data block, determine at least one data block to be deleted among the multiple current data blocks, delete the at least one data block to be deleted, and store the multiple updated data blocks into the cache space corresponding to the target cache.

[0208] The historical access data may include the access data corresponding to at least one historical period respectively.

[0209] The historical access data may include at least one historical access moment and the number of accesses, etc.

[0210] The data block to be deleted may be used to represent a data block in the target cache that is not frequently accessed and has not been accessed for a long period of time.

[0211] Optionally, the following method may be used to determine at least one data block to be deleted among the multiple current data blocks based on the historical access data corresponding to each current data block and the current access popularity of each current data block: Obtain the remaining cache capacity corresponding to the target cache; Determine the capacity difference between the remaining cache capacity and the data capacity; Based on the historical access data corresponding to each current data block and the current access popularity of each current data block, determine at least one data block to be deleted among the multiple current data blocks, and the capacity corresponding to the at least one data block to be deleted is greater than or equal to the capacity difference.

[0212] Optionally, the following method may be used to determine at least one data block to be deleted among the multiple current data blocks based on the historical access data corresponding to each current data block and the current access popularity of each current data block: Obtain the remaining cache capacity corresponding to the target cache; Determine the capacity difference between the remaining cache capacity and the data capacity; Based on the capacity difference, determine the number of data blocks to be deleted; Based on the historical access data corresponding to each current data block and the current access popularity of each current data block, determine the data blocks to be deleted corresponding to the number of data blocks among the multiple current data blocks.

[0213] It should be noted that at least one data block to be deleted may be determined according to any feasible implementation manner, and the embodiments of the present application do not limit this.

[0214] Optionally, the data blocks to be deleted corresponding to the number of data blocks can be determined from multiple current data blocks according to the historical access data corresponding to each current data block and the current access popularity of each current data block in the following manner: among the multiple current data blocks, determine multiple candidate data blocks whose current access popularity is lower than a first threshold; according to the historical access data corresponding to each candidate data block, determine the last access time of each candidate data block; sort the multiple candidate data blocks in the order from the farthest to the nearest according to the last access time to obtain a first sequence; determine the first n candidate data blocks in the first sequence as the data blocks to be deleted, where n is the number of data blocks.

[0215] Among them, the last access time can be the time closest to the current time among the historical access times.

[0216] Optionally, the data blocks to be deleted corresponding to the number of data blocks can be determined from multiple current data blocks according to the historical access data corresponding to each current data block and the current access popularity of each current data block in the following manner: according to the historical access data corresponding to each current data block, determine the last access time corresponding to each current data block; sort the multiple current data blocks in the order from the farthest to the nearest according to the last access time of each current data block to obtain a second sequence; determine the first m current data blocks in the second sequence as the third data blocks, where m is the sum of the number of data blocks and a first preset number; sort the multiple third data blocks in the order from the smallest to the largest according to the current access popularity of each third data block to obtain a third sequence; determine the first n third data blocks in the third sequence as the data blocks to be deleted, where n is the number of data blocks and n is less than m.

[0217] Among them, the first preset number can be determined according to the number of current data blocks and a first mapping relationship, and the first mapping relationship can include multiple quantity ranges and the preset number corresponding to each quantity range.

[0218] The cache management method provided in this embodiment determines multiple first data blocks among multiple data blocks according to the current access popularity of each data block; determines multiple second data blocks among multiple data blocks according to the current access popularity and historical access popularity of each data block; determines multiple updated data blocks of the target cache according to the multiple first data blocks, the multiple second data blocks, and the multiple current data blocks in the target cache; determines the data capacity corresponding to the multiple updated data blocks; determines whether the remaining cache capacity corresponding to the target cache is greater than the data capacity; if so, stores the multiple updated data blocks in the cache space corresponding to the target cache; if not, obtains the historical access data corresponding to each current data block, determines at least one data block to be deleted among the multiple current data blocks according to the historical access data corresponding to each current data block and the current access popularity of each current data block, deletes the at least one data block to be deleted, and stores the multiple updated data blocks in the cache space corresponding to the target cache. In this way, by calculating the current access popularity of each data block and dynamically adjusting the resource allocation of the target cache according to the current access popularity, it better adapts to the dynamic changes of data access, improves the cache hit rate, thereby enhancing the data read and write speed, reducing the data access latency, and improving the data access efficiency of the storage system.

[0219] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases, the former is a better implementation method.

[0220] Figure 4 It is a schematic structural diagram of a cache management device provided in an embodiment of the present application. Please refer to Figure 4 , the cache management device 400 includes an acquisition module 401, a first determination module 402, a second determination module 403, and an update module 404, where,

[0221] The acquisition module 401 is configured to acquire the current running data of the storage system in the current period and the historical access popularity of multiple data blocks, and the multiple data blocks are stored in the storage system;

[0222] The first determination module 402 is configured to determine a first weight of the current running data and a second weight of the historical access popularity according to the current running data;

[0223] The second determination module 403 is configured to determine the current access popularity of any data block in the current period according to the current running data, the historical access popularity, the first weight, and the second weight;

[0224] The update module 404 is configured to update the data blocks in the target cache according to the current access popularity and historical access popularity of each data block, and the target cache is used to store hot data.

[0225] In a possible implementation, the update module 404 is specifically configured to:

[0226] Determine a plurality of first data blocks among a plurality of data blocks according to the current access popularity of each data block;

[0227] Determine a plurality of second data blocks among a plurality of data blocks according to the current access popularity and historical access popularity of each data block;

[0228] Determine a plurality of updated data blocks of the target cache according to the plurality of first data blocks, the plurality of second data blocks, and the plurality of current data blocks in the target cache;

[0229] Update the data blocks in the target cache according to the plurality of updated data blocks.

[0230] In a possible implementation, the update module 404 is specifically configured to:

[0231] Determine the data capacity corresponding to the plurality of updated data blocks;

[0232] Determine whether the remaining cache capacity corresponding to the target cache is greater than the data capacity;

[0233] If so, store the plurality of updated data blocks in the cache space corresponding to the target cache;

[0234] If not, obtain the historical access data corresponding to each current data block, determine at least one data block to be deleted among the plurality of current data blocks according to the historical access data corresponding to each current data block and the current access popularity of each current data block, delete the at least one data block to be deleted, and store the plurality of updated data blocks in the cache space corresponding to the target cache.

[0235] In a possible implementation, the update module 404 is specifically configured to:

[0236] Obtain the remaining cache capacity corresponding to the target cache;

[0237] Determine the capacity difference between the remaining cache capacity and the data capacity;

[0238] Determine the number of data blocks to be deleted according to the capacity difference;

[0239] Determine the data blocks to be deleted corresponding to the number of data blocks among the plurality of current data blocks according to the historical access data corresponding to each current data block and the current access popularity of each current data block.

[0240] In a possible implementation, the update module 404 is specifically configured to:

[0241] Among multiple current data blocks, determine multiple candidate data blocks whose current access heat is lower than a first threshold;

[0242] According to the historical access data corresponding to each candidate data block, determine the last access time of each candidate data block;

[0243] Sort the multiple candidate data blocks in the order from the farthest to the nearest last access time to obtain a first sequence;

[0244] Determine the first n candidate data blocks in the first sequence as the data blocks to be deleted, where n is the number of data blocks.

[0245] In a possible implementation manner, the update module 404 is specifically configured to:

[0246] According to the historical access data corresponding to each current data block, determine the last access time corresponding to each current data block;

[0247] Sort the multiple current data blocks in the order from the farthest to the nearest last access time of each current data block to obtain a second sequence;

[0248] Determine the first m current data blocks in the second sequence as third data blocks, where m is the sum of the number of data blocks and a first preset number;

[0249] Sort the multiple third data blocks in the order from the smallest to the largest current access heat of each third data block to obtain a third sequence;

[0250] Determine the first n third data blocks in the third sequence as the data blocks to be deleted, where n is the number of data blocks and n is less than m.

[0251] In a possible implementation manner, the update module 404 is specifically configured to:

[0252] Sort the multiple data blocks in the order from the largest to the smallest current access heat of each data block to obtain a fourth sequence;

[0253] Determine the first a data blocks in the fourth sequence as multiple first data blocks, where a is a second preset number.

[0254] In a possible implementation manner, the update module 404 is specifically configured to:

[0255] Predict a second threshold according to the historical access heat;

[0256] Among the multiple data blocks, determine multiple data blocks whose current access heat is greater than the second threshold as multiple second data blocks.

[0257] In a possible implementation manner, the update module 404 is specifically configured to:

[0258] Determine a first set, which includes a plurality of first data blocks and a plurality of second data blocks;

[0259] In the first set, determine at least one fourth data block, where the fourth data block is the same as any current data block;

[0260] Delete at least one fourth data block in the first set to obtain a target set;

[0261] Determine a plurality of updated data blocks according to the target set.

[0262] In a possible implementation manner, the first determination module 402 is specifically configured to:

[0263] Determine a first weight of the current running data according to the current running data;

[0264] Determine a second weight of the historical access heat according to the first weight and a preset value.

[0265] In a possible implementation manner, the first determination module 402 is specifically configured to:

[0266] Perform parsing processing on the current running data to obtain a data read-write record, input the data read-write record into a weight prediction model to determine the first weight of the current running data; or,

[0267] Determine a load value corresponding to the storage system according to the current running data, and determine the first weight of the current running data according to the load value and a preset mapping relationship.

[0268] In a possible implementation manner, the current running data includes a read-write frequency, and the second determination module 403 is specifically configured to:

[0269] Determine a first product between the read-write frequency and the first weight;

[0270] Determine a second product between the historical access heat and the second weight;

[0271] Determine the sum of the first product and the second product as the current access heat.

[0272] For the description of the features in the embodiments corresponding to the cache management device, reference may be made to the relevant descriptions in the embodiments corresponding to the cache management method, which will not be elaborated here one by one.

[0273] Figure 5 This is a schematic structural diagram of the electronic device provided by this application. As Figure 5 shown, the electronic device 500 provided in this embodiment includes: at least one processor 501 and a memory 502. Optionally, the electronic device 500 further includes a communication component 503. Among them, the processor 501, the memory 502, and the communication component 503 are connected through a bus 504.

[0274] In a specific implementation process, at least one processor 501 executes computer-executable instructions stored in a memory 502, so that at least one processor 501 executes the cache management method embodiments described above.

[0275] For the specific implementation process of the processor 501, reference may be made to the above method embodiments, and their implementation principles and technical effects are similar, so they will not be elaborated here in this embodiment.

[0276] In the above embodiments, it should be understood that the processor may be a central processing unit (Central Processing Unit, abbreviated as: CPU), or other general-purpose processors, digital signal processors (Digital Signal Processor, abbreviated as: DSP), application specific integrated circuits (Application Specific Integrated Circuit, abbreviated as: ASIC), etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the application can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor.

[0277] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.

[0278] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.

[0279] An embodiment of the present application also provides a computer-readable storage medium, in which a computer program is stored, and the computer program is configured to execute the steps in any of the above cache management method embodiments when running.

[0280] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), external hard drives, magnetic disks, or optical discs.

[0281] An embodiment of the present application also provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the steps in any of the above-described embodiments of the cache management method are implemented.

[0282] Another embodiment of the present application also provides a computer program product, including a non-volatile computer-readable storage medium. The non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above-described embodiments of the cache management method are implemented.

[0283] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Skilled professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0284] The above provides a detailed introduction to a cache management method provided by the present application. Specific examples are used herein to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application. It should be noted that for those of ordinary skill in the art in the technical field, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.

Claims

1. A cache management method, characterized in that: include: Acquire current operation data of the storage system in a current cycle and historical access heats of a plurality of data blocks, wherein the plurality of data blocks are stored in the storage system; The current operation data includes resource usage data and performance indicator data; Determine, according to the current running data, a first weight of the current running data and a second weight of the historical access popularity; For any data block, determine the current access heat of the data block in the current cycle according to the current running data, the historical access heat, the first weight and the second weight; According to the current access heat and the historical access heat of each data block, the data blocks in the target cache are updated, and the target cache is used to store hot data.

2. The cache management method according to claim 1, characterized in that: According to the current access popularity and historical access popularity of each data block, the data blocks in the target cache are updated, including: Determining a plurality of first data blocks from the plurality of data blocks according to the current access popularity of each data block; Determining a plurality of second data blocks from the plurality of data blocks according to the current access popularity and the historical access popularity of each data block; Determine a plurality of update data blocks of the target cache according to the plurality of first data blocks, the plurality of second data blocks, and a plurality of current data blocks in the target cache; The data blocks in the target cache are updated according to the multiple updated data blocks.

3. The cache management method according to claim 2, characterized in that: Updating the data blocks in the target cache according to the multiple updated data blocks includes: Determining data capacity corresponding to the plurality of update data blocks; Determine whether the remaining capacity of the cache corresponding to the target cache is greater than the data capacity; If so, storing the multiple updated data blocks into the cache space corresponding to the target cache; If not, obtain the historical access data corresponding to each current data block, determine at least one data block to be deleted from the multiple current data blocks based on the historical access data corresponding to each current data block and the current access popularity of each current data block, delete the at least one data block to be deleted, and store the multiple updated data blocks in the cache space corresponding to the target cache.

4. The cache management method according to claim 3, characterized in that: Determining at least one data block to be deleted from the multiple current data blocks according to the historical access data corresponding to each current data block and the current access popularity of each current data block, including: Obtaining the remaining capacity of the cache corresponding to the target cache; Determining a capacity difference between the cache remaining capacity and the data capacity; Determining the number of data blocks to be deleted according to the capacity difference; According to the historical access data corresponding to each current data block and the current access popularity of each current data block, the to-be-deleted data blocks corresponding to the number of data blocks are determined from the multiple current data blocks.

5. The cache management method according to claim 4, characterized in that: Determining the to-be-deleted data blocks corresponding to the number of data blocks from the multiple current data blocks according to the historical access data corresponding to each current data block and the current access popularity of each current data block includes: Determine, among the multiple current data blocks, multiple candidate data blocks whose current access heat is lower than a first threshold; Determine the last access time of each candidate data block according to the historical access data corresponding to each candidate data block; Sort multiple candidate data blocks according to the order of the last access time from far to near to obtain a first sequence; The first n to-be-selected data blocks in the first sequence are determined as the to-be-deleted data blocks, where n is the number of the data blocks.

6. The cache management method according to claim 4, characterized in that: Determining the to-be-deleted data blocks corresponding to the number of data blocks from the multiple current data blocks according to the historical access data corresponding to each current data block and the current access popularity of each current data block includes: Determine the last access time corresponding to each current data block according to the historical access data corresponding to each current data block; Sorting the multiple current data blocks according to the order of the last access time of each current data block from far to near to obtain a second sequence; Determine the first m current data blocks in the second sequence as third data blocks, where m is the sum of the number of the data blocks and the first preset number; Sorting the plurality of third data blocks in ascending order of the current access popularity of each third data block to obtain a third sequence; The first n third data blocks in the third sequence are determined as data blocks to be deleted, where n is the number of data blocks and n is less than m.

7. The cache management method according to any one of claims 2 to 6, characterized in that: Determining a plurality of first data blocks from the plurality of data blocks according to the current access heat of each data block includes: Sorting the plurality of data blocks in descending order of the current access popularity of each data block to obtain a fourth sequence; The first a data blocks in the fourth sequence are determined as a plurality of first data blocks, where a is a second preset number.

8. The cache management method according to any one of claims 2 to 6, characterized in that: Determining a plurality of second data blocks from the plurality of data blocks according to the current access heat and the historical access heat of each data block includes: Predicting a second threshold value according to the historical access popularity; Among the multiple data blocks, multiple data blocks whose current access heat is greater than the second threshold are determined as multiple second data blocks.

9. The cache management method according to any one of claims 2 to 6, characterized in that: Determining a plurality of update data blocks of the target cache according to the plurality of first data blocks, the plurality of second data blocks, and a plurality of current data blocks in the target cache comprises: Determine a first set, wherein the first set includes the plurality of first data blocks and the plurality of second data blocks; In the first set, determining at least one fourth data block, the fourth data block being the same as any current data block; Deleting the at least one fourth data block from the first set to obtain a target set; The multiple update data blocks are determined according to the target set.

10. The cache management method according to any one of claims 1 to 6, characterized in that: Determining, according to the current running data, a first weight of the current running data and a second weight of the historical access heat, includes: Determining a first weight of the current running data according to the current running data; A second weight of the historical access popularity is determined according to the first weight and a preset value.

11. The cache management method according to claim 10, characterized in that: Determining a first weight of the current running data according to the current running data includes: Analyze the current running data to obtain data read and write records, input the data read and write records into a weight prediction model, and determine a first weight of the current running data; or, A load value corresponding to the storage system is determined according to the current operation data, and a first weight of the current operation data is determined according to the load value and a preset mapping relationship.

12. The cache management method according to any one of claims 1 to 6, characterized in that: The current operation data includes a read and write frequency, and determining the current access heat of the data block in the current cycle according to the current operation data, the historical access heat, the first weight, and the second weight includes: Determine a first product between the read / write frequency and the first weight; Determine a second product between the historical access popularity and the second weight; The sum of the first product and the second product is determined as the current access heat.

13. An electronic device, characterized in that: include: Memory and processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the cache management method according to any one of claims 1 to 12.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the cache management method according to any one of claims 1 to 12.

15. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the cache management method according to any one of claims 1 to 12 is implemented.

Citation Information

Patent Citations

  • Method for replacing cache files, device and system thereof

    CN102511043A

  • Cache updating method, device and equipment of storage system, medium and platform

    CN117235088A