Cache configuration determination method, program product, electronic equipment and storage medium

CN119316483APending Publication Date: 2025-01-14SHANGHAI SHIZHUANG INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411440145.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-15
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

When the cache capacity is full, the data with the longest elimination time will be eliminated, resulting in a decrease in the cache hit rate.

Method used

By receiving traffic request data, the data is collected based on the current rule information, the rule information is dynamically adjusted, including threshold information and time window, and the cache configuration is determined to ensure that data items with higher access frequency are always retained in the cache.

Benefits of technology

The cache hit rate is improved, ensuring that data items with higher access frequency are always in the cache, improving system performance and response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119316483A_ABST
    Figure CN119316483A_ABST
Patent Text Reader

Abstract

The invention provides a cache configuration determination method and device, electronic equipment and a storage medium. The method comprises the following steps: receiving traffic request data; on the basis of the flow request data, circularly executing the following steps until an obtained statistical result meets a preset caching requirement: counting the flow request data according to the current rule information to obtain a statistical result; the current rule information comprises threshold information and a time window; the statistical result comprises a high-frequency data access amount and data access effective time; adjusting the current rule information according to the statistical result to obtain the adjusted rule information, and updating the current rule information into the adjusted rule information; and after the obtained statistical result meets a preset caching requirement, determining caching configuration by using the adjusted rule information. And the rule information is dynamically adjusted by using the statistical result, and the cache configuration is determined, so that the data item with the highest access frequency is always kept in the cache to a certain extent, and the cache hit rate is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cache technology, and in particular to a cache configuration determination method, a program product, an electronic device, and a storage medium. Background Art

[0002] With the development of Internet technology, using cache middleware to improve the overall performance of the system has become an indispensable technology. Cache middleware can effectively help software programs reduce the data layer load, thereby improving the performance and response speed of the system. The current cache solution, when the number of caches exceeds the cache capacity, will eliminate the data that has existed in the cache for the longest time. This cache solution will affect the cache hit rate. Summary of the invention

[0003] The purpose of the embodiments of the present application is to provide a cache configuration determination method, program product, electronic device and storage medium, which are used to improve the above-mentioned problems and increase the cache hit rate.

[0004] In a first aspect, an embodiment of the present application provides a cache configuration determination method, comprising: receiving traffic request data; based on the traffic request data, loopingly executing the following steps until the obtained statistical results meet the preset cache requirements: performing statistics on the traffic request data according to the current rule information to obtain statistical results; the current rule information includes threshold information and a time window; the statistical results include high-frequency data access volume and / or data access effective time; high-frequency data access volume refers to the access volume of data whose access frequency in the traffic request data within the time window exceeds the threshold information; adjusting the current rule information according to the statistical results to obtain adjusted rule information, and updating the current rule information to the adjusted rule information; after the obtained statistical results meet the preset cache requirements, using the adjusted rule information to determine the cache configuration.

[0005] In the above implementation process, by collecting statistics on traffic request data, the statistical results are obtained to quickly capture the changes in traffic request access patterns, and provide accurate data support for subsequent rule optimization; the statistical results are used to dynamically adjust and optimize rule information, including access thresholds and time windows, to determine cache configuration, and to a certain extent ensure that data items with high access frequencies are always retained in the cache. When a new request attempts to access the cache, the probability of successfully finding the data in the cache will be greatly increased.

[0006] Optionally, in an embodiment of the present application, the traffic request data includes a request identifier and target data corresponding to the request identifier; the traffic request data is counted according to the current rule information to obtain statistical results, including: taking time windows as units, counting the access frequency of target data corresponding to the same request identifier in the traffic request data; determining target data whose access frequency exceeds threshold information as high-frequency access data, and determining the access volume of the high-frequency data based on the access frequency of the high-frequency access data; and determining the effective data access time of the high-frequency access data based on the occurrence of the high-frequency access data in a continuous time window.

[0007] In the implementation process of the above embodiment: the traffic request data is counted according to the current rule information to obtain the high-frequency data access volume and the data access effective time. The effective time helps to identify the duration for which the data item maintains a high access frequency, thereby determining whether its popularity is a short-term phenomenon or a long-term trend, providing a basis for dynamically adjusting the rule information.

[0008] Optionally, in an embodiment of the present application, the current rule information is adjusted according to the statistical results to obtain adjusted rule information, including: determining the cache pre-occupancy amount based on the high-frequency data access volume and the corresponding data access effective time; comparing the cache pre-occupancy amount with the preset cache capacity, and adjusting the current rule information according to the comparison result to obtain the adjusted rule information.

[0009] In the implementation process of the above embodiment: the current rule information is adjusted dynamically in real time according to the statistical results, the changes in the data access mode are quickly monitored, and the rule information is adaptively adjusted to adapt to different data access modes.

[0010] Optionally, in an embodiment of the present application, the cache pre-occupancy amount is determined based on the high-frequency data access volume and the corresponding data access effective time, including: multiplying the high-frequency data access volume and the data access effective time corresponding to the high-frequency access data to obtain the cache pre-occupancy component of the high-frequency access data; adding the cache pre-occupancy components of multiple high-frequency access data in the statistical results to obtain the cache pre-occupancy amount.

[0011] In the implementation process of the above embodiment: the high-frequency data access amount corresponding to the high-frequency access data and the data access effective time are multiplied, and then the cache pre-occupancy components of multiple high-frequency access data are added to obtain the cache pre-occupancy amount, and a quantitative method is used to evaluate the importance and popularity of the data to help determine which data is worthy of occupying limited cache space, ensuring that the cache stores data that users need to access quickly.

[0012] Optionally, in an embodiment of the present application, the cache pre-occupancy amount is compared with a preset cache capacity, and the rule information is adjusted according to the comparison result to obtain the adjusted rule information, including: comparing the cache pre-occupancy amount with the preset cache capacity to obtain a comparison result; if the comparison result indicates that the cache pre-occupancy amount is less than the cache capacity, and the difference between the two is greater than a preset value, then the threshold information in the rule information is adjusted upward to obtain the adjusted threshold information; if the comparison result indicates that the cache pre-occupancy amount is greater than the cache capacity, then the duration of the time window in the rule information is increased to obtain the adjusted time window.

[0013] In the implementation process of the above embodiment: the cache pre-occupancy amount is compared with the preset cache capacity, and the comparison result is used to adjust the threshold information or time window in the rule information to obtain more accurate rule information. Through continuous optimization, the statistical results calculated by the adjusted rule information finally meet the cache conditions, thereby achieving more reasonable cache configuration.

[0014] Optionally, in an embodiment of the present application, the statistical results meet preset cache requirements, including: the cache pre-occupancy amount is equal to the cache capacity; or, the difference between the cache pre-occupancy amount and the cache capacity is less than a preset value.

[0015] In the implementation process of the above embodiment: since the cache capacity is limited, the cache pre-occupancy is equal to the cache capacity, which maximizes the use of the cache capacity, and the cache space stores data with a higher access frequency, thereby improving the cache hit rate; and by setting a preset value as a tolerable error, the number of loop executions is reduced, thereby improving the efficiency of the cache configuration.

[0016] Optionally, in an embodiment of the present application, the adjusted rule information includes adjusted threshold information and an adjusted time window; the cache configuration includes data that needs to be cached; the traffic request data includes a request identifier and target data corresponding to the request identifier; the cache configuration is determined using the adjusted rule information, including: taking the adjusted time window as a unit, counting the access frequency of the target data corresponding to the same request identifier in the traffic request data; and determining the target data whose access frequency exceeds the adjusted threshold information as data that needs to be cached.

[0017] In the implementation process of the above embodiment: the mutual coordination of the dynamic backtracking algorithm and the sliding time window algorithm effectively ensures a better cache strategy in the software system, thereby greatly improving the performance and stability of the system.

[0018] In a second aspect, an embodiment of the present application further provides a cache configuration determination device, including: a traffic receiving module, configured to receive traffic request data;

[0019] The algorithm module is used to loop through the following steps based on the traffic request data until the obtained statistical results meet the preset cache requirements:

[0020] Statistics are performed on the traffic request data according to the current rule information to obtain statistical results; the current rule information includes threshold information and time window; the statistical results include high-frequency data access volume and / or data access effective time; high-frequency data access volume refers to the access volume of data whose access frequency exceeds the threshold information in the traffic request data within the time window;

[0021] Adjust the current rule information according to the statistical result, obtain the adjusted rule information, and update the current rule information to the adjusted rule information;

[0022] The cache configuration module is used to determine the cache configuration using the adjusted rule information after the obtained statistical results meet the preset cache requirements.

[0023] In a third aspect, an embodiment of the present application further provides a computer program product, including computer program instructions, which, when executed by a processor, execute the method provided by the first aspect or any one of the implementations of the first aspect.

[0024] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising: a processor and a memory, the memory storing computer program instructions, and the computer program instructions, when executed by the processor, execute the method provided by the first aspect or any one of the implementations of the first aspect.

[0025] In a fifth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method provided by the first aspect or any one of the implementations of the first aspect is executed.

[0026] By adopting a cache configuration determination method, program product, electronic device and storage medium provided by the present application, by counting traffic request data, statistical results are obtained, and changes in traffic request access patterns are quickly captured, and subsequent rule optimization provides accurate data support; using statistical results to dynamically adjust and optimize rule information, including access thresholds and time windows, to determine cache configuration, to a certain extent, ensure that the most frequently accessed data items are always retained in the cache. When a new request attempts to access the cache, the probability of successfully finding the data in the cache will be greatly improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0028] Figure 1 A schematic diagram of a flow chart of a cache configuration determination method provided in an embodiment of the present application;

[0029] Figure 2 A schematic diagram of the structure of a cache configuration determination device provided in an embodiment of the present application;

[0030] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0031] The following embodiments of the technical solution of the present application are described in detail in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present application, and are therefore only used as examples, and cannot be used to limit the scope of protection of the present application.

[0032] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by technicians in the technical field to which this application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit this application.

[0033] In the description of the embodiments of the present application, the technical terms "first", "second", etc. are only used to distinguish different objects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number, specific order or primary and secondary relationship of the indicated technical features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.

[0034] See also Figure 1A flow chart of a cache configuration determination method provided by an embodiment of the present application is shown. The cache configuration determination method provided by an embodiment of the present application can be applied to an electronic device, which may include a physical device such as a server, a PC, a tablet computer or a smart phone, or may also be a virtual device such as a virtual machine or a container. The electronic device may be a single device, or a combination of multiple devices or a cluster of a large number of devices. A software architecture or system for implementing the cache configuration determination method can be deployed on the above-mentioned electronic device. Taking the software architecture as an example, the software architecture may include an aggregate computing layer and an algorithm layer, and the software architecture may also include a client. The role of the aggregate computing layer and the algorithm layer will be introduced later. Of course, the aggregate computing layer and the algorithm layer may also be combined into the same algorithm module, and the present application does not limit the division of the software architecture. The cache configuration determination method may include:

[0035] Step S110: receiving flow request data.

[0036] Based on the traffic request data, the following steps (step S120-step S130) are executed cyclically until the obtained statistical results meet the preset cache requirements (step S140 is then executed):

[0037] Step S120: Count the traffic request data according to the current rule information to obtain the statistical results; the current rule information includes threshold information and a time window; the statistical results include high-frequency data access volume and / or data access effective time; high-frequency data access volume refers to the access volume of data in the traffic request data within the time window whose access frequency exceeds the threshold information.

[0038] Step S130: adjusting the rule information according to the statistical result, obtaining the adjusted rule information, and updating the current rule information to the adjusted rule information.

[0039] Step S140: after the obtained statistical results meet the preset cache requirements, the cache configuration is determined using the adjusted rule information.

[0040] In step S110, the traffic request data may be a collection of network requests within a specific time period or a historical period. The traffic request data may include the number of requests, the request type (different types of HTTP requests such as GET, POST, PUT, DELETE, etc.), the request identifier, the target data of the request, and the response data, etc., wherein the target data of the request refers to the specific resource pointed to by the request, such as a specific URL path or API interface. The traffic request data may be received by the client, and the client sends the traffic request data to the aforementioned aggregation computing layer.

[0041] As an implementation method, the client can also filter the traffic request data using pre-set rule conditions, for example, the rule conditions can be user ID, product ID or data type, etc. The advantage of this is that the cache configuration determination method can be executed for different types of traffic request data respectively, so as to determine the cache configuration belonging to this type and refine the cache configuration management.

[0042] After receiving the traffic request data, the following steps (step S120-step S130) are executed cyclically based on the traffic request data until the obtained statistical results meet the preset cache requirements (then execute step S140). It should be noted that if the statistical results obtained after executing step S120 once in the loop execution can meet the preset cache requirements, there is no need to execute step S130 again, but step S140 is executed with the adjusted rule information that meets the preset cache requirements.

[0043] In step S120, during the first execution, the current rule information may be the preset initial rule information, which includes threshold information and a time window. The threshold information is used to determine the "activity" of the data accessed in the traffic request data. For example, the access frequency of each request within the time window is analyzed. Data whose access frequency exceeds the threshold information can be determined as high-frequency access data. The high-frequency data access volume refers to the access volume of high-frequency access data within the time window. The time window can be set based on historical data, system performance requirements or other business logic, such as a time interval of 1 minute, 5 minutes or longer. The time window is used to capture a specified period or request data. Statistics are performed within a specific time window, which means that the count of each request will be reset at the end of the time window to start statistics for the next time window.

[0044] The access frequency of each request in the traffic request data is counted in units of time windows. The methods used include hash table method, counter array, etc. Among them, the hash table method uses a hash table to store the unique identifier of each request (such as URL or request ID) and the corresponding access count. Whenever a request is received, the current count of the request is searched in the hash table. If it is found, the current count is increased by one, and if it is not found, it is set to 1. Counter array refers to the use of a counter array to store the access count of each request.

[0045] After obtaining the access frequency, the data whose access frequency exceeds the threshold information is determined as the high-frequency data access in the statistical results. The data access effective time of the high-frequency access data can be determined according to the occurrence of the high-frequency access data in continuous time windows. For example, if the high-frequency access data appears in three consecutive time windows, the data access effective time of the high-frequency data access can be determined as the duration of the three time windows. The data access effective time can also be determined by a half-life model, an access interval, or by using a decay factor.

[0046] It is understandable that after each execution of S120, it is possible to determine whether the statistical results meet the preset cache requirements based on the high-frequency data access volume and / or the effective time of data access in the statistical results, such as whether the high-frequency data access volume exceeds the cache capacity, or whether the effective time of data access exceeds the cache time, etc. If the statistical results meet the preset cache requirements, execute step S140; if the statistical results do not meet the cache requirements, then execute S130 to adjust the current rule information and obtain the adjusted rule information. Update the current rule information to the adjusted rule information, and repeat S120, that is, use the adjusted rule information to recalculate the statistical results. Then, determine again whether the recalculated statistical results meet the cache requirements. If so, execute step S140. If not, continue to execute S130 and adjust the rule information again until the statistical results calculated by the adjusted rule information meet the cache requirements.

[0047] In step S130, after the aggregation computing layer obtains statistical results through statistics, the statistical results can be transmitted to the algorithm layer, and the algorithm layer adjusts the rule information according to the statistical results to obtain adjusted rule information.

[0048] For example, if the number of high-frequency data accesses in the statistical results increases, it may indicate that users have an increased demand for certain high-frequency data. At this point, you can consider shortening the time window to respond to this change more quickly. If the number of high-frequency data accesses is relatively stable, the time window can remain unchanged or be appropriately extended, which can reduce computing overhead. If the number of high-frequency data accesses is high, but the growth rate is slowing or unstable, the threshold can be maintained or appropriately lowered to avoid caching too much short-term popular but quickly cooling data. If the effective time of data access is shortened, the threshold can be lowered or the time window can be shortened. The above adjustment rules can also be changed according to business needs.

[0049] In step S140, after determining that the obtained statistical results meet the preset cache requirements, the cache configuration is determined using the rule information obtained by the last adjustment. The adjusted rule information includes adjusted threshold information and adjusted time window. Based on the adjusted threshold information and adjusted time window, more appropriate high-frequency access data can be determined, and the high-frequency access data is used as data to be cached, and then the data to be cached is stored in the cache.

[0050] In one embodiment, if the statistical result calculated by the first current rule information (ie, initial rule information) has satisfied the cache requirement, the cache configuration can be determined using the current rule information in step S140.

[0051] In the above implementation process, by collecting statistics on traffic request data and obtaining statistical results, we can quickly capture changes in traffic request access patterns, and provide accurate data support for subsequent rule optimization; we use statistical results to dynamically adjust and optimize rule information, including access thresholds and time windows, to determine cache configuration, and to a certain extent ensure that data items with high or highest access frequency are always retained in the cache. When a new request attempts to access the cache, the probability of successfully finding data in the cache will be greatly increased.

[0052] Optionally, in an embodiment of the present application, the traffic request data includes a request identifier and target data corresponding to the request identifier. The request identifier refers to a unique identifier of the request (such as a URL or request ID), and the target data corresponding to the request identifier refers to the resource data pointed to or accessed by the request.

[0053] The traffic request data is counted according to the current rule information to obtain statistical results, including:

[0054] For the determination of high-frequency data access in the statistical results: in units of time windows, count the access frequency of the target data corresponding to the same request identifier in the traffic request data. For example, a hash table can be used to store each request identifier and the corresponding number of accesses. Whenever a request is received, the current count represented by the request is searched in the hash table. If it is found, the current count is increased by 1; if it is not found, it means that the request may be the first access in the time window. Its request identifier can be stored in the hash table and the count is set to 1. In this way, the access frequency statistics of each request can be implemented. Other data structures, such as balanced trees, can also be used to track and record the access frequency of requests corresponding to each request identifier in the time window.

[0055] The target data whose access frequency exceeds the threshold information in the time window is determined as the high-frequency access data. As an implementation method, several target data with the highest access frequency in the time window can also be determined as the high-frequency access data. The high-frequency access data may be cache candidates or hot data that need special attention.

[0056] Based on the access frequency of the high-frequency access data, the high-frequency data access volume is determined. As an implementation method, the access frequency of the high-frequency access data within the time window can be used as the high-frequency data access volume. It can be understood that the high-frequency data access volume can refer to the data access volume corresponding to each high-frequency access data, or it can refer to the total data access volume of all high-frequency access data.

[0057] Determination of data access validity period: Determine the data access validity period of high-frequency access data according to the occurrence of high-frequency access data in continuous time windows. For example, if high-frequency access data appears in n consecutive time windows, the data access validity period of the high-frequency access data can be determined to be the length of n time windows (n is a positive integer). The data access validity period of different high-frequency access data may be different.

[0058] In the implementation process of the above embodiment: the traffic request data is counted according to the current rule information to obtain the high-frequency data access volume and the data access effective time. The effective time helps to identify the duration for which the data item maintains a high access frequency, thereby determining whether its popularity is a short-term phenomenon or a long-term trend, providing a basis for dynamically adjusting the rule information.

[0059] Optionally, in an embodiment of the present application, the current rule information is an important basis for determining the cache information. If the statistical results determined according to the current rule information cannot meet the cache requirements, the current rule information needs to be adjusted.

[0060] The current rule information is adjusted according to the statistical results to obtain the adjusted rule information, including:

[0061] The cache pre-occupancy is determined based on the high-frequency data access volume and the corresponding data access effective time; the cache pre-occupancy can be understood as the memory required to be occupied by the calculated cache data under the current rule information. If the cache pre-occupancy exceeds the preset buffer capacity, it means that the cache data calculated using the current rule information cannot be fully stored in the cache area, and the current rule information needs to be adjusted. If the cache pre-occupancy does not exceed the preset buffer capacity, but there is a lot of surplus, it means that the cache data calculated using the current rule information cannot fully utilize the cache capacity, which may result in too much remaining cache capacity. In this case, the current rule information should also be adjusted to improve the utilization rate of the cache area.

[0062] The cache pre-occupancy is compared with the preset cache capacity, and the current rule information is adjusted according to the comparison result to obtain the adjusted rule information. For example, if the comparison result indicates that the cache pre-occupancy is less than the cache capacity, and the difference between the two is greater than the preset value, the threshold information in the rule information can be increased.

[0063] In the implementation process of the above embodiment: the current rule information is adjusted dynamically in real time according to the statistical results, the changes in the data access mode are quickly monitored, and the rule information is adaptively adjusted to adapt to different data access modes.

[0064] Optionally, in an embodiment of the present application, determining the cache pre-occupancy amount according to the high-frequency data access amount and the corresponding data access effective time includes:

[0065] Multiply the high-frequency data access amount and data access effective time corresponding to the high-frequency access data to obtain the cache pre-occupancy component of the high-frequency access data. The cache pre-occupancy component can be understood as the current

[0066] Exemplarily, the high-frequency data access amount and the data access effective time corresponding to each high-frequency access data are multiplied to obtain the cache pre-occupancy component of the high-frequency access data. The above processing is performed on each high-frequency access data to obtain the cache pre-occupancy component of each high-frequency access data.

[0067] The cache pre-occupancy components of multiple high-frequency access data in the statistical results are added together to obtain the cache pre-occupancy amount. The statistical results include high-frequency access data, which refers to data whose access frequency exceeds the threshold information in the traffic request data within the time window. The cache pre-occupancy components of each high-frequency access data are added together to obtain the cache pre-occupancy amount.

[0068] In the implementation process of the above embodiment: the high-frequency data access amount corresponding to the high-frequency access data and the data access effective time are multiplied, and then the cache pre-occupancy components of multiple high-frequency access data are added to obtain the cache pre-occupancy amount, and a quantitative method is used to evaluate the importance and popularity of the data to help determine which data is worthy of occupying limited cache space, ensuring that the cache stores data that users need to access quickly.

[0069] Optionally, in the embodiment of the present application, the cache pre-occupancy amount is compared with the preset cache capacity, and the rule information is adjusted according to the comparison result to obtain the adjusted rule information, including:

[0070] Comparing the cache pre-occupancy amount with the preset cache capacity to obtain a comparison result;

[0071] If the comparison result indicates that the cache pre-occupancy is less than the cache capacity, and the difference between the two is greater than the preset value, the threshold information in the rule information is adjusted upward to obtain the adjusted threshold information. If the value of the cache capacity minus the cache pre-occupancy is greater than the preset value, it means that the cache pre-occupancy using the current rule information cannot fully utilize the cache capacity, which may result in excessive remaining cache capacity. The threshold information in the rule information can be increased, for example, the threshold information can be adjusted to 1.5 times, 2 times or 3 times the original value, etc., and this application does not limit this.

[0072] If the comparison result indicates that the cache pre-occupancy is greater than the cache capacity, the length of the time window in the rule information is increased to obtain an adjusted time window. For example, the time window can be adjusted to 1.5 times, 2 times, or 3 times the original time window, etc., which is not limited in this application.

[0073] In the implementation process of the above embodiment: the cache pre-occupancy amount is compared with the preset cache capacity, and the comparison result is used to adjust the threshold information or time window in the rule information to obtain more accurate rule information. Through continuous optimization, the statistical results calculated by the adjusted rule information finally meet the cache conditions, thereby achieving more reasonable cache configuration.

[0074] Optionally, in an embodiment of the present application, the statistical results meet preset cache requirements, including: the cache pre-occupancy amount is equal to the cache capacity; or, the difference between the cache pre-occupancy amount and the cache capacity is less than a preset value.

[0075] Exemplarily, after obtaining the statistical results in a certain loop execution, the cache pre-occupancy is determined by the high-frequency data access volume and the corresponding data access effective time in the statistical results, and the cache pre-occupancy is compared with the cache capacity to determine whether the cache pre-occupancy is equal to the cache capacity, or whether the difference between the cache pre-occupancy and the cache capacity is less than a preset value. It is then considered that the statistical results meet the cache conditions, and step S140 can be continued to determine the cache configuration using the adjusted rule information.

[0076] Among them, the difference between the cache pre-occupancy and the cache capacity is less than the preset value, which means that the value of the cache pre-occupancy minus the cache capacity is less than the preset value. The preset value can be understood as a tolerable error. The difference is within the preset value. In order to improve the efficiency of the cache configuration, the loop will no longer continue, and it is considered that the statistical result meets the cache condition.

[0077] In the implementation process of the above embodiment: since the cache capacity is limited, the cache pre-occupancy is equal to the cache capacity, which maximizes the use of the cache capacity, and the cache space stores data with a higher access frequency, thereby improving the cache hit rate; and by setting a preset value as a tolerable error, the number of loop executions is reduced, thereby improving the efficiency of the cache configuration.

[0078] Optionally, in an embodiment of the present application, the adjusted rule information includes adjusted threshold information and adjusted time window; the cache configuration includes data that needs to be cached; the data that needs to be cached refers to data that needs to be stored in the cache space or cache area. The traffic request data includes a request identifier and target data corresponding to the request identifier, the request identifier refers to a unique identifier of the request (such as a URL or request ID), and the target data corresponding to the request identifier refers to the resource data pointed to or accessed by the request.

[0079] The cache configuration is determined using the adjusted rule information, including: taking the adjusted time window as a unit, counting the access frequency of the target data corresponding to the same request identifier in the traffic request data; and determining the target data whose access frequency exceeds the adjusted threshold information as the data that needs to be cached.

[0080] For example, a hash table can be used to store each request identifier and the corresponding number of accesses in units of the adjusted time window. Whenever a request is received, the current count represented by the request is searched in the hash table. If it is found, the current count is increased by one; if it is not found, it means that the request may be the first access in the time window. Its request identifier can be stored in the hash table and the count is set to 1. In this way, the access frequency statistics of each request can be implemented. Other data structures, such as balanced trees, can also be used to track and record the access frequency of requests corresponding to each request identifier in the time window.

[0081] The target data whose access frequency exceeds the threshold information within the time window is determined as the data that needs to be cached.

[0082] In the implementation process of the above embodiment: the mutual coordination of the dynamic backtracking algorithm and the sliding time window algorithm effectively ensures a better cache strategy in the software system, thereby greatly improving the performance and stability of the system.

[0083] In an optional embodiment, if the cache configuration obtained by the algorithm is not effective or an error occurs, the cache effect and stability can be improved by manually setting or adjusting the cache configuration.

[0084] See also Figure 2 The schematic diagram of the structure of the cache configuration determination device provided in the embodiment of the present application is shown; the embodiment of the present application provides a cache configuration determination device 200, including:

[0085] The flow receiving module 210 is used to receive flow request data;

[0086] The algorithm module 220 is used to loop through the following steps based on the traffic request data until the obtained statistical results meet the preset cache requirements:

[0087] Statistics are performed on the traffic request data according to the current rule information to obtain statistical results; the current rule information includes threshold information and time window; the statistical results include high-frequency data access volume and / or data access effective time; high-frequency data access volume refers to the access volume of data whose access frequency exceeds the threshold information in the traffic request data within the time window;

[0088] Adjust the current rule information according to the statistical result, obtain the adjusted rule information, and update the current rule information to the adjusted rule information;

[0089] The cache configuration module 230 is used to determine the cache configuration using the adjusted rule information after the obtained statistical results meet the preset cache requirements.

[0090] Optionally, in an embodiment of the present application, the cache configuration determining device 200, the traffic request data includes a request identifier and target data corresponding to the request identifier; the algorithm module 220 is also used to count the access frequency of the target data corresponding to the same request identifier in the traffic request data in units of time windows; the target data whose access frequency exceeds the threshold information is determined as high-frequency access data, and the high-frequency data access volume is determined based on the access frequency of the high-frequency access data; and the data access effective time of the high-frequency access data is determined according to the occurrence of the high-frequency access data in a continuous time window.

[0091] Optionally, in an embodiment of the present application, the cache configuration determination device 200, the algorithm module 220, is also used to determine the cache pre-occupancy amount based on the high-frequency data access volume and the corresponding data access effective time; compare the cache pre-occupancy amount with the preset cache capacity, and adjust the current rule information according to the comparison result to obtain the adjusted rule information.

[0092] Optionally, in an embodiment of the present application, the cache configuration determination device 200, the algorithm module 220, is also used to multiply the high-frequency data access amount and the data access effective time corresponding to the high-frequency access data to obtain the cache pre-occupancy component of the high-frequency access data; add the cache pre-occupancy components of multiple high-frequency access data in the statistical results to obtain the cache pre-occupancy amount.

[0093] Optionally, in an embodiment of the present application, the cache configuration determination device 200, the algorithm module 220, is also used to compare the cache pre-occupancy with the preset cache capacity to obtain a comparison result; if the comparison result indicates that the cache pre-occupancy is less than the cache capacity, and the difference between the two is greater than a preset value, the threshold information in the rule information is adjusted upward to obtain the adjusted threshold information; if the comparison result indicates that the cache pre-occupancy is greater than the cache capacity, the length of the time window in the rule information is increased to obtain the adjusted time window.

[0094] Optionally, in an embodiment of the present application, a cache configuration determination device 200, wherein the statistical result meets a preset cache requirement, including: the cache pre-occupancy amount is equal to the cache capacity; or, the difference between the cache pre-occupancy amount and the cache capacity is less than a preset value.

[0095] Optionally, in an embodiment of the present application, the cache configuration determining device 200, the adjusted rule information includes adjusted threshold information and an adjusted time window; the cache configuration includes data that needs to be cached; the traffic request data includes a request identifier and target data corresponding to the request identifier; the cache configuration module 230 is also used to count the access frequency of the target data corresponding to the same request identifier in the traffic request data in units of the adjusted time window; and the target data whose access frequency exceeds the adjusted threshold information is determined as data that needs to be cached.

[0096] It should be understood that the device corresponds to the above-mentioned cache configuration determination method embodiment and can execute the various steps involved in the above-mentioned method embodiment. The specific functions of the device can be found in the description above. To avoid repetition, the detailed description is appropriately omitted here. The device includes at least one software function module that can be stored in a memory in the form of software or firmware or solidified in the operating system (OS) of the device.

[0097] See also Figure 3 The electronic device 300 provided in the embodiment of the present application includes: a processor 310 and a memory 320, wherein the memory 320 stores machine-readable instructions executable by the processor 310, and when the machine-readable instructions are executed by the processor 310, the above method is executed.

[0098] Figure 3 Each component shown in can be implemented by hardware, software or a combination thereof. The electronic device 300 may be a physical device, such as a server, a PC, etc., or a virtual device, such as a virtual machine, a virtualized container, etc. Moreover, the electronic device 300 is not limited to a single device, but may also be a combination of multiple devices or a cluster consisting of a large number of devices.

[0099] An embodiment of the present application further provides a storage medium, on which a computer program is stored. When the computer program is executed by a processor, the above method is executed.

[0100] Among them, the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable red-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, disk or optical disk.

[0101] In several embodiments provided by the embodiments of the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and a part of the module, program segment or code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than the order marked in the accompanying drawings. For example, two consecutive boxes 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 box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0102] In addition, the functional modules in each embodiment of the present application can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part.

[0103] The above description is only an optional implementation manner of the embodiments of the present application, but the protection scope of the embodiments of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed in the embodiments of the present application, which should be covered within the protection scope of the embodiments of the present application.

Claims

1. A method for determining cache configuration, characterized in that: include: Receive traffic request data; Based on the traffic request data, the following steps are executed in a loop until the obtained statistical results meet the preset cache requirements: The traffic request data is counted according to the current rule information to obtain the statistical result; the current rule information includes threshold information and a time window; the statistical result includes high-frequency data access volume and / or data access effective time; the high-frequency data access volume refers to the access volume of data in the traffic request data within the time window whose access frequency exceeds the threshold information; Adjust the current rule information according to the statistical result to obtain adjusted rule information, and update the current rule information to the adjusted rule information; After the obtained statistical results meet the preset cache requirements, the cache configuration is determined using the adjusted rule information.

2. The method according to claim 1, characterized in that The traffic request data includes a request identifier and target data corresponding to the request identifier; and the statistical result is obtained by performing statistics on the traffic request data according to the current rule information, including: Taking the time window as a unit, counting the access frequency of the target data corresponding to the same request identifier in the traffic request data; determining the target data whose access frequency exceeds the threshold information as high-frequency access data, and determining the high-frequency data access amount based on the access frequency of the high-frequency access data; According to the occurrence of the high-frequency access data in the continuous time window, the data access effective time of the high-frequency access data is determined.

3. The method according to claim 1, characterized in that The step of adjusting the current rule information according to the statistical result to obtain the adjusted rule information includes: Determine the cache pre-occupancy amount according to the high-frequency data access amount and the corresponding data access effective time; The cache pre-occupancy amount is compared with the preset cache capacity, and the current rule information is adjusted according to the comparison result to obtain the adjusted rule information.

4. The method according to claim 3, characterized in that The determining of the cache pre-occupancy amount according to the high-frequency data access amount and the corresponding data access effective time includes: Multiplying the high-frequency data access amount corresponding to the high-frequency data and the data access effective time to obtain a cache pre-occupancy component of the high-frequency data; The cache pre-occupancy components of the multiple high-frequency access data in the statistical result are added together to obtain the cache pre-occupancy amount.

5. The method according to claim 3, characterized in that: The comparing the cache pre-occupancy amount with the preset cache capacity, adjusting the rule information according to the comparison result, and obtaining the adjusted rule information includes: Comparing the cache pre-occupancy amount with the preset cache capacity to obtain the comparison result; If the comparison result indicates that the cache pre-occupancy is less than the cache capacity, and the difference between the two is greater than a preset value, the threshold information in the rule information is adjusted upward to obtain adjusted threshold information; If the comparison result indicates that the cache pre-occupancy amount is greater than the cache capacity, the length of the time window in the rule information is increased to obtain an adjusted time window.

6. The method according to claim 3, characterized in that in, The statistical result meets the preset cache requirement, including: the cache pre-occupancy amount is equal to the cache capacity; or, the difference between the cache pre-occupancy amount and the cache capacity is less than a preset value.

7. The method according to any one of claims 1 to 6, characterized in that: The adjusted rule information includes adjusted threshold information and adjusted time window; the cache configuration includes data to be cached; The flow request data includes a request identifier and target data corresponding to the request identifier; The determining cache configuration by using the adjusted rule information includes: Taking the adjusted time window as a unit, counting the access frequency of the target data corresponding to the same request identifier in the traffic request data; The target data whose access frequency exceeds the adjusted threshold information is determined as the data that needs to be cached.

8. A computer program product, characterized in that The method comprises computer program instructions, and when the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is executed.

9. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the method according to any one of claims 1 to 7 is executed.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is executed.