Cache management method, device and system and storage medium
By obtaining the system load level and access to cache units, updating the popularity level of business data, and performing cache rearrangements, the problems of single criteria and waste of resources in existing cache management are solved, and efficient cache resource utilization and system performance improvement are achieved.
Patent Information
- Application Number
- CN202510570020.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-08-15
AI Technical Summary
The existing cache management strategy determines a single standard when replacing data, which may mistakenly replace important data, resulting in a reduced cache hit rate, a damaged system performance, and the inability to reasonably divide cache resources according to dynamic changes in data, resulting in waste of resources and low utilization.
By obtaining the system load level, the access status of the cache unit and the initial popularity mark of the service data, the popularity level of the service data is updated, and the system load level is determined whether to perform cache rearrangement, so that the popularity level of the service data matches the performance level of the cache unit.
It improves the utilization effect of cache resources, reduces resource waste, improves system performance, and ensures the accuracy and reliability of cache management.
Smart Images

Figure CN120492497A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic digital data processing technology, and in particular to a cache management method, device, system and storage medium. Background Art
[0002] With the widespread application of electronic systems in various fields, the demand for improved electronic system performance is becoming increasingly urgent. As a key link in electronic systems, the reliability and accuracy of master cache management directly affect the overall performance of electronic systems.
[0003] The cache management strategy in related technologies only relies on simple algorithm rules for cache replacement. For example, based on the order of data access time, when the cache space is insufficient, the data that has not been accessed for the longest time is replaced first. The judgment criteria are single, and it may mistakenly replace data that has not been accessed for a period of time but is relatively important, resulting in a lower cache hit rate, poor reliability and accuracy of cache management, and affecting the overall performance of the system. Summary of the Invention
[0004] The present application provides a cache management method, device, system and storage medium to at least solve the problems of low accuracy and poor reliability when performing cache management.
[0005] The present application provides a cache management method, which is applied to a master control device in a cache management system; the cache management system also includes cache units of different performance levels; the method includes:
[0006] Obtaining a system load level, access status of each cache unit, and an initial heat mark of the business data in the cache unit; the initial heat mark is determined based on the business type of the business data;
[0007] Based on the access status of each cache unit and the initial heat mark of the business data in the cache unit, updating the heat level of the business data in the cache unit;
[0008] Based on the system load level and the heat level of the business data in the cache unit, it is determined whether to cache the business data so that the heat level of the business data after cache rearrangement matches the performance level of the cache unit.
[0009] The present application also provides a cache management device, which is provided in a main control device in a cache management system; the cache management system further includes cache units of different heat levels; the device includes:
[0010] An acquisition module, configured to acquire a system load level, access status of each cache unit, and an initial heat mark of the business data in the cache unit; the initial heat mark is determined based on the business type of the business data;
[0011] A heat update module, configured to update the heat level of the business data in the cache unit based on the access status of each cache unit and the initial heat mark of the business data in the cache unit;
[0012] The cache rearrangement module is used to determine whether to cache the business data based on the system load level and the heat level of the business data in the cache unit to match the heat level of the business data and the heat level of the cache unit.
[0013] The present application also provides a cache management system, the system comprising:
[0014] Multiple cache units with different performance levels;
[0015] A main control device is connected to the central processing unit and multiple service hosts, and is used to receive service data from the central processing unit and multiple service hosts; the main control device includes:
[0016] An initial heat mark module is used to determine the initial heat mark of the business data according to the business type of the business data;
[0017] A cache heat monitoring and feedback module is used to obtain the access status of each cache unit and the initial heat mark of the business data in the cache unit, and update the heat level of the business data in the cache unit based on the access status of each cache unit and the initial heat mark of the business data in the cache unit;
[0018] The adaptive cache adjustment module is used to obtain the system load level and, based on the system load level and the heat level of the business data in the cache unit, determine whether to cache the business data so that the heat level of the business data after the cache rearrangement matches the performance level of the cache unit.
[0019] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above cache management methods when executing the computer program.
[0020] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above cache management methods are implemented.
[0021] Through this application, the initial heat mark of the business data in the cache unit can be used as the initial basis for subsequent heat level division, and the heat level of the business data in the cache unit can be updated based on the access situation of each cache unit and the initial heat mark of the business data in the cache unit, thereby ensuring the accuracy and real-time nature of the heat level; by combining the system load level and the heat level of the business data in the cache unit, it is possible to comprehensively judge whether to cache the business data, so that the heat level of the business data after cache rearrangement matches the performance level of the cache unit, thereby improving the utilization effect of the system cache resources, reducing resource waste, improving system performance, and ensuring the accuracy and reliability of cache management. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0023] Figure 1 A schematic diagram of a cache management method flow provided in an embodiment of the present application;
[0024] Figure 2 A flowchart of another cache management method provided in an embodiment of the present application;
[0025] Figure 3 A schematic diagram of the structure of a cache management system provided in an embodiment of the present application;
[0026] Figure 4 A schematic diagram of the structure of a cache unit group provided in an embodiment of the present application;
[0027] Figure 5 A schematic diagram of the specific structure of a cache management system provided in an embodiment of the present application;
[0028] Figure 6 A flowchart of another cache management method provided in an embodiment of the present application;
[0029] Figure 7 This is a structural block diagram of a cache management device according to an embodiment of the present application;
[0030] Figure 8 This is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present application. DETAILED DESCRIPTION
[0031] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0032] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.
[0033] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0034] With the widespread application of electronic systems in various fields, the demand for improved electronic system performance is becoming increasingly urgent. As a key link in electronic systems, the reliability and accuracy of master cache management directly affect the overall performance of electronic systems.
[0035] The cache management strategies in related technologies rely solely on simple algorithmic rules for cache replacement, making them slow to respond to sudden access patterns and ignoring the importance of data, trends in popularity, and the likelihood of future access. For example, when using the LRU (Least Recently Used) algorithm for cache management, only the most recent access time of the data is considered. When cache space is insufficient, data that has not been accessed for the longest time is preferentially replaced. This single criterion can lead to incorrect replacement of relatively important data that has not been accessed for a period of time in complex data access scenarios, resulting in a reduced cache hit rate and impaired system performance. Furthermore, related technologies rely solely on experience or simple threshold indicators when performing adaptive cache space configuration adjustments. For example, when memory utilization exceeds 70%, a certain percentage of cache space is increased according to preset rules. This ignores the differences in cache requirements among different business modules and the dynamic changes of the system, resulting in adjustment lags. This causes system performance to degrade during critical periods due to unreasonable cache configuration, affecting the overall system performance. In addition, related technologies are unable to reasonably divide cache resources according to the dynamic changes of data, which may result in high-importance data not being quickly obtained, while low-importance data occupies valuable cache space, causing a waste of cache resources and affecting the overall cache utilization and system performance.
[0036] Based on this, an embodiment of the present application provides a cache management method, which is applied to a main control device in a cache management system. The host controller device refers to a hardware or software and hardware combination that plays a decision-making role in the cache management system, and is responsible for coordinating the allocation, replacement and optimization of cache resources. The main control device can be selected according to actual needs, for example, it can be a dedicated hardware controller, a general-purpose processor, etc. The cache management system also includes cache units of different performance levels, and the performance level is used to indicate the performance of the cache unit. For example, a cache unit with a high performance level has high access delay requirements, fast access speed, and high cost. The specific performance level division can be set according to actual needs.
[0037] The embodiment of the present application provides a cache management method, Figure 1 This is a flow chart of a cache management method provided by an embodiment of the present application. Figure 1 As shown, the process includes the following steps.
[0038] The specific steps are as follows:
[0039] Step S101 : obtaining the system load level, the access status of each cache unit, and the initial heat mark of the business data in the cache unit.
[0040] The system load level refers to the load level of the electronic system where the cache management system is located. The system load level is comprehensively evaluated and determined based on the current performance of the system, and an acquisition cycle can be set to update the system load level in real time. The electronic system also includes a central processing unit and multiple business hosts. The main control device needs to receive business data sent by the central processing unit and multiple business hosts, and determine the initial heat mark of the business data based on the business type of the business data. The heat of the business data is a dynamic indicator that quantifies the short-term value and access probability of the business data. The type of the initial heat mark can be set according to actual needs, such as high heat, low heat, etc. Next, the main control device preliminarily divides the business data into cache units of different performance levels for storage based on the initial heat mark of the business data. The division rules can be set according to actual needs. For example, business data with an initial heat mark of high heat is preliminarily divided into cache units of high performance levels for storage.
[0041] Step S102 : updating the heat level of the business data in the cache unit based on the access status of each cache unit and the initial heat mark of the business data in the cache unit.
[0042] For each cache unit in each cache unit, the initial heat mark of the business data in the cache unit is used as the initial basis for the update, and the heat level of the business data in the cache unit is updated in real time in combination with the access situation of the cache unit obtained in real time. The access situation of the cache unit can be the access time, access frequency, access pattern (for example, concentrated in a certain period of a day, a certain date), etc., which can be set according to actual needs. The heat level can be set according to actual needs, for example, it can be set to multiple heat levels from high to low. The update cycle can be set to update the heat level of the business data in the cache unit in real time to improve the accuracy and timeliness of cache management.
[0043] Step S103 , based on the system load level and the heat level of the business data in the cache unit, determines whether to cache rearrange the business data so that the heat level of the rearranged business data matches the performance level of the cache unit.
[0044] Taking into comprehensive consideration the current system load level and the current heat level of the business data in each cache unit, determine whether to rearrange the cache of the business data. For example, only when the system load level is low and the current heat level of the business data does not match the performance level of the stored cache unit, cache rearrangement is performed, and the business data is re-stored according to the heat level and transferred to a cache unit with a matching performance level. This ensures that under the premise that the current system load meets the requirements, the heat level of the business data after cache rearrangement matches the performance level of the cache unit. For example, business data with a high heat level is transferred to a cache unit with a high performance level, and business data with a low heat level is transferred to a cache unit with a low performance level, thereby making full use of the storage resources of each cache unit, so that business data with a high heat level can be read quickly, and business data with a low heat level does not waste high-speed storage space, thereby improving system performance.
[0045] The cache management method provided in this embodiment can use the initial heat mark of the business data in the cache unit as the initial basis for subsequent heat level division, and update the heat level of the business data in the cache unit based on the access situation of each cache unit and the initial heat mark of the business data in the cache unit, thereby ensuring the accuracy and real-time nature of the heat level; by combining the system load level and the heat level of the business data in the cache unit, it can comprehensively judge whether to cache the business data, so that the heat level of the business data after cache rearrangement matches the performance level of the cache unit, thereby improving the utilization effect of the system cache resources, reducing resource waste, improving system performance, and ensuring the accuracy and reliability of cache management.
[0046] In this embodiment, a cache management method is provided. Figure 2This is a flow chart of another cache management method provided by an embodiment of the present application. Figure 2 As shown, the process includes the following steps.
[0047] The specific steps are as follows:
[0048] Step S201: receiving business data, and storing the business data in cache units of different performance levels according to initial heat tags.
[0049] Optionally, the main control device receives business data sent from other devices in the electronic system (such as a central processing unit, a business host), and then parses the received business data to determine the business type of the business data. The business type of the business data is determined based on the business scenario of the business data, such as real-time business data (such as real-time conversation data), historical query business data (such as log analysis), key metadata (such as index tables, permission control tables), etc. The initial heat tag is determined based on the business type of the business data. Specifically, based on the business type of the business data, the initial heat tag corresponding to the business data is determined. For example, key metadata is the core functional data of the system, and the initial heat tag is high; real-time business data has requirements for real-time and persistence, and the initial heat tag is medium; historical query business data allows higher latency, and the initial heat tag is low. Finally, the business data is stored in cache units of different performance levels according to the initial heat tag. For example, business data with an initial heat tag of high is initially stored in a cache unit of high performance level.
[0050] Optionally, the cache units of different performance levels include high-performance units, medium-performance units, and low-performance units, and the initial heat is marked as high, medium, and low. Business data with an initial heat mark of high level is stored in the high-performance unit, business data with an initial heat mark of medium level is stored in the medium-performance unit, and business data with an initial heat mark of low level is stored in the low-performance unit. Exemplarily, the high-performance unit can be implemented by SRAM (Static Random Access Memory), the medium-performance unit can be implemented by MRAM (Magnetic Random Access Memory), and the low-performance unit can be implemented by DRAM (Dynamic Random Access Memory).
[0051] Step S202: Obtain the system load level, the access status of each cache unit, and the initial heat mark of the business data in the cache unit.
[0052] Optionally, when obtaining the system load level, the electronic system's central processing unit (CPU) usage, memory usage, network bandwidth, and operating status of the master control device are first obtained. The CPU usage may be CPU usage, and the memory usage may be memory occupancy. The operating status of the master control device includes input / output (I / O) latency, cache hit rate, and data access time. Specifically, when obtaining the I / O latency of the master control device, the start time and end time of the I / O operation of the master control device are first obtained through detection code pre-embedded in the master control device driver layer. Then, based on the start and end times of the I / O operation of the master control device, the I / O latency of the master control device is calculated. For example, the difference between the start time and the end time of the I / O operation of the master control device is subtracted from the theoretical minimum delay of the master control device to obtain the I / O latency of the master control device. When obtaining the cache hit rate and data access time of the master control device, the cache hit rate and data access time of the master control device are calculated based on a counter and timer pre-set at the cache access interface. For example, the cache hit rate of the master device can be directly read through the built-in performance monitoring counters (PMC) of the master device, or the cache hit rate of the master device can be read through the software layer cache statistics function of the master device, and the RDTSC (Read Time-Stamp Counter) timestamp difference can be directly read through the built-in performance monitoring counters of the master device to calculate the data access time.
[0053] Next, based on the memory usage, network bandwidth, and the operating status of the master control device, fuzzy reasoning is performed using a fuzzy logic algorithm to obtain a fuzzy output of the system load. Data fusion technology is used to integrate multi-source monitoring data, including memory usage, network bandwidth, and the operating status of the master control device, to comprehensively assess the system operating status and provide rich data support for precise adjustment. Specifically, a fuzzy rule base is first constructed based on historical system load data and historical load analysis data. Then, using the CPU usage, memory usage, network bandwidth, the input and output wait time of the master control device, and the cache hit rate and data access time of the master control device as fuzzy input variables, fuzzy reasoning is performed on the system load in conjunction with the fuzzy rule base to obtain a fuzzy output of the system load. Finally, the current system load data (including memory usage, network bandwidth, and the operating status of the master control device) is used as the historical system load data, and the fuzzy output of the current system load is stored as the historical load analysis data in the fuzzy rule base. In other words, after each analysis of the system load level, the corresponding system load data and analysis results are added to the fuzzy rule base to achieve real-time updating of the fuzzy rule base.
[0054] Finally, the fuzzy output of the system load is defuzzified so that it can be quantified to obtain a specific system load level, enabling accurate judgment of the system load. Specific quantification rules can be set according to actual needs. For example, the system load level can be set to high, medium, or low. If the CPU usage is high, the memory usage is high, and the input and output wait times are long, the system load level is determined to be high; if the CPU usage is high, the memory usage is high, and the input and output wait times are long, the system load level is determined to be low; otherwise, the system load level is determined to be medium.
[0055] Step S203 : updating the heat level of the business data in the cache unit based on the access status of each cache unit and the initial heat mark of the business data in the cache unit.
[0056] Specifically, the above step S203 includes:
[0057] S2031, obtaining the number of accesses and access time of each cache unit.
[0058] The main control unit can directly read the number of accesses and the access time of each cache unit through the built-in performance monitoring unit (PMU) of each cache unit.
[0059] S2032, determining the heat value of the business data in each cache unit based on the number of accesses, access time, preset access number weight value, preset access time weight value and initial heat mark of the business data in the cache unit.
[0060] Specifically, the initial heat mark of the business data in each cache unit is first imported, and then based on the initial heat mark of the business data in the cache unit, the initial heat value of the business data in the cache unit is determined as the basis for subsequent updating of the heat value.
[0061] Next, a weighted average algorithm is used to calculate the popularity of the business data, using the number of visits and the access time as weights. Specifically, a preset access count weight value and a preset access time weight value are pre-set. These preset access count weight values and preset access time weight values are determined based on a large number of historical experiments and data analysis. For example, in high-concurrency real-time data processing scenarios, the preset access count weight value is set to a larger value, while in relatively stable data storage scenarios, the preset access time weight value is set to a larger value.
[0062] Then, based on the number of times the cache unit is accessed and the preset access number weight value, the first heat value of the business data in the cache unit is determined, for example, the product of the number of times the cache unit is accessed and the preset access number weight value is used as the first heat value; based on the access time of the cache unit and the preset access time weight value, the second heat value of the business data in the cache unit is determined, for example, the product of the access time of the cache unit and the preset access time weight value is used as the second heat value.
[0063] Then, based on the initial heat value, the first heat value, and the second heat value, the intermediate heat value of the business data in the cache unit is calculated. The calculation rules of the intermediate heat value can be set according to actual needs. For example, the initial heat value is used as the intermediate heat value when the data unit is first accessed as the calculation starting point to improve the accuracy of the heat calculation. When the heat is subsequently calculated, the sum of the first heat value and the second heat value is used as the intermediate heat value of the business data in the cache unit. Alternatively, a weight can be set for the initial heat value. Each time the intermediate heat value is calculated, the product of the initial heat value and the corresponding weight and the sum of the first heat value and the second heat value are used as the intermediate heat value. Alternatively, an exponential decay model can be used to compensate for the timeliness of the initial heat value. Each time the heat value is calculated, a gradually decaying initial heat compensation value is obtained based on the initial heat value and the corresponding exponential decay model. The sum of the initial heat compensation value, the first heat value, and the second heat value is used as the intermediate heat value.
[0064] Finally, the intermediate heat values of the business data in the cache unit are normalized, and the intermediate heat values are mapped to the [0,1] interval through the normalization function to obtain the heat values of the business data in the cache unit, ensuring that the heat values of different business data are comparable, which facilitates the subsequent heat level division.
[0065] S2033: Compare the heat value of the business data in each cache unit with a preset heat threshold, and update the heat level of the business data in the cache unit.
[0066] Optionally, multiple heat levels and corresponding multiple preset heat thresholds are set, for example, a high heat level, a medium heat level and a low heat level are set, a first heat threshold and a second heat threshold are set, the first heat threshold is less than the second heat threshold, and the second heat threshold does not exceed 1. When the heat value of the business data is lower than the first heat threshold, the heat level of the business data is a low heat level; when the heat value of the business data is not lower than the first heat threshold and lower than the second heat threshold, the heat level of the business data is a medium heat level; when the heat value of the business data is not lower than the second heat threshold, the heat level of the business data is a high heat level. By setting the heat level, it helps the main control device to quickly identify business data of different importance, provide a basis for cache management, and improve the accuracy of cache management.
[0067] Step S204 : Based on the system load level and the heat level of the business data in the cache unit, determine whether to cache rearrange the business data so that the heat level of the rearranged business data matches the performance level of the cache unit.
[0068] Specifically, the above step S204 includes:
[0069] S2041 , comparing the performance level of the cache unit and the heat level of the business data in the cache unit, and determining the heat matching status of the business data in the cache unit.
[0070] The correspondence between the performance level of the cache unit and the heat level of the business data can be set according to actual needs. For example, when the performance level of the cache unit is a high performance level and the heat level of the business data in the cache unit is a high heat level, the heat matching situation of the business data in the cache unit is a match; when the performance level of the cache unit is a medium performance level and the heat level of the business data in the cache unit is a medium heat level, the heat matching situation of the business data in the cache unit is a match; when the performance level of the cache unit is a low performance level and the heat level of the business data in the cache unit is a low heat level, the heat matching situation of the business data in the cache unit is a match; in other cases, such as when the performance level of the cache unit is a high performance level and the heat level of the business data in the cache unit is a low heat level, the heat matching situation of the business data in the cache unit is a mismatch.
[0071] S2042: Based on the system load level and the heat matching of the business data in the cache unit, determine whether to cache the business data.
[0072] If the heat matching condition of the business data in the cache unit is mismatch, it is determined to be yes, that is, the business data needs to be cached and rearranged.
[0073] S2043: If yes, then based on the heat level of the business data, migrate the business data to a cache unit of a corresponding performance level, so that the heat level of the business data after cache rearrangement matches the performance level of the cache unit.
[0074] Business data migration is performed based on the correspondence between the performance level of the cache unit and the heat level of the business data. For example, when the performance level of the cache unit is high performance and the heat level of the business data in the cache unit is low heat level, since the heat matching of the business data in the cache unit is mismatched, it is judged that the business data needs to be cached and rearranged. Based on the heat level of the business data being high performance, the business data is migrated to the corresponding cache unit with a high performance level to complete the cache rearrangement of the cache unit. By analogy, the cache rearrangement of each cache unit is completed.
[0075] The embodiment of the present application provides a cache management system, Figure 3 A schematic diagram of the structure of a cache management system provided in an embodiment of the present application is shown as follows: Figure 3 As shown, the cache management system includes a main control device and multiple cache units with different performance levels.
[0076] For example, Figure 4A structural diagram of the cache unit group provided in an embodiment of the present application, wherein the cache unit group includes multiple cache units of different performance levels, specifically, high-performance units, medium-performance units and low-performance units, each cache unit includes multiple data blocks, and the received business data can be divided into the multiple data blocks according to the data length and stored separately.
[0077] The main control device is connected to the central processor and multiple service hosts respectively, and is used to receive service data from the central processor and multiple service hosts. The main control device includes an initial heat marking module, a cache heat monitoring and feedback module, and an adaptive cache adjustment module.
[0078] The initial heat mark module is used to determine the initial heat mark of the business data according to the business type of the business data.
[0079] The cache heat monitoring and feedback module is used to obtain the access status of each cache unit and the initial heat mark of the business data in the cache unit, and update the heat level of the business data in the cache unit based on the access status of each cache unit and the initial heat mark of the business data in the cache unit.
[0080] The adaptive cache adjustment module is used to obtain the system load level and, based on the system load level and the heat level of the business data in the cache unit, determine whether to cache the business data so that the heat level of the cache-rearranged business data matches the performance level of the cache unit.
[0081] As one or more specific application examples of the embodiments of the present application, the optimal implementation scheme or the solution that the inventor most wants to embody is described below in combination with specific application scenarios.
[0082] Figure 5 A schematic diagram of the specific structure of a cache management system provided in an embodiment of the present application. The cache management system includes a master control device and a cache unit group. The master control device includes an initial heat marking module, a cache heat monitoring and feedback module, and an adaptive cache adjustment module. The master control device receives business data from a central processing unit and other host devices (business hosts).
[0083] The initial heat tag module determines the initial heat tag of the business data. The cache heat monitoring and feedback module includes a heat detection unit, a heat statistics and calculation unit, a heat classification unit, and a heat calibration unit. The heat detection unit is used to import the initial heat tag of the business data and obtain the number of accesses and access time of each cache unit. The heat statistics and calculation unit is used to determine the heat value of the business data in each cache unit based on the number of accesses, access time, preset access number weight value, preset access time weight value, and the initial heat tag of the business data in the cache unit. The heat classification unit is used to compare the heat value of the business data in each cache unit with a preset heat threshold to determine the heat level of the business data in the cache unit. The heat calibration unit is responsible for coordinating the heat detection unit, the heat statistics and calculation unit, and the heat classification unit to repeat the above steps. According to established rules and algorithms, the heat value of the data is dynamically determined and updated, and the heat level of the business data in the cache unit is updated in real time. The heat level reflects the importance and frequency of use of the business data in the current business scenario.
[0084] The adaptive cache adjustment module includes a state perception unit, a load monitoring unit, and a cache rearrangement unit. The state perception unit is used to obtain the CPU usage, memory usage, network bandwidth, and the working status of the main control device. The load monitoring unit is used to continuously and in real time conduct a comprehensive detection of the overall load of the system. Based on the memory usage, network bandwidth, and the working status of the main control device, the fuzzy output of the system load is obtained through fuzzy reasoning, and the fuzzy output of the system load is then defuzzified to obtain the system load level. Through a comprehensive analysis of the CPU usage, memory usage, network bandwidth, and the working status of the main control device, the load monitoring unit can accurately assess the current load pressure status of the system and promptly feed back the assessment results to the cache rearrangement unit. The cache rearrangement unit is used to comprehensively consider the system load situation fed back by the load monitoring unit and the heat level of the business data after the heat calibration unit is updated, compare the performance level of the cache unit and the heat level of the business data in the cache unit, judge the heat matching of the business data in the cache unit, and judge whether to cache the business data based on the system load level and the heat matching of the business data in the cache unit. If so, based on the heat level of the business data, migrate the business data to the cache unit of the corresponding performance level, so that the heat level of the business data after the cache rearrangement matches the performance level of the cache unit, and realize comprehensive optimization of the cache arrangement. In the cache rearrangement unit, there is a small cache buffer built in, which can assist in adjusting the storage location, order and allocation strategy of the business data in the cache to ensure that data with high heat level and urgently needed by the system can be quickly accessed, thereby effectively improving the system response speed, reducing the overall load pressure of the system, and realizing efficient utilization of system cache resources and maximizing system performance.
[0085] Figure 6A flow chart of another cache management method provided for an embodiment of the present application. The main control device receives a service request sent by the central processing unit / other host device, the initial heat marking module preliminarily marks the heat of each group of business data, and obtains an initial heat value. The heat detection unit imports the initial heat value of the business data, and the heat statistics and calculation unit calculates the heat level of the business data in the data block based on the number of accesses and time of the data block in the cache unit. The heat calibration unit dynamically determines and updates the heat level of the business data. At the same time, the state perception unit detects various performance indicators of the main control device, and the load evaluation unit integrates multi-dimensional monitoring data to evaluate the system load level. Then, the cache rearrangement unit determines whether to perform cache rearrangement based on the load situation and the updated heat level. If not, it re-judges. If so, the cache Buffer is used to assist in cache rearrangement. According to the partitioning scheme of the cache unit, business data of different heat levels are written into different cache particles (data blocks).
[0086] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0087] The embodiment of the present application also provides a cache management device, which is set in a main control device in a cache management system; the cache management system also includes cache units of different heat levels. Figure 7 As shown, the cache management device includes an acquisition module 701 , a heat update module 702 and a cache rearrangement module 703 .
[0088] An acquisition module 701 is configured to acquire a system load level, access status of each cache unit, and an initial heat mark of the business data in the cache unit; the initial heat mark is determined based on the business type of the business data;
[0089] A heat update module 702 is configured to update the heat level of the business data in the cache unit based on the access status of each cache unit and the initial heat mark of the business data in the cache unit;
[0090] The cache rearrangement module 703 is used to determine whether to cache rearrange the business data based on the system load level and the heat level of the business data in the cache unit to match the heat level of the business data and the heat level of the cache unit.
[0091] For the description of the features in the embodiment corresponding to the cache management device, please refer to the relevant description of the embodiment corresponding to the cache management method, and will not be repeated here.
[0092] The embodiment of the present application also provides an electronic device, such as Figure 8 As shown, it includes a memory 10 and a processor 20, the memory 10 stores a computer program, and the processor 20 is configured to run the computer program to execute the steps in any of the above cache management method embodiments.
[0093] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any of the above cache management method embodiments when running.
[0094] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0095] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of any of the above cache management method embodiments are implemented.
[0096] An embodiment of the present application also provides another computer program product, including a non-volatile computer-readable storage medium, wherein 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-mentioned cache management method embodiments are implemented.
[0097] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0098] The above is a detailed introduction to a cache management method, device, system and storage medium provided by the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core ideas. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the present application.
Claims
1. A cache management method, characterized in that: A master control device used in a cache management system; the cache management system also includes cache units of different performance levels; the method includes: Obtaining a system load level, access status of each cache unit, and an initial heat mark of the business data in the cache unit; the initial heat mark is determined based on the business type of the business data; Based on the access status of each cache unit and the initial heat mark of the business data in the cache unit, updating the heat level of the business data in the cache unit; Based on the system load level and the heat level of the business data in the cache unit, it is determined whether to cache the business data so that the heat level of the business data after cache rearrangement matches the performance level of the cache unit.
2. The cache management method according to claim 1, wherein: Before obtaining the system load level, the access status of each cache unit, and the initial heat mark of the business data in the cache unit, the method further includes: Receive business data; Parsing the business data to determine the business type of the business data; Determining an initial heat tag corresponding to the business data based on the business type of the business data; The business data is stored in cache units of different performance levels according to initial heat tags.
3. The cache management method according to claim 1, wherein: The updating of the heat level of the business data in the cache unit based on the access status of each cache unit and the initial heat mark of the business data in the cache unit includes: Obtain the number of times each cache unit is accessed and the access time; Determine the heat value of the business data in each cache unit based on the number of times each cache unit is accessed, the time it is accessed, the preset weight value of the number of times it is accessed, the preset weight value of the time it is accessed, and the initial heat mark of the business data in the cache unit; The heat value of the business data in each cache unit is compared with a preset heat threshold, and the heat level of the business data in the cache unit is updated.
4. The cache management method according to claim 3, wherein: The determining of the heat value of the business data in each cache unit based on the number of accesses, the access time, the preset access number weight value, the preset access time weight value, and the initial heat mark of the business data in the cache unit includes: Determining an initial heat value of the business data in the cache unit based on the initial heat mark of the business data in the cache unit; Determining a first heat value of the business data in the cache unit based on the number of times the cache unit has been accessed and a preset access number weight value; Determining a second heat value of the business data in the cache unit based on the access time of the cache unit and a preset access time weight value; Calculating an intermediate heat value of the business data in the cache unit based on the initial heat value, the first heat value, and the second heat value; The intermediate heat values of the business data in the cache unit are normalized to obtain the heat values of the business data in the cache unit.
5. The cache management method according to any one of claims 1 to 4, characterized in that: The obtaining of the system load level includes: Obtain CPU usage, memory usage, network bandwidth, and the working status of the main control device; Based on the memory usage, network bandwidth and working status of the main control device, a fuzzy output of the system load is obtained through fuzzy reasoning; The fuzzy output of the system load is defuzzified to obtain the system load level.
6. The cache management method according to claim 5, characterized in that: Obtaining the working status of the master control device includes: Get the start and end time of the input and output operations of the master device; Calculating the input and output waiting time of the master control device based on the start and end time of the input and output operation of the master control device; Get the cache hit rate and data access time of the master device.
7. The cache management method according to any one of claims 1 to 4, characterized in that: The determining, based on the system load level and the heat level of the business data in the cache unit, whether to cache rearrange the business data so that the heat level of the business data after the cache rearrangement matches the performance level of the cache unit includes: Compare the performance level of the cache unit and the heat level of the business data in the cache unit to determine the heat matching status of the business data in the cache unit; Based on the system load level and the heat matching of the business data in the cache unit, determining whether to cache the business data; If so, the business data is migrated to a cache unit of a corresponding performance level based on the heat level of the business data, so that the heat level of the business data after cache rearrangement matches the performance level of the cache unit.
8. A cache management device, characterized in that: A main control device is provided in a cache management system; the cache management system further includes cache units of different heat levels; the device includes: An acquisition module, configured to acquire a system load level, access status of each cache unit, and an initial heat mark of the business data in the cache unit; the initial heat mark is determined based on the business type of the business data; A heat update module, configured to update the heat level of the business data in the cache unit based on the access status of each cache unit and the initial heat mark of the business data in the cache unit; The cache rearrangement module is used to determine whether to cache the business data based on the system load level and the heat level of the business data in the cache unit to match the heat level of the business data and the heat level of the cache unit.
9. A cache management system, characterized in that: The system comprises: Multiple cache units with different performance levels; A main control device is connected to the central processing unit and multiple service hosts, and is used to receive service data from the central processing unit and multiple service hosts; the main control device includes: An initial heat mark module is used to determine the initial heat mark of the business data according to the business type of the business data; A cache heat monitoring and feedback module is used to obtain the access status of each cache unit and the initial heat mark of the business data in the cache unit, and update the heat level of the business data in the cache unit based on the access status of each cache unit and the initial heat mark of the business data in the cache unit; The adaptive cache adjustment module is used to obtain the system load level and, based on the system load level and the heat level of the business data in the cache unit, determine whether to cache the business data so that the heat level of the business data after the cache rearrangement matches the performance level of the cache unit.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the cache management method according to any one of claims 1 to 7.
Citation Information
Cited By
Intelligent hierarchical caching method and system based on hyper-converged architecture
CN120705077A