Data cache management method and device, storage medium and program product
By adjusting cache priority and hierarchy from multiple dimensions, the problems of poor adaptability and low hit rate caused by a single cache management strategy are solved, achieving more efficient cache management and lower query latency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SAIC GM WULING AUTOMOBILE CO LTD
- Filing Date
- 2025-12-31
- Publication Date
- 2026-05-12
AI Technical Summary
In existing technologies, cache management strategies are fixed and single-dimensional, resulting in poor adaptability in complex scenarios, low cache hit rate, and poor user experience.
By adjusting cache priority and level based on multiple dimensions such as the access frequency, space usage, and timeliness of target data, the cache strategy can be dynamically adjusted in real time, improving the adaptability and granularity of cache management.
It significantly improved the cache hit rate, reduced the average query latency of data, and enhanced the efficiency of cache resource utilization and user experience.
Smart Images

Figure CN122019410A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, specifically to a data caching management method, device, storage medium, and program product. Background Technology
[0002] With the rapid development of information technology, the amount of global data is exploding, and society has entered the era of big data. In the context of massive amounts of data, how to perform data queries efficiently and with low latency has become a key bottleneck affecting the performance of various big data applications. To alleviate the read / write pressure on the underlying storage system and improve data access speed, caching technology is widely used in big data processing architectures. Its key lies in storing target data in storage media with different speeds based on data access patterns (such as access frequency), thereby reducing the average query latency.
[0003] In related technologies, a fixed strategy is typically used to configure the caching level and priority of target data, i.e., caching is configured based on preset rules. While this approach is simple to implement and has low deployment costs, it cannot be adjusted according to real-time data changes and has poor adaptability to complex scenarios. Furthermore, caching management strategies are usually formulated only considering the data access frequency, resulting in low granularity of caching management. Consequently, it is impossible to formulate an optimal caching management strategy, leading to low cache hit rates and a poor user experience.
[0004] It should be noted that the information disclosed in the background section of this application is intended only to enhance the understanding of the general background of this application, and should not be regarded as an admission or in any way implying that the information constitutes prior art known to those skilled in the art. Summary of the Invention
[0005] This application provides a data caching management method, device, storage medium, and program product to help solve the problems in related technologies where the use of fixed cache configurations leads to poor adaptability of cache management in complex scenarios, and where the formulation of cache management strategies only considers a single dimension, resulting in a low cache hit rate.
[0006] In a first aspect, embodiments of this application provide a data caching management method, applied to a data caching management system, comprising: The cache priority of the target data is determined based on the access frequency of the target data in the first preset time interval and the space occupied by the target data. Based on the timeliness type of the target data, the access frequency of the target data in a first preset time interval, and the space occupied by the target data, the cache level of the target data is determined, and the cache level includes high-speed cache and low-speed cache; The caching method for the target data is adjusted based on the cache priority and cache level of the target data.
[0007] In one possible implementation, determining the cache priority of the target data based on the access frequency of the target data within a first preset time interval and the space occupied by the target data includes: The first cache priority of the target data is determined based on the access frequency of the target data in the first preset time interval; The second cache priority of the target data is determined based on the weighted value of the access frequency ratio of the target data in the first preset time interval and the space occupied by the target data. The cache priority of the target data is determined based on the weighted value of the first cache priority and the second cache priority of the target data. Wherein, the access frequency ratio of the target data in the first preset time interval is the ratio of the access frequency of the target data in the first preset time interval to the access frequency of all data in the first preset time interval, and the space occupied by the target data is the ratio of the space occupied by the target data to the available space of the data cache management system.
[0008] In one possible implementation, determining the cache level of the target data based on the timeliness type of the target data, the access frequency of the target data within a first preset time interval, and the space occupied by the target data includes: If the time-sensitive type of the target data is real-time data, then the cache level of the target data is determined to be a high-speed cache; If the time-sensitive type of the target data is non-real-time data, then the cache level of the target data is determined based on the access frequency of the target data in the first preset time interval and the space occupied by the target data.
[0009] In one possible implementation, determining the cache level of the target data based on the access frequency of the target data within a first preset time interval and the space occupied by the target data includes: The first cache level of the target data is determined based on the access frequency of the target data in the first preset time interval; Based on the space occupied by the target data, determine the second cache level of the target data; The cache level of the target data is determined based on the weighted value of the first cache level and the second cache level of the target data.
[0010] One possible implementation also includes: The load index of the data cache management system is determined based on the weighted values of CPU utilization, memory utilization, network bandwidth, and disk I / O of the data cache management system. Based on the comparison between the load index of the data cache management system and the load index threshold, the method for adjusting the cache capacity of the data cache management system is determined.
[0011] In one possible implementation, the method for determining the cache capacity adjustment of the data cache management system based on a comparison between the load index of the data cache management system and a load index threshold includes: If the load index of the data cache management system is greater than or equal to the first load index threshold, then the cache capacity of the data cache management system is expanded. If the load index of the data cache management system is less than or equal to the second load index threshold, then the cache capacity of the data cache management system is reduced.
[0012] In one possible implementation, Expanding the cache capacity of the data cache management system includes: increasing the number of cache nodes and expanding the cache capacity of the cache nodes; Reducing the cache capacity of the data cache management system includes: reducing the number of cache nodes and reducing the cache capacity of the cache nodes.
[0013] One possible implementation also includes: Compare the access frequency of the target data in the first preset time interval with the historical access frequency of the target data; If the ratio of the access frequency of the target data in the first preset time interval to the historical access frequency of the target data is greater than a preset ratio, then the cache level of the target data is determined to be a high-speed cache. If the ratio of the access frequency of the target data in the first preset time interval to the historical access frequency of the target data is less than a preset ratio, then the cache level of the target data is determined to be a low-speed cache.
[0014] One possible implementation also includes: The historical access records of the data caching management system are input into the prediction model, and the access frequency of the target data and the load index of the data caching management system in the second preset time interval are output. If the access frequency of the target data in the second preset time interval is greater than the access frequency threshold, then the caching prefetching strategy of the data caching management system for the target data in the second preset time interval is determined based on the comparison result between the load index of the data caching management system in the second preset time interval and the prefetch load index threshold. The historical access records of the data caching management system include the access time of the target data, the access frequency of the target data in a third preset time interval, the space occupied by the target data, and the load index of the data caching management system in the third preset time interval.
[0015] In one possible implementation, determining the caching prefetching strategy for the target data in the second preset time interval based on the comparison result between the load index of the data caching management system and the prefetch load index threshold in the second preset time interval includes: If the load index of the data caching management system in the second preset time interval is less than or equal to the first prefetch load index threshold, then the target data is cached and prefetched according to the first preset cache prefetch range. If the load index of the data caching management system in the second preset time interval is greater than or equal to the second prefetch load index threshold, then the target data is cached and prefetched according to the second preset cache prefetch range. If the load index of the data caching management system in the second preset time interval is greater than the first prefetch load index threshold and less than the second prefetch load index threshold, then the target data is cached and prefetched according to the third preset cache prefetch range. Wherein, the third preset cache prefetch range is greater than the second preset cache prefetch range, and the third preset cache prefetch range is less than the first preset cache prefetch range.
[0016] Secondly, embodiments of this application provide an electronic device, including: processor; Memory; And a computer program, wherein the computer program is stored in the memory, and when the computer program is executed by the processor, causes the electronic device to perform the method described in any one of the first aspects.
[0017] Thirdly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in any one of the first aspects.
[0018] Fourthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the method described in any one of the first aspects. In this embodiment, the cache priority and cache level of the target data are adjusted in real time according to the changes in the access pattern of the target data, which improves the adaptability of cache management to complex scenarios. Furthermore, the cache level and cache priority of the target data are determined from multiple dimensions by considering the access frequency, space occupied and time type of the target data, which significantly improves the granularity of cache management, increases the cache hit rate and reduces the average query latency of the data. Attached Figure Description
[0019] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 A flowchart illustrating a data caching management method provided in an embodiment of this application; Figure 2 A flowchart illustrating a method for determining the cache priority of target data provided in an embodiment of this application; Figure 3 A flowchart illustrating a method for determining the cache level of target data provided in an embodiment of this application; Figure 4 A flowchart illustrating a method for adjusting the cache capacity of a data cache management system provided in this application embodiment; Figure 5 A flowchart illustrating a cache capacity management method for a data cache management system provided in this application embodiment; Figure 6 A flowchart illustrating another data caching management method provided in an embodiment of this application; Figure 7 A flowchart illustrating a method for determining a cache prefetching strategy provided in an embodiment of this application; Figure 8 A flowchart illustrating a data prefetching strategy provided in an embodiment of this application; Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0021] To better understand the technical solution of this application, the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0022] It should be understood that the described embodiments are merely some, not all, of the embodiments in this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.
[0023] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. The singular forms “a,” “the,” and “the” used in the embodiments of this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.
[0024] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0025] To alleviate read / write pressure on the underlying storage system and improve data access speed, caching technology is widely used in big data processing architectures. The key lies in storing target data in storage media of different speeds based on data access patterns (such as access frequency), thereby reducing the average query latency. Specifically, frequently accessed data is stored in high-speed storage media (high-speed cache), while less frequently accessed data is stored in low-speed storage media (low-speed cache). In this way, high-frequency, hot data, which has the greatest impact on the average query latency of the cache, is stored in the fastest storage tier. When a data request occurs, there is a higher probability that it will be directly hit in the high-speed cache, resulting in a faster response time. Low-frequency, non-hot data is migrated to the low-speed cache. This layered design avoids the ineffective use of expensive high-speed cache space by non-hot data while ensuring that access to this data is faster than directly returning to the underlying storage. Therefore, while ensuring the performance of core business operations, it improves the resource utilization efficiency of the entire data caching management system and reduces the average data access latency.
[0026] However, related technologies still have certain limitations in cache management. On the one hand, these technologies typically employ fixed strategies to configure the cache level and priority of target data. While such strategies are simple to implement and have low deployment costs, they cannot dynamically perceive and adapt to real-time changes in data access patterns. When faced with periodic access, sudden traffic spikes, or queries with complex relationships, this static configuration often leads to a disconnect between cached content and actual needs. Hot data fails to enter the cache in a timely manner, while non-hot data occupies resources for extended periods, resulting in low cache resource utilization and unsatisfactory cache hit rates.
[0027] On the other hand, existing cache management methods typically only consider the frequency of data access when evaluating cache management, neglecting other equally important factors (such as data block size and data expiration type). This single-dimensional approach often results in low granularity of cache management, making it impossible to formulate optimal cache management strategies. Consequently, cache hit rates are low, average data access latency is high, and user experience is significantly impacted.
[0028] To address the aforementioned issues, this application provides a data caching management method. By adjusting the cache priority and cache level of the target data in real time according to changes in the access pattern of the target data, the adaptability of cache management to complex scenarios is improved. Furthermore, by simultaneously considering the access frequency, space occupied, and timeliness type of the target data, the cache level and cache priority of the target data are determined from multiple dimensions, significantly improving the granularity of cache management, increasing the cache hit rate, and reducing the average query latency of the data.
[0029] See Figure 1 This is a flowchart illustrating a data caching management method provided in an embodiment of this application. Figure 1 As shown, the method specifically includes the following steps.
[0030] Step S101: Determine the cache priority of the target data based on the access frequency of the target data in the first preset time interval and the space occupied by the target data.
[0031] The target data refers to the data stored in the data caching management system that requires caching management (such as adjusting cache levels and cache priorities). The first preset time interval refers to a preset time interval prior to the current moment, that is, the time period used to statistically analyze the historical access behavior of the target data.
[0032] The cache priority of target data refers to the order in which target data is cached; the higher the cache priority, the earlier it is cached. The access frequency of target data within a first preset time interval refers to the number of times the target data is accessed within that time interval. The storage space occupied by target data refers to the amount of storage space occupied by the target data and its associated structures in the caching system. The associated structures include, but are not limited to, data metadata, indexes, or descriptions of the logical groups to which the data belongs (such as data tables, data partitions, etc.). In practical applications, the access frequency and storage space occupied by the target data can be obtained by accessing the system logs and access records of the data caching management system.
[0033] In this embodiment, the cache priority of the target data is determined based on the access frequency and storage space occupied by the target data within a first preset time interval. It is understood that the higher the access frequency of the target data within the first preset time interval, the higher the cache priority should be; that is, the access frequency and cache priority are positively correlated. The storage space occupied by the target data is also positively correlated with the cache priority. Specifically, the larger the storage space occupied by the target data, the longer the transmission time required to request the target data, and the higher the latency. To reduce latency, the storage space occupied by the target data should be positively correlated with its priority.
[0034] In practical applications, in order to better evaluate the caching priority of target data, it is necessary to refine the method for determining the caching priority of target data.
[0035] See Figure 2 This is a flowchart illustrating a method for determining the caching priority of target data according to an embodiment of this application. Figure 2 As shown, the method specifically includes the following steps.
[0036] Step S201: Determine the first cache priority of the target data based on the access frequency of the target data in the first preset time interval.
[0037] First, the first priority of the target data is determined based on its access frequency within a first preset time interval. This can be done by comparing the access frequency of the target data with a preset access frequency; the higher the access frequency of the target data compared to the preset access frequency, the higher its first priority; conversely, the lower the access frequency of the target data compared to the preset access frequency, the lower its first priority. For ease of quantification, the first cache priority of the target data can be represented numerically.
[0038] The preset access frequency can be determined based on the historical average access frequency of the target data and the business importance coefficient of the data, such as according to the formula: Preset access frequency = Historical average access frequency of target data × (1 + 0.3 × Business importance coefficient).
[0039] For example, assuming the historical average access frequency of vehicle real-time status data is 500 times per minute and the business importance coefficient of this data is 1.0, then the data access frequency is 650 times per minute. Assuming the access frequency of vehicle real-time status data in a first preset time interval is 5000 times per minute, the first cache priority can be determined based on the degree to which 5000 is greater than 650. For example, the ratio of 5000 to 650, 7.69, can be determined as the first cache priority for this data.
[0040] In practical applications, the preset access frequency can be dynamically changed according to the historical average access frequency, thereby improving the adaptability of cache management to complex scenarios. If the access frequency of target data in the first preset time interval is greater than or equal to the preset access frequency, the target data can be defined as hot data; if the access frequency of target data in the first preset time interval is less than the preset access frequency, the target data can be defined as non-hot data.
[0041] Step S202: Determine the second cache priority of the target data based on the weighted value of the access frequency ratio of the target data in the first preset time interval and the space occupied by the target data.
[0042] In practical applications, cache priority may not be completely positively correlated with the space occupied. Therefore, it is necessary to combine the access frequency of the target data in the first preset time interval with the space occupied by the target data to jointly determine the second cache priority of the target data.
[0043] In step S202, the access frequency ratio of the target data in the first preset time interval is the ratio of the access frequency of the target data in the first preset time interval to the access frequency of all data in the first preset time interval, which can be used to reflect the access frequency relationship between the target data and all data; the space occupied by the target data is the ratio of the space occupied by the target data to the available space of the data cache management system, which can be used to reflect the relationship between the space occupied by the target data and the overall available space of the data cache management system; by combining the data access patterns of the target data and all data, the second cache priority of the target data can be determined more accurately.
[0044] For ease of quantification, the second cache priority of the target data can be represented by a numerical value.
[0045] For example, assuming the user charging behavior data occupies 500GB of space, and the available space of the cache management system is 8TB, then the space occupied by this data is 500 / 8000=0.0625; assuming the access frequency of the user charging behavior data in the first preset time interval is 800 times per minute, and the access frequency of all data in the first preset time interval is 1000 times per minute, then the access frequency ratio of this data in the first preset time interval is 800 / 1000=0.8; if the weights of the above two are both 0.5, then the second cache priority of this data is 0.43.
[0046] Step S203: Determine the cache priority of the target data based on the weighted value of the first cache priority and the second cache priority of the target data.
[0047] In the above text, the first cache priority of the target data was determined based on the access frequency of the target data in the first preset time interval, and the second cache priority of the target data was determined based on the access frequency of the target data in the first preset time interval and the space occupied by the target data. By combining the two (weighting), a cache priority of the target data that takes into account the multi-dimensional data access patterns can be obtained, which has higher accuracy.
[0048] Step S102: Determine the cache level of the target data based on the timeliness type of the target data, the access frequency of the target data in the first preset time interval, and the space occupied by the target data.
[0049] The timeliness type of the target data includes real-time data and non-real-time data. Real-time data (such as vehicle status data) refers to data used in business scenarios that require immediate response, such as online transactions, real-time monitoring, or high-frequency data processing. In such scenarios, the real-time nature of the data is crucial to ensuring service accuracy; any significant access delay may lead to business failure or a degraded user experience. Non-real-time data (such as user charging behavior data) does not possess the above characteristics.
[0050] The cache hierarchy includes a high-speed cache and a low-speed cache. The high-speed cache is composed of media with low latency and high bandwidth characteristics, including but not limited to dynamic random access memory or high-speed solid-state drives (SSDs). The low-speed cache is composed of relatively low-speed media, including but not limited to SSDs or high-speed hard disk drives (HDDs). Of course, those skilled in the art can adjust the specific composition of the cache hierarchy according to actual needs, such as adopting a more refined layering method; this application does not impose specific limitations on this.
[0051] In this embodiment, the determination of the cache level for target data takes into account the timeliness type, access frequency, and space occupied by the target data. For example, a basic cache level can be determined first based on the timeliness type and access frequency of the target data, and then the basic cache level can be modified based on the space occupied.
[0052] Of course, those skilled in the art can adjust the specific method of determining the cache level according to actual needs, and the embodiments of this application do not impose specific limitations on this.
[0053] Step S103: Adjust the caching method for the target data according to the cache priority and cache level of the target data.
[0054] In the steps above, the cache priority and cache level of the target data have been determined. Therefore, in this step, we only need to adjust the cache of the target data based on its cache priority and cache level.
[0055] For example, the target storage pool to which the target data should be written can be determined first based on the cache level of the target data. Then, it can be checked whether the remaining space in the target storage pool is sufficient to store the target data. If the space is sufficient, the target data is stored in the target storage pool. If the space is insufficient, all existing data in the target storage pool is traversed, their cache priorities are compared, and one or more data with the lowest priority are selected to replace them until enough space is freed up before the target data is stored.
[0056] In this embodiment, the caching level and priority of the target data can be adjusted periodically based on a preset time, thereby achieving dynamic adjustment. This period can be adjusted according to the time-sensitive nature of the target data; for example, real-time data can be adjusted every 10 minutes, and non-real-time data every 24 hours.
[0057] Of course, those skilled in the art can adjust the caching operation of the target data according to actual needs, and the embodiments of this application do not impose specific limitations on this.
[0058] In this embodiment, the cache priority and cache level of the target data are adjusted in real time according to the changes in the access pattern of the target data, which improves the adaptability of cache management to complex scenarios. Furthermore, the cache level and cache priority of the target data are determined from multiple dimensions by considering the access frequency, space occupied and time type of the target data, which significantly improves the granularity of cache management, increases the cache hit rate and reduces the average query latency of the data.
[0059] In practical applications, in order to ensure that the caching level of the target data can accurately reflect the caching requirements of the target data, it is necessary to refine the determination of the caching level of the target data.
[0060] See Figure 3 This is a flowchart illustrating a method for determining the cache level of target data according to an embodiment of this application. Figure 3 As shown, the method specifically includes the following steps.
[0061] Step S301: If the time-sensitive type of the target data is real-time data, then determine the cache level of the target data as a high-speed cache.
[0062] As mentioned above, real-time data is used in business scenarios requiring immediate responses, such as online transactions, real-time monitoring, or high-frequency data processing. In these scenarios, the real-time nature of the data is crucial to ensuring service correctness; any significant access delay can lead to business failure or a degraded user experience. Understandably, real-time data has strict requirements for caching levels. Therefore, if the target data is real-time, the caching level for the target data can be directly determined to be a high-speed cache.
[0063] Step S302: If the time-sensitive type of the target data is non-real-time data, then determine the cache level of the target data based on the access frequency of the target data in the first preset time interval and the space occupied by the target data.
[0064] In this embodiment of the application, if the timeliness type of the target data is non-real-time data, it means that the timeliness type of the data does not have a direct requirement for the cache level. However, in order for the cache level of the target data to accurately reflect the access mode of the target data, it is also necessary to determine the cache level of the target data based on the data access frequency of the target data in the first preset time interval and the size of the space occupied by the target data.
[0065] In one possible implementation, a first cache level for the target data is determined based on the access frequency of the target data in a first preset time interval; a second cache level for the target data is determined based on the space occupied by the target data; and the cache level of the target data is determined based on the weighted value of the first cache level and the second cache level.
[0066] In simple terms, the first and second cache levels of the target data are determined based on the access frequency and space occupied by the target data in the first preset time interval. By combining the two, a cache level that accurately reflects the access frequency and space occupied by the target data can be obtained.
[0067] In another possible implementation, the cache priority of the target data can be determined directly based on the weighted value of the ratio of the access frequency of the target data in the first preset time interval to the ratio of the space occupied by the target data.
[0068] In practical applications, simply considering the access frequency, space usage, and timeliness of target data for caching can lead to a multi-dimensional approach to target data caching management. However, in practice, it is also necessary to consider the hardware performance of the data caching management system (such as load performance) to avoid the inability to adjust the caching of target data due to insufficient system hardware (such as cache fullness).
[0069] See Figure 4 This is a flowchart illustrating a method for adjusting the cache capacity of a data cache management system provided in an embodiment of this application. Figure 4 As shown, the method specifically includes the following steps.
[0070] Step S401: Determine the load index of the data cache management system based on the weighted values of CPU utilization, memory utilization, network bandwidth, and disk I / O of the data cache management system.
[0071] The system load index is measured by several metrics: CPU utilization to assess computational load, memory utilization to assess memory resource pressure, network bandwidth utilization to assess network transmission load, and disk I / O to assess storage access load. These metrics represent the current load status of the data caching management system from multiple perspectives. Based on these metrics, the load values of these four dimensions are weighted and summed using preset weights to generate a comprehensive system load index.
[0072] For example, the load index = 0.4 × CPU utilization + 0.3 × memory utilization + 0.2 × network bandwidth + 0.1 × disk I / O. Of course, those skilled in the art can adjust the coefficients according to actual needs, and the embodiments of this application do not impose specific limitations in this regard.
[0073] Step S402: Based on the comparison between the load index of the data cache management system and the load index threshold, determine the method for adjusting the cache capacity of the data cache management system.
[0074] The load index threshold is a reference value used to measure the system load of the data cache management system. By comparing the current system load with this reference value, the current load of the data cache management system can be accurately measured, and a corresponding cache capacity adjustment method can be formulated based on the load.
[0075] For example, when the load index of the data cache management system is greater than the load index threshold, the cache capacity is increased accordingly; when the load index of the data cache management system is less than the load index threshold, the cache capacity is reduced accordingly.
[0076] In practical applications, in order to make the adjustment of cache capacity more in line with actual applications, it is necessary to further refine the method of adjusting cache capacity.
[0077] In one possible implementation, if the load index of the data cache management system is greater than or equal to a first load index threshold, the cache capacity of the data cache management system is increased; if the load index of the data cache management system is less than or equal to a second load index threshold, the cache capacity of the data cache management system is decreased.
[0078] The first load index threshold represents the upper limit of the data cache management system's load. If this limit is exceeded, it indicates that the current system's cache capacity is insufficient to meet data access demands, thus requiring an expansion of the cache capacity. The second load index threshold represents the lower limit of the data cache management system's load. If the load is below this threshold, it indicates that the current system's cache capacity has significant spare capacity. To conserve system resources, the cache capacity can be reduced, releasing idle storage resources to other applications or system processes. In essence, when the data management system's load index falls between the first and second load indices, the current system load is within a reasonable range, and therefore, no adjustment to the cache capacity is necessary.
[0079] The following section, with reference to the accompanying diagram, explains how to adjust the cache capacity.
[0080] See Figure 5 This is a flowchart illustrating a cache capacity management method for a data cache management system provided in an embodiment of this application.
[0081] like Figure 5 As shown, the system monitors resource usage in real time, including CPU utilization, memory utilization, network bandwidth, and disk I / O. It sets corresponding system load index thresholds and evaluates the current system load index. If the current system load index is greater than the first load index threshold, the system cache capacity is increased; if the current system load index is less than the second load index threshold, the system cache capacity is reduced; if the current system load index is less than or equal to the first load index threshold and greater than or equal to the second load index threshold, the system cache capacity remains unchanged.
[0082] In practical applications, the first load index threshold and the second load index threshold can be set to 0.8 and 0.6, respectively. Of course, those skilled in the art can adjust them according to actual needs, and this application embodiment does not impose specific limitations in this regard.
[0083] In practical applications, the expansion and reduction of cache capacity can be achieved by directly adjusting the capacity of a single cache node. However, this method has problems, such as the possibility of forcibly evicting critical data when reducing capacity, and the potential for prolonged memory allocation and data warm-up when expanding capacity.
[0084] Therefore, in one possible implementation, expanding the cache capacity of the data cache management system includes: increasing the number of cache nodes and expanding the cache capacity of the cache nodes; reducing the cache capacity of the data cache management system includes: reducing the number of cache nodes and reducing the cache capacity of the cache nodes.
[0085] It is understandable that the cache capacity can be adjusted by simultaneously adjusting the combination of the number of cache nodes and the cache capacity of the cache nodes, thereby achieving fine-grained adjustment of the cache capacity.
[0086] In practical applications, the method for adjusting the cache capacity can be determined based on the current system load index and the first load index threshold.
[0087] For example, the number of cache nodes to be added can be calculated by multiplying the difference between the system's load index and a first load index threshold by a coefficient (such as 2) and then rounding up; the number of cache nodes to be reduced can be calculated by multiplying the difference between the second load index threshold and the system's load index by a coefficient (such as 2) and then rounding down. Similarly, the expansion ratio of cache node capacity can be determined by multiplying the difference between the system's load index and the first load index threshold by a coefficient (such as 0.5); the reduction ratio of cache node capacity can be determined by multiplying the difference between the second load index threshold and the system's load index by a coefficient (such as 0.5).
[0088] For example, assuming the system load index is 0.83, the cache capacity is 12TB, the first load index threshold is 0.8, and the second load index threshold is 0.6, it will obviously trigger the expansion of the cache capacity, increasing the number of cache nodes by (0.83-0.8)×2=0.06, which rounds up to 1; the capacity expansion ratio of the cache nodes is (0.83-0.8)×0.5=1.5%; that is, one more cache node will be added, and the cache capacity of the cache node will be expanded to 12×(100%+1.5%)=12.18TB.
[0089] Of course, those skilled in the art can adjust the method of adjusting the cache capacity according to actual needs, and the embodiments of this application do not impose specific limitations on this.
[0090] In practical applications, determining the cache level of target data solely by comparing its historical access frequency with the preset access frequency cannot fully account for the changing access frequency of the target data.
[0091] See Figure 6 This is a flowchart illustrating another data caching management method provided in an embodiment of this application. Figure 6 As shown, the method specifically includes the following steps.
[0092] Step S601: Compare the access frequency of the target data in the first preset time interval with the historical access frequency of the target data.
[0093] The historical access frequency of the target data can be the instantaneous access frequency of the target data at a specific historical moment (such as the last evaluation moment), or it can be the access data based on a continuous historical period before the first preset time interval.
[0094] Step S602: If the ratio of the access frequency of the target data in the first preset time interval to the historical access frequency of the target data is greater than the preset ratio, then the cache level of the target data is determined to be a high-speed cache.
[0095] The ratio of the access frequency of the target data in the first preset time interval to the historical access frequency of the target data is used to characterize the change relationship of the access frequency of the target data. If the ratio is greater than 1, it indicates that the access frequency of the target data is increasing; if the ratio is less than 1, it indicates that the access popularity of the target data is decreasing; if the ratio is approximately equal to 1, it indicates that its access popularity is in a relatively stable state. The preset ratio is a reference value for the change in the access frequency of the target data (e.g., 1.5), used to characterize the growth rate of the preset ratio.
[0096] In this embodiment of the application, if the ratio of the access frequency of the target data in the first preset time interval to the historical access frequency of the target data is greater than the preset ratio, it indicates that the access frequency of the target data has increased significantly. Therefore, its caching level can be determined as a high-speed cache so that users can access the data faster.
[0097] In one possible implementation, a threshold can be set as a supplementary condition if the ratio of the access frequency of the target data in the first preset time interval to the historical access frequency of the target data is greater than a preset ratio, thereby improving the rigor of the judgment condition.
[0098] Step S603: If the ratio of the access frequency of the target data in the first preset time interval to the historical access frequency of the target data is less than the preset ratio, then the cache level of the target data is determined to be low-speed cache.
[0099] In this embodiment of the application, if the ratio of the access frequency of the target data in the first preset time interval to the historical access frequency of the target data is less than the preset ratio, it indicates that the growth rate of the access frequency of the target data is low. Therefore, its caching level can be determined as low-speed caching in order to save system resources.
[0100] In one possible implementation, a threshold can be set as a supplementary condition if the ratio of the access frequency of the target data in the first preset time interval to the historical access frequency of the target data is less than a preset ratio, thereby improving the rigor of the judgment condition.
[0101] In practical applications, the method for determining the target data caching level as a low-speed cache can be further improved. For example, if the ratio of the access frequency of the target data in the first preset time interval to the historical access frequency of the target data is less than the preset ratio when the target data is evaluated multiple times (e.g., 5 times), the caching level of the target data can then be determined as a low-speed cache.
[0102] At the same time, the effect of adjusting the cache level can be evaluated, such as by assessing the effect of the adjustment through indicators such as system response time and cache hit rate, and then the cache level can be adjusted again based on the effect of the adjustment.
[0103] Of course, those skilled in the art can adjust the specific implementation of cache level adjustment according to actual needs, and the embodiments of this application do not impose specific limitations on this.
[0104] In practical applications, the access frequency of target data will show periodic peaks. Therefore, in order to reduce the cache management pressure of the system, a cache prefetching strategy can be adopted.
[0105] See Figure 7 This is a flowchart illustrating a method for determining a cache prefetching strategy provided in an embodiment of this application. Figure 7 As shown, the method specifically includes the following steps.
[0106] Step S701: Input the historical access records of the data cache management system into the prediction model, and output the access frequency of the target data in the second preset time interval and the load index of the data cache management system in the second preset time interval.
[0107] The historical access records of the data cache management system include the access time of the target data, the access frequency of the target data in the third preset time interval, the space occupied by the target data, and the load index of the data cache management system in the third preset time interval.
[0108] The third preset time interval refers to a historical time window. In practical applications, the length of this historical time window can be equal to or greater than the first preset time interval to accommodate different analytical needs. The second preset time interval is a future time window.
[0109] The prediction model is used to predict the access frequency and load index of target data in a second preset time interval. In practical applications, the prediction model can use the random forest algorithm and be trained in advance using historical access records, so that it can learn the inherent patterns of data access and load change patterns (prediction accuracy greater than 85%), and achieve accurate prediction of future load and access frequency.
[0110] For example, a predictive model is used to predict the real-time status data of vehicles. The prediction shows that the access frequency of the real-time status data of vehicles during the morning peak period (7:00-9:00) is 1,000 times, and the system load index during the morning peak period is 0.85.
[0111] In this embodiment, the historical access records of the data caching management system are input into the prediction model to obtain the access frequency of the target data in the second preset time interval and the load index of the data caching management system in the second preset time interval.
[0112] Step S702: If the access frequency of the target data in the second preset time interval is greater than the access frequency threshold, then based on the comparison result between the load index of the data cache management system in the second preset time interval and the prefetch load index threshold, determine the cache prefetching strategy of the data cache management system for the target data in the second preset time interval.
[0113] The access frequency threshold is a reference value used to evaluate the access frequency of the target data. In practical applications, the access frequency threshold can be equal to or different from the preset access frequency mentioned above, thus adapting to different needs.
[0114] In this embodiment of the application, if the access frequency of the target data in the second preset time interval is greater than the access frequency threshold, it means that the data needs to be prefetched, that is, the access frequency of the target data has reached the prefetching requirement.
[0115] Therefore, based on the comparison between the load index of the data caching management system and the prefetch load index threshold in the second preset time interval, a specific data prefetching strategy is determined.
[0116] For example, if the load index of the data caching management system in the second preset time interval is greater than the prefetch load index threshold, then a portion of the target data is prefetched; if the load index of the data caching management system in the second preset time interval is less than the prefetch load index threshold, then all of the target data is prefetched. It can be understood that the target data may consist of multiple fields, and partial prefetching means prefetching only a portion of the target data's fields.
[0117] In practical applications, in order to make the prefetching strategy more adaptable, it is also necessary to limit the prefetching strategy.
[0118] See Figure 8 This is a flowchart illustrating a data prefetching strategy provided in an embodiment of this application. Figure 8 As shown, firstly, the load index of the data caching management system output by the above prediction model is obtained in the second preset time interval, and then specific first prefetch load index threshold and second prefetch load index threshold are set.
[0119] If the load index of the data caching management system in the second preset time interval is less than or equal to the first prefetch load index threshold, then the target data is cached and prefetched according to the first preset cache prefetch range.
[0120] Specifically, if the load index of the data caching management system in the second preset time interval is less than or equal to the first prefetch load index threshold, it indicates that the load index of the data caching management system in the second preset time interval is relatively small, and therefore the target data can be fully prefetched. In practical applications, the first preset cache prefetch range is usually 1.2 times the historical average prefetch amount of all data. Of course, those skilled in the art can adjust the first preset cache prefetch range according to actual needs, such as directly setting a value; this application embodiment does not impose specific limitations on this.
[0121] If the load index of the data caching management system in the second preset time interval is greater than or equal to the second prefetch load index threshold, then the target data is cached and prefetched according to the second preset cache prefetch range.
[0122] Specifically, if the load index of the data caching management system in the second preset time interval is greater than or equal to the second prefetch load index threshold, it indicates that the load index of the data caching management system in the second preset time interval is high, and therefore it is necessary to limit the prefetch range of the target data. In practical applications, the second preset cache prefetch range is usually 0.8 times the historical average prefetch amount of all data. Of course, those skilled in the art can adjust the second preset cache prefetch range according to actual needs, such as directly setting a value; this application embodiment does not impose specific limitations on this.
[0123] If the load index of the data caching management system in the second preset time interval is greater than the first prefetch load index threshold and less than the second prefetch load index threshold, then the target data is cached and prefetched according to the third preset cache prefetch range.
[0124] Specifically, if the load index of the data caching management system in the second preset time interval is greater than the first prefetch load index threshold but less than the second prefetch load index threshold, it indicates that the load index of the data caching management system in the second preset time interval is moderate. Therefore, it is only necessary to prefetch the target data according to the commonly used prefetch range. In practical applications, the third preset cache prefetch range is usually approximately equal to the historical average prefetch amount of all data. Of course, those skilled in the art can adjust the third preset cache prefetch range according to actual needs, such as directly setting a value. This application embodiment does not impose specific limitations on this.
[0125] It should be noted that the third preset cache prefetch range is larger than the second preset cache prefetch range, and the third preset cache prefetch range is smaller than the first preset cache prefetch range.
[0126] In practical applications, the first prefetch load index threshold can be equal to the first load index threshold, and the second prefetch load index threshold can be equal to the second load index threshold. Of course, they can also be different, and those skilled in the art can adjust them according to actual needs. This application does not impose specific limitations on this.
[0127] In practical applications, the cache hit rate after prefetching can also be adjusted. If the hit rate is lower than a certain threshold (such as 70%), the prefetching strategy can be adjusted again.
[0128] To facilitate understanding, the following explanation of data caching management methods will be provided using specific examples.
[0129] For example, through caching (such as Alluxio caching), the system can analyze vehicle status data in real time and predict potential risks. For instance, if it detects a vehicle traveling too fast while making a sharp turn, the system can issue a warning within 50ms. To ensure low latency even during peak traffic periods (such as morning rush hour), the system automatically adds cache nodes during each morning rush hour to ensure the real-time performance of the safety warning system. User charging behavior data is cached in the high-speed cache, facilitating parallel processing of multiple tasks. The system predicts the access frequency of user charging behavior data using a predictive model and prefetches data in advance. For example, if the system predicts increased demand for charging behavior analysis on weekends, it adjusts the caching strategy in advance, increasing the cache hit rate of user charging behavior data from 60% to 85%.
[0130] Corresponding to the above embodiments, this application also provides an electronic device.
[0131] See Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 9 As shown, the electronic device 900 may include a processor 901, a memory 902, and a communication unit 903. These components communicate via one or more buses. Those skilled in the art will understand that the electronic device structure shown in the figures does not constitute a limitation on the embodiments of this application. It may be a bus topology or a star topology, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0132] The communication unit 903 is used to establish a communication channel, thereby enabling the electronic device to communicate with other devices.
[0133] The processor 901 serves as the control center of the electronic device, connecting various parts of the device via various interfaces and lines. It executes software programs and / or modules stored in the memory 902, and calls data stored in the memory to perform various functions and / or process data. The processor may be composed of integrated circuits (ICs), such as a single packaged IC or multiple packaged ICs with the same or different functions connected together. For example, the processor 901 may consist only of a central processing unit (CPU). In this embodiment, the CPU may have a single processing core or include multiple processing cores.
[0134] Memory 902 is used to store the execution instructions of processor 901. Memory 902 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0135] When the execution instructions in memory 902 are executed by processor 901, the electronic device 900 is able to perform some or all of the steps in the above method embodiments.
[0136] Corresponding to the above embodiments, this application also provides a computer-readable storage medium, wherein the computer-readable storage medium may store a program, wherein when the program runs, it can control the device where the computer-readable storage medium is located to execute some or all of the steps in the above method embodiments. In specific implementation, the computer-readable storage medium may be a magnetic disk, an optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0137] Corresponding to the above embodiments, this application also provides a computer program product containing executable instructions that, when executed on a computer, cause the computer to perform some or all of the steps in the above method embodiments.
[0138] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, the simultaneous existence of A and B, or the existence of B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects have an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, and c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0139] Those skilled in the art will recognize that the units and algorithm steps described in the embodiments disclosed herein can be implemented using electronic hardware, computer software, or a combination of electronic hardware and software. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can 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.
[0140] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the data caching management system, device and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0141] In the several embodiments provided in this application, any function, if implemented as a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0142] The above description is merely a specific embodiment of this application. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the protection scope of this application. The protection scope of this application should be determined by the protection scope of the claims.
Claims
1. A data caching management method, applied to a data caching management system, characterized in that, include: The cache priority of the target data is determined based on the access frequency of the target data in the first preset time interval and the space occupied by the target data. The cache level of the target data is determined based on the timeliness type of the target data, the access frequency of the target data in a first preset time interval, and the space occupied by the target data. The cache level includes high-speed cache and low-speed cache. The caching method for the target data is adjusted based on the cache priority and cache level of the target data.
2. The method according to claim 1, characterized in that, The step of determining the cache priority of the target data based on the access frequency of the target data in a first preset time interval and the space occupied by the target data includes: The first cache priority of the target data is determined based on the access frequency of the target data in the first preset time interval; The second cache priority of the target data is determined based on the weighted value of the access frequency ratio of the target data in the first preset time interval and the space occupied by the target data. The cache priority of the target data is determined based on the weighted value of the first cache priority and the second cache priority of the target data. Wherein, the access frequency ratio of the target data in the first preset time interval is the ratio of the access frequency of the target data in the first preset time interval to the access frequency of all data in the first preset time interval, and the space occupied by the target data is the ratio of the space occupied by the target data to the available space of the data cache management system.
3. The method according to claim 1, characterized in that, The step of determining the cache level of the target data based on the timeliness type of the target data, the access frequency of the target data within a first preset time interval, and the space occupied by the target data includes: If the time-sensitive type of the target data is real-time data, then the cache level of the target data is determined to be a high-speed cache; If the time-sensitive type of the target data is non-real-time data, then the cache level of the target data is determined based on the access frequency of the target data in the first preset time interval and the space occupied by the target data.
4. The method according to claim 3, characterized in that, The step of determining the cache level of the target data based on the access frequency of the target data within a first preset time interval and the space occupied by the target data includes: The first cache level of the target data is determined based on the access frequency of the target data in the first preset time interval; Based on the space occupied by the target data, determine the second cache level of the target data; The cache level of the target data is determined based on the weighted value of the first cache level and the second cache level of the target data.
5. The method according to claim 1, characterized in that, Also includes: The load index of the data cache management system is determined based on the weighted values of CPU utilization, memory utilization, network bandwidth, and disk I / O of the data cache management system. Based on the comparison between the load index of the data cache management system and the load index threshold, the method for adjusting the cache capacity of the data cache management system is determined.
6. The method according to claim 5, characterized in that, The method for determining the cache capacity adjustment of the data cache management system based on the comparison result of the load index of the data cache management system and the load index threshold includes: If the load index of the data cache management system is greater than or equal to the first load index threshold, then the cache capacity of the data cache management system is expanded. If the load index of the data cache management system is less than or equal to the second load index threshold, then the cache capacity of the data cache management system is reduced.
7. The method according to claim 6, characterized in that, Expanding the cache capacity of the data cache management system includes: increasing the number of cache nodes and expanding the cache capacity of the cache nodes; Reducing the cache capacity of the data cache management system includes: reducing the number of cache nodes and reducing the cache capacity of the cache nodes.
8. The method according to claim 1, characterized in that, Also includes: Compare the access frequency of the target data in the first preset time interval with the historical access frequency of the target data; If the ratio of the access frequency of the target data in the first preset time interval to the historical access frequency of the target data is greater than a preset ratio, then the cache level of the target data is determined to be a high-speed cache. If the ratio of the access frequency of the target data in the first preset time interval to the historical access frequency of the target data is less than a preset ratio, then the cache level of the target data is determined to be a low-speed cache.
9. The method according to claim 1, characterized in that, Also includes: The historical access records of the data caching management system are input into the prediction model, and the access frequency of the target data in the second preset time interval and the load index of the data caching management system in the second preset time interval are output. If the access frequency of the target data in the second preset time interval is greater than the access frequency threshold, then the caching prefetching strategy of the data caching management system for the target data in the second preset time interval is determined based on the comparison result between the load index of the data caching management system in the second preset time interval and the prefetch load index threshold. The historical access records of the data caching management system include the access time of the target data, the access frequency of the target data in a third preset time interval, the space occupied by the target data, and the load index of the data caching management system in the third preset time interval.
10. The method according to claim 9, characterized in that, The step of determining the caching prefetching strategy for the target data in the second preset time interval based on the comparison result between the load index of the data caching management system in the second preset time interval and the prefetch load index threshold includes: If the load index of the data caching management system in the second preset time interval is less than or equal to the first prefetch load index threshold, then the target data is cached and prefetched according to the first preset cache prefetch range. If the load index of the data caching management system in the second preset time interval is greater than or equal to the second prefetch load index threshold, then the target data is cached and prefetched according to the second preset cache prefetch range. If the load index of the data caching management system in the second preset time interval is greater than the first prefetch load index threshold and less than the second prefetch load index threshold, then the target data is cached and prefetched according to the third preset cache prefetch range. Wherein, the third preset cache prefetch range is greater than the second preset cache prefetch range, and the third preset cache prefetch range is less than the first preset cache prefetch range.
11. An electronic device, characterized in that, include: processor; Memory; And a computer program, wherein the computer program is stored in the memory, and when the computer program is executed by the processor, causes the electronic device to perform the method of any one of claims 1 to 10.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method described in any one of claims 1 to 10.
13. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method described in any one of claims 1 to 10.