Cache optimization method and device, equipment, storage medium and computer program product
By updating the cache policy and optimizing the cache content, combined with the method of dynamic path selection, the problems of low cache hit rate and high content transmission cost in the existing technology are solved, and efficient cache management and storage resource utilization are achieved.
Patent Information
- Application Number
- CN202411606632.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-11-11
AI Technical Summary
When facing large-scale and dynamically changing network environments, the existing cache management methods have low cache hit rate, high content transmission cost, and it is difficult to balance the utilization of cache space and the frequency of content updates.
By obtaining the data information of each cache node in different cache levels, updating the cache policy, optimizing the cache content, and dynamic path selection when user content requests, obtaining the target cache content.
It effectively improves the cache hit rate, reduces content transmission costs, and realizes efficient utilization of storage resources and optimization of access performance.
Smart Images

Figure CN119484641A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cache optimization technology, and in particular to a cache optimization method, apparatus, device, storage medium and computer program product. Background Art
[0002] Distributed cache technology is an important part of edge computing. By storing popular content on network edge servers, it can significantly reduce the number of requests back to the source server and alleviate network congestion. However, due to the uneven temporal and spatial distribution of content requests and the dynamic changes in the network environment, how to achieve efficient cache management in the edge cloud has become an important research topic. Although the existing cache management methods perform well in certain specific scenarios, there is still a lot of room for improvement when facing large-scale and dynamically changing network environments. First, the cache content placement and update strategies often lack dynamic adjustment capabilities and cannot adapt to changes in network traffic in real time, resulting in a low cache hit rate and affecting user experience. Secondly, in a multi-level cache structure, the collaboration and content transmission efficiency between levels need to be improved. Existing methods often encounter bottlenecks in cross-level content transmission, which increases transmission delays. In addition, cache elimination strategies are difficult to balance the utilization of cache space and the frequency of content updates, resulting in a waste of cache resources or frequent cache replacement overhead.
[0003] Therefore, how to effectively improve the cache hit rate and reduce the content transmission cost is a problem that needs to be solved urgently.
[0004] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0005] The main purpose of this application is to provide a cache optimization method, device, equipment and storage medium, aiming to solve the technical problem of how to effectively improve the cache hit rate and reduce the content transmission cost.
[0006] To achieve the above objectives, the present application proposes a cache optimization method, which includes:
[0007] Acquire data information of each cache node in different cache levels, and update the cache strategy based on the data information to obtain an updated cache strategy, wherein the different cache levels include a local cache level, a regional cache level, and a global cache level;
[0008] Optimizing each cache level based on the updated cache strategy to obtain optimized cache content;
[0009] In response to a user's content request, dynamically select a path at different cache levels to obtain a target request path;
[0010] The target cache content is obtained from the optimized cache content based on the target request path.
[0011] In one embodiment, the step of obtaining data information of each cache node in different cache levels and updating the cache strategy based on the data information to obtain the updated cache strategy includes:
[0012] Get data information of each cache node in different cache levels;
[0013] Determine data characteristics and performance indicators of cached content in each cache node based on the data information;
[0014] Updating the data features and the performance indicators to obtain updated data features and updated performance indicators;
[0015] The cache strategy of each cache node in different cache levels is updated according to the updated data characteristics and the updated performance indicators to obtain an updated cache strategy.
[0016] In one embodiment, the step of updating the cache strategy of each cache node in different cache levels according to the updated data characteristics and the updated performance indicators to obtain the updated cache strategy includes:
[0017] Collecting user request data within a time window of a preset length;
[0018] constructing a data set based on the user request data, and determining an average gradient based on the data set;
[0019] Updating the model parameters of the local models corresponding to the cache nodes in the different cache levels according to the average gradient to obtain an updated local model;
[0020] Based on the updated data features, the updated performance indicators and the updated local model, the cache strategy of each cache node in different cache levels is updated to obtain an updated cache strategy.
[0021] In one embodiment, the step of optimizing each cache level based on the updated cache strategy to obtain optimized cache content includes:
[0022] Obtaining the cache capacity, current cache content set and new cache content set of each cache node in each cache level;
[0023] Determine, according to the updated cache strategy, a first content popularity of each cached content in the current cached content set and a second content popularity of each cached content in the new cached content set;
[0024] Each cache level is optimized according to the cache capacity, the first content popularity, and the second content popularity to obtain optimized cache content.
[0025] In one embodiment, the step of performing dynamic path selection at different cache levels in response to a user's content request to obtain a target request path includes:
[0026] In response to a user's content request, obtaining a query priority of each cache level, and performing dynamic path selection at different cache levels according to the query priority to determine a target cache level;
[0027] Query cache content of cache nodes in the target cache level according to the content request to obtain the target cache node;
[0028] A target request path is generated according to the target cache node.
[0029] In one embodiment, the step of querying cache content of a cache node in a target cache level according to the content request to obtain the target cache node comprises:
[0030] querying cache content of an initial cache node in a target cache level according to the content request to obtain a first query result;
[0031] When the first query result indicates that there is a hit cache content, taking the initial cache node as the target cache node;
[0032] When the first query result is that there is no hit cache content, obtaining the transition probability of the initial cache node, and determining a neighbor node based on the transition probability;
[0033] querying the cache content of the neighbor node according to the content request to obtain a second query result;
[0034] When the second query result indicates that there is a hit cache content, taking the neighbor cache node as the target cache node;
[0035] When the second query result is that there is no hit cache content, and the current query depth reaches the preset depth threshold or the current query time reaches the preset time threshold, the cache level of the next query priority is used as the target cache level, and the step of querying the cache content of the initial cache node in the target cache level according to the content request is executed to obtain the first query result.
[0036] In addition, to achieve the above purpose, the present application also proposes a cache optimization device, which includes:
[0037] An update module, used to obtain data information of each cache node in different cache levels, and update the cache strategy based on the data information to obtain an updated cache strategy, wherein the different cache levels include a local cache level, a regional cache level, and a global cache level;
[0038] An optimization module, used to optimize each cache level based on the updated cache strategy to obtain optimized cache content;
[0039] A selection module, configured to perform dynamic path selection at the different cache levels in response to a user's content request to obtain a target request path;
[0040] An acquisition module is used to acquire target cache content from the optimized cache content based on the target request path.
[0041] In addition, to achieve the above objectives, the present application also proposes a cache optimization device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the cache optimization method described above.
[0042] In addition, to achieve the above objectives, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the cache optimization method described above are implemented.
[0043] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the cache optimization method described above are implemented.
[0044] The present application provides a cache optimization method, which first obtains data information of each cache node in different cache levels, and updates the cache strategy based on the data information to obtain an updated cache strategy, wherein the different cache levels include a local cache level, a regional cache level, and a global cache level; optimizes each cache level based on the updated cache strategy to obtain optimized cache content; performs dynamic path selection at different cache levels in response to a user's content request to obtain a target request path; obtains the target cache content from the optimized cache content based on the target request path, which can effectively adapt to data requests of different sizes and types, realize efficient utilization of storage resources and optimization of access performance, effectively improve cache hit rate, and reduce content transmission costs.
[0045] In summary, the present application updates the cache strategy through the data information of each cache node in the cache hierarchy such as the local cache hierarchy, the regional cache hierarchy and the global cache hierarchy. Through the multi-level structure and the collaboration mechanism, it can effectively adapt to data requests of different sizes and types, realize the efficient utilization of storage resources and the optimization of access performance. It optimizes each cache hierarchy based on the updated cache strategy, which can effectively improve the cache hit rate, and then respond to user content requests, perform dynamic path selection at different cache levels and obtain the target cache content from the optimized cache content based on the target request path, effectively reducing the content transmission cost, and overcoming the technical defects of the existing cache management method of low cache hit rate and high content transmission cost. It can effectively adapt to data requests of different sizes and types, realize the efficient utilization of storage resources and the optimization of access performance, effectively improve the cache hit rate, and reduce the content transmission cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0047] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0048] Figure 1 A schematic diagram of a process flow provided for the first embodiment of the cache optimization method of the present application;
[0049] Figure 2 A schematic diagram of a flow chart provided for Embodiment 2 of the cache optimization method of this application;
[0050] Figure 3 A schematic diagram of a process flow provided for Embodiment 3 of the cache optimization method of this application;
[0051] Figure 4 A schematic diagram of the video pathfinding process between multiple layers of cache provided in Example 3 of the cache optimization method of this application;
[0052] Figure 5 This is a schematic diagram of the module structure of the cache optimization device according to an embodiment of the present application;
[0053] Figure 6 A schematic diagram of the device structure of the hardware operating environment involved in the cache optimization method of an embodiment of the present application.
[0054] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0055] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0056] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0057] The main solution of the embodiment of the present application is: obtaining data information of each cache node in different cache levels, and updating the cache strategy based on the data information to obtain an updated cache strategy, wherein the different cache levels include a local cache level, a regional cache level and a global cache level; optimizing each cache level based on the updated cache strategy to obtain optimized cache content; performing dynamic path selection at different cache levels in response to a user's content request to obtain a target request path; obtaining the target cache content from the optimized cache content based on the target request path.
[0058] Distributed cache technology is an important part of edge computing. By storing popular content on network edge servers, it can significantly reduce the number of requests back to the source server and alleviate network congestion. However, due to the uneven temporal and spatial distribution of content requests and the dynamic changes in the network environment, how to achieve efficient cache management in the edge cloud has become an important research topic. Although the existing cache management methods perform well in certain specific scenarios, there is still a lot of room for improvement when facing large-scale and dynamically changing network environments. First, the cache content placement and update strategies often lack dynamic adjustment capabilities and cannot adapt to changes in network traffic in real time, resulting in a low cache hit rate and affecting user experience. Secondly, in a multi-level cache structure, the collaboration and content transmission efficiency between levels need to be improved. Existing methods often encounter bottlenecks in cross-level content transmission, increasing transmission delays. In addition, the cache elimination strategy is difficult to balance the utilization of cache space and the frequency of content updates, resulting in a waste of cache resources or frequent cache replacement overhead. Therefore, how to effectively improve the cache hit rate and reduce the cost of content transmission is a problem that needs to be solved urgently.
[0059] The present application updates the cache strategy through the data information of each cache node in the cache hierarchy, such as the local cache hierarchy, the regional cache hierarchy and the global cache hierarchy. Through the multi-level structure and the collaboration mechanism, it can effectively adapt to data requests of different sizes and types, realize the efficient use of storage resources and the optimization of access performance, optimize each cache hierarchy based on the updated cache strategy, effectively improve the cache hit rate, and then respond to user content requests, perform dynamic path selection at different cache hierarchies and obtain the target cache content from the optimized cache content based on the target request path, effectively reduce the content transmission cost, overcome the technical defects of the existing cache management method of low cache hit rate and high content transmission cost, can effectively adapt to data requests of different sizes and types, realize the efficient use of storage resources and the optimization of access performance, effectively improve the cache hit rate, and reduce the content transmission cost.
[0060] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a cache optimization device, etc. The following takes the cache optimization device as an example to illustrate this embodiment and the following embodiments.
[0061] Based on this, the embodiment of the present application provides a cache optimization method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the cache optimization method of the present application.
[0062] In this embodiment, the cache optimization method includes steps S10 to S40:
[0063] Step S10, obtaining data information of each cache node in different cache levels, and updating the cache strategy based on the data information to obtain an updated cache strategy, wherein the different cache levels include a local cache level, a regional cache level, and a global cache level.
[0064] It should be noted that in this embodiment, a multi-level distributed cache architecture is adopted, which specifically includes a three-level cache structure, namely a local cache level, a regional cache level and a global cache level. Each level is composed of multiple distributed cache nodes, and the cache nodes at each level are equipped with corresponding cache space for storing partial content to meet user requests at different levels.
[0065] It is understandable that the local cache is located on each edge server, directly serving user requests and providing the lowest access latency; the regional cache is located in the center between multiple edge servers, acting as an intermediate layer to balance storage capacity and access speed; the global cache is located near the core data center or the main server, providing the most comprehensive content coverage. This multi-level structure can effectively adapt to data requests of different sizes and types, and at the same time, through the collaboration mechanism between levels, it achieves efficient use of storage resources and optimization of access performance.
[0066] It is worth noting that the data information of each cache node may include but is not limited to user request patterns, content popularity, network status, etc. The distributed online learning method can dynamically adjust the cache strategy by analyzing user request patterns, content popularity, network status, etc. in real time to adapt to changes in network traffic and fluctuations in user requests.
[0067] It is worth mentioning that due to the use of a distributed architecture, each cache node is allowed to learn and optimize independently, while sharing learning results through a collaborative mechanism to achieve global optimization.
[0068] Step S20, optimizing each cache level based on the updated cache strategy to obtain optimized cache content.
[0069] It should be noted that the optimization of each cache level includes the optimization of cache content and cache space. The optimization of cache content mainly refers to how to select appropriate content for storage according to the updated cache strategy to improve the cache hit rate, while the optimization of cache space focuses on how to reasonably allocate and manage cache space to avoid resource waste and frequent cache replacement. Through this optimization, the cache content and size of each node are dynamically adjusted to ensure that the cache content is consistent with user needs to adapt to different data access patterns, while improving the utilization of cache space.
[0070] It is understandable that in multi-layer distributed cache optimization, the small batch learning method is used to balance real-time performance and system overhead. The small batch learning method can be used to dynamically adjust the selection of cache content and update the cache strategy. By optimizing the cache content on a larger time scale, the overhead caused by frequent cache replacement is reduced, ensuring the stability of the system and long-term optimization effect.
[0071] In a feasible implementation, in order to reduce the computing and network overhead caused by frequent cache replacements and balance response speed and resource efficiency, step S20 may include: obtaining the cache capacity of each cache node in each cache level, the current cache content set and the new cache content set; determining the first content popularity of each cache content in the current cache content set and the second content popularity of each cache content in the new cache content set according to the updated cache strategy; optimizing each cache level according to the cache capacity, the first content popularity and the second content popularity to obtain optimized cache content.
[0072] It should be noted that cache capacity refers to the maximum space that a cache node can store content, the current cache content set refers to the content set currently stored in the cache node, and the new cache content set refers to the newly recommended content set. Content popularity refers to the popularity of a cached content on a cache node in a specific time period. Content popularity can be measured based on the number of visits or request frequency of the content in the past period of time. Generally, the higher the content, the more popular it is, and therefore more likely to be requested by users. By comparing the popularity of each content in the current cache content set and the new cache content set, it can be determined which content should be retained and which content should be replaced, thereby optimizing the cache content.
[0073] It is understandable that in cache optimization, the mini-batch learning method can be used to dynamically adjust the selection and update strategy of cache content. Let C be the cache capacity, For the current cache content set, by analyzing the small batch data set B t , we can calculate the popularity of each content and adjust the cache content based on the popularity. Let H i It represents the popularity of content i in time window t, as follows:
[0074]
[0075] in, represents the indicator function, when x j When it is equal to content i, otherwise
[0076] It is worth noting that by calculating the popularity of each content in the current cache content set and the new cache content set, the content with the highest popularity can be selected for cache update. In order to optimize the cache strategy, a dynamic elimination strategy based on mini-batch learning can be adopted. For the new cache content set, update it through the following steps: 1. Calculate the popularity H of each content i(t); 2. Sort by popularity and select the most popular content to update the cache; 3. Use LRU (Least Recently Used) or LFU (Least Frequently Used) strategy to eliminate low-popularity content and release cache space. In this way, it is possible to optimize the utilization of cache space while ensuring a high cache hit rate.
[0077] Step S30 , in response to the user's content request, dynamic path selection is performed at different cache levels to obtain a target request path.
[0078] It should be noted that dynamic path selection is to intelligently select the most appropriate cache level for content retrieval based on the current network conditions, load conditions, and content popularity, thereby reducing response time and improving user experience. For example, if the content requested by the user exists in the local cache level and is up-to-date, the content is provided directly from the local cache level; if it does not exist in the local cache level, the regional cache level and the global cache level are checked in turn until the required content is found.
[0079] It can be understood that in this embodiment, the dynamic path selection adopts a dynamic path selection algorithm based on random walk, which combines content popularity, server load and network topology, and intelligently selects the optimal request path between cache nodes at different levels through random walk to achieve efficient content distribution and access.
[0080] It is worth mentioning that the random walk algorithm uses random walk theory to achieve dynamic path selection through collaboration and information sharing between nodes. In each layer of cache, when a node receives a content request, it first searches the local cache to see whether the target content exists. If not found, the algorithm will intelligently select neighboring nodes for query based on historical data and current network status. This selection not only takes into account the probabilistic characteristics of random walks, but also combines the content popularity and load conditions of the nodes to increase the probability of request hits.
[0081] Step S40: acquiring target cache content from the optimized cache content based on the target request path.
[0082] It should be noted that the target cache node in the cache level where the target cache content is located can be quickly found according to the target request path, and then the required target cache content can be retrieved from the cache node to ensure fast retrieval and transmission of content and reduce content transmission costs.
[0083] It is understandable that after obtaining the target cache content, the target cache content is displayed to the user who initiated the request, thereby reducing waiting time and improving user experience.
[0084] The present embodiment provides a cache optimization method, which first obtains data information of each cache node in different cache levels, and updates the cache strategy based on the data information to obtain an updated cache strategy, wherein the different cache levels include a local cache level, a regional cache level, and a global cache level; optimizes each cache level based on the updated cache strategy to obtain optimized cache content; performs dynamic path selection at different cache levels in response to a user's content request to obtain a target request path; obtains the target cache content from the optimized cache content based on the target request path, which can effectively adapt to data requests of different sizes and types, realize efficient utilization of storage resources and optimization of access performance, effectively improve cache hit rate, and reduce content transmission costs.
[0085] In summary, this embodiment updates the cache strategy through the data information of each cache node in the cache hierarchy such as the local cache hierarchy, the regional cache hierarchy and the global cache hierarchy. Through the multi-level structure and the collaboration mechanism, it can effectively adapt to data requests of different sizes and types, and realize the efficient use of storage resources and the optimization of access performance. It optimizes each cache hierarchy based on the updated cache strategy, which can effectively improve the cache hit rate, and then respond to user content requests, perform dynamic path selection at different cache levels, and obtain the target cache content from the optimized cache content based on the target request path, which effectively reduces the content transmission cost, overcomes the technical defects of the existing cache management method of low cache hit rate and high content transmission cost, can effectively adapt to data requests of different sizes and types, realize the efficient use of storage resources and the optimization of access performance, effectively improve the cache hit rate, and reduce the content transmission cost.
[0086] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can refer to the above introduction, and will not be repeated later. Figure 2 , the step S10 further includes steps S101-S104:
[0087] Step S101, obtaining data information of each cache node in different cache levels.
[0088] It should be noted that obtaining data information of each cache node in different cache levels can be achieved in a variety of ways, such as through a network management system, monitoring tools or directly collecting data from the cache nodes. This data information includes but is not limited to user request patterns, content popularity, network conditions and other data.
[0089] Step S102: determining data characteristics and performance indicators of cached content in each cache node based on the data information.
[0090] It should be noted that the data characteristics of cached content include the content popularity of the cached content, user viewing patterns, network load, etc., while performance indicators include cache hit rate, video loading time, playback freeze rate, etc.
[0091] It is understandable that in this embodiment, a distributed adaptive multi-objective cache optimization algorithm (DAMCO) is used. The DAMCO algorithm combines distributed learning, online optimization and multi-objective decision-making technology, and can achieve real-time optimization of cache space and timely update of cache allocation strategy in a large-scale edge computing environment, thereby achieving efficient use of cache resources, reducing data access delays, and adapting to dynamically changing network environments and user needs.
[0092] It is worth noting that by analyzing the usage of cache nodes and content popularity, the DAMCO algorithm can intelligently adjust the cache strategy to ensure that the most popular and most frequently accessed content is stored in the cache first. In addition, the algorithm also takes into account network load and server status to avoid storing too much content on high-load or poorly performing nodes, thereby optimizing overall cache performance.
[0093] Considering the characteristics of the multi-layer cache architecture, DAMCO adopts different learning strategies at different levels. For example, the local cache layer focuses more on the rapid response of short-term hot videos, the regional cache layer focuses on the mid-term content popularity trend, and the global cache layer focuses more on the efficient storage of long-tail content. Through the global coordinator, cross-level learning parameter sharing and strategy coordination are achieved to optimize the overall cache efficiency. In addition, the DAMCO algorithm introduces an adaptive learning rate mechanism to cope with the dynamic changes of video traffic, as shown below:
[0094] η(t+1)=η(t)·exp(γ·(R target -R(t)))
[0095] Where R(t) can be the current cache hit rate or the average video loading time, R target To achieve the target performance value, this mechanism can quickly adjust the cache strategy when facing sudden hot events (such as major live events).
[0096] Step S103: Update the data features and the performance indicators to obtain updated data features and updated performance indicators.
[0097] It should be noted that each cache node continuously collects and updates local data. For example, for video streaming content, the cache node will record information such as the request frequency, viewing time, and user geographic distribution of different videos, and use exponential moving average to update data features and performance indicators, as shown in the following formula:
[0098] X i(t) = α × X i (t)+(1-α)×X i (t-1)
[0099] Y i (t) = β × Y i (t)+(1-β)Y i (t-1)
[0100] Among them, X i (t) is the data feature, Y i (t) is the performance index, α and β are weight indices.
[0101] Step S104: updating the cache strategy of each cache node in different cache levels according to the updated data characteristics and the updated performance indicators to obtain an updated cache strategy.
[0102] It should be noted that the multi-level structure strikes a balance between storage capacity and access speed. The local cache capacity is small but the access speed is the fastest, the regional cache capacity is large but the access speed is slightly slower, and the global cache capacity is the largest but the access speed is relatively slow. This design can not only effectively cope with the dynamic changes in data popularity, but also reasonably allocate data according to its importance and access frequency. The cache nodes at each level are closely connected through a complex coordination mechanism. The core cache controller is responsible for coordinating the distributed system. It dynamically adjusts the content and size of each cache node by analyzing network conditions, user behavior, and data access patterns in real time. For example, when the access frequency of a certain content exceeds a preset threshold within a specific time, the cache controller will instruct the relevant local cache nodes to increase the priority of this content, or even obtain the content from the upper cache in advance. This cache strategy greatly reduces the probability of cache misses and improves the response speed of the overall system.
[0103] It is understandable that both distributed online learning technology and small batch learning methods are used in the cache space optimization and cache strategy update process. Distributed online learning ensures the system's rapid response to short-term changes, while small batch learning ensures the stability and efficiency of long-term optimization. For example, distributed online learning may adjust the cache location of a popular video in real time, while small batch learning may adjust the cache ratio of different types of content based on a week's data. This combination can quickly adapt to short-term changes while maintaining long-term optimization effects.
[0104] It is worth noting that the mini-batch learning method is a technology used to optimize cache content and update cache strategies. It aims to balance real-time performance and system overhead. Unlike traditional real-time update strategies, the mini-batch learning method optimizes cache content on a larger time scale. By collecting access data within a certain period of time, and then learning and updating in batches, rather than responding immediately to each request, this method can reduce the computational and network overhead caused by frequent cache replacements, while still maintaining sensitivity to changes in user behavior and content popularity. By reasonably setting the batch size and update frequency, the best balance can be achieved between response speed and resource efficiency.
[0105] In a feasible implementation, in order to ensure model update efficiency and reduce computing overhead, step S104 may include: collecting user request data within a time window of preset length; constructing a data set based on the user request data, and determining an average gradient based on the data set; updating the model parameters of the local model corresponding to each cache node in the different cache levels according to the average gradient to obtain an updated local model; updating the cache strategy of each cache node in the different cache levels based on the updated data features, the updated performance indicators and the updated local model to obtain an updated cache strategy.
[0106] It should be noted that in the multi-layer distributed cache architecture, the DAMCO algorithm works together at three levels: local cache level, regional cache level, and global cache level. i Maintain a local model M i (e.g., a neural network-based model) based on the currently observed data features X i (t) and historical performance indicator Y i (t) to predict the optimal cache strategy S i (t+1):
[0107] S i (t+1)=f(M i ,X i (t),Y i (t))
[0108] Among them, M i For the local model, X i (t) including the popularity of video content, user viewing patterns, network load, etc.; Y i (t) includes performance indicators such as cache hit rate, video loading time, and playback freeze rate.
[0109] Each cache node updates its local model based on the collected data. Considering the computing resource limitations of edge nodes, DAMCO adopts a lightweight online gradient descent algorithm:
[0110]
[0111] Among them, η represents the learning rate, which controls the step size of each update. A smaller learning rate can make the model more stable but converge more slowly, while a larger learning rate may lead to faster convergence but may also cause instability. Represents the gradient operator, which represents the loss function L with respect to the model parameter M i The partial derivative of (t), L(M i (t),X i (t),Y i (t)) represents the loss function, which is used to measure the current model M i (t) In the input data X i The predicted and observed performance indicator Y on (t) i (t) The difference between
[0112] In the specific implementation, let T be the length of the time window, collect user request data in each time window, and construct a small batch data set B = {x1, x2, ..., x m}, where x i represents the i-th user request data in the time window, m is the size of the small batch data, and each data point x i Contains multiple features, such as request time, request content, user geographic location, etc. By extracting and normalizing these data, we can get the feature vector x∈R d , where d is the feature dimension. The construction of feature vectors is helpful for subsequent model training and optimization.
[0113] In mini-batch learning, the model is updated using the mini-batch gradient descent algorithm. Let θ be the model parameter, J(θ) be the loss function, and optimize the model parameter by minimizing the loss function. In each time window, the update formula of the mini-batch gradient descent algorithm is:
[0114]
[0115] Among them, η is the learning rate, Β t is a small batch data set within the time window t, J(θ,Β t ) represents the small batch dataset Β t The gradient on .
[0116] In the mini-batch dataset Β t The average gradient is calculated as follows:
[0117]
[0118] Among them, θ is the model parameter, Βt is a small batch dataset Β t , m is the size of the mini-batch, x i Indicates the i-th user request data within the time window.
[0119] Using average gradients to update model parameters can reduce computational overhead while ensuring model update efficiency. Technologies such as stochastic gradient descent (SGD) can quickly adapt to environmental changes and achieve efficient learning under limited computing resources. This method can dynamically adjust cache content and size, predict hot content, and improve cache hit rate, thereby significantly improving overall performance.
[0120] The algorithm complexity of the small batch learning method mainly depends on the processing of small batch data and the model update. Let m be the size of the small batch data, d be the feature dimension, and the update complexity of the model parameters is O(md). Since the amount of data in each time window is limited, the small batch learning method can reduce the computational overhead while ensuring real-time performance. The small batch learning method can not only dynamically adjust the cache content and cache strategy to improve the cache hit rate, but also find the global optimal solution in multi-objective optimization and improve the overall performance of the system. By reasonably setting the size of the small batch data and the length of the time window, the best balance can be achieved between response speed and resource efficiency.
[0121] Furthermore, in order to capture regional content popularity trends, adjacent cache nodes exchange limited information. For example, edge nodes in adjacent cities may share information about popular local videos. i With its neighboring nodes N(v i ) After exchanging model parameters, the model is aggregated by weighted averaging:
[0122]
[0123] Among them, M i ′(t) is the model after aggregation, v i is a cache node, N(v i ) is a neighbor node, ω j is the weight.
[0124] Considering the multiple performance objectives of video streaming services (such as cache hit rate, video startup time, playback quality, etc.), DAMCO adopts a multi-objective optimization method. Define the objective function set: F(S) = {f1(S), f2(S), ..., f k (S)}. Use the Pareto optimization method to find the optimal strategy, as follows:
[0125]
[0126] Among them, S represents a specific cache strategy, fi (S) represents the evaluation function of the i-th performance target. For example, f1(S) represents the cache hit rate, which is calculated as: number of hit requests / total number of requests; f2(S) represents the average video startup time, which is calculated as: total startup time / number of video requests, etc. S * is a set of solutions such that for each solution S, there does not exist another solution S′ that is no worse than S in all objectives and strictly better than S in at least one objective.
[0127] Each solution in the Pareto optimal solution set is "not completely surpassable". For any solution in the set, it is impossible to find another solution that improves at least one objective without sacrificing any other objective. The final strategy selected is Among them, P(S,X(t)) is a preference function based on the current system state, which can be dynamically adjusted according to the service focus in different time periods (such as peak period vs. trough period). The selected strategy S opt Applied to the caching system, for example, to decide to pre-fetch certain popular videos to the local cache, or to migrate long-tail content from the local cache to the regional cache, continuously monitor the effect of the cache strategy execution, such as changes in user experience indicators, and pass the results back to the learning algorithm as a feedback signal.
[0128] In this embodiment, by utilizing each cache node in different cache levels to determine data characteristics and performance indicators and update them, and then using the updated data characteristics and updated performance indicators to update the cache strategy using a small batch learning algorithm, the cache hit rate can be improved and the best balance between response speed and resource efficiency can be achieved.
[0129] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the cache optimization method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0130] Based on the first embodiment of the present application, in the third embodiment of the present application, the same or similar contents as those in the first embodiment can be referred to the above description, and will not be described in detail later. Figure 3 , the step S30 further includes steps S301-S303:
[0131] Step S301 , in response to a user's content request, obtaining the query priority of each cache level, and performing dynamic path selection at different cache levels according to the query priority to determine a target cache level.
[0132] It should be noted that a content request refers to a request sent by a user to the system to obtain specific video content. In this embodiment, the content request may include information such as a user ID, a requested video content ID, and a request time, and this embodiment does not specifically limit this.
[0133] It can be understood that in the present embodiment, a multi-level cache structure is adopted, including a three-level cache structure including a local cache level, a regional cache level and a global cache level. The query priority of the local cache level is the highest, followed by the query priority of the regional cache level, and the query priority of the global cache level is the lowest, indicating that the local cache level is queried first. When the required content exists in the local cache level, the global cache level is queried. When the required content does not exist in the global cache level, the global cache level is queried. If the required content does not exist in the global cache level either, a request is finally sent to the main server.
[0134] It is worth noting that dynamic path selection based on random walk is a request processing strategy used to improve the system's request processing efficiency and load balancing capabilities. When a user's content request is received, an improved random walk algorithm is used to select a suitable node for query within the same level, combined with content popularity and server load information. If the content is not found at the current level, the algorithm will decide whether to raise the request to a higher level. It can not only effectively disperse request pressure and avoid single point failures, but also dynamically adjust the path according to real-time network conditions, improving the overall response speed and reliability of the system.
[0135] Step S302: query cache content of cache nodes in the target cache level according to the content request to obtain the target cache node.
[0136] It should be noted that when processing user requests, a multi-level path selection strategy is adopted, that is, when a user request arrives, a search is performed in the target cache layer. If the required content is not found, a neighboring node query mechanism based on random walk is started. The neighboring node query mechanism is not a simple broadcast query, but intelligently selects the neighboring node that is most likely to store the target content based on historical data and current network status. To prevent the query from spreading infinitely, a query termination condition is set, that is, a specific threshold for query depth or query time. If the content is still not found under these conditions, the request will rise to the cache layer corresponding to the next query priority.
[0137] In a feasible implementation manner, in order to improve the probability of request hit, step S302 may include: querying the cache content of the initial cache node in the target cache level according to the content request to obtain a first query result; when the first query result is that there is a hit cache content, using the initial cache node as the target cache node;
[0138] When the first query result is that there is no hit cache content, obtain the transition probability of the initial cache node, and determine the neighbor node based on the transition probability; query the cache content of the neighbor node according to the content request to obtain the second query result; when the second query result is that there is a hit cache content, use the neighbor cache node as the target cache node; when the second query result is that there is no hit cache content, and the current query depth reaches a preset depth threshold or the current query time reaches a preset time threshold, use the cache level of the next query priority as the target cache level, and execute the step of querying the cache content of the initial cache node in the target cache level according to the content request to obtain the first query result.
[0139] It should be noted that, according to the query priority, the initial target cache level is the local cache level. When a user request arrives, it is first searched in the local cache level. If the required content is not found, the neighboring node query mechanism based on random walk will be started. According to historical data and current network status, the neighboring node that is most likely to store the target content will be intelligently selected. If the content is still not found under the termination condition, the request will be raised to the cache level of the next query priority, that is, the regional cache level.
[0140] It is understandable that in the regional cache layer, a similar but more relaxed query strategy is adopted. Since the regional cache nodes cover a wider range, a greater query depth and longer query time are allowed. At the same time, the nodes in the regional cache layer are interconnected through a high-speed network, which can exchange information faster. If the regional cache layer also fails to find the required content, the request will eventually rise to the global cache layer. The global cache layer serves as the last barrier and stores the most comprehensive content. If it is still not found in the global cache layer, the system will initiate a request to the source server.
[0141] It is worth noting that the transition probability P i,j (t) indicates content pathfinding from node v i Transfer to neighbor node v at time t j Let G = (V, E) be the graph structure of the cache network, where V represents the node set and E represents the edge set between nodes. i ∈V maintains a cache content list C i and a load value L i , each content request is represented by r. The transition probability depends on the content popularity of the node H j and load L j , as follows:
[0142]
[0143] Where N(i) represents the node v iThe neighbor node set, H j (t) represents the node v j The popularity of the content at time t, L j (t) represents the node v j Load value at time t.
[0144] Content popularity indicates the popularity of a certain content on a certain node in a specific time period. Content popularity can be measured based on the number of visits or request frequency of the content in the past period of time. The higher the popularity, the more popular the content is on the node, and the greater the probability that users will request the content. The load value indicates the resource usage of a node in a specific time period, including CPU usage, memory usage, network bandwidth, etc. The higher the load value, the more inefficient the resource usage of the node and the lower the ability to process requests. When a node v i When receiving a content request r, first cache C locally i If it does not hit, then according to the transition probability P i,j (t) Select a neighbor node v j The next query is performed, and this process will continue until the target content is found or the preset termination condition is reached. Content popularity H j (t) and load L j (t) is dynamically changing, and the content popularity H is updated in real time j (t) and load L j (t), as follows:
[0145] H j (t+1)=α×H j (t)+(1-α)R j (t)
[0146] L j (t+1) = βL j (t)+(1-β)U j (t)
[0147] Among them, R j (t) represents the node v j The request frequency at time t, U j (t) represents the node v j The load changes at time t, α and β are smoothing coefficients, ranging from 0 to 1, reflecting the degree of system dependence on historical data.
[0148] In the specific implementation, when the user request reaches the local cache node v i When the local cache C is checked first i If it misses, then according to the transition probability P i,j (t) Randomly select a neighbor node vj Perform a query. If the preset query depth d local and time threshold T local If no content is found in the cache, the request goes up to the regional cache layer. In the regional cache layer, node v i After receiving the ascending request, according to the transfer probability P i,j (t) Select neighbor node v with higher content popularity and lower load j Perform a query. If the preset query depth d regional and time threshold T regional If no content is found in the cache, the request goes up to the global cache layer. The global cache layer is the last query layer, and node v i After receiving the request, according to the transition probability P i,j (t) Select neighbor node v j If the content is still not found in the global cache layer, a request is finally made to the source server. The preset query depth d local It can be 3 hops, and the time threshold is T local It can be 100 milliseconds, and this embodiment does not impose any specific limitation on this.
[0149] In order to further optimize the query process, an adaptive back-propagation mechanism is introduced. When a node successfully finds the target content, it will back-propagate the success information along the query path and update the content popularity and load information of all nodes on the path. This mechanism helps to improve the hit rate and query efficiency of future requests. To prove the effectiveness of the algorithm in multi-layer cache, consider the transition probability and termination condition of each layer of cache. Let the transition probability matrix of each layer be P (l) , where l represents the cache level (local, regional, global). The transfer matrix of each layer satisfies the following conditions:
[0150]
[0151] Where N(i) represents the set of nodes that can connect to node i. In addition, let T (l) is the query time threshold of each cache layer, D (l) is the query depth threshold.
[0152] The query process in each layer of cache can be expressed as:
[0153]
[0154] Among them, Pr(F|l) represents the probability of finding content in level l, which means that when the query depth does not exceed D (l) In the case of iThe probability of finding the target content in the initial query path. The product term in the formula represents the probability of not finding the content in the first k-1 nodes of the query path, and the last term represents the probability of finding the content at the kth node.
[0155] If the content is not found in level l, the query request will rise to level l+1 and continue the above process. Through recursive calculation, the query success probability under the entire multi-layer cache architecture can be obtained. The overall query success probability Pr(F) in the multi-layer cache architecture can be expressed by the combination of success probabilities of each level:
[0156]
[0157] Where L is the total number of cache levels. This formula represents the complement of the probability of not finding content at all levels, that is, the probability of finding content at at least one level.
[0158] like Figure 4 As shown, Figure 4 Figure 1 is a schematic diagram of the video pathfinding process between multiple caches. User A requests to watch video V1 in city X. The pathfinding process of video V1 between multiple caches includes: 1. Local cache check: User A's request first reaches the nearest edge server S1. S1 checks the local cache layer and returns if it is found. If not, it continues to step 2. 2. Neighboring node request in the same layer: S1 searches the surrounding cache node S2. S2 checks the cache and returns if it is found. If not, it continues to step 3. 3. Regional cache request: Since video V1 is not found in the local cache and the neighboring nodes in the same layer, S1 raises the request to the regional cache layer (sent to the nearest neighbor according to the geographical location). 1. The nearest upper layer node), that is, sending a request to the regional cache node R1, R1 checks its cache, returns if found, if not found, it continues to step 4; 4. Global cache request: S1 continues to request the global cache level, sends a request to the global cache node G1, G1 checks its cache, returns if found, if not found, it continues to step 5; 5. Request back to the source server: After searching through multiple layers of cache, video V1 is still not found. S1 finally sends a request to the main server, the main server transmits video V1 to S1, and S1 then transmits the video to user A; 6. Cache update: In order to improve the hit rate of subsequent requests, S1 caches video V1 in the local cache for direct hit the next time the request is made.
[0159] Step S303: Generate a target request path according to the target cache node.
[0160] It should be noted that the target cache node refers to the cache node that stores the cache content that meets the user's content request. According to the location of the target cache node and the network topology, an optimal path from the local cache node to the target cache node is constructed. When constructing the path, factors such as network latency, bandwidth, and load balancing need to be considered to ensure that the request can efficiently reach the target cache node.
[0161] It can be understood that in this embodiment, an adaptive back-propagation mechanism is introduced. When a node successfully finds the target content, the success information is back-propagated along the query path, and the content popularity and load information of all nodes on the path are updated to improve the hit rate and query efficiency of future requests.
[0162] In this embodiment, the query priority of each cache level is used to perform dynamic path selection to accurately locate the target cache level, and then the cache content of the cache node in the target cache level is queried according to the content request to determine the target cache node and generate the target request path, effectively improving the query efficiency and the probability of request hit.
[0163] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the cache optimization method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0164] This application also provides a cache optimization device, please refer to Figure 5 , the cache optimization device comprises:
[0165] The update module 10 is used to obtain data information of each cache node in different cache levels, and update the cache strategy based on the data information to obtain an updated cache strategy, wherein the different cache levels include a local cache level, a regional cache level and a global cache level.
[0166] The optimization module 20 is used to optimize each cache level based on the updated cache strategy to obtain optimized cache content.
[0167] The selection module 30 is used to perform dynamic path selection at the different cache levels in response to the user's content request to obtain a target request path.
[0168] The acquisition module 40 is used to acquire target cache content from the optimized cache content based on the target request path.
[0169] The present embodiment provides a cache optimization device, which obtains data information of each cache node in different cache levels, and updates the cache strategy based on the data information to obtain an updated cache strategy, wherein the different cache levels include a local cache level, a regional cache level, and a global cache level; optimizes each cache level based on the updated cache strategy to obtain optimized cache content; performs dynamic path selection at different cache levels in response to a user's content request to obtain a target request path; obtains the target cache content from the optimized cache content based on the target request path, which can effectively adapt to data requests of different sizes and types, realize efficient utilization of storage resources and optimization of access performance, effectively improve cache hit rate, and reduce content transmission costs.
[0170] In summary, this embodiment updates the cache strategy through the data information of each cache node in the cache hierarchy such as the local cache hierarchy, the regional cache hierarchy and the global cache hierarchy. Through the multi-level structure and the collaboration mechanism, it can effectively adapt to data requests of different sizes and types, and realize the efficient use of storage resources and the optimization of access performance. It optimizes each cache hierarchy based on the updated cache strategy, which can effectively improve the cache hit rate, and then respond to user content requests, perform dynamic path selection at different cache levels, and obtain the target cache content from the optimized cache content based on the target request path, which effectively reduces the content transmission cost, overcomes the technical defects of the existing cache management method of low cache hit rate and high content transmission cost, can effectively adapt to data requests of different sizes and types, realize the efficient use of storage resources and the optimization of access performance, effectively improve the cache hit rate, and reduce the content transmission cost.
[0171] Optionally, the update module 10 is also used to obtain data information of each cache node in different cache levels; determine data characteristics and performance indicators of cache content in each cache node based on the data information; update the data characteristics and the performance indicators to obtain updated data characteristics and updated performance indicators; update the cache strategy of each cache node in different cache levels according to the updated data characteristics and the updated performance indicators to obtain an updated cache strategy.
[0172] Optionally, the update module 10 is also used to collect user request data within a time window of preset length; construct a data set based on the user request data, and determine an average gradient based on the data set; update the model parameters of the local model corresponding to each cache node in the different cache levels according to the average gradient to obtain an updated local model; update the cache strategy of each cache node in the different cache levels based on the updated data characteristics, the updated performance indicators and the updated local model to obtain an updated cache strategy.
[0173] Optionally, the optimization module 20 is also used to obtain the cache capacity of each cache node in each cache level, the current cache content set and the new cache content set; determine the first content popularity of each cache content in the current cache content set and the second content popularity of each cache content in the new cache content set according to the updated cache strategy; optimize each cache level according to the cache capacity, the first content popularity and the second content popularity to obtain optimized cache content.
[0174] Optionally, the selection module 30 is also used to respond to the user's content request, obtain the query priority of each cache level, and perform dynamic path selection at different cache levels according to the query priority to determine the target cache level; query the cache content of the cache node in the target cache level according to the content request to obtain the target cache node; and generate the target request path according to the target cache node.
[0175] Optionally, the selection module 30 is also used to query the cache content of the initial cache node in the target cache layer according to the content request to obtain a first query result; when the first query result is that there is a hit in the cache content, the initial cache node is used as the target cache node; when the first query result is that there is no hit in the cache content, the transition probability of the initial cache node is obtained, and the neighbor node is determined based on the transition probability; according to the content request, the cache content of the neighbor node is queried to obtain a second query result; when the second query result is that there is a hit in the cache content, the neighbor cache node is used as the target cache node; when the second query result is that there is no hit in the cache content, and the current query depth reaches a preset depth threshold or the current query time reaches a preset time threshold, the cache layer of the next query priority is used as the target cache layer, and the step of querying the cache content of the initial cache node in the target cache layer according to the content request to obtain the first query result is executed.
[0176] The cache optimization device provided by the present application adopts the cache optimization method in the above embodiment, which can solve the technical problem of how to effectively improve the cache hit rate and reduce the content transmission cost. Compared with the prior art, the beneficial effects of the cache optimization device provided by the present application are the same as the beneficial effects of the cache optimization method provided by the above embodiment, and the other technical features in the cache optimization device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0177] The present application provides a cache optimization device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the cache optimization method in the above-mentioned embodiment one.
[0178] Reference below Figure 6 , which shows a schematic diagram of the structure of a cache optimization device suitable for implementing the embodiment of the present application. The cache optimization device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The cache optimization device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0179] like Figure 6 As shown, the cache optimization device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the cache optimization device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the cache optimization device to communicate with other devices wirelessly or by wire to exchange data. Although the cache optimization device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0180] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0181] The cache optimization device provided by the present application adopts the cache optimization method in the above embodiment, which can solve the technical problem of how to effectively improve the cache hit rate and reduce the content transmission cost. Compared with the prior art, the beneficial effects of the cache optimization device provided by the present application are the same as the beneficial effects of the cache optimization method provided by the above embodiment, and the other technical features in the cache optimization device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0182] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0183] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0184] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the cache optimization method in the above-mentioned embodiment.
[0185] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0186] The computer-readable storage medium may be included in the cache optimization device; or may exist independently without being assembled into the cache optimization device.
[0187] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the cache optimization device, the cache optimization device: obtains data information of each cache node in different cache levels, and updates the cache strategy based on the data information to obtain an updated cache strategy, wherein the different cache levels include a local cache level, a regional cache level and a global cache level; optimizes each cache level based on the updated cache strategy to obtain optimized cache content; performs dynamic path selection at different cache levels in response to a user's content request to obtain a target request path; obtains target cache content from the optimized cache content based on the target request path.
[0188] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0189] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0190] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0191] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned cache optimization method, and can solve the technical problem of how to effectively improve the cache hit rate and reduce the content transmission cost. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the cache optimization method provided by the above-mentioned embodiment, and will not be repeated here.
[0192] The present application also provides a computer program product, including a computer program, which implements the steps of the cache optimization method as described above when executed by a processor.
[0193] The computer program product provided by this application can solve the technical problem of how to effectively improve the cache hit rate and reduce the content transmission cost. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the cache optimization method provided by the above embodiment, which will not be repeated here.
[0194] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A cache optimization method, characterized in that: The method comprises: Acquire data information of each cache node in different cache levels, and update the cache strategy based on the data information to obtain an updated cache strategy, wherein the different cache levels include a local cache level, a regional cache level, and a global cache level; Optimizing each cache level based on the updated cache strategy to obtain optimized cache content; In response to a user's content request, dynamically select a path at different cache levels to obtain a target request path; The target cache content is obtained from the optimized cache content based on the target request path.
2. The method according to claim 1, characterized in that The step of obtaining data information of each cache node in different cache levels and updating the cache strategy based on the data information to obtain the updated cache strategy includes: Get data information of each cache node in different cache levels; Determine data characteristics and performance indicators of cached content in each cache node based on the data information; Updating the data features and the performance indicators to obtain updated data features and updated performance indicators; The cache strategy of each cache node in different cache levels is updated according to the updated data characteristics and the updated performance indicators to obtain an updated cache strategy.
3. The method according to claim 2, characterized in that The step of updating the cache strategy of each cache node in different cache levels according to the updated data characteristics and the updated performance indicators to obtain the updated cache strategy includes: Collecting user request data within a time window of a preset length; constructing a data set based on the user request data, and determining an average gradient based on the data set; Updating the model parameters of the local models corresponding to the cache nodes in the different cache levels according to the average gradient to obtain an updated local model; The cache strategy of each cache node in different cache levels is updated based on the updated data characteristics, the updated performance indicators and the updated local model to obtain an updated cache strategy.
4. The method according to claim 1, characterized in that The step of optimizing each cache level based on the updated cache strategy to obtain optimized cache content includes: Obtaining the cache capacity, current cache content set and new cache content set of each cache node in each cache level; Determine, according to the updated cache strategy, a first content popularity of each cached content in the current cached content set and a second content popularity of each cached content in the new cached content set; Each cache level is optimized according to the cache capacity, the first content popularity, and the second content popularity to obtain optimized cache content.
5. The method according to claim 1, characterized in that The step of performing dynamic path selection at different cache levels in response to a user's content request to obtain a target request path comprises: In response to a user's content request, obtaining a query priority of each cache level, and performing dynamic path selection at different cache levels according to the query priority to determine a target cache level; Query cache content of cache nodes in the target cache level according to the content request to obtain the target cache node; A target request path is generated according to the target cache node.
6. The method according to claim 5, characterized in that The step of querying the cache content of the cache node in the target cache level according to the content request to obtain the target cache node comprises: querying cache content of an initial cache node in a target cache level according to the content request to obtain a first query result; When the first query result indicates that there is a hit cache content, taking the initial cache node as the target cache node; When the first query result is that there is no hit cache content, obtaining the transition probability of the initial cache node, and determining a neighbor node based on the transition probability; querying the cache content of the neighbor node according to the content request to obtain a second query result; When the second query result indicates that there is a hit cache content, taking the neighbor cache node as the target cache node; When the second query result is that there is no hit cache content, and the current query depth reaches the preset depth threshold or the current query time reaches the preset time threshold, the cache level of the next query priority is used as the target cache level, and the step of querying the cache content of the initial cache node in the target cache level according to the content request is executed to obtain the first query result.
7. A cache optimization device, characterized in that: The cache optimization device comprises: An update module, used to obtain data information of each cache node in different cache levels, and update the cache strategy based on the data information to obtain an updated cache strategy, wherein the different cache levels include a local cache level, a regional cache level, and a global cache level; An optimization module, used to optimize each cache level based on the updated cache strategy to obtain optimized cache content; A selection module, configured to perform dynamic path selection at the different cache levels in response to a user's content request to obtain a target request path; An acquisition module is used to acquire target cache content from the optimized cache content based on the target request path.
8. A cache optimization device, characterized in that: The cache optimization device comprises: a memory, a processor, and a cache optimization program stored in the memory and executable on the processor, wherein the cache optimization program is configured to implement the cache optimization method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium stores a cache optimization program, and when the cache optimization program is executed by the processor, the cache optimization method according to any one of claims 1 to 6 is implemented.
10. A computer program product, characterized in that The computer program product comprises a cache optimization program, and when the cache optimization program is executed by a processor, the steps of the cache optimization method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Data caching method and device, electronic equipment and readable storage medium
CN117009389A
Data processing method and related device
CN117539915A
Multi-level cache adaptive system and strategy based on machine learning
CN118012906A
Multi-level cache management method and device and computer readable storage medium
CN118210739A
Cache performance evaluation method and device, electronic equipment and readable storage medium
CN118227446A
Cited By
Dynamic management method and system for multi-layer data cache
CN119987685A
A method and system for dynamic management of multi-layer data cache
CN119987685B
Memory optimization method and device for file system, equipment and medium
CN120763079A