Setting method, device, equipment and medium of persistent cache

文档序号:1126537 发布日期:2020-10-02 浏览:8次 中文

阅读说明:本技术 一种持久缓存的设置方法、装置、设备及介质 (Setting method, device, equipment and medium of persistent cache ) 是由 马诗 陈小钟 苗辉 于 2019-03-25 设计创作,主要内容包括:本发明提供了一种持久缓存方法、装置和计算机设备。涉及计算机互联网技术,解决了现有的持久缓存方案消耗资源量过大,且无法真正实现持久缓存效果、影响资源访问效率的问题。该方法包括:将符合预置的持久缓存条件的缓存资源作为持久缓存资源,其他资源作为普通缓存资源;在需要进行清理时,优先清理所述普通缓存资源。本发明提供的技术方案适用于缓存资源管理,实现了高效高资源利用率的真正持久缓存。(The invention provides a persistent cache method, a persistent cache device and computer equipment. The method relates to the computer internet technology, and solves the problems that the existing persistent cache scheme consumes too much resources, cannot really realize the persistent cache effect, and affects the resource access efficiency. The method comprises the following steps: taking the cache resource meeting the preset persistent cache condition as a persistent cache resource, and taking other resources as common cache resources; and when the common cache resources need to be cleared, the common cache resources are preferentially cleared. The technical scheme provided by the invention is suitable for cache resource management, and realizes high-efficiency and real persistent cache with high resource utilization rate.)

1. A method for setting a persistent cache, comprising:

setting a global disk high-water value and a global disk low-water value to indicate that when the disk usage is higher than the disk high-water value, disk cache resources are cleared to the global disk low-water value;

a persistent cache high-water bit value is set.

2. The setting method according to claim 1, wherein the step of clearing the disk cache resource comprises:

when the data volume of the disk cache resources exceeds the high-water-level value of the disk, starting cleaning the disk cache resources;

checking the data volume of the persistent cache resource;

when the data volume of the persistent cache resources does not exceed the high water level value of the persistent cache, cleaning the common cache resources until the data volume of the disk cache resources is reduced to the low water level value of the disk;

and taking the cache resource meeting the preset persistent cache condition as the persistent cache resource, and taking other resources as the common cache resource.

3. The setting method according to claim 2, wherein the step of checking the data amount of the persistent cache resource is followed by further comprising:

when the data volume of the persistent cache resource exceeds the persistent cache high-water-level value, cleaning the persistent cache resource until the data volume of the persistent cache resource is lower than the persistent cache high-water-level value;

checking the data volume of the disk cache resources again;

and when the data volume of the disk cache resources still exceeds the high water level value of the disk, cleaning the common cache resources until the data volume of the disk cache resources is reduced to the low water level value of the disk.

4. The setting method according to claim 2, wherein the step of using the cache resource meeting the preset persistent cache condition as the persistent cache resource and using other resources as the common cache resource comprises:

maintaining a bidirectional linked list, and dividing the bidirectional linked list into a common segment and a persistent segment;

and storing the cache resources meeting the preset persistent cache condition to the persistent section of the double linked list, and storing other resources to the common section of the double linked list.

5. An apparatus for setting a persistent cache, comprising:

the global threshold setting unit is used for setting a global disk high-water value and a global disk low-water value so as to indicate that when the disk usage is higher than the disk high-water value, the disk cache resources are cleared to the global disk low-water value;

and the persistent cache threshold setting unit is used for setting a persistent cache high-level value.

6. The setting device according to claim 5, characterized in that the setting device further comprises:

the cleaning judgment unit is used for starting cleaning the disk cache resources when the data volume of the disk cache resources exceeds the high water level value of the disk;

the cache checking unit is used for checking the data volume of the persistent cache resources;

a cleaning execution unit, configured to clean the normal cache resource until the data amount of the disk cache resource is reduced to the disk low-level value when the data amount of the persistent cache resource does not exceed the persistent cache high-level value,

and the cache type management module is used for taking the cache resource which meets the preset persistent cache condition as the persistent cache resource and taking other resources as the common cache resource.

7. The setting apparatus according to claim 6, wherein the cache type management module comprises:

the chain table maintenance unit is used for maintaining a bidirectional chain table and dividing the bidirectional chain table into a common section and a persistent section;

and the resource marking unit is used for storing the cache resources which accord with the preset persistent cache condition to the persistent section of the double linked list and storing other resources to the common section of the double linked list.

8. A computer arrangement, characterized in that the computer arrangement comprises a processor for implementing the steps of the method according to any one of claims 1 to 4 when executing a computer program stored in a memory.

9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 4.

Technical Field

The present invention relates to computer network technologies, and in particular, to a method, an apparatus, a device, and a medium for setting a persistent cache.

Background

In order to accelerate the response speed and improve the service quality of the client, some client resources need to be stored on a Content Delivery Network (CDN) for a long time, and when the CDN disk occupancy is high, the cached resources are cleaned and eliminated according to a certain algorithm. When requests for certain resources are not frequent or certain resources are not accessed for a long time, the resources are easily cleaned up during disk cleaning.

Persistent caching of a resource is typically achieved by configuring the resource with a longer cache time. When the disk occupation ratio of the persistent cache resource is high, the space of other resources is occupied, so that the hit rate of other resources is reduced, and the access efficiency of other resources is influenced. And under the condition that the resource is not accessed for a long time, the resource is cleaned according to an lru algorithm during disk cleaning, and the effect of persistent cache cannot be really realized.

In summary, the existing persistent cache scheme consumes too much resources, and cannot really realize the persistent cache effect, which affects the resource access efficiency.

Disclosure of Invention

The present invention is directed to solving the problems described above.

According to a first aspect of the present invention, there is provided a persistent caching method, including:

taking the cache resource meeting the preset persistent cache condition as a persistent cache resource, and taking other resources as common cache resources;

and when the common cache resources need to be cleared, the common cache resources are preferentially cleared.

Preferably, the step of using the cache resource meeting the preset persistent cache condition as the persistent cache resource and using other resources as the common cache resource includes:

maintaining a bidirectional linked list, and dividing the bidirectional linked list into a common segment and a persistent segment;

and storing the cache resources meeting the preset persistent cache condition to the persistent section of the double linked list, and storing other resources to the common section of the double linked list.

Preferably, the step of using the cache resource meeting the preset persistent cache condition as the persistent cache resource and using other resources as the common cache resource further includes:

and when the persistent cache resources stored in the persistent segment are accessed again, moving the persistent cache resources to the end of the persistent segment.

Preferably, before the step of using the cache resource meeting the preset persistent cache condition as the persistent cache resource and using other resources as the common cache resource, the method further includes:

setting a global disk high-water value and a global disk low-water value to indicate that when the disk usage is higher than the disk high-water value, disk cache resources are cleared to the global disk low-water value;

a persistent cache high-water bit value is set.

Preferably, when the common cache resource needs to be cleared, the step of preferentially clearing the common cache resource includes:

when the data volume of the disk cache resources exceeds the high-water-level value of the disk, starting cleaning the disk cache resources;

checking the data volume of the persistent cache resource;

and when the data volume of the persistent cache resources does not exceed the high water level value of the persistent cache, cleaning the common cache resources until the data volume of the disk cache resources is reduced to the low water level value of the disk.

Preferably, after the step of checking the data amount of the persistent cache resource, the method further includes:

when the data volume of the persistent cache resource exceeds the persistent cache high-water-level value, cleaning the persistent cache resource until the data volume of the persistent cache resource is lower than the persistent cache high-water-level value;

checking the data volume of the disk cache resources again;

and when the data volume of the disk cache resources still exceeds the high water level value of the disk, cleaning the common cache resources until the data volume of the disk cache resources is reduced to the low water level value of the disk.

According to another aspect of the present invention, there is also provided a persistent caching apparatus, including:

the cache type management module is used for taking the cache resources meeting the preset persistent cache conditions as persistent cache resources, and taking other resources as common cache resources;

and the disk cleaning module is used for preferentially cleaning the common cache resources when cleaning is needed.

Preferably, the cache type management module includes:

the chain table maintenance unit is used for maintaining a bidirectional chain table and dividing the bidirectional chain table into a common section and a persistent section;

and the resource marking unit is used for storing the cache resources which accord with the preset persistent cache condition to the persistent section of the double linked list and storing other resources to the common section of the double linked list.

Preferably, the disk cleaning module includes:

the global threshold setting unit is used for setting a global disk high-water value and a global disk low-water value so as to indicate that when the disk usage is higher than the disk high-water value, the disk cache resources are cleared to the global disk low-water value;

the persistent cache threshold setting unit is used for setting a persistent cache high-level value;

the cleaning judgment unit is used for starting cleaning the disk cache resources when the data volume of the disk cache resources exceeds the high water level value of the disk;

the cache checking unit is used for checking the data volume of the persistent cache resources;

and the cleaning execution unit is used for cleaning the common cache resource when the data volume of the persistent cache resource does not exceed the high water level value of the persistent cache until the data volume of the disk cache resource is reduced to the low water level value of the disk.

According to another aspect of the present invention, there is also provided a computer device, including a processor, a memory, and a computer program stored on the memory, wherein when the processor runs the computer program, the following steps are implemented:

taking the cache resource meeting the preset persistent cache condition as a persistent cache resource, and taking other resources as common cache resources;

and when the common cache resources need to be cleared, the common cache resources are preferentially cleared.

The invention provides a persistent cache method, a persistent cache device and computer equipment. Taking the cache resource meeting the preset persistent cache condition as a persistent cache resource, taking other resources as common cache resources, and preferentially cleaning the common cache resources when cleaning is needed. The method and the device realize real persistent cache, provide a mechanism for cleaning persistent cache resources, maintain the persistent cache resources with high access amount on the basis of reasonably utilizing disk resources, and solve the problems that the existing persistent cache scheme consumes too much resources, cannot really realize persistent cache effect and affects resource access efficiency.

Other characteristic features and advantages of the invention will become apparent from the following description of exemplary embodiments, which is to be read in connection with the accompanying drawings.

Drawings

The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the invention and together with the description, serve to explain the principles of the invention. In the drawings, like reference numerals are used to indicate like elements. The drawings in the following description are directed to some, but not all embodiments of the invention. For a person skilled in the art, other figures can be derived from these figures without inventive effort.

Fig. 1 exemplarily illustrates a flow of a persistent caching method provided by an embodiment of the present invention;

FIG. 2 schematically shows a detailed flow of step 104 in FIG. 1;

FIG. 3 is a diagram illustrating an exemplary structure of a persistent cache apparatus according to an embodiment of the present invention;

FIG. 4 schematically shows the structure of the disk cleaning module 301 in FIG. 3;

fig. 5 exemplarily shows a structure of a computer device provided by an embodiment of the present invention.

Detailed Description

In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention. It should be noted that the embodiments and features of the embodiments in the present application may be arbitrarily combined with each other without conflict.

The existing persistent cache scheme consumes too much resources, cannot really realize the persistent cache effect and affects the resource access efficiency.

In order to solve the above problem, embodiments of the present invention provide a persistent caching method, apparatus, and computer device. The method classifies common resources and persistent cache resources, preferentially cleans the cache resources which do not conform to the persistent cache condition when the disk is required to be cleaned, and solves the problems that the resource consumption of the existing persistent cache scheme is too large and the resource access efficiency is influenced.

An embodiment of the present invention provides a persistent cache method, where a flow of completing persistent cache management by using the method is shown in fig. 1, and the method includes:

step 101, setting a global disk high-water value, a global disk low-water value and a persistent cache high-water value.

In this step, a global disk high water level value and a global disk low water level value are set to indicate that when the disk usage is higher than the disk high water level value, the disk cache resources are cleared to the global disk low water level value.

Setting a persistent cache high-water value to indicate that a portion of a persistent cache resource that exceeds the persistent cache high-water value is flushed if necessary.

For example, globally configured are:

cache_swap_high 80

cache_swap_low 60

these two configurations are valid for all domain names, cache _ swap _ high is the global disk high water value, cache _ swap _ low is the global disk low water value.

When the usage of the disk reaches cache _ swap _ high, the disk is cleaned according to lru and the level of the cache _ swap _ low is obtained.

And 102, taking the cache resource meeting the preset persistent cache condition as a persistent cache resource, and taking other resources as common cache resources.

In the embodiment of the invention, configuration is provided for the domain name granularity to specify which files need to be cached persistently.

The following is an example of persistent cache condition configuration:

in the above configuration, persistent _ store allow all is configured for the domain name www.voole.com, that is, all resources of the domain name are persistently cached, and the cache resource under the domain name is the cache resource meeting the preset persistent caching condition.

Cn is not configured with persistent store, in other words, all resources under this domain are normal cache.

In this step, a bidirectional linked list is maintained, and the bidirectional linked list is divided into a common segment and a persistent segment; then, the cache resources meeting the preset persistent cache conditions are stored to the persistent section of the double linked list, and other resources are stored to the common section of the double linked list.

In the embodiment of the invention, each disk corresponds to one doubly linked list. For example, disk D1 corresponds to doubly linked list L1, and disk D1 has resources a, b, c, D, e, f, and g. Wherein, a, b, c and d are persistent cache resources, and e, f and g are common cache resources.

The doubly linked list L1, originally having only a head and tail, is now called mid one more location. mid locations are used to separate the linked list into normal and persistent segments.

The structure is as follows:

and 103, when the persistent cache resources stored in the persistent segment are accessed again, moving the persistent cache resources to the end of the persistent segment.

In the step, the cache resources are sorted according to the access heat, so that the cache resources with less or no access again can be preferentially cleaned during cleaning, the cache resources with higher heat are reserved, and the access efficiency is pertinently improved.

In order to prevent the persistent cache resources from occupying too much disk space to influence other normal resources, statistics and monitoring of the total amount of the persistent cache resources of each disk are provided, and when the total amount of the persistent cache reaches a certain set threshold value, a mechanism for eliminating and cleaning the persistent cache resources is provided.

When the system is restarted, the cache resources are sorted according to the time sequence of starting to create and added into the doubly linked list.

And step 104, when the common cache resources need to be cleared, preferentially clearing the common cache resources.

As shown in fig. 2, the steps include:

and 1041, when the data volume of the disk cache resource exceeds the high-level value of the disk, starting to clean the disk cache resource.

Step 1042, checking the data volume of the persistent cache resource.

In this step, different processing is performed according to the relationship between the data volume of the persistent cache resource and the preset persistent cache high-water-level value. When the data volume of the persistent cache resource does not exceed the high-level value of the persistent cache, step 1043 is performed; otherwise, go to step 1044-1046.

And 1043, when the data volume of the persistent cache resource does not exceed the high water level value of the persistent cache, cleaning the common cache resource until the data volume of the disk cache resource is reduced to the low water level value of the disk.

Step 1044, when the data volume of the persistent cache resource exceeds the persistent cache high-level value, cleaning the persistent cache resource until the data volume of the persistent cache resource is lower than the persistent cache high-level value.

Step 1045, check the data volume of the disk cache resource again.

And 1046, when the data volume of the disk cache resource still exceeds the high water level value of the disk, cleaning the common cache resource until the data volume of the disk cache resource is reduced to the low water level value of the disk. And when the data volume of the disk cache resources after the cleaning in the step 1044 is less than or equal to the high water level value of the disk, stopping the cleaning.

After all, the space of the disk is limited, and when the storage usage reaches a certain proportion, the cache resources which are not accessed for the longest time need to be cleared in time, so that new resources are cached in space.

But cleaning up space is more performance consuming and easily affects the access quality of the request. There is then a night-time disk scrubbing mechanism that scrubs the disk to a lower threshold when the amount of access is minimal, to reserve enough space for the next day's cache. When the disk occupancy exceeds the high water level, disk grooming operations are triggered within the execution time. And triggering the cleaning process when the execution time is reached and the data volume of the disk cache resources exceeds the high-level value of the disk. The specific cleaning method is the same as the method described in step 104, and the description thereof is not repeated.

When the cache resources are cleared, preferably, the cache resources with the front positions (i.e. with small access amount) are preferentially cleared according to the sequence of the cache resources in the doubly linked list, and the persistent segment and the normal segment are respectively processed in such a way. Specifically, each directory has a member to maintain a replacement policy (e.g., a replacement algorithm), and the required data structure (e.g., an LRU algorithm would maintain a doubly linked list). StoreEntry- > lastref is used to maintain the order. Each time a StoreEntry is accessed, the StoreEntry is inserted last. When cleaning the disk, always cleaning the head of the linked list until the disk occupation ratio is reduced

An embodiment of the present invention further provides a persistent cache method, where a persistent cache high-water bit value is configured, and if a current disk utilization occupancy ratio is higher than a global disk high-water bit value, and a total data amount of persistent cache resources is higher than the configured persistent cache high-water bit value, the persistent cache resources are preferentially cleared.

The ratio of the capacity of the disk which needs to be cleaned up is X, the ratio of the persistent cache resource which needs to be cleaned up is Y, and the following three conditions are specifically involved when cleaning up is carried out:

1、X>Y。

and preferentially cleaning the persistent cache resources, wherein after Y is cleaned, the ratio of the common cache to be cleaned is X-Y.

2、X==Y。

After the resources of the persistent cache are cleared, the ordinary cache does not need to be cleared.

3、X<Y。

The persistent cache is preferably cleared, and after the X is cleared from the persistent cache, the common cache does not need to be cleared.

In the following, only one disk, all resources existing on this disk (abstract model) and accessing the cached resources on the disk according to the following access order are taken as an application environment:

a.www.voole.com/1/bili.mp4

b.www.voole.com/2/bili.mp4

c.www.voole.com/3/bili.mp4

d.www.voole.com/4/bili.mp4

e.qostcp.cn/1/p1.png

f.qostcp.cn/2/p1.png

g.qostcp.cn/3/p1.png

wherein a, b, c, d conform to persistent cache, e, f, g are non-persistent cache.

Globally, the following are configured:

cache_swap_high 80

cache_swap_low 60

these two configurations are valid for all domain names, cache _ swap _ high is the global disk high water value, cache _ swap _ low is the global disk low water value.

Scene one:

the cache resources a, b, c, e, f, g and d are requested in sequence, the disk cleaning operation is triggered by the assumption that the sum total of the resources is more than 80% of the total of the disk (cache _ swap _ high), and the expected deletion sequence is e, f, g, a, b, c and d. Therefore, the effect of cleaning the common cache firstly when the disk is cleaned can be achieved.

However, the more persistent cache resources under such a model of scenario, the new configuration item is developed, which is a maximum threshold configuration item for persistent cache: persistent store high water for use as a retirement when the total amount of persistent cache resources exceeds the threshold.

Scene two:

configure under the www.voole.com domain name:

persistent_store_high_water 15

sequentially requesting cache resources a, b, c, e, f, g and d, wherein the total data volume of the cache resources exceeds 80% of the total volume of the disk (cache _ swap _ high), and further triggering disk cleaning operation; and assume that the persistent cached resource a.b.c.d size exceeds 15% of the total amount of disk (persistent store high water).

In this case, the order of cleaning is a, b, c, d, e, f, g. I.e. the persistent cached resources are preferably cleaned up. It should be noted that, in the process of cleaning a, b, c, and d, after the data size of the persistent cache falls below the configured value of persistent _ store _ high _ water after the part is cleaned, the cleaning of the persistent cache resource may be stopped, and the normal cache resource is continuously cleaned.

When the resource of the persistent cache does not reach the configuration value of persistent _ store _ high _ water, the cleaning sequence always follows the first cleaning of the ordinary cache and then the cleaning of the persistent cache, namely, the scenario one is followed.

The preferential cleaning of the persistent cache requires two conditions to be satisfied: the first condition is as follows: the total usage of the current disk exceeds cache _ swap _ high; and satisfying a second condition when the first condition is satisfied: the total amount of persistent cache resources exceeds persistent store high water.

Scene three: assuming that the existing persistent cache resources account for 25% of the total amount of the disk, and exceed the high-level value of the persistent cache, the persistent cache needs to be cleared first from 25% to 15% of the persistent _ store _ high _ water configuration, and the clearing is 10%, but the total amount of the disk needs to be cleared from cache _ swap _ high to cache _ swap _ low, that is, the total clearing amount is 20% of the disk capacity. Then after the persistent cache resources accounting for 10% of the disk capacity are cleared, the normal cache resources accounting for 10% of the disk capacity are cleared.

An embodiment of the present invention further provides a persistent cache method, where one cache resource corresponds to one StoreEntry structure in a memory. StoreEntry will be persisted to swap.

A StoreEntry stores many relevant information of resources (such as URL, resource creation time, last access time, etc.), consumes memory comparatively, and in order to save memory, the old StoreEntry is converted into StoreEntry min, which is less than the information stored in the StoreEntry (mainly lacking URL information), and can be understood as a reduced version of the StoreEntry. After memory optimization is performed by using the storeenytin, how many StoreEntry should reside in the memory is specified, and when the number of the StoreEntry in the memory reaches a threshold, the StoreEntry exceeding the threshold needs to be converted into the storeenytin.

When the service is restarted, the storeEntry information stored in the original memory is completely emptied, the permanent file swap. And restoring the information of the resources cached previously to the memory. In order to save memory space, the resources all exist in the form of StoreEntryMin, and then the resources are available to convert the corresponding resources from StoreEntryMin to StoreEntry.

An embodiment of the present invention further provides a persistent cache method, where a process of completing persistent cache management by using the method includes:

process 1: when a resource is accessed for the first time and is not cached on a disk, a StoreEntry is created to judge whether the resource meets a persistent caching condition, specifically an Access Control List (ACL for short). If yes, a flag bit of the persistent cache is set for the StoreEntry, the resource meeting the persistent cache condition is used as the persistent cache resource, the persistent segment is added when the persistent segment is added into the doubly linked list, and the last of the doubly linked list is always added. And when the stored persistent cache resources are accessed again in the follow-up process, updating the position of the persistent cache and moving to the tail end of the persistent segment.

The following is an example of an access control list configuration:

under a certain domain name:

acl acl_time_url url_regex-i.*\.mp4($|\?)

persistent_store allow acl_time_url

the persistent _ store configuration is a persistent cache condition used for specifying which files need to be persistently cached, the two configurations mean that the persistent cache is performed on files of which the file type is mp4, the persistent cache is not performed on other types which do not conform to the mp4 format, the standard of the persistent cache is controlled by writing acl, and acl supports regular expressions, so that the standard of the persistent cache can be modified and customized according to requirements.

And (2) a process: and (6) restarting.

When restarting is executed, reconstructing StoreEntryMin according to the information in swap.state, recovering whether the flag bit is consistent with the persistent cache, and always placing the cache resource consistent with the persistent cache condition in the persistent segment of the lru linked list when reconstructing lru linked list.

Preferably, the total amount of the resources of the persistent cache is counted during restarting, and whether disk cleaning needs to be started or not can be judged according to the counting result.

And 3, process: and (5) cleaning the magnetic disk.

When the data volume of the persistent cache resources exceeds the persistent cache high-level value, the persistent cache resources are preferentially cleared during disk cleaning, and when the persistent cache resources are cleared to be below the persistent cache high-level value and the total disk occupation ratio is still high, the cache of the common resources is continuously cleared until the disk occupation ratio is reduced.

An embodiment of the present invention further provides a persistent cache apparatus, whose structure is shown in fig. 3, including:

the cache type management module 301 is configured to use a cache resource meeting a preset persistent cache condition as a persistent cache resource, and use other resources as common cache resources;

and the disk cleaning module 302 is configured to preferentially clean the common cache resource when cleaning is required.

Preferably, the structure of the cache type management module 301 is shown in fig. 4, and includes:

a linked list maintenance unit 3011, configured to maintain a bidirectional linked list, and divide the bidirectional linked list into a normal segment and a persistent segment;

and the resource marking unit 3012 is configured to store the cache resource meeting the preset persistent cache condition to the persistent segment of the doubly linked list, and store other resources to the common segment of the doubly linked list.

Preferably, the disk cleaning module 301 further includes:

a global threshold setting unit 3013, configured to set a global disk high-water value and a global disk low-water value, so as to indicate that when a disk usage is higher than the disk high-water value, a disk cache resource is cleared to the global disk low-water value level;

a persistent cache threshold setting unit 3014 configured to set a persistent cache high-level value;

a cleaning determination unit 3015, configured to start cleaning the disk cache resource when the data amount of the disk cache resource exceeds the high-level value of the disk;

a cache check unit 3016 configured to check a data amount of the persistent cache resource;

30113017, configured to, when the data amount of the persistent cache resource does not exceed the persistent cache high-water value, clean the normal cache resource until the data amount of the disk cache resource falls to the disk low-water value.

Preferably, the cleaning execution unit 3017 is further configured to clean the persistent cache resource when the data amount of the persistent cache resource exceeds the persistent cache high-level value until the data amount of the persistent cache resource is lower than the persistent cache high-level value, and when the cache check unit 3016 checks that the data amount of the disk cache resource still exceeds the disk high-level value, continue to clean the normal cache resource until the data amount of the disk cache resource is reduced to the disk low-level value;

the cache checking unit 3016 is further configured to check the data size of the disk cache resource again when the cleaning execution unit 3017 cleans the persistent cache resource until the data size is lower than the persistent cache high-level value.

An embodiment of the present invention further provides a computer device, which has a structure as shown in fig. 5, and includes a processor, a memory, and a computer program stored in the memory, where when the processor runs the computer program, the following steps are implemented:

taking the cache resource meeting the preset persistent cache condition as a persistent cache resource, and taking other resources as common cache resources;

and when the common cache resources need to be cleared, the common cache resources are preferentially cleared.

The embodiment of the invention provides a persistent caching method, a persistent caching device and computer equipment. Taking the cache resource meeting the preset persistent cache condition as a persistent cache resource, taking other resources as common cache resources, and preferentially cleaning the common cache resources when cleaning is needed. The method and the device realize real persistent cache, provide a mechanism for cleaning persistent cache resources, maintain the persistent cache resources with high access amount on the basis of reasonably utilizing disk resources, and solve the problems that the existing persistent cache scheme consumes too much resources, cannot really realize persistent cache effect and affects resource access efficiency.

And the ACL under the domain name granularity can be used for specifying which resources need to be subjected to persistent cache, so that the range of the resources is accurately cached persistently, and the access efficiency is further improved.

The distinguishing of the persistent cache resources from the common cache resources is realized through different sections of the bidirectional linked list, and the distinguishing information can still be recovered after the restart, so that the reliability of the persistent cache scheme provided by the embodiment of the invention is ensured.

The proportion of the persistent cache resources in the total amount of each disk resource can be counted, and the current use condition of the persistent cache resources can be conveniently analyzed and known.

And the elimination and cleaning algorithm of the persistent cache resources is provided, optimization processing is further performed within the range of the persistent cache resources, reservation of high-access resources is guaranteed, elimination of low-access resources is realized, and the resource utilization rate is further improved.

It will be understood by those of ordinary skill in the art that all or some of the steps of the methods, systems, functional modules/units in the devices disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof. In a hardware implementation, the division between functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be performed by several physical components in cooperation. Some or all of the components may be implemented as software executed by a processor, such as a digital signal processor or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). The term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data, as is well known to those of ordinary skill in the art. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, Digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by a computer. In addition, communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media as known to those skilled in the art.

The above-described aspects may be implemented individually or in various combinations, and such variations are within the scope of the present invention.

Finally, it should be noted that: the above examples are only for illustrating the technical solutions of the present invention, and are not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

17页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:安全数据移除

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类