Cache optimization method, apparatus, medium, and device

CN122601756APending Publication Date: 2026-08-18凌川峰(贵州)信息技术有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610771581.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-29
Publication Date
2026-08-18

AI Technical Summary

Technical Problem

[0002]在AI爬虫流量与人类访问流量混合的CDN环境中,AI爬虫的广覆盖、低复用的访问模式会将人类用户频繁访问的热门内容从共享缓存中挤出(缓存污染),AI爬虫流量的动态变化会导致缓存性能波动

Benefits of technology

[0022] The cache optimization method of this application involves edge nodes determining the AI ​​access traffic pollution index of the node cache within each sliding time window; reporting the AI ​​access traffic pollution index to the management platform and receiving cache priority weight parameters from the management platform; and adjusting the cache eviction algorithm or cache strategy based on the AI ​​access traffic pollution index and the cache priority weight parameters. Determining the AI ​​access traffic pollution index by the edge nodes provides a standardized indicator of the degree of AI access traffic pollution to the cache. Sending the pollution index to the management platform allows operations personnel or customers to determine the impact of AI access traffic on cache performance based on the AI ​​access traffic pollution index, thereby determining the cache priority weight parameters. The edge nodes adjust the cache eviction algorithm or cache strategy based on the AI ​​access traffic pollution index and the cache priority weight parameters to reduce cache pollution and improve cache performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122601756A_ABST
    Figure CN122601756A_ABST
Patent Text Reader

Abstract

The application relates to a cache optimization method, device, medium and equipment. The cache optimization method is applied to an edge node and comprises the following steps: determining an AI access traffic pollution index of a node cache in each sliding time window; reporting the AI access traffic pollution index to a management platform and receiving a cache priority weight parameter issued by the management platform; and adjusting a cache eviction algorithm based on the AI access traffic pollution index and the cache priority weight parameter. The cache eviction algorithm can be adaptively adjusted, the optimal cache eviction algorithm can be autonomously selected, and the cache performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of content delivery network technology, and in particular to a caching optimization method, apparatus, medium and device. Background Technology

[0002] In a CDN environment where AI crawler traffic and human access traffic are mixed, the wide coverage and low reuse access pattern of AI crawlers will squeeze popular content that human users frequently access from the shared cache (cache pollution). The dynamic changes in AI crawler traffic will cause cache performance fluctuations.

[0003] Traditional technologies lack standardized metrics to quantify the degree of cache pollution caused by AI crawler traffic. As a result, operations and maintenance personnel and customers cannot intuitively understand the impact of AI crawler traffic on cache performance. Website operators cannot customize cache priorities for different traffic source types (human user access traffic and AI crawler traffic) according to their own business needs, and the caching system cannot take into account the differentiated caching needs of different traffic sources. Summary of the Invention

[0004] To overcome the problems existing in related technologies, this application provides a cache optimization method, apparatus, medium, and device.

[0005] According to a first aspect of the embodiments of this application, a cache optimization method is provided, applied to edge nodes, including: Determine the AI ​​access traffic pollution index of the node cache within each sliding time window; The AI ​​access traffic pollution index is reported to the management platform, and the cache priority weight parameters issued by the management platform are received. The cache eviction algorithm is adjusted based on the AI ​​access traffic pollution index and the cache priority weight parameter.

[0006] Based on the aforementioned scheme, in some embodiments of this application, determining the AI ​​access traffic pollution index of the node cache within each sliding time window includes: Determine the percentage of deduplicated URLs in all requests within the sliding time window, the percentage of requests generated by URLs with access frequency below the frequency threshold, and the percentage of cached entries whose hit count is less than the preset number when being evicted. The AI ​​access traffic pollution index of the node cache within the sliding time window is determined by weighted summation of the proportion of deduplicated URLs in all requests, the proportion of requests generated by URLs with access frequency below the frequency threshold in all requests, and the proportion of cache entries whose hit count at the time of elimination is less than the preset threshold.

[0007] Based on the foregoing scheme, in some embodiments of this application, the cache eviction algorithm adjusted based on the AI ​​access traffic pollution index and the cache priority weight parameter includes: When the slope of the trend curve of the AI ​​access traffic pollution index is greater than the slope threshold, or when the AI ​​access traffic pollution index is greater than the pollution threshold, the shadow caching engine is started to simulate and verify the candidate cache eviction algorithm. The simulated weighted hit rate of the candidate cache eviction algorithm is calculated according to the cache priority weight parameter. When the simulated weighted hit rate of the candidate cache eviction algorithm exceeds the sum of the first weighted hit rate and the confirmation threshold of the source cache eviction algorithm, the current cache eviction algorithm is switched from the source cache eviction algorithm to the candidate cache eviction algorithm. The confirmation threshold is a real number greater than or equal to 0, and the first weighted hit rate is the average hit rate.

[0008] Based on the foregoing solution, in some embodiments of this application, the cache optimization method further includes: Monitor the second weighted hit rate of the candidate cache eviction algorithm. If the second weighted hit rate is less than the first weighted hit rate within N consecutive sliding time windows, switch the current cache eviction algorithm from the candidate cache eviction algorithm back to the source cache eviction algorithm. N is an integer greater than or equal to 1, and the second weighted hit rate is the average weighted hit rate within N sliding windows.

[0009] Based on the foregoing solution, in some embodiments of this application, the cache optimization method further includes: Adjust caching strategy; The adjusted caching strategy includes: Determine the cache value of cached resources; According to the preset eviction policy of the current cache eviction algorithm, k candidate eviction resources are selected from the cache resources, and the eviction resource with the lowest cache value among the k candidate eviction resources is determined as the eviction resource to be evicted; where k is an integer greater than or equal to 2; When the cache space occupancy rate is greater than or equal to the first occupancy rate threshold, the resource to be evicted is discarded.

[0010] Based on the foregoing solution, in some embodiments of this application, the adjusted caching strategy further includes: When the cache space occupancy rate is greater than or equal to the second occupancy rate threshold and less than the first occupancy rate threshold, the cache value of the resource to be cached and the resource to be evicted are compared. When the cache value of the resource to be cached is greater than the sum of the cache value of the resource to be evicted and the debouncing threshold, the resource to be evicted is evicted and written into the cache space. The debouncing threshold is a real number greater than or equal to 0.

[0011] Based on the foregoing solution, in some embodiments of this application, the cache optimization method further includes: Monitor the third weighted hit rate after adjusting the caching strategy. If the third weighted hit rate is lower than the average weighted hit rate of the current cache eviction algorithm within M consecutive sliding time windows, evict cache resources according to the preset eviction strategy of the current cache eviction algorithm. M is an integer greater than or equal to 1, and the third weighted hit rate is the average weighted hit rate within M sliding time windows.

[0012] Based on the aforementioned scheme, in some embodiments of this application, the cache priority weight parameter includes: a first type of traffic weight, a second type of traffic weight, a third type of traffic weight, and a fourth type of traffic weight; the sum of the first type of traffic weight, the second type of traffic weight, the third type of traffic weight, and the fourth type of traffic weight is 1; The weighted hit rate of the target cache eviction algorithm is the result of weighted summation of the cache hit rate of various traffic types and their corresponding weights under the target cache eviction algorithm. The target cache eviction algorithm includes any one of the source cache eviction algorithm and the candidate cache eviction algorithm.

[0013] Based on the aforementioned scheme, in some embodiments of this application, the cache value of the cached resource is the output of a lightweight gradient boosting decision tree model with the multidimensional features of the request as input. The lightweight gradient boosting decision tree model is trained with the objective of maximizing the objective value of the weighted multi-objective function as the optimization objective. The multidimensional features include one or more of the following: request source type label, the proportion of requests of the same type within the current sliding time window, the number of cache evictions triggered by requests of that type within a unit of time, and the distribution vector of the number of times the evicted cache entry is hit by requests of different source types.

[0014] According to another aspect of the embodiments of this application, a cache optimization apparatus is provided, applied to an edge node, comprising: The pollution index determination module is used to determine the pollution index of AI access traffic cached by nodes within each sliding time window; The communication module is used to report the AI ​​access traffic pollution index to the management platform and receive the cache priority weight parameters issued by the management platform. The adjustment module is used to adjust the cache eviction algorithm based on the AI ​​access traffic pollution index and the cache priority weight parameter.

[0015] Based on the foregoing solution, in some embodiments of this application, the adjustment module is further configured to: When the slope of the trend curve of the AI ​​access traffic pollution index is greater than the slope threshold, or when the AI ​​access traffic pollution index is greater than the pollution threshold, the shadow caching engine is started to simulate and verify the candidate cache eviction algorithm. The simulated weighted hit rate of the candidate cache eviction algorithm is calculated according to the cache priority weight parameter. When the simulated weighted hit rate of the candidate cache eviction algorithm exceeds the sum of the first weighted hit rate and the confirmation threshold of the source cache eviction algorithm, the current cache eviction algorithm is switched from the source cache eviction algorithm to the candidate cache eviction algorithm. The confirmation threshold is a real number greater than or equal to 0, and the first weighted hit rate is the average hit rate.

[0016] Based on the foregoing solution, in some embodiments of this application, the cache optimization device is characterized by further comprising: The verification module is used to monitor the second weighted hit rate of the candidate cache eviction algorithm. If the second weighted hit rate is less than the first weighted hit rate within N consecutive sliding time windows, the current cache eviction algorithm is switched from the candidate cache eviction algorithm back to the source cache eviction algorithm. N is an integer greater than or equal to 1, and the second weighted hit rate is the average weighted hit rate within N sliding windows.

[0017] Based on the foregoing solution, in some embodiments of this application, the adjustment module is further configured to: Adjust caching strategy; The adjusted caching strategy includes: Determine the cache value of cached resources; According to the preset eviction policy of the current cache eviction algorithm, k candidate eviction resources are selected from the cache resources, and the eviction resource with the lowest cache value among the k candidate eviction resources is determined as the eviction resource to be evicted; where k is an integer greater than or equal to 2; When the cache space occupancy rate is greater than or equal to the first occupancy rate threshold, the resource to be evicted is discarded.

[0018] Based on the foregoing solution, in some embodiments of this application, the adjustment module is further configured to: When the cache space occupancy rate is greater than or equal to the second occupancy rate threshold and less than the first occupancy rate threshold, the cache value of the resource to be cached and the resource to be evicted are compared. When the cache value of the resource to be cached is greater than the sum of the cache value of the resource to be evicted and the debouncing threshold, the resource to be evicted is evicted and written into the cache space. The debouncing threshold is a real number greater than or equal to 0.

[0019] Based on the foregoing scheme, in some embodiments of this application, the verification module is further configured to: monitor the third weighted hit rate after adjusting the caching strategy; if the third weighted hit rate is lower than the average weighted hit rate of the current cache eviction algorithm within M consecutive sliding time windows, evict cache resources according to the preset eviction strategy of the current cache eviction algorithm, where M is an integer greater than or equal to 1, and the third weighted hit rate is the average weighted hit rate within M sliding time windows.

[0020] According to another aspect of the embodiments of this application, a computer-readable storage medium is provided, on which a computer program is stored, wherein the computer program, when executed, implements the steps of a cache optimization method.

[0021] According to another aspect of the embodiments of this application, a computer device is provided, including a processor, a memory, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of a cache optimization method.

[0022] The cache optimization method of this application involves edge nodes determining the AI ​​access traffic pollution index of the node cache within each sliding time window; reporting the AI ​​access traffic pollution index to the management platform and receiving cache priority weight parameters from the management platform; and adjusting the cache eviction algorithm or cache strategy based on the AI ​​access traffic pollution index and the cache priority weight parameters. Determining the AI ​​access traffic pollution index by the edge nodes provides a standardized indicator of the degree of AI access traffic pollution to the cache. Sending the pollution index to the management platform allows operations personnel or customers to determine the impact of AI access traffic on cache performance based on the AI ​​access traffic pollution index, thereby determining the cache priority weight parameters. The edge nodes adjust the cache eviction algorithm or cache strategy based on the AI ​​access traffic pollution index and the cache priority weight parameters to reduce cache pollution and improve cache performance.

[0023] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0024] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0025] Figure 1 This is a flowchart illustrating a cache optimization method according to an exemplary embodiment.

[0026] Figure 2 This is a block diagram illustrating a cache optimization apparatus according to an exemplary embodiment.

[0027] Figure 3This is a block diagram illustrating a cache optimization apparatus according to an exemplary embodiment.

[0028] Figure 4 This is a block diagram illustrating a computer device according to an exemplary embodiment. Detailed Implementation

[0029] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0030] In traditional technologies, in a CDN environment where AI crawler traffic and human access traffic are mixed, the wide coverage and low reuse access pattern of AI crawler traffic will squeeze popular content frequently accessed by human users out of the shared cache (cache pollution).

[0031] This application provides a cache optimization method that can adaptively adjust the cache eviction algorithm or cache strategy based on the degree of cache pollution and the cache priority weight parameters issued by the management platform.

[0032] Figure 1 This is a flowchart illustrating a cache optimization method according to an exemplary embodiment. (Reference) Figure 1 Caching optimization methods are applied to edge nodes, including: Step S11: Determine the AI ​​access traffic pollution index of the node cache within each sliding time window.

[0033] Edge nodes can receive user request traffic triggered through UI interfaces or APIs, which can be associated with user accounts, sessions, IPs, devices, etc., and have a clear target. This type of request traffic can be regarded as human user-initiated request traffic, and is considered human access traffic or the first type of traffic. They can also receive AI access traffic from AI models calling tools or interfaces. This type of request is characterized by high concurrency and cyclical calls, and is significantly different from human access requests. Depending on their purpose, AI access request traffic can be further divided into RAG real-time query AI crawler traffic (or the second type of traffic), training data collection AI crawler traffic (or the third type of traffic), and search indexing AI crawler traffic (or the fourth type of traffic).

[0034] Because AI access traffic is characterized by high concurrency and cyclical calls, the proportion of AI access traffic in all requests can be determined by factors such as the percentage of deduplicated URLs and the percentage of requests generated by URLs with access frequencies below a frequency threshold within the sliding time window. A higher proportion of AI access traffic will result in more cached entries for AI access traffic in the cache space. By calculating the proportions of key parameters, the degree to which the cache is contaminated by AI access traffic can be reflected.

[0035] In an exemplary embodiment, determining the AI ​​access traffic pollution index of the node cache within each sliding time window includes: Determine the percentage of deduplicated URLs in all requests within the sliding time window, the percentage of requests generated by URLs with access frequency below a frequency threshold, and the percentage of cached entries whose hit count during eviction is less than a preset threshold.

[0036] The percentage of deduplicated URLs in all requests can be expressed as the Unique Access Ratio (UAR), which reflects the degree of dispersion of requests.

[0037] The percentage of requests generated by URLs with access frequency below a frequency threshold in all requests can be represented as LTR (Long-Tail Ratio), reflecting the degree to which long-tail content is accessed.

[0038] The percentage of cached entries whose hit count is less than a preset number when they are evicted can be represented as SUR (Single-Use Ratio). This reflects the degree to which cache space is occupied by low-reusability content. The preset number can be 2 or an integer greater than 2.

[0039] The AI ​​access traffic pollution index of the node cache within the sliding time window is determined by weighting and summing the proportion of the number of deduplicated URLs in all requests, the proportion of requests generated by URLs with access frequency below the frequency threshold in all requests, and the proportion of cache entries with fewer than the preset number of hits when being evicted.

[0040] The AI ​​access traffic pollution index can be represented as ATPI.

[0041] , where w1, w2, and w3 are weighting coefficients.

[0042] The ATPI (Asia Access Traffic Pollution Index) reflects the degree of AI access traffic pollution in node cache. A higher ATPI value indicates a higher degree of AI access traffic pollution.

[0043] The duration of the sliding time window can be set according to the specific use case. The number of sliding steps can be set to be less than the duration of the sliding time window, which can continuously update the AI ​​access traffic pollution index and form a smooth curve. For example, the sliding time window can be set to 5 minutes, and the number of sliding steps can be set to 1 minute.

[0044] By determining the AI ​​access traffic pollution index of the node cache within each sliding time window, a trend curve of the AI ​​access traffic pollution index can be generated.

[0045] By using the AI ​​access traffic pollution index and its trend curve, the degree of pollution of the cache by AI access traffic can be quantified, making it easier for operations and maintenance personnel and website customers to intuitively understand the impact of AI access traffic on cache performance.

[0046] Step S12: Report the AI ​​access traffic pollution index to the management platform and receive the cache priority weight parameters issued by the management platform.

[0047] Edge nodes can report the AI ​​access traffic pollution index of their node within each sliding time window to the management platform.

[0048] The management platform can display the current ATPI value and the corresponding pollution level in a real-time numerical dashboard.

[0049] For example, an ATPI value less than 0.3 indicates low AI access traffic pollution, normal node caching, and a green display on the real-time dashboard. An ATPI value greater than or equal to 0.3 and less than or equal to 0.6 indicates moderate AI access traffic pollution, with AI access traffic beginning to impact node caching performance, and a yellow display on the real-time dashboard. An ATPI value greater than 0.6 indicates severe AI access traffic pollution, degraded node caching performance, and a red display on the real-time dashboard.

[0050] The management platform can also generate trend curves, displaying historical trend graphs to operations and maintenance personnel, showing the ATPI change trend over a certain period of time for their reference.

[0051] The management platform can also trigger an alarm notification when the ATPI value exceeds a preset threshold, notifying maintenance personnel or website operators to take measures to adjust the cache priority weight configuration.

[0052] In an exemplary embodiment, the cache priority weight parameters include a first type of traffic weight α, a second type of traffic weight β, a third type of traffic weight γ, and a fourth type of traffic weight δ. The sum of the first type of traffic weight α, the second type of traffic weight β, the third type of traffic weight γ, and the fourth type of traffic weight δ is 1.

[0053] By adjusting the weighting coefficients of different traffic types, caching priorities can be implemented for different traffic types. For example, human access traffic can be cached first, or AI access traffic can be cached first.

[0054] For example, the system can provide several preset templates. The first is a template prioritizing human user access traffic, in which... The first type of traffic has the highest weight α. Choosing the human user access traffic priority template allows for the caching of human user access traffic more efficiently, maximizing the caching experience for human users. The second type is the balanced template, where... The weights of various traffic types are relatively balanced. Choosing a balanced template can accommodate the caching needs of both human user access traffic and AI access traffic. The third type is an AI access traffic-friendly template, in which... The first type of traffic has a lower weight α, while AI access traffic has a relatively higher weight. Choosing an AI access traffic-friendly template can cache AI ​​access traffic as much as possible, which is suitable for scenarios where you want to maximize AI search indexing and content distribution.

[0055] The management platform provides a cache priority weight configuration interface. When the AI-generated traffic pollution index exceeds the pollution threshold, operations and maintenance personnel or website operators can select different templates through this interface, or customize the weight coefficients for various traffic types. Selecting different templates or customizing the weight coefficients for various traffic types determines the cache priority weight parameters, with the intention of prioritizing or increasing the cache priority of certain types of traffic.

[0056] For example, when the pollution index of cached AI access traffic exceeds the pollution threshold, a human user access traffic priority template can be selected to ensure that edge nodes prioritize caching human user access traffic. When the pollution index of cached AI traffic is low, a balanced template or an AI access traffic friendly template can be selected to ensure that edge nodes provide more caching resources for AI access traffic. Alternatively, the weighting coefficients for various types of traffic can be customized according to specific needs or scenarios.

[0057] After receiving the template type or weight coefficients corresponding to various traffic types selected by the operation and maintenance personnel or website operators in the priority and weight configuration interface, the management platform will send the priority and weight parameters corresponding to the template type or the custom priority and weight parameters to the edge nodes.

[0058] Step S13: Adjust the cache eviction algorithm based on the AI ​​access traffic pollution index and cache priority weight parameters.

[0059] Edge nodes can adjust cache eviction algorithms based on AI access traffic pollution index and cache priority weight parameters.

[0060] Cache eviction algorithms include LRU (Least Recently Used algorithm, which evicts the least recently accessed data when the cache is full), SIEVE (a lightweight and efficient cache eviction algorithm), S3FIFO (a modern cache eviction algorithm that combines the advantages of FIFO and LFU), and LFU (Least Frequently Used algorithm, which evicts data with the lowest access frequency). Different eviction algorithms are suitable for different scenarios. For example, using SIEVE or LRU eviction algorithms can optimize the hit rate of popular content and response latency, suitable for scenarios where human user access traffic is prioritized for caching. Using S3FIFO or LFU eviction algorithms can optimize content coverage and origin server traffic, suitable for scenarios that also require caching AI access traffic.

[0061] In one exemplary embodiment, adjusting the cache eviction algorithm based on the AI ​​access traffic pollution index and cache priority weight parameters includes: When the slope of the trend curve of the AI ​​access traffic pollution index is greater than the slope threshold, or when the AI ​​access traffic pollution index is greater than the pollution threshold, the shadow caching engine is started to simulate and verify the candidate cache eviction algorithm. The simulated weighted hit rate of the candidate cache eviction algorithm is calculated based on the cache priority weight parameter. When the simulated weighted hit rate of the candidate cache eviction algorithm exceeds the sum of the first hit rate and the confirmation threshold of the source cache eviction algorithm, the current cache eviction algorithm is switched from the source cache eviction algorithm to the candidate cache eviction algorithm through the hot migration protocol.

[0062] The source eviction algorithm is the cache eviction algorithm used before the adjustment of the cache eviction algorithm. The candidate cache eviction algorithm is another available cache eviction algorithm besides the source eviction algorithm. There can be one or more candidate cache eviction algorithms.

[0063] The slope of the trend curve of the AI ​​access traffic pollution index reflects the intensity of the change. When the slope of the trend curve is greater than the slope threshold, it indicates that the traffic mixing state is changing significantly, which may cause serious pollution to the cache in the future (for example, a large amount of human access traffic cache is squeezed out by AI access traffic), and timely and effective measures need to be taken.

[0064] When the AI ​​access traffic pollution index is greater than the pollution threshold (e.g., 60%), it indicates that the cache has been severely polluted by AI access traffic and immediate measures need to be taken.

[0065] Edge nodes can launch a shadow caching engine to simulate and verify candidate algorithms. The shadow caching engine is a lightweight simulation instance of the candidate algorithm, maintaining only the cache's metadata structure and not actually storing data. The shadow caching engine's simulation and verification of candidate algorithms has no impact on the cached content. It simulates the write operations and cache resource evictions for each request under the candidate algorithm and records the simulated weighted hit rate of the candidate algorithm.

[0066] The edge nodes also maintain an algorithm performance prediction table, recording the average weighted hit rate of each cache eviction algorithm under different cache priority weight parameters. The average weighted hit rate can be the average weighted hit rate of the most recent consecutive sliding time windows under a certain cache priority weight parameter, and the number of consecutive sliding time windows can be set according to requirements.

[0067] If the simulated weighted hit rate of the candidate cache eviction algorithm is higher than the first weighted hit rate of the source cache eviction algorithm (the average weighted hit rate of the source cache eviction algorithm under the current cache priority weight parameter), it means that the candidate cache eviction algorithm is more suitable than the source cache eviction algorithm under the current cache priority weight parameter.

[0068] In this embodiment, when the simulated weighted hit rate of the candidate cache eviction algorithm exceeds the sum of the first hit rate and the confirmation threshold of the source cache eviction algorithm, the current cache eviction algorithm is switched from the source cache eviction algorithm to the candidate cache eviction algorithm. The confirmation threshold is a real number greater than or equal to 0, which can be determined according to the specific scenario. If the confirmation threshold is 0, switching the current cache eviction algorithm from the source cache eviction algorithm to the candidate cache eviction algorithm when the simulated weighted hit rate of the candidate cache eviction algorithm exceeds the first hit rate of the source cache eviction algorithm can easily lead to frequent switching of cache eviction algorithms, causing space jitter. To prevent cache space jitter, the confirmation threshold can be set to 5% or a larger number. For example, if the source eviction algorithm is LRU with an average hit rate of 50% under the current cache priority weight parameters, and the candidate cache eviction algorithm is SIEVE with a simulated weighted hit rate of 56%, 56% > 50% + 5%, the switching condition is met, and the current algorithm can be switched to SIEVE through a hot migration protocol. The core of the hot migration protocol is metadata transformation: according to the types of the source cache eviction algorithm and the candidate cache eviction algorithm, the old metadata of each cache entry is converted into new metadata according to predefined rules. For example, when the current cache eviction algorithm switches from LRU to SIEVE, the visited bit of the first 50% of entries in the LRU sort is set to 1, and the visited bit of the last 50% of entries is set to 0; when switching from LRU to S3FIFO, entries accessed more than or equal to 2 times are assigned to the main queue, and entries accessed once are assigned to the small queue.

[0069] When there are multiple candidate cache eviction algorithms, a simulated weighted hit rate can be calculated sequentially using one of the candidate algorithms as the target cache eviction algorithm. The candidate cache eviction algorithm with the highest simulated weighted hit rate is then selected from among the multiple candidate algorithms. When a certain condition is met, the current cache eviction algorithm is switched from the source cache eviction algorithm to the candidate cache eviction algorithm with the highest simulated weighted hit rate. This achieves the selection of the optimal cache eviction algorithm.

[0070] In an exemplary embodiment, there are a first type of traffic weight, a second type of traffic weight, a third type of traffic weight, and a fourth type of traffic weight; the sum of the first type of traffic weight, the second type of traffic weight, the third type of traffic weight, and the fourth type of traffic weight is 1. The weighted hit rate of the target cache eviction algorithm is the result of summing the cache hit rate of various traffic types with their corresponding weights under the target cache eviction algorithm. The target cache eviction algorithm includes any one of the source cache eviction algorithm and the candidate cache eviction algorithm.

[0071] The weighted multi-objective function can be expressed as:

[0072] in, For the target value, The cache hit rate for the first type of traffic (human access traffic). The cache hit rate for the second type of traffic (RAG real-time query AI crawler traffic). The cache hit rate for the third type of traffic (AI crawler traffic for training data collection). This represents the cache hit rate for the fourth type of traffic (search indexing AI crawler traffic). The cache hit rates for the above four types of traffic are the actual hit rates for these four types of traffic.

[0073] α, β, γ, and δ are the weights for the first type of traffic (α), the second type of traffic (β), the third type of traffic (γ), and the fourth type of traffic (δ) included in the cache priority weight parameters. The sum of the weights for the four types of traffic is 1.

[0074] The target cache eviction algorithm includes any one of the source cache eviction algorithm and the candidate cache eviction algorithm. Calculating the weighted hit rate of any cache eviction algorithm, or simulating the weighted hit rate, is the result of determining the weight of each type of traffic based on the cache priority weight parameter, and then summing the cache hit rates of the four types of traffic with their corresponding weights.

[0075] When the slope of the AI ​​access traffic pollution index trend curve exceeds a slope threshold, or when the AI ​​access traffic pollution index exceeds a pollution threshold, a cache eviction algorithm switch is triggered. The shadow caching engine simulates and verifies one or more candidate cache eviction algorithms. Based on cache priority weight parameters, the simulated weighted hit rate of the candidate cache eviction algorithms is calculated, and the optimal cache eviction algorithm is selected. The current cache eviction algorithm is switched from the source cache eviction algorithm to the optimal candidate cache eviction algorithm. This achieves adaptive selection of the cache eviction algorithm, ensuring that after switching algorithms, priority is given to caching of either human access traffic or AI access traffic. This avoids excessive pollution of human access traffic cache by AI access traffic while maximizing caching services for AI access traffic. It is worth noting that when the current cache eviction algorithm is switched from the source cache eviction algorithm to the optimal candidate cache eviction algorithm, if the switch is successful, the source cache eviction algorithm becomes the candidate cache eviction algorithm.

[0076] In one exemplary embodiment, the cache optimization method further includes: After switching the current cache eviction algorithm from the source cache eviction algorithm to the candidate cache eviction algorithm, monitor the second weighted hit rate of the candidate cache eviction algorithm. If the second weighted hit rate is less than the first weighted hit rate within N consecutive sliding time windows, switch the current cache eviction algorithm back from the candidate cache eviction algorithm to the source cache eviction algorithm. The second weighted hit rate is the average weighted hit rate within N sliding windows.

[0077] After switching from the source cache eviction algorithm to the candidate cache eviction algorithm, if the average weighted hit rate of the candidate cache eviction algorithm is less than the first weighted hit rate of the source cache eviction algorithm over N consecutive sliding time windows, it indicates that the cache eviction algorithm switch has not achieved the expected purpose. This may be due to a problem with the shadow cache engine's algorithm or a significant change in the ATPI value. In this case, it is necessary to promptly revert to the source cache eviction algorithm and issue an alarm message to the operations and maintenance personnel to adjust the shadow cache engine's algorithm accordingly. In this embodiment, N can be an integer greater than or equal to 1.

[0078] In one exemplary embodiment, the cache optimization method further includes adjusting the cache strategy.

[0079] Adjusting the caching strategy includes: Determine the cache value of cached resources; According to the preset eviction policy of the current cache eviction algorithm, k candidate eviction resources are selected from the cache resources, and the eviction resource with the lowest cache value among the k candidate eviction resources is determined as the eviction resource to be evicted. When the cache space utilization rate is greater than or equal to the first utilization rate threshold, the resource to be evicted is replaced.

[0080] Caching strategies involve determining when to write or read data. For example, clearing cached data when the cache space reaches a certain level.

[0081] After switching the cache eviction algorithm, the caching strategy can be further adjusted. In this embodiment, the cache value of the cached resources is determined, and then k candidate eviction resources are selected from the cached resources according to the preset eviction strategy of the current cache eviction algorithm. For example, after switching the current cache eviction algorithm from the source cache eviction algorithm (S3FIFO) to the candidate cache eviction algorithm (LRU), the current cache eviction algorithm is LRU. The LRU caching strategy is to prioritize eviction of the data that has not been accessed for the longest time when the cache is full. The k cache resources that have not been accessed for the longest time can be selected as candidate eviction resources, where K is an integer greater than or equal to 2. The default k=3. The eviction resource with the lowest cache value among the k candidate eviction resources is selected as the eviction resource to be evicted. When the cache space occupancy rate is greater than or equal to a first occupancy rate threshold (e.g., 90%), the eviction resource to be evicted is evicted.

[0082] The default eviction policy of the current cache eviction algorithm (eviction of the data that has not been accessed for the longest time) has been adjusted to select the cache resource with the lowest cache value from multiple cache data that have not been accessed for the longest time.

[0083] In one exemplary embodiment, the cached value of the cached resource is the output of a lightweight gradient boosting decision tree model that takes the multidimensional features of the request as input. The lightweight gradient boosting decision tree model is trained with the objective of maximizing the objective value of a weighted multi-objective function. The multidimensional features of the request include one or more of the following: request source type label, the proportion of requests of the same source type within the current sliding time window, the number of cache evictions triggered by requests of that source type per unit time, and the distribution vector of the number of times evicted cache entries are hit by requests of different source types.

[0084] In an exemplary embodiment, the cache value score can be represented as v, which is a real number between [0, 1], representing "the expected benefit of putting the content corresponding to this request into the cache". The higher the cache value score, the higher the hit rate that the content can contribute after being cached.

[0085] The lightweight gradient boosting decision tree model is trained with the optimization objective of maximizing the objective value of a weighted multi-objective function, and v is the output of the lightweight gradient boosting decision tree model.

[0086] The lightweight gradient boosting decision tree model is trained using historical log data. It learns which characteristics of requests, when cached, increase the objective value (Objective) of the weighted multi-objective function. For example, human requests with moderately sized objects that have been accessed multiple times recently are more likely to be cached, significantly increasing the hit rate and contributing to the Objective. However, for AI requests with large objects and a high unique access rate (UAR), caching is less likely to result in a hit and consumes a large amount of cache space, thus contributing less to the Objective.

[0087] Once the lightweight gradient boosting decision tree model is trained, it can be deployed to edge nodes. For each received request, the multi-dimensional features of the request are extracted and input into the lightweight gradient boosting decision tree model, which then outputs a cache value score.

[0088] Based on cache value scoring, admission decisions can be made for cache writes. For example, only requests with a cache value greater than a threshold are allowed to be cached.

[0089] It can also calculate a cache value score for any cached resource.

[0090] In applications, the model can be deployed using a Teacher-Student hierarchical architecture: the Teacher model is trained in full using aggregated logs at the CDN central node, while the Student model is generated through distillation and distributed to edge nodes, where incremental online learning is performed every 5 minutes.

[0091] Multidimensional features include one or more of the following: request source type label, percentage of requests of the same source type within the current sliding time window, number of cache evictions triggered by requests of that source type per unit time, and a distribution vector showing the number of times evicted cache entries are hit by requests of different source types. Traditional object-level features may also be included: object size, last access time, access frequency, etc. Request source type refers to which category of traffic (first, second, third, or fourth) the request originates from.

[0092] In this embodiment, source-aware features are introduced as input to the caching strategy, based on traditional object-level features (object size, recent access time, access frequency). The cached resources are scored for cache value, and cached resources with low cache value are eliminated first, thereby improving the overall cache value.

[0093] Because lightweight gradient boosting decision tree models are trained to maximize the objective value of a weighted multi-objective function, and the weights of various traffic types in the weighted multi-objective function are determined by cache priority weight parameters, the cache value of the same cache resource may differ under different cache priority weight parameters.

[0094] For example, when the cache priority weight parameter is At that time, the first type of traffic has the highest weight α. The lightweight gradient boosting decision tree model optimizes the result by maximizing the objective value of the weighted multi-objective function. The cached resources corresponding to human access requests have high cache value, while the cached resources corresponding to AI access requests have low cache value. When determining the resource with the lowest cache value among the k candidate resources to be evicted, the cached resources corresponding to AI access requests can be evicted first, while the cached resources corresponding to human access requests can be retained.

[0095] Similarly, when the cache priority weight parameter is At that time, the AI ​​access traffic has a relatively high weight. The lightweight gradient boosting decision tree model optimizes the result by maximizing the objective value of the weighted multi-objective function. The cache value of the cached resources corresponding to human access requests and the cached resources corresponding to AI access requests are not much different. When determining the resource with the lowest cache value among the k candidate resources to be eliminated, the cached resource corresponding to human access requests may be eliminated or the cached resource corresponding to AI access requests may be eliminated. The probabilities are similar, so AI access traffic can be cached as much as possible.

[0096] In one exemplary embodiment, adjusting the caching strategy further includes: When the cache space occupancy rate is greater than or equal to the second occupancy rate threshold and less than the first occupancy rate threshold, the cache value of the resource to be cached and the resource to be evicted are compared. When the cache value of the resource to be cached is greater than the sum of the cache value of the resource to be evicted and the debouncing threshold, the resource to be evicted is evicted and written into the cache space. The debouncing threshold is a real number greater than or equal to 0.

[0097] If the cache value of a computational request is high, the request can be cached, and it will only be considered as a resource to be cached. The request will not be cached immediately. If the cache space occupancy rate is greater than or equal to the second occupancy threshold (80%) but less than the first occupancy threshold (90%), the cache space will be full. Cacheing the resource to be cached at this time may trigger the eviction of other cached resources. Among the k candidate eviction resources, the resource with the lowest cache value is determined as the resource to be evicted. The cache values ​​of the resource to be cached and the resource to be evicted are compared. If the cache value of the resource to be cached is greater than the cache value of the resource to be evicted, or if the cache value of the resource to be cached is greater than the sum of the cache value of the resource to be evicted and the debouncing threshold, the resource to be evicted is evicted, and the resource to be cached is written to the cache space. Otherwise, it is not stored.

[0098] In this application, adjusting the caching strategy essentially involves setting cache admission decisions and optimizing the cache eviction policy. This preserves the overall framework of the current cache eviction algorithm while fine-tuning the caching strategy to prevent "high-value" entries under the current cache priority weight parameters from being evicted. In scenarios where human access traffic is cached first, this effectively avoids the contamination of human access traffic cache by AI access traffic.

[0099] In an exemplary embodiment, the third weighted hit rate after adjusting the caching strategy is monitored. If the third weighted hit rate is lower than the average weighted hit rate of the current cache eviction algorithm within M consecutive sliding time windows, the cache resource is evicted according to the preset eviction strategy of the current cache eviction algorithm. M is an integer greater than or equal to 1, and the third weighted hit rate is the average weighted hit rate within M sliding time windows.

[0100] Adjusting the caching strategy is a further optimization of cached resources after adjusting the cache eviction algorithm. Adjusting the cache eviction algorithm includes the following: If the simulated weighted hit rate of the candidate cache eviction algorithm does not exceed the sum of the first weighted hit rate and the confirmation threshold of the source cache eviction algorithm, then there is no need to switch the cache eviction algorithm; the current cache eviction algorithm is the source cache eviction algorithm.

[0101] When the simulated weighted hit rate of a candidate cache eviction algorithm exceeds the sum of the first weighted hit rate and the confirmation threshold of the source cache eviction algorithm, the current cache eviction algorithm is switched from the source cache eviction algorithm to the candidate cache eviction algorithm. Furthermore, if the second weighted hit rate of the candidate cache eviction algorithm is greater than or equal to the first weighted hit rate within N consecutive sliding time windows, the cache eviction algorithm switch is successful. At this point, the candidate cache eviction algorithm is used as the current cache eviction algorithm.

[0102] When the simulated weighted hit rate of a candidate cache eviction algorithm exceeds the sum of the first weighted hit rate and the confirmation threshold of the source cache eviction algorithm, the current cache eviction algorithm is switched from the source cache eviction algorithm to the candidate cache eviction algorithm. However, if the second weighted hit rate of the candidate cache eviction algorithm is less than the first weighted hit rate within N consecutive sliding time windows, the cache eviction algorithm switch fails, and it needs to fall back to the source cache eviction algorithm. In this case, the source cache eviction algorithm is used as the current cache eviction algorithm.

[0103] In all three scenarios described above, the caching strategy can be adjusted based on the current cache eviction algorithm. This aims to reduce the AI ​​access traffic pollution index or alter its trend.

[0104] If the third weighted hit rate after adjusting the caching strategy is higher than the average weighted hit rate of the current cache eviction algorithm, it means that the adjustment of the caching strategy has been effective, and cache resources should be evicted according to the adjusted caching strategy.

[0105] If the third weighted hit rate after adjusting the caching strategy is lower than the average weighted hit rate of the current cache eviction algorithm, it means that the adjustment of the caching strategy has not been effective and it is necessary to revert to the state before the adjustment and evict cache resources according to the preset eviction strategy of the current cache eviction algorithm.

[0106] To better understand the cache optimization method provided in this application, specific embodiments are described below. Specific Implementation Example 1 When a CDN system provides caching services for AI request traffic, caching optimization methods are deployed on edge nodes.

[0108] For example, in the initial stage, edge nodes have sufficient cache space. The edge nodes determine the AI ​​access traffic pollution index (ATPI) value of the node cache within each sliding time window and report it to the management platform.

[0109] The management platform shows an ATPI value less than 0.3, indicating low levels of AI access traffic contamination and normal node caching operation. To cache AI ​​access traffic as much as possible, the operations team used the system's preset AI access traffic-friendly template, and the cache priority weight parameters... The goal is to provide balanced caching services for different types of traffic. The current cache eviction algorithm uses LRU (Least Recently Used) to cache AI ​​access traffic as much as possible. The management platform distributes cache priority weight parameters to edge nodes.

[0110] During the runtime phase, the edge nodes maintain an algorithm performance prediction table, which records the weighted hit rate calculated by the cache eviction algorithm under various cache priority weight parameters, and calculates the average weighted hit rate.

[0111] At this point, the edge node records the LRU cache eviction algorithm's cache priority weight parameter. The weighted hit rate is calculated below, and the average weighted hit rate is statistically averaged, assumed to be 70%.

[0112] At a certain point, the slope of the AI ​​access traffic pollution index trend curve exceeded the slope threshold, triggering a cache eviction algorithm adjustment. At this moment, the AI ​​access traffic pollution index was 40, indicating a moderate level of AI access traffic pollution. AI access traffic was beginning to impact node cache performance, and the real-time dashboard displayed a yellow indicator. The operations team selected a load balancer template, and the cache priority weight parameters... The goal is to balance the caching needs of both human user traffic and AI access traffic. The management platform distributes cache priority and weight parameters to edge nodes.

[0113] The edge node starts a shadow caching engine to simulate and verify the candidate eviction algorithms. Three candidate eviction algorithms are available: SIEVE, S3FIFO, and LFU. The shadow caching engine simulates the write operations and cache resource eviction for each request under each candidate algorithm, based on the latest cache priority weight parameter. Calculate the simulated weighted hit rate of the candidate cache eviction algorithms. Assume that the simulated weighted hit rate of S3FIFO is the highest at 72%, which does not exceed the sum of the weighted hit rate of the source cache eviction algorithm LRU (70%) and the confirmation threshold (5%). The cache eviction algorithm does not need to be adjusted, and the current cache eviction algorithm is maintained as LRU.

[0114] Record the current cache eviction algorithm as LRU, with the latest cache priority weight parameter. The weighted hit rate is calculated, and the average weighted hit rate is assumed to be 71%.

[0115] The caching strategy has been further adjusted by introducing a cache value scoring system. When evicting cached resources, three candidate resources are selected from the cached resources. The resource with the lowest cache value among the three candidates is then evicted, instead of eviction based on the default LRU strategy of evicting the "least recently used" cache resource. The latest cache priority weight parameter is used. The lightweight gradient boosting decision tree model assigns a higher value score to cached resources for human access traffic based on a weight of 0.4. When the unaccessed time is the same, cached resources for AI access traffic are prioritized for elimination.

[0116] Edge nodes obtain the actual hit rates of various traffic types after adjusting the caching strategy, and combine them with the latest cache priority weight parameters. Substituting these parameters into a weighted multi-objective function, the weighted hit rate after the strategy adjustment is calculated. Assuming it is 72%, which is greater than the weighted hit rate of 71% before the caching strategy adjustment, this indicates that the adjusted caching strategy is effective.

[0117] Edge nodes continue to use cache priority weight parameters Run the program and report the ATPI value at any time.

[0118] When the ATPI value rises to 65 at a certain point, it indicates a severe level of AI access traffic pollution. The management platform's operations and maintenance personnel issue an alarm. They then select the "Human User Access Traffic Priority" template in the management platform's cache priority and weight configuration interface, intending for the system to prioritize caching human user access traffic. The administrator sets the cache priority and weight parameters as follows: Distribute to edge nodes.

[0119] The edge node starts a shadow caching engine to simulate and verify the candidate eviction algorithm. The shadow caching engine simulates the write operation of each request and the eviction of cached resources under the candidate algorithm, based on the latest cache priority weight parameter. Calculate the simulated weighted hit rate of the candidate cache eviction algorithms. Assume that the S3FIFO algorithm has the highest simulated weighted hit rate of 76%, exceeding the sum of the source cache eviction algorithm LRU's weighted hit rate of 70% and the acknowledgment threshold (5%). The cache eviction algorithm needs adjustment; switch from the source cache eviction algorithm LRU to the candidate cache eviction algorithm S3FIFO. Using a hot migration protocol, allocate entries accessed at least twice to the main queue and entries accessed once to the small queue.

[0120] Subsequently, the edge node monitoring cache eviction algorithm S3FIFO adjusts the cache priority weight parameter. If the average weighted hit rate of the SIEVE cache eviction algorithm is greater than or equal to 70% within 5 sliding time windows, the current cache eviction algorithm is maintained as S3FIFO, and the algorithm switch is successful. If the average weighted hit rate of the S3FIFO cache eviction algorithm is less than 70% within 5 time windows, algorithm rollback is performed, and the current cache eviction algorithm is switched back to the source cache eviction algorithm LRU.

[0121] If the cache eviction algorithm switch is successful, the current cache eviction algorithm is S3FIFO. Record the cache priority weight parameter of the S3FIFO cache eviction algorithm in the algorithm performance prediction table. The weighted hit rate is calculated below, and the average weighted hit rate is statistically averaged, assumed to be 75%.

[0122] The caching strategy can be further adjusted. The default eviction strategy of the S3FIFO cache eviction algorithm is to evict the cache resource with the fewest accesses. The adjusted caching strategy is as follows: when evictioning a cache resource, select 3 candidate eviction resources from the cache resources, and determine the eviction resource with the lowest cache value among the 3 candidate eviction resources as the resource to be evicted.

[0123] After monitoring and adjusting the caching strategy, if the weighted hit rate after the adjustment is greater than or equal to 75% of the weighted hit rate of the current cache eviction algorithm S3FIFO within 5 consecutive sliding time windows, the adjusted caching strategy will be executed.

[0124] If the average weighted hit rate is less than 75% of the average weighted hit rate of the current cache eviction algorithm S3FIFO within 5 consecutive sliding time windows, the cache resource will be evicted according to the preset eviction policy of the cache eviction algorithm S3FIFO.

[0125] According to the above embodiments, the cache optimization method provided in this application can generate a real-time value of the AI ​​access traffic pollution index, quantify the degree of pollution, and issue an alarm message when the degree of pollution exceeds a set threshold, reminding relevant personnel to intervene in a timely manner. Furthermore, when the slope of the trend curve of the AI ​​access traffic pollution index is greater than a slope threshold, or when the AI ​​access traffic pollution index is greater than a pollution threshold, the cache eviction algorithm and cache strategy can be adaptively adjusted according to the cache priority weight parameters set by relevant personnel, autonomously selecting the optimal cache eviction algorithm and cache strategy to improve cache performance.

[0126] Figure 2 This is a block diagram illustrating a cache optimization apparatus according to an exemplary embodiment. (Reference) Figure 2 The cache optimization device is applied to edge nodes and includes: a pollution index determination module 201, a communication module 202, and an adjustment module 203.

[0127] The pollution index determination module 201 is configured to determine the pollution index of AI access traffic cached by nodes within each sliding time window.

[0128] The communication module 202 is configured to report the AI ​​access traffic pollution index to the management platform and receive cache priority weight parameters issued by the management platform.

[0129] The adjustment module 203 is configured to adjust the cache eviction algorithm based on the AI ​​access traffic pollution index and cache priority weight parameters.

[0130] In one exemplary embodiment, the pollution index determination module 201 is further configured to: Determine the percentage of deduplicated URLs in all requests within the sliding time window, the percentage of requests generated by URLs with access frequency below the frequency threshold, and the percentage of cached entries whose hit count is less than the preset number when being evicted. The AI ​​access traffic pollution index of the node cache within the sliding time window is determined by weighted summation of the proportion of deduplicated URLs in all requests, the proportion of requests generated by URLs with access frequency below the frequency threshold in all requests, and the proportion of cache entries whose hit count at the time of elimination is less than the preset threshold.

[0131] In one exemplary embodiment, the adjustment module 203 is further configured to: When the slope of the trend curve of the AI ​​access traffic pollution index is greater than the slope threshold, or when the AI ​​access traffic pollution index is greater than the pollution threshold, the shadow caching engine is started to simulate and verify the candidate cache eviction algorithm. The simulated weighted hit rate of the candidate cache eviction algorithm is calculated according to the cache priority weight parameter. When the simulated weighted hit rate of the candidate cache eviction algorithm exceeds the sum of the first weighted hit rate and the confirmation threshold of the source cache eviction algorithm, the current cache eviction algorithm is switched from the source cache eviction algorithm to the candidate cache eviction algorithm. The confirmation threshold is a real number greater than or equal to 0, and the first weighted hit rate is the average hit rate.

[0132] In one exemplary embodiment, the adjustment module 203 is further configured to: Determine the cache value of cached resources; Based on the preset eviction policy of the current cache eviction algorithm, k candidate eviction resources are selected from the cache resources, and the eviction resource with the lowest cache value among the k candidate eviction resources is determined as the eviction resource to be evicted; where k is an integer greater than or equal to 2; When the cache space utilization rate is greater than or equal to the first utilization rate threshold, the resource to be evicted is replaced.

[0133] In one exemplary embodiment, the adjustment module 203 is further configured to: When the cache space occupancy rate is greater than or equal to the second occupancy rate threshold and less than the first occupancy rate threshold, the cache value of the resource to be cached and the resource to be evicted are compared. When the cache value of the resource to be cached is greater than the sum of the cache value of the resource to be evicted and the debouncing threshold, the resource to be evicted is evicted and the resource to be cached is written into the cache space. The debouncing threshold is a real number greater than or equal to 0.

[0134] Figure 3 This is a block diagram illustrating a cache optimization apparatus according to an exemplary embodiment. (Reference) Figure 3 The cache optimization device also includes: verification module 301.

[0135] The verification module 301 is configured to: monitor the second weighted hit rate of the candidate cache eviction algorithm; if the second weighted hit rate is less than the first weighted hit rate within N consecutive sliding time windows, switch the current cache eviction algorithm from the candidate cache eviction algorithm back to the source cache eviction algorithm, where N is an integer greater than or equal to 1, and the second weighted hit rate is the average weighted hit rate within N sliding windows.

[0136] In one exemplary embodiment, the verification module 301 is further configured to: Monitor the third weighted hit rate after adjusting the caching strategy. If the third weighted hit rate is lower than the average weighted hit rate of the current cache eviction algorithm within M consecutive sliding time windows, evict cache resources according to the preset eviction strategy of the current cache eviction algorithm. M is an integer greater than or equal to 1, and the third weighted hit rate is the average weighted hit rate within M sliding time windows.

[0137] Figure 4 This is a block diagram illustrating a computer device 400 for cache optimization according to an exemplary embodiment. For example, the computer device 400 may be provided as a server. (Refer to...) Figure 4 The computer device 400 includes a processor 401, the number of which can be set to one or more as needed. The computer device 400 also includes a memory 402 for storing instructions executable by the processor 401, such as application programs. The number of memories can be set to one or more as needed. The stored application programs can be one or more. The processor 401 is configured to execute instructions to perform the aforementioned cache optimization method.

[0138] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus (devices), or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code. Computer storage media include volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data), including but not limited to RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible by a computer. Furthermore, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and can include any information delivery medium.

[0139] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0140] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0141] In this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that an article or device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such an article or device. Without further limitation, an element defined by the phrase "comprising..." does not exclude the presence of other identical elements in the article or device that includes said element.

[0142] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.

[0143] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if these modifications and variations fall within the scope of the claims of this application and their equivalents, the intent of this application also includes these modifications and variations.

Claims

1. A cache optimization method, characterized by, Applied to edge nodes, including: Determine the AI ​​access traffic pollution index of the node cache within each sliding time window; The AI ​​access traffic pollution index is reported to the management platform, and the cache priority weight parameters issued by the management platform are received. The cache eviction algorithm is adjusted based on the AI ​​access traffic pollution index and the cache priority weight parameter.

2. The cache optimization method of claim 1, wherein, The determination of the AI ​​access traffic pollution index for node cache within each sliding time window includes: Determine the percentage of deduplicated URLs in all requests within the sliding time window, the percentage of requests generated by URLs with access frequency below the frequency threshold, and the percentage of cached entries whose hit count is less than the preset number when being evicted. The AI ​​access traffic pollution index of the node cache within the sliding time window is determined by weighted summation of the proportion of deduplicated URLs in all requests, the proportion of requests generated by URLs with access frequency below the frequency threshold in all requests, and the proportion of cache entries whose hit count at the time of elimination is less than the preset threshold.

3. The cache optimization method of claim 1, wherein, The cache eviction algorithm based on the AI ​​access traffic pollution index and the cache priority weight parameter includes: When the slope of the trend curve of the AI ​​access traffic pollution index is greater than the slope threshold, or when the AI ​​access traffic pollution index is greater than the pollution threshold, the shadow caching engine is started to simulate and verify the candidate cache eviction algorithm. The simulated weighted hit rate of the candidate cache eviction algorithm is calculated according to the cache priority weight parameter. When the simulated weighted hit rate of the candidate cache eviction algorithm exceeds the sum of the first weighted hit rate and the confirmation threshold of the source cache eviction algorithm, the current cache eviction algorithm is switched from the source cache eviction algorithm to the candidate cache eviction algorithm. The confirmation threshold is a real number greater than or equal to 0, and the first weighted hit rate is the average hit rate.

4. The cache optimization method of claim 3, wherein, Also includes: Monitor the second weighted hit rate of the candidate cache eviction algorithm. If the second weighted hit rate is less than the first weighted hit rate within N consecutive sliding time windows, switch the current cache eviction algorithm from the candidate cache eviction algorithm back to the source cache eviction algorithm. N is an integer greater than or equal to 1, and the second weighted hit rate is the average weighted hit rate within N sliding windows.

5. The cache optimization method as described in any one of claims 1-4, characterized in that, Also includes: Adjust caching strategy; The adjusted caching strategy includes: Determine the cache value of cached resources; According to the preset eviction policy of the current cache eviction algorithm, k candidate eviction resources are selected from the cache resources, and the eviction resource with the lowest cache value among the k candidate eviction resources is determined as the eviction resource to be evicted; where k is an integer greater than or equal to 2; When the cache space occupancy rate is greater than or equal to the first occupancy rate threshold, the resource to be evicted is discarded.

6. The cache optimization method as described in claim 5, characterized in that, The adjusted caching strategy also includes: When the cache space occupancy rate is greater than or equal to the second occupancy rate threshold and less than the first occupancy rate threshold, the cache value of the resource to be cached and the resource to be evicted are compared. When the cache value of the resource to be cached is greater than the sum of the cache value of the resource to be evicted and the debouncing threshold, the resource to be evicted is evicted and written into the cache space. The debouncing threshold is a real number greater than or equal to 0.

7. The cache optimization method as described in claim 6, characterized in that, Also includes: Monitor the third weighted hit rate after adjusting the caching strategy. If the third weighted hit rate is lower than the average weighted hit rate of the current cache eviction algorithm within M consecutive sliding time windows, evict cache resources according to the preset eviction strategy of the current cache eviction algorithm. M is an integer greater than or equal to 1, and the third weighted hit rate is the average weighted hit rate within M sliding time windows.

8. The cache optimization method as described in claim 5, characterized in that, The cache priority weight parameters include: first type traffic weight, second type traffic weight, third type traffic weight, and fourth type traffic weight; the sum of the first type traffic weight, second type traffic weight, third type traffic weight, and fourth type traffic weight is 1; The weighted hit rate of the target cache eviction algorithm is the result of weighted summation of the cache hit rate of various traffic types and their corresponding weights under the target cache eviction algorithm. The target cache eviction algorithm includes any one of the source cache eviction algorithm and the candidate cache eviction algorithm.

9. The cache optimization method as described in claim 8, characterized in that, The cache value of the cached resource is the output of a lightweight gradient boosting decision tree model that takes the multidimensional features of the request as input. The lightweight gradient boosting decision tree model is trained with the optimization objective of maximizing the objective value of the weighted multi-objective function. The multidimensional features include one or more of the following: request source type label, the proportion of requests of the same source type in the current sliding time window, the number of cache evictions triggered by requests of that type of source per unit time, and the distribution vector of the number of times the evicted cache entry is hit by requests of different source types.

10. A cache optimization device, characterized in that, Applied to edge nodes, including: The pollution index determination module is used to determine the pollution index of AI access traffic cached by nodes within each sliding time window; The communication module is used to report the AI ​​access traffic pollution index to the management platform and receive the cache priority weight parameters issued by the management platform. The adjustment module is used to adjust the cache eviction algorithm based on the AI ​​access traffic pollution index and the cache priority weight parameter.

11. The cache optimization apparatus as described in claim 10, characterized in that, The adjustment module is also used for: When the slope of the trend curve of the AI ​​access traffic pollution index is greater than the slope threshold, or when the AI ​​access traffic pollution index is greater than the pollution threshold, the shadow caching engine is started to simulate and verify the candidate cache eviction algorithm. The simulated weighted hit rate of the candidate cache eviction algorithm is calculated according to the cache priority weight parameter. When the simulated weighted hit rate of the candidate cache eviction algorithm exceeds the sum of the first weighted hit rate and the confirmation threshold of the source cache eviction algorithm, the current cache eviction algorithm is switched from the source cache eviction algorithm to the candidate cache eviction algorithm. The confirmation threshold is a real number greater than or equal to 0, and the first weighted hit rate is the average hit rate.

12. The cache optimization apparatus as described in claim 11, characterized in that, Also includes: The verification module is used to monitor the second weighted hit rate of the candidate cache eviction algorithm. If the second weighted hit rate is less than the first weighted hit rate within N consecutive sliding time windows, the current cache eviction algorithm is switched from the candidate cache eviction algorithm back to the source cache eviction algorithm. N is an integer greater than or equal to 1, and the second weighted hit rate is the average weighted hit rate within N sliding windows.

13. The cache optimization apparatus as described in claim 12, characterized in that, The adjustment module is also used for: Adjust caching strategy; The adjusted caching strategy includes: Determine the cache value of cached resources; According to the preset eviction policy of the current cache eviction algorithm, k candidate eviction resources are selected from the cache resources, and the eviction resource with the lowest cache value among the k candidate eviction resources is determined as the eviction resource to be evicted; where k is an integer greater than or equal to 2; When the cache space occupancy rate is greater than or equal to the first occupancy rate threshold, the resource to be evicted is discarded.

14. The cache optimization apparatus as described in claim 13, characterized in that, The adjustment module is also used for: When the cache space occupancy rate is greater than or equal to the second occupancy rate threshold and less than the first occupancy rate threshold, the cache value of the resource to be cached and the resource to be evicted are compared. When the cache value of the resource to be cached is greater than the sum of the cache value of the resource to be evicted and the debouncing threshold, the resource to be evicted is evicted and written into the cache space. The debouncing threshold is a real number greater than or equal to 0.

15. The cache optimization apparatus as described in claim 14, characterized in that, The verification module is also used to: monitor the third weighted hit rate after adjusting the caching strategy; if the third weighted hit rate is lower than the average weighted hit rate of the current cache eviction algorithm within M consecutive sliding time windows, evict cache resources according to the preset eviction strategy of the current cache eviction algorithm, where M is an integer greater than or equal to 1, and the third weighted hit rate is the average weighted hit rate within M sliding time windows.

16. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed, it implements the steps of the method as described in any one of claims 1-9.

17. A computer device comprising a processor, a memory, and a computer program stored in the memory, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1-9.