A data storage system with multi-segment cache function
Through the data acquisition, analysis and priority correction modules, the data storage strategy of the multi-segment cache system is optimized, which solves the problem of inaccurate cache priority judgment in the existing technology, and improves system performance and efficiency.
Patent Information
- Application Number
- CN202410723078.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2044-06-05
AI Technical Summary
The existing multi-stage cache system is incorrectly calculated when setting cache priority, resulting in inaccurate priority judgment of cache level and affecting system performance.
Data blocks are acquired through the data acquisition and processing module, the data analysis module calculates the initial priority of each data block at each cache level, the priority judgment module corrects the priority, and the data cache module stores data according to the clearance probability and final priority. Ensure the rational use of cache resources.
Improve the performance and efficiency of the cache system, enhance the accuracy of cache priority judgment, and ensure that the latest and most important data is stored at the appropriate cache level.
Smart Images

Figure CN118733490B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a data storage system with a multi-segment cache function. Background Art
[0002] Cache is a technology for temporarily storing data to speed up data access and improve system performance. It is usually used to store some data in servers, computers, or some mobile electronic devices. A data storage system with multi-segment cache function refers to storing data in caches at different levels to improve system performance and efficiency. Multi-segment cache usually includes level 1 cache, level 2 cache, and level 3 cache. These different levels of cache have different storage speeds and storage spaces, and are used to store different data. Different data chooses different storage levels, which has a certain impact on the overall response speed of the cache system.
[0003] In the prior art, cache priority levels are manually set through different strategies. Therefore, if the set strategy is calculated improperly, the priority of different cache levels will be inaccurate, resulting in a decrease in the performance of the entire cache system when reading and writing cache data. Summary of the invention
[0004] The invention provides a data storage system with a multi-segment cache function to solve the existing problems.
[0005] A data storage system with a multi-segment cache function of the present invention adopts the following technical solution:
[0006] An embodiment of the present invention provides a data storage system with a multi-segment cache function, the system comprising the following modules:
[0007] A data acquisition and processing module, used for acquiring a number of data blocks in the data to be cached;
[0008] The data analysis module is used to record a preset time period before the current time as a target time period, and obtain the initial priority of each data block in each cache level according to the number of times each data block is read and modified in the target time period of each cache level and the time interval between each data block and the most recent reading time in each cache level; mark all cache blocks in each cache level with serial numbers, and obtain the probability of clearing each cache block in each cache level according to the storage size and the marking serial number of each cache block in each cache level;
[0009] A priority determination module is used to modify the initial priority of each data block in each cache level according to the space occupied by each data block in the data to be cached and the storage capacity of the remaining space in each cache level, so as to obtain the final priority of each data block in each cache level;
[0010] The data cache module is used to store the data to be cached according to the clearing probability of each cache block in each cache level and the final priority of each data block stored in different caches.
[0011] Further, obtaining the initial priority of each data block in each cache level according to the number of times each data block is read and modified within the target time period of each cache level and the time interval between each data block and the most recent read time in each cache level includes:
[0012] The ratio between the number of times each data block is read and the number of times it is modified during the target time period of each cache level is recorded as the read-write ratio of each data block in each cache level;
[0013] The initial priority of each data block in each cache level is obtained according to the number of times each data block is read within the target time period of each cache level, the read-write ratio of each data block in each cache level, and the time interval between each data block and the most recent read time in each cache level.
[0014] Further, obtaining the initial priority of each data block in each cache level according to the number of times each data block is read in the target time period of each cache level, the read-write ratio of each data block in each cache level, and the time interval between each data block in each cache level and the most recent read time includes:
[0015] The product of the number of times each data block is read within the target time period of each cache level, the read-write ratio of each data block in each cache level, and the time interval between each data block and the most recent read time in each cache level is recorded as the first product value of each data block in each cache level. The first product values of all data blocks in each cache level are linearly normalized, and the normalized first product value of each data block in each cache level is recorded as the initial priority of each data block in each cache level.
[0016] Furthermore, the step of marking all cache blocks in each cache level with serial numbers includes:
[0017] All cache blocks in each cache level are sorted according to the time sequence of storage in the cache level, and the sorted cache blocks are marked with serial numbers 1, 2, 3, etc. in sequence to obtain the marked serial number of each cache block in each cache level.
[0018] Further, obtaining the probability of clearing each cache block in each cache level according to the storage size and the tag sequence number of each cache block in each cache level includes:
[0019] The proportion of the storage size of each cache block in each cache level to the storage size of all cache blocks is recorded as the storage proportion of each cache block in each cache level;
[0020] Obtaining the probability of clearing each cache block in each cache level according to the storage ratio of each cache block in each cache level and the front position of the mark number of each cache block in each cache level among the mark numbers of all cache blocks;
[0021] Among them, the storage ratio of each cache block in each cache level is positively correlated with the clearing probability of each cache block in each cache level, and the front position of the mark number of each cache block in each cache level in the mark numbers of all cache blocks is positively correlated with the clearing probability of each cache block in each cache level.
[0022] Furthermore, the degree to which the mark serial number of each cache block in each cache level is positioned in front of the mark serial numbers of all cache blocks includes:
[0023] The ratio of the tag number of each cache block in each cache level to the number of all cache blocks in each cache level is recorded as the first ratio of each cache block in each cache level, and the difference between 1 and the first ratio of each cache block in each cache level is recorded as the forward position of the tag number of each cache block in each cache level in the tag numbers of all cache blocks.
[0024] Further, the initial priority of each data block in each cache level is modified according to the space occupied by each data block in the data to be cached and the storage capacity of the remaining space in each cache level to obtain the final priority of each data block in each cache level, including:
[0025] The space ratio of each data block is calculated based on the ratio of the space occupied by each data block to the space occupied by all data blocks.
[0026] According to the space proportion of each data block, the storage efficiency of each data block in each cache level, and the initial priority of each data block in each cache level, the final priority of each data block in each cache level is obtained;
[0027] The space proportion of each data block is negatively correlated with the final priority of each data block in each cache level, and the storage efficiency of each data block in each cache level is negatively correlated with the final priority of each data block in each cache level.
[0028] Furthermore, the storage efficiency of each data block in each cache level includes:
[0029] The ratio of the space occupied by each data block to the storage capacity of the remaining space in each cache level is recorded as the storage efficiency of each data block in each cache level.
[0030] Furthermore, storing the data to be cached according to the probability of clearing each cache block in each cache level and the final priority of each data block stored in different caches includes:
[0031] Obtain all data blocks with the highest final priority corresponding to each cache level, count the storage space required by all the data blocks, and when the storage capacity of the remaining space in the corresponding storage level is greater than or equal to the storage space required by all the data blocks, store all the data blocks in the corresponding cache level; when the storage capacity of the remaining space in the corresponding storage level is less than the storage space required by all the data blocks, clear each cache level one by one in order from the largest probability to the smallest probability according to the clearing probability of each cache block in each cache level, until the storage capacity of the remaining space in each cache level is greater than or equal to the storage space required by all the data blocks, then stop clearing, and then store all the data blocks in the corresponding cache level.
[0032] Furthermore, the step of recording a preset time period before the current time as the target time period includes the following specific steps:
[0033] Record the A1-minute time period before the current time as the target time period;
[0034] Among them, A1 is 10.
[0035] The technical solution of the present invention has the following beneficial effects: the present invention obtains the initial priority of each data block in each cache level according to the number of times each data block is read and modified within the target time period of each cache level and the time interval between each data block and the most recent reading time in each cache level; obtains the removal probability of each cache block in each cache level according to the storage size and tag sequence number of each cache block in each cache level, removes some unimportant data in the cache by the removal probability of each cache block in each cache level, so as to store some latest and most important data, which can effectively utilize cache resources and improve the performance and efficiency of the system; according to the space size occupied by each data block in the data to be cached and the storage capacity of the remaining space in each cache level, corrects the initial priority of each data block in each cache level, obtains the final priority of each data block in each cache level, and improves the accuracy of cache priority judgment by the final priority of each data block in each cache level; stores the data to be cached according to the removal probability of each cache block in each cache level and the final priority of each data block stored in different caches, thereby improving the performance of the entire cache system. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1 A module flow chart of a data storage system with a multi-segment cache function according to the present invention;
[0038] Figure 2 The data storage flow chart for the multi-segment cache function. DETAILED DESCRIPTION
[0039] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the specific implementation, structure, features and effects of a data storage system with a multi-segment cache function proposed by the present invention in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0040] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0041] The following describes in detail a specific scheme of a data storage system with a multi-segment cache function provided by the present invention in conjunction with the accompanying drawings.
[0042] See also Figure 1 , which shows a module flow chart of a data storage system with a multi-segment cache function provided by an embodiment of the present invention, the system includes the following modules:
[0043] Module 101: a data acquisition and processing module, used to obtain a number of data blocks in the data to be cached.
[0044] It should be noted that when placing data into different caches, the cache level is usually selected based on factors such as the frequency of data access, the importance of the data, and the usage pattern of the data; select the cache level that best suits application requirements and performance optimization to improve system performance, scalability, and user experience.
[0045] Specifically, the data that needs to be put into the cache is recorded as data to be cached; the data to be cached is split into several different data blocks, for example, a PDF document is split into different data blocks such as headers, footers, text contents, images, etc.; wherein, splitting the data to be cached into different data blocks is a well-known technology in computers and will not be described in detail here.
[0046] At this point, several data blocks in the data to be cached are obtained.
[0047] Module 102: A data analysis module, used to record a preset time period before the current time as a target time period, and obtain the initial priority of each data block in each cache level according to the number of times each data block is read and modified within the target time period of each cache level and the time interval between each data block and the most recent reading time in each cache level; mark all cache blocks in each cache level with serial numbers, and obtain the clearing probability of each cache block in each cache level according to the storage size and marking serial number of each cache block in each cache level.
[0048] It should be noted that the first-level cache is a small, high-speed cache located inside the processor core, which is used to store instructions and data frequently accessed by the processor core. Among the three levels of cache, the first-level cache has the smallest capacity but is very fast; the second-level cache is located between the processor core and the main memory, and is used to store data and instructions that are frequently accessed by the processor but are not in the first-level cache. The capacity of the second-level cache is larger than that of the first-level cache, but the speed is slower than the first-level cache; the third-level cache is usually located on the processor chip or on the package connected to the processor, and is used to store data and instructions shared by multiple processor cores. The capacity of the third-level cache is usually larger than that of the second-level cache, but the speed is slower, slower than the second-level cache.
[0049] It should be further explained that when caching different data, a suitable cache level is selected according to the specific data to be cached, thereby improving the overall performance of the cached data. The more times a piece of data is read within a period of time, the easier it is to read the data, and the corresponding cache levels of the data are level 1, level 2, and level 3 cache from high to low; the easier it is to modify a piece of data, the closer the data should be to the main memory, and the corresponding cache levels of the data are level 3, level 2, and level 1 cache from high to low; the shorter the time interval between a piece of data and the last time it was read, the easier it is to read the data, and the corresponding cache levels of the data are level 1, level 2, and level 3 cache from high to low.
[0050] Specifically, a parameter A1 is preset, wherein this embodiment is described by taking A1=10 as an example, and this embodiment is not specifically limited, wherein A1 can be determined according to specific implementation conditions.
[0051] The A1 minute time period before the current time is recorded as the target time period; the number of times each data block is read and modified during the target time period of each cache level is counted through performance analysis tools (IntelVTune Profiler, AMD CodeXL, etc.). Among them, obtaining the read and write times of data blocks through performance analysis tools is a well-known technology and will not be described in detail here.
[0052] The initial priority of each data block in each cache level is obtained according to the number of times each data block is read and modified within the target time period of each cache level and the time interval between each data block and the most recent read time in each cache level.
[0053] As an embodiment, the specific calculation method of the initial priority of each data block in each cache level is:
[0054] The ratio of the number of times each data block is read to the number of times it is modified within the target time period of each cache level is recorded as the read-write ratio of each data block in each cache level; based on the number of times each data block is read within the target time period of each cache level, the read-write ratio of each data block in each cache level, and the time interval between each data block in each cache level and the most recent read time, the initial priority of each data block in each cache level is obtained.
[0055] Among them, the product of the number of times each data block is read within the target time period of each cache level, the read-write ratio of each data block in each cache level, and the time interval between each data block and the most recent read time in each cache level is recorded as the first product value of each data block in each cache level, the first product values of all data blocks in each cache level are linearly normalized, and the normalized first product value of each data block in each cache level is recorded as the initial priority of each data block in each cache level.
[0056] In one embodiment of the present invention, it is specifically expressed by the formula:
[0057]
[0058] Where D i,r represents the number of times the i-th data block is read within the target time period of the r-th cache level, W i,r represents the number of times the i-th data block is modified within the target time period of the r-th cache level, T i,r represents the time interval between the i-th data block in the r-th cache level and the last read time, norm() represents the linear normalization function, and Y i,r represents the initial priority of the i-th data block in the r-th cache level. The purpose of adding 0.01 to the denominator of the formula is to prevent the denominator from being zero.
[0059] The more times each data block is read within the target time period of each cache level, the easier it is to read the data block, and the higher the cache priority of the corresponding level of the data block. It indicates the ratio of the number of reads and modifications of each data block in the target time period of each cache level. The larger the ratio, the more likely the data block should be stored in the cache level close to the processor core, that is, the higher the cache priority of the corresponding level of the data block. The shorter the time interval between the last read time of each data block in each cache level, the greater the probability of the data block being read, and the higher the cache priority of the corresponding level of the data block.
[0060] At this point, the initial priority of each data block stored in different caches is obtained.
[0061] It should be noted that when caching data, because the capacity of each cache level is limited, when the cache capacity is full, the selection of cache level will be affected when caching each data. In order to better place the data to be cached into a more appropriate cache level, the data in the cache needs to be cleared to a certain extent.
[0062] It should be further explained that in conventional cache clearing, first-in-first-out and other principles are often used to clear data. First-in-first-out is a clearing rule based on time sequence, but it does not take into account the storage size of the cleared data. In order to increase the cache hit rate of subsequent data in the caching process, the time sequence and the storage size of the data are considered to clear the data in the cache to a certain extent.
[0063] Specifically, all cache blocks in each cache level are sorted according to the time sequence of storage in the cache level, and the sorted cache blocks are marked with serial numbers 1, 2, 3, ... in sequence; that is, the earlier the cache block is stored with data, the smaller the corresponding marked serial number.
[0064] According to the storage size of each cache block in each cache level and the tag sequence number of the cache block, the clearing probability of each cache block in each cache level is obtained.
[0065] As an embodiment, the specific calculation method of the clearing probability of each cache block in each cache level is:
[0066] The proportion of the storage size of each cache block in each cache level to the storage size of all cache blocks is recorded as the storage proportion of each cache block in each cache level; according to the storage proportion of each cache block in each cache level and the front position of the mark number of each cache block in each cache level among the mark numbers of all cache blocks, the probability of clearing each cache block in each cache level is obtained;
[0067] Among them, the ratio of the mark serial number of each cache block in each cache level to the number of all cache blocks in each cache level is recorded as the first ratio of each cache block in each cache level, and the difference between 1 and the first ratio of each cache block in each cache level is recorded as the front position of the mark serial number of each cache block in each cache level in the mark serial numbers of all cache blocks.
[0068] Among them, the storage ratio of each cache block in each cache level is positively correlated with the clearing probability of each cache block in each cache level, and the front position of the mark number of each cache block in each cache level in the mark numbers of all cache blocks is positively correlated with the clearing probability of each cache block in each cache level.
[0069] In one embodiment of the present invention, it is specifically expressed by the formula:
[0070]
[0071] In the formula, Z c,v represents the storage size of the vth cache block in the cth cache level, Z c,krepresents the storage size of the kth cache block in the cth cache level, M c represents the number of all cache blocks in the cth cache level, X c,v represents the mark number of the vth cache block in the cth cache level, norm() represents the linear normalization function, Q c,v represents the probability of eviction of the vth cache block in the cth cache level.
[0072] in, The earlier a cache entry is made, the more likely it is to be cleared, i.e., it follows the first-in-first-out principle; It indicates the proportion of the storage size of each cache block in each cache level to the storage size of all cache blocks. The larger the proportion, the more likely it is to be cleared, so as to further expand the storage space. The greater the probability of clearing the cache block. On the contrary, the smaller the proportion, the smaller the probability of clearing the cache block.
[0073] At this point, the probability of clearing each cache block in each cache level is obtained.
[0074] Module 103: A priority determination module, used to modify the initial priority of each data block in each cache level according to the space occupied by each data block in the cached data and the storage capacity of the remaining space in each cache level, so as to obtain the final priority of each data block in each cache level.
[0075] It should be noted that when the data block in the data to be cached has a larger storage space, it is more appropriate to cache it in the third-level cache, followed by the second-level cache, and finally the first-level cache; when the data block in the data to be cached has a larger storage space, it is more appropriate to cache it in the first-level cache, followed by the second-level cache, and finally the third-level cache. In addition to considering the size of its own storage space, the storage of a piece of data also needs to consider the size of the remaining space in the cache, that is, the larger the remaining space in the cache, the greater the possibility of storage.
[0076] Specifically, the final priority of each data block stored in different caches is obtained according to the size of the space occupied by the data blocks in the data to be cached and the storage capacity of the remaining space in the cache level.
[0077] As an embodiment, the specific calculation method of the final priority of each data block in each cache level is:
[0078] The proportion of the space occupied by each data block in the space occupied by all data blocks is recorded as the space proportion of each data block, and the ratio of the space occupied by each data block to the storage capacity of the remaining space in each cache level is recorded as the storage efficiency of each data block in each cache level; based on the space proportion of each data block, the storage efficiency of each data block in each cache level, and the initial priority of each data block in each cache level, the final priority of each data block in each cache level is obtained.
[0079] The space proportion of each data block is negatively correlated with the final priority of each data block in each cache level, and the storage efficiency of each data block in each cache level is negatively correlated with the final priority of each data block in each cache level.
[0080] In one embodiment of the present invention, it is specifically expressed by the formula:
[0081]
[0082] In the formula, H j Indicates the size of the space occupied by the jth data block, H i represents the space occupied by the i-th data block, n represents the number of all data blocks in the cached data, S r represents the storage capacity of the remaining space in the rth cache level, exp() represents an exponential function with a natural constant as the base, and Y i,r represents the initial priority of the i-th data block in the r-th cache level, Y' i,r It represents the final priority of each data block in the rth cache level. The purpose of adding 0.01 to the denominator of the formula is to prevent the denominator from being zero.
[0083] in, It represents the ratio of the space occupied by each data block to the storage capacity of the remaining space in each cache level. The larger the ratio, the less likely it is that the data block is stored in the cache level; the smaller the ratio, the more likely it is that the data block is stored in the cache level. Indicates the proportion of the space occupied by each data block in the space occupied by all data blocks. middle As The larger the weight is, the smaller the possibility that each data block is stored in each cache level is.
[0084] At this point, the final priority of each data block in each cache level is obtained.
[0085] Module 104: a data cache module, used to store data to be cached according to the clearing probability of each cache block in each cache level and the final priority of each data block stored in different caches.
[0086] It should be noted that after knowing that each data block in the data to be cached is placed in the most appropriate cache level, when the storage space in each cache level is insufficient, the cache blocks can be cleared according to the clearing probability of each cache block in each cache level so that there is enough space to store the data to be cached.
[0087] Specifically, all data blocks with the highest final priority corresponding to each cache level are obtained, and the size of the storage space required by all the data blocks is counted; when the storage capacity of the remaining space in the corresponding storage level is greater than or equal to the size of the storage space required by all the data blocks, all the data blocks are stored in the corresponding cache level; when the storage capacity of the remaining space in the corresponding storage level is less than the size of the storage space required by all the data blocks, each cache level is cleared one by one in order from the largest probability to the smallest probability according to the clearing probability of each cache block in each cache level, and when the storage capacity of the remaining space in each cache level is greater than or equal to the size of the storage space required by all the data blocks, the clearing is stopped, and then all the data blocks are stored in the corresponding cache level.
[0088] At this point, the storage of the data to be cached is completed. The data storage flow chart of the multi-segment cache function is as follows: Figure 2 shown.
[0089] It should be noted that the exp(-x) model used in this embodiment is only used to indicate that the negative correlation and the result of the constraint model output are in the interval (0,1). In specific implementation, it can be replaced with other models with the same purpose. This embodiment only uses the exp(-x) model as an example for description without making specific limitations on it, where x refers to the input of the model.
[0090] At this point, this embodiment is completed.
[0091] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A data storage system with multi-segment cache function, characterized in that: The system includes the following modules: A data acquisition and processing module, used for acquiring a number of data blocks in the data to be cached; A data analysis module is used to record a preset time period before the current time as a target time period, and obtain the initial priority of each data block in each cache level according to the number of times each data block is read and modified in the target time period of each cache level and the time interval between each data block and the most recent reading time in each cache level; All cache blocks in each cache level are marked with serial numbers, and the probability of clearing each cache block in each cache level is obtained according to the storage size and marking serial number of each cache block in each cache level; The step of obtaining the probability of clearing each cache block in each cache level according to the storage size and the tag sequence number of each cache block in each cache level includes: The proportion of the storage size of each cache block in each cache level to the storage size of all cache blocks is recorded as the storage proportion of each cache block in each cache level; Obtaining the probability of clearing each cache block in each cache level according to the storage ratio of each cache block in each cache level and the front position of the mark number of each cache block in each cache level among the mark numbers of all cache blocks; Among them, the storage ratio of each cache block in each cache level is positively correlated with the probability of clearing each cache block in each cache level, and the front position of the mark number of each cache block in each cache level in the mark numbers of all cache blocks is positively correlated with the probability of clearing each cache block in each cache level; The degree to which the mark serial number of each cache block in each cache level is positioned in front of the mark serial numbers of all cache blocks includes: The ratio between the mark serial number of each cache block in each cache level and the number of all cache blocks in each cache level is recorded as the first ratio of each cache block in each cache level, and the difference between 1 and the first ratio of each cache block in each cache level is recorded as the front position of the mark serial number of each cache block in each cache level in the mark serial numbers of all cache blocks; A priority determination module is used to modify the initial priority of each data block in each cache level according to the space occupied by each data block in the data to be cached and the storage capacity of the remaining space in each cache level, so as to obtain the final priority of each data block in each cache level; The method of modifying the initial priority of each data block in each cache level according to the space occupied by each data block in the data to be cached and the storage capacity of the remaining space in each cache level to obtain the final priority of each data block in each cache level includes: The space ratio of each data block is calculated based on the ratio of the space occupied by each data block to the space occupied by all data blocks. According to the space proportion of each data block, the storage efficiency of each data block in each cache level, and the initial priority of each data block in each cache level, the final priority of each data block in each cache level is obtained; Among them, the space proportion of each data block is negatively correlated with the final priority of each data block in each cache level, and the storage efficiency of each data block in each cache level is negatively correlated with the final priority of each data block in each cache level; The storage efficiency of each data block in each cache level includes: The ratio between the space occupied by each data block and the storage capacity of the remaining space in each cache level is recorded as the storage efficiency of each data block in each cache level; The data cache module is used to store the data to be cached according to the clearing probability of each cache block in each cache level and the final priority of each data block stored in different caches.
2. A data storage system with multi-segment cache function according to claim 1, characterized in that: The method of obtaining the initial priority of each data block in each cache level according to the number of times each data block is read and modified within the target time period of each cache level and the time interval between each data block and the most recent read time in each cache level comprises: The ratio between the number of times each data block is read and the number of times it is modified during the target time period of each cache level is recorded as the read-write ratio of each data block in each cache level; The initial priority of each data block in each cache level is obtained according to the number of times each data block is read within the target time period of each cache level, the read-write ratio of each data block in each cache level, and the time interval between each data block and the most recent read time in each cache level.
3. A data storage system with multi-segment cache function according to claim 2, characterized in that: The method of obtaining the initial priority of each data block in each cache level according to the number of times each data block is read in the target time period of each cache level, the read-write ratio of each data block in each cache level, and the time interval between each data block in each cache level and the most recent read time includes: The product of the number of times each data block is read within the target time period of each cache level, the read-write ratio of each data block in each cache level, and the time interval between each data block and the most recent read time in each cache level is recorded as the first product value of each data block in each cache level. The first product values of all data blocks in each cache level are linearly normalized, and the normalized first product value of each data block in each cache level is recorded as the initial priority of each data block in each cache level.
4. A data storage system with multi-segment cache function according to claim 1, characterized in that: The serial number marking of all cache blocks in each cache level includes: All cache blocks in each cache level are sorted according to the time sequence of storage in the cache level, and the sorted cache blocks are marked with serial numbers 1, 2, 3, etc. in sequence to obtain the marked serial number of each cache block in each cache level.
5. The data storage system with multi-segment cache function according to claim 1, characterized in that: The storing of the data to be cached according to the clearing probability of each cache block in each cache level and the final priority of each data block stored in different caches includes: Obtain all data blocks with the highest final priority corresponding to each cache level, count the storage space required by all the data blocks, and when the storage capacity of the remaining space in the corresponding storage level is greater than or equal to the storage space required by all the data blocks, store all the data blocks in the corresponding cache level; when the storage capacity of the remaining space in the corresponding storage level is less than the storage space required by all the data blocks, clear each cache level one by one in order from the largest probability to the smallest probability according to the clearing probability of each cache block in each cache level, until the storage capacity of the remaining space in each cache level is greater than or equal to the storage space required by all the data blocks, then stop clearing, and then store all the data blocks in the corresponding cache level.
6. A data storage system with multi-segment cache function according to claim 1, characterized in that: The specific steps of recording a preset time period before the current time as the target time period are as follows: Record the time period of minutes before the current time as the target time period; in, is 10.
Citation Information
Patent Citations
Resource distribution method and device, and data mapping method and device
CN105792359A
Data caching method, storage control apparatus and storage device
CN107430551A
Data caching method, storage control device and storage equipment
CN112214420A
Cache data clearing method and related component
CN114880255A
Data caching method, system and equipment and computer readable storage medium
CN117648266A
