Cache space allocation method, device and equipment and computer readable storage medium

By identifying the target object with the smallest change rate of cache miss rate in the shared cache space and reducing its cache space, the problem of cache resource contention is solved, the reasonable allocation and utilization of cache space are improved, and the back-to-origin traffic and operating costs are reduced.

CN120956602APending Publication Date: 2025-11-14WUHAN DAMENG DATABASE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511018344.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-23
Publication Date
2025-11-14

AI Technical Summary

Technical Problem

In shared cache spaces, there is a serious competition for cache resources, which leads to a decline in cache performance, an increase in back-to-origin traffic, and an increase in operating costs. Especially in multi-tenant scenarios, malicious competition for cache space results in resource waste and a decline in service quality.

Method used

By determining the cache miss rate and change rate of objects under different preset cache space sizes, and combining the cache miss rate change rates of all objects, the target object with the smallest cache miss rate change rate is identified, and its actual cache space size is reduced to achieve reasonable allocation of cache space.

Benefits of technology

It achieves reasonable allocation of cache space, reduces cache allocation overhead, improves cache utilization, and reduces back-to-origin traffic and operating costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120956602A_ABST
    Figure CN120956602A_ABST
Patent Text Reader

Abstract

The invention discloses a cache space allocation method, device and equipment and a computer readable storage medium. The method comprises the following steps: determining a cache missing rate of an object corresponding to a preset cache space size and an actual cache space size; according to the cache miss rate corresponding to the object in each preset cache space size and the cache miss rate corresponding to the object in the actual cache space size, obtaining a cache miss rate change rate corresponding to the object in each preset cache space size; synthesizing the cache missing rates corresponding to all the objects in the preset cache space size to obtain mu; determining a target object, wherein the target object has a cache miss rate change rate smaller than mu; and reducing the actual cache space size of the target object. According to the cache allocation method and device, the cache space is reasonably allocated, and the overhead required for cache allocation is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of caching technology, specifically to a cache space allocation method, apparatus / system, device, and computer-readable storage medium. Background Technology

[0002] With the advent of the digital age, the internet has become an indispensable part of people's daily lives. The increasing number of people accessing the internet has led to an exponential growth in internet traffic, and the massive influx of high-concurrency accesses is putting increasing pressure on content provider servers. On the other hand, with the iteration of internet technology and the diversification of market demands, the number of tenants is growing exponentially, making it more difficult for content providers to customize caching solutions for each tenant, and drastically increasing operational complexity. To reduce operational costs and improve resource utilization, content providers have begun using shared caching solutions to lower costs and increase cache utilization. However, shared caching suffers from severe cache resource contention. Some aggressive data flows can exhaust most of the cache space, significantly impacting the performance of globally shared caching strategies. Furthermore, the globally shared strategy creates opportunities for some tenants to maliciously compete for cache space, placing low-access but periodically accessed data in the cache. This results in other tenants generating high origin-fetching traffic due to insufficient cache space, increasing the overall origin-fetching traffic of the platform. This leads to a series of problems, including wasted cache space, decreased service quality for multi-tenants, and increased overall operating costs. Summary of the Invention

[0003] To address the aforementioned technical problems, this application provides a cache space allocation method, apparatus, device, and computer-readable storage medium.

[0004] In a first aspect, embodiments of this application provide a cache space allocation method, the cache space allocation method comprising: Determine the object exist A preset cache space size and the actual cache space size The corresponding cache miss rate, of which, Preset cache space size and actual cache space size It can form an arithmetic sequence, the minimum value of which is And tolerance , The amount of data written to the cache within a preset time period; According to the object exist The preset cache space size and the actual cache space size The corresponding cache miss rate yields the object. exist The rate of change of cache miss rate corresponding to a preset cache space size; Integrating all objects The rate of change of cache miss rate corresponding to each preset cache space size is obtained as μ; Identify a target object, wherein the target object has a cache miss rate change rate less than μ; Reduce the actual cache space size of the target object.

[0005] In conjunction with the first aspect, in one implementation, the determined object exist The preset cache space size and the actual cache space size The corresponding cache miss rates include: According to the object Get cache statistics for objects In cache space size Corresponding cache miss rate ; Cache statistics and objects of the cache server within a preset time period. Input the cache statistics data into the prediction model to obtain the object exist The cache miss rate corresponding to a preset cache space size and The difference; Add to the difference Get the object exist The cache miss rate corresponding to a preset cache space size.

[0006] In conjunction with the first aspect, in one implementation, the statement based on the object exist The preset cache space size and the actual cache space size The corresponding cache miss rate yields the object. exist The cache miss rate change rate corresponding to each preset cache space size includes: Set the preset cache space size Object exist Corresponding cache miss rate Cache space size and objects exist Corresponding cache miss rate Substituting into the formula for calculating the rate of change, the formula for calculating the rate of change is:

[0007] in, , For object Within the preset cache space size The corresponding rate of change in cache miss rate; And so on, to obtain the object exist The rate of change in cache miss rate corresponding to a preset cache space size.

[0008] In conjunction with the first aspect, in one implementation, the integration of all objects in The cache miss rate change rate corresponding to each preset cache space size is used to obtain μ, which includes: Calculate all objects in μ is obtained by taking the average of the rate of change of cache miss rate corresponding to each preset cache space size.

[0009] In conjunction with the first aspect, in one implementation, reducing the actual cache space size of the target object includes: Determine the order of adjustment among the target objects; The actual cache space size of each target object is reduced sequentially according to the adjustment order, wherein the cumulative reduction value is no greater than [missing value]. .

[0010] In conjunction with the first aspect, in one implementation, the target object with the smallest change rate of cache miss rate is adjusted earlier.

[0011] In conjunction with the first aspect, in one implementation, the step of sequentially reducing the actual cache space size of each target object according to the adjustment order includes: For each target object, select the largest preset cache space size from the preset cache space sizes corresponding to cache miss rate changes greater than or equal to μ, and calculate the difference between the actual cache space size of the target object and the largest preset cache space size, using the difference as the adjustment amount for the target object; Check whether the adjustment amount of the target object ranked p in the adjustment sequence is greater than the remaining adjustable amount, where the initial value of p is 1, and the initial value of the remaining adjustable amount is 1. ; If it is greater than, then the actual cache space size of the target object ranked p-th will be reduced by the remaining adjustable amount, and the reduction process will end. If it is not greater than, then the actual cache space size of the target object ranked p is reduced by the adjustment amount of the target object ranked p, and the remaining adjustable amount is reduced by the adjustment amount of the target object ranked p. Check whether all target objects have been traversed; If completed, the reduction process ends; If not completed, let p = p + 1, and return to the step of detecting whether the adjustment amount of the target object ranked p in the adjustment order is greater than the remaining adjustable amount.

[0012] Secondly, embodiments of this application provide a cache space allocation device, the cache space allocation device comprising: The determination module is used to determine the object. exist The preset cache space size and the actual cache space size The corresponding cache miss rate, of which, Preset cache space size and actual cache space size It can form an arithmetic sequence, the minimum value of which is And tolerance , The amount of data written to the cache within a preset time period; The rate of change calculation module is used to calculate the rate of change based on the object. exist The preset cache space size and the actual cache space size The corresponding cache miss rate yields the object. exist The rate of change of cache miss rate corresponding to a preset cache space size; The critical value determination module is used to comprehensively consider all objects in The cache miss rate corresponding to each preset cache space size is obtained as μ; The identification module is used to determine the target object, wherein the target object has a cache miss rate change rate of less than μ; The adjustment module is used to reduce the actual cache space size of the target object.

[0013] Thirdly, embodiments of this application provide a cache space allocation device, the cache space allocation device including a processor, a memory, and a cache space allocation program stored in the memory and executable by the processor, wherein when the cache space allocation program is executed by the processor, it implements the steps of the cache space allocation method as described in the first aspect.

[0014] Fourthly, embodiments of this application provide a computer-readable storage medium storing a cache space allocation program, wherein when the cache space allocation program is executed by a processor, it implements the steps of the cache space allocation method as described in the first aspect.

[0015] The beneficial effects of the technical solutions provided in this application include: In this embodiment of the application, the object is determined. exist The preset cache space size and the actual cache space size The corresponding cache miss rate, of which, Preset cache space size and actual cache space size It can form an arithmetic sequence, the minimum value of which is And tolerance , The amount of data written to the cache within a preset time period; based on the object. exist The preset cache space size and the actual cache space size The corresponding cache miss rate yields the object. exist The cache miss rate change rate corresponding to each preset cache space size; (combining all objects in...) The cache miss rate corresponding to each preset cache space size is calculated as μ; a target object is identified, wherein the target object has a cache miss rate change rate less than μ; the actual cache space size of the target object is reduced. Through the embodiments of this application, for each object, only its cache miss rate under N+1 cache space sizes is determined. On this basis, both reasonable allocation of cache space and reduction of the overhead required for cache allocation are achieved. Attached Figure Description

[0016] Figure 1 This is a flowchart illustrating an embodiment of the cache space allocation method of this application; Figure 2 This is a schematic diagram illustrating cache space adjustment in one embodiment of the cache space allocation method of this application; Figure 3 This is a schematic diagram of the functional modules of an embodiment of the cache space allocation device of this application; Figure 4 This is a schematic diagram of the hardware structure of the cache space allocation device involved in the embodiments of this application. Detailed Implementation

[0017] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.

[0018] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0019] In a first aspect, embodiments of this application provide a method for allocating cache space.

[0020] In one embodiment, reference is made to Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the cache space allocation method of this application. Figure 1 As shown, the cache space allocation methods include: Step S10, Determine the object exist The preset cache space size and the actual cache space size The corresponding cache miss rate, of which, Preset cache space size and actual cache space size It can form an arithmetic sequence, the minimum value of which is And tolerance , The amount of data written to the cache within a preset time period; In this embodiment, objects refer to shared cache services, servers, clients, etc. In shared cache scenarios, the number of objects is generally quite large; this article uses 100 objects as an example.

[0021] Assuming the actual cache size of object 1 If the data size is 100MB, and the amount of data written to the cache server is counted at preset time intervals, then... It can be the value from the most recent statistics, in order to Take MB as an example. The value should be selected according to actual needs, for example... If we take 10, the tolerance is 2MB. The 10 preset cache space sizes corresponding to object 1 include 80MB, 82MB, 84MB, 86MB, 88MB, 90MB, 92MB, 94MB, 96MB, and 98MB. Therefore, we determine the cache miss rate for object 1 corresponding to these 10 preset cache space sizes, denoted as [missing value]. , , , , , , , , as well as The actual cache size of object 1. The cache miss rate corresponding to 100MB This can be obtained through statistics.

[0022] Assuming the actual cache size of object 2 If the cache size is 50MB, then the 10 preset cache space sizes corresponding to object 2 include 30, 32, 34, 36, 38, 40, 42, 44, 46, and 48. The cache miss rate for object 2 corresponding to these 10 preset cache space sizes is then determined and denoted as... , , , , , , , , as well as The actual cache size of object 2. The cache miss rate corresponding to 50MB This can be obtained through statistics.

[0023] And so on, to determine each object exist The preset cache space size and the actual cache space size The corresponding cache miss rate.

[0024] Further, in one embodiment, step S10 includes: According to the object Get cache statistics for objects In cache space size Corresponding cache miss rate ; Cache statistics and objects of the cache server within a preset time period. Input the cache statistics data into the prediction model to obtain the object exist The cache miss rate corresponding to a preset cache space size and The difference; Add to the difference Get the object exist The cache miss rate corresponding to a preset cache space size.

[0025] In this embodiment, the prediction model is implemented based on machine learning technology. It uses cache statistics data from the cache server and objects within a preset time period. The cached statistical data is used to construct a feature vector, which is then input into the prediction model. In conventional techniques, the prediction model typically predicts the object directly based on the input feature vector. The cache miss rate corresponds to a certain preset cache space size, but this can easily lead to overfitting and inaccurate prediction results. Therefore, in this embodiment, the prediction object is... exist The cache miss rate corresponding to a preset cache space size and The difference, for example, predicting the cache miss rate of object 1 at 80MB. and The difference δ1, and then add to δ1 get And so on, until each object is obtained. exist The cache miss rate corresponding to a preset cache space size.

[0026] Among them, the feature vector integrates cache statistics data of the cache server and objects within a preset time period. The cache statistics are constructed. Specifically, the cache statistics for the cache server are the overall statistics related to the cache; objects... Cache statistics, which are related to caching, are only applicable to objects. Statistical data. Optional, cache statistics for the cache server and objects. The cache statistics are shown in Table 1:

[0027] Table 1 The feature processing of the distribution is achieved using quantile statistics, specifically FSD. t For example, the 1%, 10%, 20%, ..., 90%, and 99% quantiles of the size distribution of statistical objects are calculated, and other distribution characteristics are processed in a similar manner. It should be noted that the "objects" referred to in Table 1 refer to data objects stored in the cache, which has a different meaning from the "objects" referred to elsewhere in this article.

[0028] It should be noted that the cache space allocation method described in this application is executed periodically, for example, with a 10-minute cycle, that is, the cache statistics data and objects of the cache server are collected every 10 minutes. The cache statistics are calculated, and steps S10 to S50 are executed.

[0029] The prediction model used is the LightGBM model, which is trained on a pre-built dataset. To prevent a decrease in prediction accuracy, the prediction model needs to be retrained periodically to keep its accuracy within an acceptable range.

[0030] Step S20, according to the object exist The preset cache space size and the actual cache space size The corresponding cache miss rate yields the object. exist The rate of change of cache miss rate corresponding to a preset cache space size; In this embodiment, taking object 1 as an example, after obtaining the cache miss rate corresponding to cache space sizes of 80MB, 82MB, 84MB, 86MB, 88MB, 90MB, 92MB, 94MB, 96MB, 98MB and 100MB, the corresponding cache miss rate curve can be constructed, and the change rate of cache miss rate of object 1 corresponding to 10 preset cache space sizes can be determined, that is, the slope of the curve of object 1 at the cache miss rate corresponding to each preset cache space size can be determined.

[0031] Further, in one embodiment, step S20 includes: Set the preset cache space size Object exist Corresponding cache miss rate Cache space size and objects exist Corresponding cache miss rate Substituting into the formula for calculating the rate of change, the formula for calculating the rate of change is:

[0032] in, , For object Within the preset cache space size The corresponding rate of change in cache miss rate; And so on, to obtain the object exist The rate of change in cache miss rate corresponding to a preset cache space size.

[0033] In this embodiment, taking object 1 as an example, when If it is 80MB, then If it is 82MB, then:

[0034] That is, to obtain the change rate of cache miss rate for object 1 at a preset cache space size of 80MB. And so on, you can obtain each object. exist The rate of change in cache miss rate corresponding to a preset cache space size.

[0035] Step S30, integrate all objects in The rate of change of cache miss rate corresponding to each preset cache space size is obtained as μ; In this embodiment, as described above, it is assumed that there are 100 objects, and If the value is 10, then 1000 cache miss rate changes can be obtained. Based on these 1000 cache miss rate changes, μ is obtained through a specific calculation rule.

[0036] Further, in one embodiment, step S30 includes: Calculate all objects in μ is obtained by taking the average of the rate of change of cache miss rate corresponding to each preset cache space size.

[0037] In this embodiment, taking 1000 cache miss rate change rates as an example, the average value of these 1000 cache miss rate change rates is calculated, and the calculation result is taken as μ.

[0038] Step S40: Determine the target object, wherein the target object has a cache miss rate change rate of less than μ; In this embodiment, for ease of explanation, we take three objects as an example. Assume that based on step S20, the following information was obtained: The cache miss rate changes for object 1 across 10 preset cache space sizes are as follows: , , , , , , , , , .

[0039] The cache miss rate changes for object 2 across 10 preset cache space sizes are as follows: , , , , , , , , , .

[0040] The cache miss rate changes for object 3 across 10 preset cache space sizes are as follows: , , , , , , , , , .

[0041] Assuming, Less than μ, and If the value is less than μ, then the identified target objects include object 1 and object 3.

[0042] Step S50: Reduce the actual cache space size of the target object.

[0043] In this embodiment, assuming the determined target objects include object 1 and object 3, the actual cache space size of object 1 and object 3 is reduced. For example, the actual cache space size of both object 1 and object 3 is reduced by a preset value, or the actual cache space size of object 1 and object 3 is reduced by a corresponding value according to their priorities.

[0044] Further, in one embodiment, step S50 includes: Step S501: Determine the adjustment order among the target objects; In this embodiment, the target object refers to the object whose actual cache space size needs to be reduced. When there are multiple target objects, their adjustment order can be determined based on the cache utilization rate of the target objects. For example, the target object with the lower cache utilization rate will be adjusted earlier; or it can be based on the priority / importance of the target objects. The target object with the lower priority / importance will be adjusted earlier.

[0045] Furthermore, in one embodiment, the target object with the smallest change rate of cache miss rate is adjusted earlier.

[0046] In this embodiment, it is assumed that the target objects include object 1, object 2, and object 3, and the minimum cache miss rate change rate corresponding to object 1 is... The minimum cache miss rate change rate corresponding to object 2 is The minimum cache miss rate change rate corresponding to object 3 is ;like < < The adjustment order is as follows: first adjust object 1, then adjust object 2, and finally adjust object 3.

[0047] Step S502: Reduce the actual cache space size of each target object sequentially according to the adjustment order, wherein the cumulative reduction value is no greater than [missing value]. .

[0048] In this embodiment, Taking MB as an example, suppose we first adjust object 1 and reduce its actual cache space by 10MB; then we adjust object 2, at which point we can only reduce its actual cache space by a maximum of 10MB, and so on, until the cumulative reduction reaches... Alternatively, the traversal of all target objects can be completed, meaning that the actual cache space size of all target objects has been reduced.

[0049] Furthermore, in one embodiment, reference is made to Figure 2 , Figure 2 This is a schematic diagram illustrating cache space adjustment in one embodiment of the cache space allocation method of this application. Figure 2 As shown, step S502 includes: For each target object, select the largest preset cache space size from the preset cache space sizes corresponding to cache miss rate changes greater than or equal to μ, and calculate the difference between the actual cache space size of the target object and the largest preset cache space size, using the difference as the adjustment amount for the target object; Detect whether the adjustment amount of the target object ranked p in the adjustment order is greater than the remaining adjustable amount, where the initial value of p is 1 and the initial value of the remaining adjustable amount is X; If it is greater than, then the actual cache space size of the target object ranked p-th will be reduced by the remaining adjustable amount, and the reduction process will end. If it is not greater than, then the actual cache space size of the target object ranked p is reduced by the adjustment amount of the target object ranked p, and the remaining adjustable amount is reduced by the adjustment amount of the target object ranked p. Check whether all target objects have been traversed; If completed, the reduction process ends; If not completed, let p = p + 1, and return to the step of detecting whether the adjustment amount of the target object ranked p in the adjustment order is greater than the remaining adjustable amount.

[0050] In this embodiment, it is assumed that the target objects include object 1, object 2, and object 3. Wherein: The rate of change of cache miss rate for object 1 that is greater than or equal to μ includes , , as well as The corresponding preset cache space sizes are 80MB, 82MB, 84MB and 86MB respectively, so the largest preset cache space size is selected as 86MB; the actual cache space size of object 1 is 100MB, so the adjustment amount of object 1 is 100MB-86MB=14MB. The rate of change of cache miss rate for object 2 greater than or equal to μ includes , , , , , , , as well as The corresponding preset cache space sizes are 30MB, 32MB, 34MB, 36MB, 38MB, 40MB, 42MB, 44MB and 46MB respectively. The largest preset cache space size is selected as 46MB. The actual cache space size of object 2 is 50MB. Therefore, the adjustment amount for object 2 is 50MB-46MB=4MB. The rate of change in cache miss rate for object 3 that is greater than or equal to μ includes , as well as The corresponding preset cache space sizes are 50MB, 52MB and 54MB respectively, so the largest preset cache space size is selected as 54MB; the actual cache space size of object 3 is 70MB, so the adjustment amount of object 3 is 70MB-54MB=16MB.

[0051] Assume the adjustment order is to adjust object 1 first, then object 2, and finally object 3.

[0052] First, check if the adjustment amount of the target object ranked first is greater than the remaining adjustable amount, that is, check if the adjustment amount of object 1 is greater than the remaining adjustable amount. At this time, the remaining adjustable amount is... That is, 20MB.

[0053] If 14MB < 20MB, then the actual cache space size of object 1 will be reduced by 14MB, that is, the actual cache space size allocated to object 1 will be reduced from 100MB to 86MB, and the remaining adjustable amount will be reduced by 14MB, that is, the remaining adjustable amount will be changed to 6MB.

[0054] At this point, the actual cache space size of objects 2 and 3 has not been adjusted, meaning that the traversal of each target object has not been completed. Therefore, it is checked whether the adjustment amount of the target object ranked 2 is greater than the remaining adjustable amount, that is, it is checked whether the adjustment amount of object 2 is greater than the remaining adjustable amount. At this time, the remaining adjustable amount is 6MB.

[0055] If 4MB < 6MB, then the actual cache space size of object 2 will be reduced by 4MB, that is, the actual cache space size allocated to object 2 will be reduced from 50MB to 46MB, and the remaining adjustable amount will be reduced by 4MB, that is, the remaining adjustable amount will be changed to 2MB.

[0056] At this point, the actual cache space size of object 3 has not been adjusted. Then, it is checked whether the adjustment amount of the target object ranked 3rd is greater than the remaining adjustable amount. That is, it is checked whether the adjustment amount of object 3 is greater than the remaining adjustable amount. At this time, the remaining adjustable amount is 2MB.

[0057] If 16MB > 2MB, then the actual cache space size of object 3 will be reduced by 2MB, that is, the actual cache space size allocated to object 2 will be reduced from 70MB to 68MB, and the reduction process will end.

[0058] In this embodiment of the application, the object is determined. exist The preset cache space size and the actual cache space size The corresponding cache miss rate, of which, Preset cache space size and actual cache space size It can form an arithmetic sequence, the minimum value of which is And tolerance , The amount of data written to the cache within a preset time period; based on the object. exist The preset cache space size and the actual cache space size The corresponding cache miss rate yields the object. exist The cache miss rate change rate corresponding to each preset cache space size; (combining all objects in...) The cache miss rate corresponding to each preset cache space size is calculated as μ; a target object is identified, wherein the target object has a cache miss rate change rate less than μ; the actual cache space size of the target object is reduced. Through the embodiments of this application, for each object, only its cache miss rate under N+1 cache space sizes is determined. On this basis, both reasonable allocation of cache space and reduction of the overhead required for cache allocation are achieved.

[0059] Secondly, embodiments of this application also provide a cache space allocation device.

[0060] In one embodiment, reference is made to Figure 3 , Figure 3 This is a functional module diagram of an embodiment of the cache space allocation device of this application. Figure 3 As shown, the cache space allocation device includes: Module 10 is used to determine the object. exist The preset cache space size and the actual cache space size The corresponding cache miss rate, of which, Preset cache space size and actual cache space size It can form an arithmetic sequence, the minimum value of which is And tolerance , The amount of data written to the cache within a preset time period; The rate of change calculation module 20 is used to calculate the rate of change based on the object. exist The preset cache space size and the actual cache space size The corresponding cache miss rate yields the object. exist The rate of change of cache miss rate corresponding to a preset cache space size; Critical value determination module 30 is used to comprehensively determine the critical value of all objects. The cache miss rate corresponding to each preset cache space size is obtained as μ; Identification module 40 is used to determine a target object, wherein the target object has a cache miss rate change rate of less than μ; Adjustment module 50 is used to reduce the actual cache space size of the target object.

[0061] Furthermore, in one embodiment, the determining module 10 is used for: According to the object Get cache statistics for objects In cache space size Corresponding cache miss rate ; Cache statistics and objects of the cache server within a preset time period. Input the cache statistics data into the prediction model to obtain the object exist The cache miss rate corresponding to a preset cache space size and The difference; Add to the difference Get the object exist The cache miss rate corresponding to a preset cache space size.

[0062] Furthermore, in one embodiment, the rate of change calculation module 20 is used for: Set the preset cache space size Object exist Corresponding cache miss rate Cache space size and objects exist Corresponding cache miss rate Substituting into the formula for calculating the rate of change, the formula for calculating the rate of change is:

[0063] in, , For object Within the preset cache space size The corresponding rate of change in cache miss rate; And so on, to obtain the object exist The rate of change in cache miss rate corresponding to a preset cache space size.

[0064] Furthermore, in one embodiment, the critical value determination module 30 is used for: Calculate all objects in μ is obtained by taking the average of the rate of change of cache miss rate corresponding to each preset cache space size.

[0065] Furthermore, in one embodiment, the adjustment module 50 is used to: Determine the order of adjustment among the target objects; The actual cache space size of each target object is reduced sequentially according to the adjustment order, wherein the cumulative reduction value is no greater than [missing value]. .

[0066] Furthermore, in one embodiment, the target object with the smallest change rate of cache miss rate is adjusted earlier.

[0067] Furthermore, in one embodiment, the adjustment module 50 is used to: For each target object, select the largest preset cache space size from the preset cache space sizes corresponding to cache miss rate changes greater than or equal to μ, and calculate the difference between the actual cache space size of the target object and the largest preset cache space size, using the difference as the adjustment amount for the target object; Check whether the adjustment amount of the target object ranked p in the adjustment sequence is greater than the remaining adjustable amount, where the initial value of p is 1, and the initial value of the remaining adjustable amount is 1. ; If it is greater than, then the actual cache space size of the target object ranked p-th will be reduced by the remaining adjustable amount, and the reduction process will end. If it is not greater than, then the actual cache space size of the target object ranked p is reduced by the adjustment amount of the target object ranked p, and the remaining adjustable amount is reduced by the adjustment amount of the target object ranked p. Check whether all target objects have been traversed; If completed, the reduction process ends; If not completed, let p = p + 1, and return to the step of detecting whether the adjustment amount of the target object ranked p in the adjustment order is greater than the remaining adjustable amount.

[0068] The functions of each module in the cache space allocation device correspond to the steps in the cache space allocation method embodiment, and their functions and implementation processes will not be described in detail here.

[0069] Thirdly, embodiments of this application provide a cache space allocation device, which can be a personal computer (PC), laptop computer, server, or other device with data processing capabilities.

[0070] Reference Figure 4 , Figure 4 This is a schematic diagram of the hardware structure of the cache space allocation device involved in the embodiments of this application. In the embodiments of this application, the cache space allocation device may include a processor, a memory, a communication interface, and a communication bus.

[0071] The communication bus can be of any type and is used to interconnect the processor, memory, and communication interface.

[0072] Communication interfaces include input / output (I / O) interfaces, physical interfaces, and logical interfaces used for interconnecting devices within the cache space allocation device, as well as interfaces used for interconnecting the cache space allocation device with other devices (such as other computing devices or user equipment). Physical interfaces can be Ethernet interfaces, fiber optic interfaces, ATM interfaces, etc.; user equipment can be displays, keyboards, etc.

[0073] Memory can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), flash memory, optical storage, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.

[0074] The processor can be a general-purpose processor, which can call a cache space allocation program stored in memory and execute the cache space allocation method provided in the embodiments of this application. For example, the general-purpose processor can be a central processing unit (CPU). The method executed when the cache space allocation program is called can be referred to in the various embodiments of the cache space allocation method of this application, and will not be repeated here.

[0075] Those skilled in the art will understand that Figure 4The hardware structure shown does not constitute a limitation of this application and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0076] Fourthly, embodiments of this application also provide a computer-readable storage medium.

[0077] The present application has a cache space allocation program stored on a computer-readable storage medium, wherein when the cache space allocation program is executed by a processor, it implements the steps of the cache space allocation method described above.

[0078] The method implemented when the cache space allocation procedure is executed can be referred to in various embodiments of the cache space allocation method of this application, and will not be repeated here.

[0079] It should be noted that the sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0080] The terms "comprising" and "having," and any variations thereof, in the specification, claims, and accompanying drawings of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus. The terms "first," "second," and "third," etc., are used to distinguish different objects, etc., and do not indicate a sequence, nor do they limit "first," "second," and "third" to different types.

[0081] In the description of the embodiments of this application, terms such as "exemplary," "for example," or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplary," "for example," or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary," "for example," or "for instance" is intended to present the relevant concepts in a concrete manner.

[0082] In the description of the embodiments of this application, unless otherwise stated, " / " means "or". For example, A / B can mean A or B. The "and / or" in the text is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of this application, "multiple" means two or more.

[0083] In some processes described in the embodiments of this application, multiple operations or steps are included in a specific order. However, it should be understood that these operations or steps may not be executed in the order they appear in the embodiments of this application, or they may be executed in parallel. The sequence number of the operation is only used to distinguish different operations, and the sequence number itself does not represent any execution order. In addition, these processes may include more or fewer operations, and these operations or steps may be executed sequentially or in parallel, and these operations or steps may be combined.

[0084] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device to execute the methods described in the various embodiments of this application.

[0085] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A cache space allocation method, characterized in that, The cache space allocation method includes: Determine the object exist A preset cache space size and the actual cache space size The corresponding cache miss rate, where, Preset cache space size and actual cache space size It can form an arithmetic sequence, the minimum value of which is And tolerance , The amount of data written to the cache within a preset time period; According to the object exist A preset cache space size and the actual cache space size The corresponding cache miss rate yields the object. exist The rate of change of cache miss rate corresponding to a preset cache space size; Integrating all objects The rate of change of cache miss rate corresponding to each preset cache space size is obtained as μ; Identify a target object, wherein the target object has a cache miss rate change rate less than μ; Reduce the actual cache space size of the target object.

2. The cache space allocation method as described in claim 1, characterized in that, The determined object exist A preset cache space size and the actual cache space size The corresponding cache miss rates include: According to the object Get cache statistics for objects In cache space size Corresponding cache miss rate ; Cache statistics and objects of the cache server within a preset time period. Input the cache statistics data into the prediction model to obtain the object exist The cache miss rate corresponding to a preset cache space size and The difference; Add to the difference Get the object exist The cache miss rate corresponding to a preset cache space size.

3. The cache space allocation method as described in claim 1, characterized in that, According to the object exist A preset cache space size and the actual cache space size The corresponding cache miss rate yields the object. exist The cache miss rate change rate corresponding to each preset cache space size includes: Set the preset cache space size Object exist Corresponding cache miss rate Cache space size and objects exist Corresponding cache miss rate Substituting into the formula for calculating the rate of change, the formula for calculating the rate of change is: in, , For object Within the preset cache space size The corresponding rate of change in cache miss rate; And so on, to obtain the object exist The rate of change in cache miss rate corresponding to a preset cache space size.

4. The cache space allocation method as described in claim 1, characterized in that, The integration of all objects in The cache miss rate change rate corresponding to each preset cache space size is used to obtain μ, which includes: Calculate all objects in μ is obtained by taking the average of the rate of change of cache miss rate corresponding to each preset cache space size.

5. The cache space allocation method as described in claim 1, characterized in that, The reduction of the actual cache space size of the target object includes: Determine the order of adjustment among the target objects; The actual cache space size of each target object is reduced sequentially according to the adjustment order, wherein the cumulative reduction value is no greater than [missing value]. .

6. The cache space allocation method as described in claim 5, characterized in that, The smaller the change rate of the minimum cache miss rate, the higher the adjustment order of the target object.

7. The cache space allocation method as described in claim 5, characterized in that, The step of reducing the actual cache space size of each target object sequentially according to the adjustment order includes: For each target object, select the largest preset cache space size from the preset cache space sizes corresponding to cache miss rate changes greater than or equal to μ, and calculate the difference between the actual cache space size of the target object and the largest preset cache space size, using the difference as the adjustment amount for the target object; Check whether the adjustment amount of the target object ranked p in the adjustment sequence is greater than the remaining adjustable amount, where the initial value of p is 1, and the initial value of the remaining adjustable amount is 1. ; If it is greater than, then the actual cache space size of the target object ranked p-th will be reduced by the remaining adjustable amount, and the reduction process will end. If it is not greater than, then the actual cache space size of the target object ranked p is reduced by the adjustment amount of the target object ranked p, and the remaining adjustable amount is reduced by the adjustment amount of the target object ranked p. Check whether all target objects have been traversed; If completed, the reduction process ends; If not completed, let p = p + 1, and return to the step of detecting whether the adjustment amount of the target object ranked p in the adjustment order is greater than the remaining adjustable amount.

8. A cache space allocation device, characterized in that, The cache space allocation device includes: The determination module is used to determine the object. exist A preset cache space size and the actual cache space size The corresponding cache miss rate, where, Preset cache space size and actual cache space size It can form an arithmetic sequence, the minimum value of which is And tolerance , The amount of data written to the cache within a preset time period; The rate of change calculation module is used to calculate the rate of change based on the object. exist A preset cache space size and the actual cache space size The corresponding cache miss rate yields the object. exist The rate of change of cache miss rate corresponding to a preset cache space size; The critical value determination module is used to comprehensively consider all objects in The cache miss rate corresponding to each preset cache space size is obtained as μ; The identification module is used to determine the target object, wherein the target object has a cache miss rate change rate of less than μ; The adjustment module is used to reduce the actual cache space size of the target object.

9. A cache space allocation device, characterized in that, The cache space allocation device includes a processor, a memory, and a cache space allocation program stored in the memory and executable by the processor, wherein when the cache space allocation program is executed by the processor, it implements the steps of the cache space allocation method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a cache space allocation program, wherein when the cache space allocation program is executed by a processor, it implements the steps of the cache space allocation method as described in any one of claims 1 to 7.