CN115878677A - Data processing method and device for distributed multi-level cache - Google Patents

Data processing method and device for distributed multi-level cache Download PDF

Info

Publication number
CN115878677A
CN115878677A CN202310086503.4A CN202310086503A CN115878677A CN 115878677 A CN115878677 A CN 115878677A CN 202310086503 A CN202310086503 A CN 202310086503A CN 115878677 A CN115878677 A CN 115878677A
Authority
CN
China
Prior art keywords
data objects
local cache
priority list
cache
data object
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202310086503.4A
Other languages
Chinese (zh)
Other versions
CN115878677B (en
Inventor
陈大伟
朱路明
张立群
徐莉萍
张庆丰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
XCMG Hanyun Technologies Co Ltd
Original Assignee
XCMG Hanyun Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by XCMG Hanyun Technologies Co Ltd filed Critical XCMG Hanyun Technologies Co Ltd
Priority to CN202310086503.4A priority Critical patent/CN115878677B/en
Publication of CN115878677A publication Critical patent/CN115878677A/en
Application granted granted Critical
Publication of CN115878677B publication Critical patent/CN115878677B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a data processing method and device of distributed multi-level caches, corresponding local caches are respectively built for a plurality of application instances of target application, an associated pre-priority list is respectively built for each local cache, unique identifier sets of a second number of data objects with the highest heat metric value are obtained from unique identifier sets of a first number of data objects in the pre-priority list associated with each local cache, the second number of data objects and the heat metric values thereof are written into each local cache, and a third number of data objects except the unique identifier sets of the second number of data objects in the unique identifier sets of the first number of data objects are distributively written into cache nodes in a second-level distributed cache. According to the data access method and device, the hit rate of the data objects in the distributed multi-level cache can be improved, and the response performance of the target application to the data access request of the client side is improved.

Description

Data processing method and device for distributed multi-level cache
Technical Field
The present application relates to the field of computer software technologies, and in particular, to a data processing method and apparatus for distributed multi-level cache.
Background
In a JAVA-based distributed application system, in order to meet the requirement of system access performance under high concurrency, a distributed multi-level cache architecture is constructed by using a local cache of a JVM (JAVA virtual machine) in combination with distributed caches such as Redis and Memcache, which is a feasible solution. In the distributed multi-level cache architecture, a local cache of the JVM is mainly used as a first-level cache, and distributed caches such as external Redis, memcache and the like are used as second-level caches. In order to improve the data access performance of the system, the hot data object needs to be cached in a local cache with limited capacity, so as to reduce the access frequency to the second-level cache and a database at the back end.
In The above distributed multi-level cache architecture, data objects in The local cache and The second-level cache are processed based on data elimination strategies such as a conventional LRU (The Least recently Used), an LFU (Least frequently Used), and The like, which is a common cache data replacement strategy. The LRU policy caches data objects according to the access recency of the data objects, and the LFU policy caches the data objects according to the access frequency of the data objects, but both of the two manners may cause substantial cold data objects to replace hot data objects in the cache, thereby reducing the hit rate of the data objects in the distributed multi-level cache and further affecting the access performance of the target application under high concurrency.
Disclosure of Invention
In view of this, the present application provides a data processing method and apparatus for distributed multi-level caches, so as to prevent a substantial cold data object from replacing a hot data object in the distributed multi-level caches, improve a hit rate of the data object in the distributed multi-level caches, and improve access performance of a target application under high concurrency.
In a first aspect of the present application, a data processing method for a distributed multi-level cache is provided, including:
respectively constructing a corresponding local cache for each application instance in a plurality of application instances of the target application, and obtaining a plurality of local caches respectively corresponding to the plurality of application instances;
respectively constructing a pre-priority list for each local cache in the plurality of local caches, obtaining a plurality of pre-priority lists respectively associated with the plurality of local caches, wherein the pre-priority lists are used for recording the unique identifiers and the heat metric values of a first number of data objects with the highest heat metric value accessed by the client in each application instance in real time, and sorting the unique identifiers and the heat metric values according to the heat metric values of the data objects;
acquiring unique identifier sets of a second number of data objects with highest heat degree metric values from the unique identifier sets of the first number of data objects in the pre-priority list associated with each local cache, acquiring the second number of data objects according to the unique identifier sets of the second number of data objects, writing the second number of data objects and the heat degree metric values thereof into each local cache, acquiring a third number of data objects according to the unique identifier sets of the third number of data objects except the unique identifier sets of the second number of data objects in the unique identifier sets of the first number of data objects, and distributively writing the third number of data objects into each cache node in a second-level distributed cache.
In some embodiments, the heat metric value includes a difference between a number of reads and a number of updates for each data object monitored in real-time by each application instance.
In some embodiments, the method further comprises:
each application instance responds to an access request of a client to a target data object, calculates the heat metric value of the target data object in real time, and updates a front priority list associated with a local cache corresponding to each application instance according to the heat metric value of the target data object;
judging whether the target data object is hit in the local cache corresponding to each application instance, if not, searching the target data object from the second-level distributed cache or a database node at the rear end;
judging whether the heat metric value of the target data object is larger than the minimum heat metric value of the data object in the local cache corresponding to each application example; if so, replacing the data object with the minimum hot metric value and the hot metric value thereof in the local cache corresponding to each application instance by the target data object and the hot metric value thereof.
In some embodiments, the updating the pre-priority list of the local cache association corresponding to each application instance according to the heat metric value of the target data object includes:
determining the position of the unique identifier of the target data object in a pre-priority list according to the comparison between the heat metric value of the target data object and the heat metric value of the data object in the pre-priority list associated with the local cache corresponding to each application instance;
updating the pre-priority list according to the position of the unique identifier of the target data object in the pre-priority list, so that the pre-priority list keeps recording the unique identifiers and the heat degree metric values of the first number of data objects with the highest heat degree metric values.
In some embodiments, the method further comprises:
and if the target data object is hit in the local cache corresponding to each application example, updating the position and the heat metric value of the target data object in the local cache corresponding to each application example according to the heat metric value of the target data object.
In some embodiments, the method further comprises:
merging and sorting the plurality of pre-priority lists to obtain a global pre-priority list, wherein the global pre-priority list records unique identifiers and global heat metric values of a first number of data objects with highest global heat metric values accessed by clients in the plurality of application instances;
comparing the global pre-priority list with the pre-priority list associated with each local cache to obtain a difference set between the unique identifier set of the second number of data objects with the highest global heat metric value in the global pre-priority list and the unique identifier set of the second number of data objects with the highest heat metric value in the pre-priority list associated with each local cache;
updating the pre-priority list associated with each local cache according to the global heat metric value of any data object identified by the unique identifier in the difference set;
judging whether the global heat metric value of any data object is larger than the minimum heat metric value of the data object in the local cache or not; if so, searching any data object from the second-level distributed cache or a database node at the rear end, and replacing the data object with the minimum heat metric value and the heat metric value thereof in each local cache by using any data object and the global heat metric value thereof.
In some embodiments, said updating said pre-priority list associated with each local cache according to the global heat metric value for any data object identified by a unique identifier in said difference set comprises:
determining the position of the unique identifier of any data object in the pre-priority list associated with each local cache according to the comparison of the global heat metric value of any data object and the heat metric values of the data objects in the pre-priority list associated with each local cache;
updating the pre-priority list associated with each local cache according to the position of the unique identifier of any data object in the pre-priority list associated with each local cache, so that the pre-priority list associated with each local cache keeps recording the unique identifiers and the heat degree metric values of the first number of data objects with the highest heat degree metric values.
In some embodiments, the method further comprises:
calculating a first average hit rate of the second number of unique identifier sets of the data objects in the local cache and a second average hit rate of the third number of unique identifier sets of the data objects in the second-level distributed cache in each metric cycle of the second number of data objects in the pre-priority list associated with each local cache;
and judging whether the first average hit rate and the second average hit rate meet the condition that the first average hit rate is smaller than a preset threshold and the second average hit rate is larger than the preset threshold, if so, proportionally attenuating the heat metric values of all data objects in the preposed priority list and the local cache until the first average hit rate is larger than or equal to the preset threshold in a subsequent metric period.
In some embodiments, the first average hit rate is a ratio of a total number of hits of the unique identifier sets of the second number of data objects in the local cache to the second number, and the second average hit rate is a ratio of a total number of hits of the unique identifier sets of the third number of data objects in the second-level distributed cache to the third number.
In a second aspect of the present application, a data processing apparatus for distributed multi-level cache is further provided, including:
the cache construction unit is used for respectively constructing a corresponding local cache for each application instance in a plurality of application instances of the target application to obtain a plurality of local caches respectively corresponding to the plurality of application instances;
the data monitoring unit is used for respectively constructing a pre-priority list for each local cache in the plurality of local caches, obtaining a plurality of pre-priority lists respectively associated with the plurality of local caches, and the pre-priority lists are used for recording the unique identifiers and the heat metric values of a first number of data objects with the highest heat metric value accessed by the client in each application instance in real time and sorting the data objects according to the heat metric values of the data objects;
a cache processing unit, configured to obtain a second number of unique identifier sets of data objects with the highest heat metric value from the first number of unique identifier sets of data objects in the pre-priority list associated with each local cache, obtain the second number of data objects according to the second number of unique identifier sets of data objects, write the second number of data objects and their heat metric values into each local cache, obtain a third number of data objects according to a third number of unique identifier sets of data objects, excluding the second number of unique identifier sets of data objects, in the first number of unique identifier sets of data objects, and distributively write the third number of data objects into each cache node in the second-level distributed cache.
The distributed multi-level cache data processing method and device provided by the application respectively construct an associated pre-priority list for a local cache corresponding to each application instance of a target application, record unique identifiers and heat metric values of a first number of data objects with the highest heat metric value accessed by a client in each application instance in real time, obtain a unique identifier set of a second number of data objects with the highest heat metric value from the unique identifier sets of the first number of data objects in the pre-priority list associated with each local cache, obtain the second number of data objects according to the unique identifier sets of the second number of data objects, write the second number of data objects and the heat metric values thereof into each local cache, obtain a third number of data objects according to the unique identifier sets of the third number of data objects except the unique identifier sets of the second number of data objects in the unique identifier sets of the first number of data objects, write the third number of data objects into each local cache in a distributed manner, thereby effectively preventing the distributed multi-level cache from significantly responding to hot spot data objects in distributed application instance nodes in the distributed multi-level cache, and effectively preventing the client from significantly improving the performance of distributed multi-level cache.
Drawings
Fig. 1 is a schematic architecture diagram of an application scenario to which the distributed multi-level cache data processing method of the present application is applied;
FIG. 2 is a flow chart illustrating a data processing method of a distributed multi-level cache according to an embodiment of the present application;
FIG. 3 is a schematic diagram illustrating an operation principle of a data processing method of a distributed multi-level cache according to an embodiment of the present application;
FIG. 4 is a partial flow diagram illustrating a data processing method for a distributed multi-level cache according to another embodiment of the present application;
FIG. 5 is a partial flow diagram of a data processing method of a distributed multi-level cache according to another embodiment of the present application;
FIG. 6 is a partial flow diagram of a data processing method of a distributed multi-level cache according to another embodiment of the present application;
FIG. 7 is a partial flow diagram of a data processing method of a distributed multi-level cache according to another embodiment of the present application;
FIG. 8 is a partial flow diagram illustrating a data processing method for a distributed multi-level cache according to another embodiment of the present application;
FIG. 9 is a block diagram of a data processing apparatus for distributed multi-level caching according to an embodiment of the present application;
FIG. 10 is a schematic diagram of a partial structure of a data processing apparatus of a distributed multi-level cache according to another embodiment of the present application;
FIG. 11 is a schematic diagram of a portion of a distributed multi-level cached data processing apparatus according to another embodiment of the present application;
fig. 12 is a schematic partial structure diagram of a data processing apparatus of a distributed multi-level cache according to another embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings of the embodiments of the present application. However, it is to be understood that the described embodiments are merely some exemplary embodiments of this application and not all embodiments, and thus the following detailed description of the embodiments of the application is not intended to limit the scope of the claims. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
It should be noted that the terms "first," "second," and the like in the description and in the claims of this application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order, or for indicating or implying any relative importance.
Fig. 1 is a schematic architecture diagram of an application scenario to which the distributed multi-level cache data processing method of the present application is applied. As shown in fig. 1, in the system architecture, a plurality of local caches corresponding to a plurality of application instances of the target application respectively and a plurality of distributed cache nodes form a distributed multi-level cache, where the plurality of local caches corresponding to the plurality of application instances of the target application are first-level caches, and the plurality of distributed cache nodes form a second-level cache. An application instance (instance) of a target application, also called a service instance, may provide an application process of an external service for the target application, where each application instance has a corresponding local cache, and the local cache is a certain amount of memory space in the application process of the application instance.
The local cache corresponding to each application instance adopts a Key value pair { Key: value format, where key is the unique identifier of the data object and Value is the Value of the data object. In order to ensure data access response performance under high-concurrency user access requests, hot data objects should be cached as much as possible in the local cache corresponding to each application instance. When the application example receives a data access request of a client, the application example searches the data object in the corresponding local cache, and if the data object is not hit, the application example further searches the distributed cache nodes of the second-level cache. In one embodiment, the secondary cache may be implemented by a Redis in-memory database, and each distributed cache node may be a node in the Redis in-memory database cluster. Redis is an open-source, memory-based, distributed Key-value pair { Key: value store database. Compared with the local cache, the data object with the second degree of hotness can be loaded to each distributed cache node of the second-level cache from the database node at the back end in advance. The data object is distributed to all distributed cache nodes according to the hash operation of the Key, and when the data object cannot be hit in the local cache, the application instance searches the corresponding distributed cache nodes according to the hash operation of the Key of the data object. And if the second-level cache is not hit, reading and loading the data object from the database node at the back end into the distributed cache node, and returning the data object to the client.
As described above, in the application scenario of the distributed multi-level cache, processing data objects in the local cache and the second-level cache based on data elimination strategies such as conventional LRU (least recently used), LFU (least frequently used), and the like may cause substantial cold data objects to replace hot data objects in the cache, thereby reducing the hit rate of the data objects in the distributed multi-level cache, and further affecting the access performance of the target application under high concurrency. In the present application, a hot data object refers to a data object with a very high reading frequency but a low modification frequency, and a cold data object refers to a data object with a very low access frequency or a very high modification frequency.
Therefore, the present application provides a data processing method and apparatus for distributed multi-level cache to solve the above technical problems.
Fig. 2 is a flowchart illustrating a data processing method of a distributed multi-level cache according to an embodiment of the present application. As shown in fig. 2, the data processing method of the distributed multi-level cache of the present application includes the following steps:
step S201, respectively constructing a corresponding local cache for each application instance in a plurality of application instances of a target application, and obtaining a plurality of local caches respectively corresponding to the plurality of application instances;
step S202, respectively constructing a pre-priority list for each local cache in the plurality of local caches, obtaining a plurality of pre-priority lists respectively associated with the plurality of local caches, wherein the pre-priority lists are used for recording the unique identifiers and the heat metric values of a first number of data objects with the highest heat metric values accessed by the client in each application instance in real time, and sorting the unique identifiers and the heat metric values according to the heat metric values of the data objects;
step S203, obtaining a second number of unique identifier sets of data objects with the highest heat metric value from the first number of unique identifier sets of data objects in the pre-priority list associated with each local cache, obtaining the second number of data objects according to the second number of unique identifier sets of data objects, writing the second number of data objects and the heat metric value thereof into each local cache, obtaining a third number of data objects according to a third number of unique identifier sets of data objects, excluding the second number of unique identifier sets of data objects, in the first number of unique identifier sets of data objects, and distributively writing the third number of data objects into each cache node in the second-level distributed cache.
In this embodiment, multiple application instances of the target application may run on one or more server nodes in the Java distributed application system. Each application instance of the target application is respectively allocated with a corresponding local cache, and the local cache is a memory space with a preset capacity in an application process of each application instance. Each application instance of the target application independently constructs a pre-priority list associated with the local cache, and the pre-priority list is used for recording the unique identifiers and the heat metric values of the first number of data objects with the highest heat metric value accessed by the client in each application instance in real time.
The heat metric is a quantitative measure in this application that measures the degree of heat of each data object accessed by the client in each application instance. In one embodiment, the heat metric value may include a difference between read times and update times for each data object monitored in real-time by each application instance. For each data object, the more the number of reads, the greater the degree of hotness that reflects the data object, and the more the number of updates, the lesser the degree of hotness that reflects the data object. Therefore, in order to improve the hit rate of the data objects in the local cache, the local cache corresponding to each application instance needs to store the data object with the greatest heat degree as possible, that is, the data object with the greater reading times and the smaller updating times. The actual degree of popularity of each data object accessed by the client in each application instance can be effectively reflected by the difference between the reading times and the updating times of each data object.
Assume that the pre-priority list of local cache associations corresponding to each application instance is represented as
Figure SMS_3
The unique identifier for any data object in the pre-priority list is expressed as ≧ H>
Figure SMS_4
,/>
Figure SMS_7
P represents a pre-priority list ≧ corresponding to the local cache>
Figure SMS_2
The number of unique identifiers of the data object in (b), then the data object @>
Figure SMS_5
Is measured->
Figure SMS_8
Can be calculated by the formula->
Figure SMS_10
Wherein->
Figure SMS_1
The representation is based on a unique identifier->
Figure SMS_6
Number of reads of the identified data object, <' >>
Figure SMS_9
The representation is based on a unique identifier->
Figure SMS_11
A number of updates of the identified data object.
In order to better record and distribute the hot data objects accessed by the client in each application instance among the multiple levels of caches in real time, the number P of the unique identifiers of the data objects in the pre-priority list associated with the local cache corresponding to each application instance is at least greater than the number N of the data objects in the local cache. Assume that the set of data objects in the local cache corresponding to each application instance is represented as
Figure SMS_12
Set of data objects in local cache +>
Figure SMS_13
Is less than the pre-priority list &'s associated with the local cache>
Figure SMS_14
Number P of unique identifiers of data objects in (a), i.e. < >>
Figure SMS_15
In this embodiment, the pre-priority list associated with each local cache pre-records the unique identifiers (Key keys) of the top P data objects with the highest heat metric among all the data objects accessed by the client in each application instance and the heat metric thereof. The pre-priority list associated with each local cache may occupy a predetermined amount of memory space in the application process of each application instance as the local cache does.
In one embodiment, the unique identifiers for the P data objects in the pre-priority list are arranged in reverse order or in order of low to high of the heat metric value for each data object.
And each application instance acquires the unique identifiers of the first N data objects with the maximum heat metric value from the pre-priority list, reads the values corresponding to the N data objects from the second-level distributed cache or a database node at the rear end according to the unique identifiers of the N data objects, and writes the key value pairs of the N data objects and the heat metric values of the N data objects into a local cache corresponding to each application instance. Likewise, the sets of data objects in the local cache may also be ordered in order from high to low or low to high according to a measure of hotness.
In this embodiment, the pre-priority list associated with each local cache may be divided into two sub-lists by taking the minimum heat metric value of the data object written into the local cache as a boundary, that is, a first pre-priority list and a second pre-priority list, where the first pre-priority list is a list formed by unique identifier sets of N data objects written into the local cache, and the second pre-priority list is a list formed by unique identifier sets of P-N data objects whose heat metric value is smaller than the minimum heat metric value. In this embodiment, after writing the data objects identified by the N unique identifiers in the first pre-priority list into the associated local caches, the identified data objects may be further obtained from the database node at the back end according to the P-N unique identifiers in the second pre-priority list and written into each distributed cache node in the second-level distributed cache in a distributed manner. For each application instance, the local cache serving as the first-level cache stores the hottest set of data objects in the pre-priority list, and the distributed cache node serving as the second-level cache stores the second-hot set of data objects in the pre-priority list.
To better illustrate the technical solution of the present embodiment, the following is exemplarily explained with reference to the schematic operation principle diagram of the pre-priority list shown in fig. 3. As shown in fig. 3, each application instance (application instance 1, application instance 2.., application instance X) of the target application constructs a pre-priority list 302 for the local cache 303, and taking application instance 1 as an example, when the application instance 1 receives an access request 301 from a client to a target data object, the heat metric H of the target data object is calculated in real time, and a unique identifier (Key) of the target data object and the heat metric H thereof are recorded in the pre-priority list 302 according to the size of the heat metric H of the target data object and according to a predetermined order. The unique identifier (Key) of the top P data objects with the highest heat metric value among all the data objects accessed by the client in application example 1 and the heat metric value thereof are recorded in the pre-priority list 302. The application example 1 obtains the unique identifiers of the first N data objects with the largest heat metric Value from the unique identifier set of the P data objects in the pre-priority list 302, reads the values Value corresponding to the N data objects from the second-level distributed cache or the database node at the back end according to the unique identifiers of the N data objects, and compares the Key Value pairs { Key: value and the heat metric values H of the N data objects are written into the local cache 303 corresponding to the application instance 1. Meanwhile, the application example 1 obtains the unique identifiers of P-N data objects with the later heat metric value from the unique identifier set of P data objects in the pre-priority list 302, and obtains the identified data objects from the database node at the back end to distributively write into each distributed cache node 304 in the second-level distributed cache. Therefore, the data processing mode can effectively prevent the problem that hot spot data objects in the distributed multi-level cache are replaced by substantial cold data objects in the application instance, obviously improve the hit rate of the data objects in the distributed multi-level cache, and improve the response performance of the target application to the data access request of the client side at high concurrency.
In summary, in the embodiment of the present application, an associated pre-priority list is respectively constructed for a local cache corresponding to each application instance of a target application, unique identifiers and heat metric values of a first number of data objects with the highest heat metric value accessed by a client in each application instance are recorded in real time, a unique identifier set of a second number of data objects with the highest heat metric value is obtained from the unique identifier sets of the first number of data objects in the pre-priority list associated with each local cache, the second number of data objects and the heat metric values thereof are written into each local cache, the third number of data objects are obtained according to the unique identifier sets of the third number of data objects in the unique identifier sets of the first number of data objects, the third number of data objects are distributively written into each node in a second-level distributed cache, so that a user effectively prevents the client from accessing each local cache of distributed data objects in a distributed cache, and hit on a distributed cache of multiple levels of data objects in a distributed cache, and a distributed response to a distributed cold-access request of a high-level data object in a distributed cache is effectively prevented.
In some embodiments, based on the foregoing example, as shown in fig. 4, the method may further include the following steps:
step S401, each application instance responds to an access request of a client to a target data object, calculates the heat metric value of the target data object in real time, and updates a pre-priority list associated with a local cache corresponding to each application instance according to the heat metric value of the target data object;
step S402, judging whether the target data object is hit in the local cache corresponding to each application instance, if not, searching the target data object from the second-level distributed cache or the database node at the rear end;
step S403, determining whether the heat metric of the target data object is greater than the minimum heat metric of the data object in the local cache corresponding to each application instance; if so, replacing the data object with the minimum hot metric value and the hot metric value thereof in the local cache corresponding to each application instance by the target data object and the hot metric value thereof.
In this embodiment, for an access request of a client to a target data object, each application instance of a target application may calculate and obtain a latest heat metric value of the target data object in real time, and update a pre-priority list associated with a local cache corresponding to each application instance according to the heat metric value of the target data object.
Subsequently, in this embodiment, by determining whether the target data object hits in the local cache, if not, the access data object is searched in the distributed cache node in the second-level distributed cache according to the unique identifier of the target data object; and if the target data object is not found in the second-level distributed cache, finding the target data object from a database node at the rear end, and writing the target data object into a distributed cache node of the second-level distributed cache.
And then after the target data object is searched, judging whether the heat metric value of the target data object is larger than the minimum heat metric value of the data object in the local cache, if so, determining the position of the target data object in the local cache according to the heat metric value of the target data object, and writing the target data object and the heat metric value thereof into the local cache. When the number of the data objects in the local cache reaches N and maintains the maximum number N, the target data objects and the heat metric values thereof are written into the local cache, which means that the data objects with the minimum heat metric values in the data object set in the local cache and the heat metric values thereof are replaced and removed.
In one embodiment, the method may further comprise:
and if the target data object is hit in the local cache corresponding to each application example, updating the position and the heat metric value of the target data object in the local cache corresponding to each application example according to the heat metric value of the target data object.
In this embodiment, because the data object sets in the local cache may also be sorted in the order from high to low or from low to high according to the heat metric value, the positions of the target data objects in the local cache may be updated simultaneously when the heat metric value of the target data object in the local cache is updated.
Further, for a data object replaced by a target data object in the local cache, it may be further determined whether the data object replaced in the local cache is cached at the distributed cache nodes of the second-level distributed cache, and if not, the data object replaced in the local cache may be distributively written into each distributed cache node of the second-level distributed cache.
To sum up, in this embodiment, each application instance responds to an access request of a client to a target data object, calculates a heat metric value of the target data object in real time, updates a pre-priority list associated with a local cache according to the heat metric value of the target data object, determines whether the target data object is hit in the local cache, if not, searches for the target data object from a second-level distributed cache or a database node at a rear end, and determines whether the heat metric value of the target data object is greater than a minimum heat metric value of a data object in the local cache; if so, replacing the data object and the heat metric value thereof with the target data object and the heat metric value thereof, which are the minimum heat metric value in the local cache corresponding to each application instance, so that after each application instance receives a new data access request, recording the latest heat metric value of the target data object accessed by the client in real time, and writing the target data object into the local cache only when the heat of the target data object is greater than the minimum heat metric value in the local cache when the local cache is not hit, or storing the target data object in a second-level distributed cache, thereby effectively preventing the problem that a substantial cold data object accessed by the client in the application instance replaces a hot spot data object in the distributed multi-level cache, improving the hit rate of the data object in the distributed multi-level cache, and improving and issuing the response performance of the target application to the data access request of the client.
In an implementation manner, on the basis of any of the foregoing embodiments, as shown in fig. 5, the step S401 of updating the pre-priority list associated with the local cache corresponding to each application instance according to the heat metric value of the target data object may include the following steps:
step S501, determining the position of the unique identifier of the target data object in a pre-priority list according to the comparison between the hot metric value of the target data object and the hot metric value of the data object in the pre-priority list associated with the local cache corresponding to each application instance;
step S502, the pre-priority list is updated according to the position of the unique identifier of the target data object in the pre-priority list, so that the pre-priority list keeps recording the unique identifiers and the heat degree metric values of the first quantity of data objects with the highest heat degree metric value.
In this embodiment, the position of the unique identifier of the target data object in the pre-priority list is determined by comparing the heat metric value of the target data object with the heat metric values of the data objects in the pre-priority list, and the pre-priority list is updated based on the position of the unique identifier of the target data object in the pre-priority list, and the updated pre-priority list always keeps recording the unique identifiers and the heat metric values of the first number of data objects with the highest heat metric value, which are accessed by the client, of each application instance.
In some embodiments, based on any of the foregoing embodiments, as shown in fig. 6, the method may further include the steps of:
step S601, merging and sorting the plurality of pre-priority lists to obtain a global pre-priority list, wherein the global pre-priority list records unique identifiers and global heat metric values of a first number of data objects with highest global heat metric values accessed by clients in the plurality of application instances;
step S602, comparing the global pre-priority list with the pre-priority list associated with each local cache, and obtaining a difference set between the unique identifier sets of the second number of data objects with the highest global heat metric value in the global pre-priority list and the unique identifier sets of the second number of data objects with the highest heat metric value in the pre-priority list associated with each local cache;
step S603, updating the pre-priority list associated with each local cache according to the global heat metric value of any data object identified by the unique identifier in the difference set;
step S604, judging whether the global heat metric value of any data object is larger than the minimum heat metric value of the data object in each local cache; if so, searching any data object from the second-level distributed cache or a database node at the rear end, and replacing the data object with the minimum heat metric value and the heat metric value thereof in each local cache by using any data object and the global heat metric value thereof.
In this embodiment, the pre-priority lists associated with the local caches corresponding to the multiple application instances may be aggregated from the application dimension, and a global pre-priority list of all application instances of the target application is constructed, where the global pre-priority list is formed by merging and sorting the pre-priority lists associated with the local caches corresponding to the multiple application instances, and taking the unique identifiers of the top P data objects with the largest global heat metric. The global heat metric value refers to a maximum heat metric value of the data object in a pre-priority list associated with the local caches respectively corresponding to the multiple application instances. If the data objects in the global pre-priority list exist in the pre-priority lists associated with the local caches corresponding to the multiple application instances, the maximum heat metric value is reserved as the global heat metric value, and the ordering positions of the data objects in the global pre-priority list are determined according to the global heat metric value of the merged data objects.
Subsequently, the present embodiment compares the global pre-priority list with the pre-priority list associated with each local cache, specifically, takes a difference set between the unique identifier set of the N data objects with the highest global heat metric value in the global pre-priority list and the unique identifier set of the N data objects with the highest heat metric value in the pre-priority list associated with each local cache. And updating the pre-priority list associated with each local cache according to the global heat metric value of any data object identified by the unique identifier in the difference set. And simultaneously, comparing the global heat metric value of the data object identified by the unique identifier in the difference set with the minimum heat metric value of the data object in each local cache. And judging whether the global heat metric value of the data object identified by the unique identifier in the difference set is greater than the minimum heat metric value of the data object in each local cache, if so, determining the position of the data object in the difference set in the local caches according to the global heat metric value of the data object identified by the unique identifier in the difference set, writing the data object in the difference set and the global heat metric value thereof into each local cache, and replacing the data object of the minimum heat metric value in each local cache and the heat metric value thereof by the data object in the difference set and the global heat metric value thereof.
The scheme of this embodiment may be implemented in combination with a Zookeeper distributed application coordination service, where a Zookeeper is a distributed application coordination service of a distributed open source, each application instance of a target application may be registered as a temporary node on the Zookeeper, each application instance may periodically send a pre-priority list associated with a local cache to a corresponding temporary node, and a background management process may obtain the pre-priority lists sent by each application instance by subscribing to each temporary node, merge the pre-priority lists into a global pre-priority list, correspondingly obtain a difference set between the global pre-priority list and the pre-priority list associated with each local cache, and notify each application instance.
Further, for the data object replaced in the local cache, it may be further determined whether the data object replaced in the local cache is cached at the distributed cache nodes of the second-level distributed cache, and if not, the data object replaced in the local cache may be distributively written into each distributed cache node of the second-level distributed cache.
In summary, in this embodiment, a global pre-priority list is obtained by merging and sorting a plurality of pre-priority lists respectively associated with the plurality of local caches, the global pre-priority list is compared with the pre-priority list associated with each local cache, a difference set between the unique identifier set of the second number of data objects with the highest global heat metric value in the global pre-priority list and the unique identifier set of the second number of data objects with the highest heat metric value in the pre-priority list associated with each local cache is obtained, when the global heat metric value of any data object identified by the unique identifier in the difference set is greater than the minimum heat metric value of the data object in each local cache, the data object with the lowest heat metric value in each local cache and the heat metric value thereof are replaced by the data object in the difference set and the global heat metric value thereof, so that a global hot data object in an application dimension can be further obtained and written into the local cache of each application instance, thereby effectively preventing a client from replacing a multi-level data object in the local cache accessed by a client from hitting a distributed type hot data object, and improving a distributed access rate of a distributed data object in a distributed type.
In some embodiments, based on any of the foregoing embodiments, as shown in fig. 7, the step S603 updates the pre-priority list associated with each local cache according to the global heat metric value of any data object identified by the unique identifier in the difference set, and may further include the following steps:
step S701, determining a position of the unique identifier of any data object in the pre-priority list associated with each local cache according to a comparison between the global heat metric value of any data object and the heat metric values of the data objects in the pre-priority lists associated with each local cache;
step S702, updating the pre-priority list associated with each local cache according to the position of the unique identifier of any data object in the pre-priority list associated with each local cache, so that the pre-priority list associated with each local cache keeps recording the unique identifiers and the heat metric values of the first number of data objects with the highest heat metric value.
In this embodiment, by comparing the difference set between the unique identifier sets of the second number of data objects with the highest global heat metric value in the global pre-priority list and the unique identifier sets of the second number of data objects with the highest heat metric value in the pre-priority list associated with each local cache, the global heat metric value of any data object identified by the unique identifier in the difference set is further compared with the heat metric value of the data object in the pre-priority list associated with each local cache, the position of the unique identifier of any data object in the pre-priority list associated with each local cache is determined, the pre-priority list is updated based on the position of the unique identifier of any data object in the pre-priority list associated with each local cache, and the updated pre-priority list always keeps and records the unique identifiers and the heat metric values of the first number of data objects with the highest heat metric value accessed by the client in each application instance.
In some embodiments, based on any of the previous embodiments, as shown in fig. 8, the method may further include the steps of:
step S801, calculating a first average hit rate of the unique identifier sets of the second number of data objects in the local cache and a second average hit rate of the unique identifier sets of the third number of data objects in the second-level distributed cache in the pre-priority list associated with each local cache in each metric cycle;
step S802, judging whether the first average hit rate and the second average hit rate meet the condition that the first average hit rate is smaller than a preset threshold and the second average hit rate is larger than the preset threshold, if so, proportionally attenuating the heat degree metric values of all data objects in the preposed priority list and the local cache until the first average hit rate is larger than or equal to the preset threshold in the subsequent measurement period.
In this embodiment, the first average hit rate is used to represent an average hit rate in the local cache of the unique identifier sets (corresponding to the first pre-priority list in the foregoing embodiment) of the second number of data objects in each local cache associated pre-priority list in each measurement period, and the second average hit rate is used to represent an average hit rate in the second-level distributed cache of the unique identifier sets (corresponding to the second pre-priority list in the foregoing embodiment) of the third number of data objects in each local cache associated pre-priority list in each measurement period. In one embodiment, the first average hit rate is a ratio of the total number of hits of the unique identifier sets of the second number of data objects in the each local cache to the second number, and the second average hit rate is a ratio of the total number of hits of the unique identifier sets of the third number of data objects in the second-level distributed cache to the third number.
Assume that a certain application instance processes C data access requests of a client in one measurement period, wherein,
Figure SMS_16
. If the total number of hits of the unique identifier set of the data object in the first pre-priority list in the pre-priority list associated with the local cache corresponding to the application instance in the local cache is ^ 5>
Figure SMS_17
Then the first average hit rate->
Figure SMS_18
Can be calculated by the following formula>
Figure SMS_19
. If the unique identifier set of the data object in the second pre-priority list in the pre-priority list associated with the local cache corresponding to the application instance is ^ greater than or equal to the total number of hits in the second-level distributed cache>
Figure SMS_20
Then a second average hit rate>
Figure SMS_21
Can be calculated by the following formula>
Figure SMS_22
And judging whether the first average hit rate and the second average hit rate meet the conditions that the first average hit rate is smaller than a preset threshold value and the second average hit rate is larger than the preset threshold value or not in each measurement period. If so, the overall heat trend of the data objects in the second preposed priority list written into the second-level distributed cache in the preposed priority list exceeds the overall heat trend of the data objects in the first preposed priority list written into the local cache, namely the data objects in the second preposed priority list become hot gradually. At this time, the heat metric values of all the data objects in the pre-priority list and the local cache may be proportionally attenuated to shorten the difference between the heat metric value of the data object in the second pre-priority list and the difference between the heat metric values of the data objects in the first pre-priority list, so that the data object in the second pre-priority list may be written into the local cache more quickly in the subsequent measurement period, and replace the old data object that is gradually cooled in the first pre-priority list until the first average hit rate is greater than or equal to the predetermined threshold.
In one embodiment, proportionally attenuating the heat metric values of all data objects in the pre-priority list and the local cache may include halving attenuation, i.e., attenuating the heat metric values of all data objects in the pre-priority list and the local cache to 1/2 of the original heat metric value.
The embodiment proportionally attenuates the pre-priority list and the heat metric values of all the data objects in the local cache until the first average hit rate is greater than or equal to the predetermined threshold in the subsequent measurement cycle by calculating a first average hit rate of the unique identifier sets of the second number of data objects in the local cache and a second average hit rate of the unique identifier sets of the third number of data objects in the second-level distributed cache in each measurement cycle, when the first average hit rate is less than the predetermined threshold and the second average hit rate is greater than the predetermined threshold, and until the first average hit rate is greater than or equal to the predetermined threshold in the subsequent measurement cycle. Therefore, the problem that the hot spot data object in the distributed multi-level cache is replaced by the substantial cold data object accessed by the client in each application instance can be further prevented, the hit rate of the data object in the distributed multi-level cache is improved, and the response performance of the target application to the data access request of the client is improved.
Fig. 9 is a schematic structural diagram of a data processing apparatus of a distributed multi-level cache according to an embodiment of the present application. As shown in fig. 9, the data processing apparatus of distributed multi-level cache according to the present application includes the following units:
a cache constructing unit 901, configured to respectively construct a corresponding local cache for each of a plurality of application instances of a target application, and obtain a plurality of local caches respectively corresponding to the plurality of application instances;
a data monitoring unit 902, configured to respectively construct a pre-priority list for each local cache in the multiple local caches, obtain multiple pre-priority lists associated with the multiple local caches, where the pre-priority list is used to record, in real time, unique identifiers and heat metric values of a first number of data objects with highest heat metric values accessed by a client in each application instance, and sort the unique identifiers and the heat metric values according to the heat metric values of the data objects;
a cache processing unit 903, configured to obtain a unique identifier set of a second number of data objects with the highest heat metric value from the unique identifier sets of the first number of data objects in the pre-priority list associated with each local cache, obtain the second number of data objects according to the unique identifier sets of the second number of data objects, write the second number of data objects and their heat metric values into each local cache, obtain a third number of data objects according to the unique identifier sets of the third number of data objects, excluding the unique identifier sets of the second number of data objects, in the unique identifier sets of the first number of data objects, and distributively write the third number of data objects into each cache node in the second-level distributed cache.
In some embodiments, based on the foregoing embodiment, as shown in fig. 10, the apparatus may further include:
a first list updating unit 1001, configured to calculate, in real time, a heat metric value of a target data object in response to an access request of a client to the target data object by each application instance, and update a pre-priority list associated with a local cache corresponding to each application instance according to the heat metric value of the target data object;
a hit result determining unit 1002, configured to determine whether the target data object is hit in the local cache corresponding to each application instance, and if the target data object is not hit, search the target data object from the second-level distributed cache or a database node at the back end;
a first data replacing unit 1003, configured to determine whether the heat metric value of the target data object is greater than the minimum heat metric value of the data object in the local cache corresponding to each application instance; if yes, replacing the data object with the minimum hot metric value and the hot metric value thereof in the local cache corresponding to each application instance by the target data object and the hot metric value thereof.
In one embodiment, the apparatus may further include:
and the cache updating unit is used for updating the position and the heat metric value of the target data object in the local cache corresponding to each application example according to the heat metric value of the target data object if the target data object is hit in the local cache corresponding to each application example.
In an implementation manner, on the basis of any one of the foregoing embodiments, the first list updating unit 1001 may be further configured to:
determining the position of the unique identifier of the target data object in a pre-priority list according to the comparison between the heat metric value of the target data object and the heat metric value of the data object in the pre-priority list associated with the local cache corresponding to each application instance;
updating the pre-priority list according to the position of the unique identifier of the target data object in the pre-priority list, so that the pre-priority list keeps recording the unique identifiers and the heat degree metric values of the first number of data objects with the highest heat degree metric values.
In some embodiments, on the basis of any one of the foregoing embodiments, as shown in fig. 11, the apparatus may further include:
a list aggregation unit 1101, configured to merge and sort the multiple pre-priority lists to obtain a global pre-priority list, where the global pre-priority list records unique identifiers and global heat metric values of a first number of data objects with highest global heat metric values accessed by clients in the multiple application instances;
a difference set comparing unit 1102, configured to compare the global pre-priority list with the pre-priority lists associated with each local cache, and obtain a difference set between a unique identifier set of a second number of data objects with a highest global heat metric value in the global pre-priority list and a unique identifier set of a second number of data objects with a highest heat metric value in the pre-priority list associated with each local cache;
a second list updating unit 1103, configured to update the pre-priority list associated with each local cache according to the global heat metric value of any data object identified by the unique identifier in the difference set;
a second data replacement unit 1104, configured to determine whether a global heat metric of any data object is greater than a minimum heat metric of a data object in each local cache; if so, searching any data object from the second-level distributed cache or a database node at the rear end, and replacing the data object with the minimum heat metric value and the heat metric value thereof in each local cache by using any data object and the global heat metric value thereof.
In some implementations, on the basis of any one of the foregoing embodiments, the second list updating unit 1103 may be further configured to:
determining the position of the unique identifier of any data object in the pre-priority list associated with each local cache according to the comparison of the global heat metric value of any data object and the heat metric values of the data objects in the pre-priority list associated with each local cache;
updating the pre-priority list associated with each local cache according to the position of the unique identifier of any data object in the pre-priority list associated with each local cache, so that the pre-priority list associated with each local cache keeps recording the unique identifiers and the heat degree metric values of the first number of data objects with the highest heat degree metric values.
In some embodiments, based on any of the foregoing embodiments, as shown in fig. 12, the apparatus may further include the following units:
a hit calculating unit 1201, configured to calculate, in each metric cycle, a first average hit rate of the unique identifier sets of the second number of data objects in the local cache and a second average hit rate of the unique identifier sets of the third number of data objects in the second-level distributed cache in the pre-priority list associated with each local cache;
and a heat attenuation unit 1202, configured to determine whether the first average hit rate and the second average hit rate meet a condition that the first average hit rate is less than a predetermined threshold and the second average hit rate is greater than the predetermined threshold, if yes, attenuate heat metric values of all data objects in the pre-priority list and the local cache in proportion until the first average hit rate is greater than or equal to the predetermined threshold in a subsequent measurement period.
In summary, the distributed multi-level cache data processing method and apparatus according to the embodiments of the present application respectively construct an associated pre-priority list for a local cache corresponding to each application instance of a target application, record in real time unique identifiers and heat metric values of a first number of data objects with the highest heat metric value accessed by a client in each application instance, obtain a unique identifier set of a second number of data objects with the highest heat metric value from the unique identifier sets of the first number of data objects in the pre-priority list associated with each local cache, obtain the second number of data objects according to the unique identifier sets of the second number of data objects, write the second number of data objects and their heat metric values into each local cache, obtain a third number of data objects according to the unique identifier sets of the third number of data objects in the unique identifier sets of the first number of data objects, except the unique identifier sets of the second number of data objects, write the third number of data objects into the unique identifier sets of the distributed multi-level caches in each application instance distributively, thereby effectively preventing a problem of significantly improved access to the distributed multi-level cache in response to a hot spot access request of data objects in the distributed multi-level cache.
It should be noted that, those skilled in the art can understand that different embodiments described in the method embodiment of the present application, and descriptions thereof, and technical effects achieved are also applicable to the apparatus embodiment of the present application, and are not described herein again.
Further, an embodiment of the present application also provides an electronic device, where the electronic device may include: one or more processors, and a memory. Where the memory stores computer program instructions that may be called by one or more processors to perform all or part of the steps of the methods described in any of the embodiments of the present application. The computer program instructions in the memory described above may be implemented in the form of software functional units and stored in a computer readable storage medium when sold or used as a stand-alone product.
Further, the present application also provides a computer program product comprising a non-transitory computer readable storage medium storing a computer program, which when connected to a computer device, is capable of performing all or part of the steps of the method according to any of the embodiments of the present application when the computer program is executed by one or more processors of the computer device.
Further, the present application also provides a non-transitory computer readable storage medium having stored thereon a computer program, which can be executed by one or more processors to perform all or part of the steps of the method described in any of the embodiments of the present application.
Through the above description of the embodiments, those skilled in the art can clearly understand that the embodiments of the present application can be implemented by software or by software in combination with a necessary general hardware platform, and of course, can also be implemented by hardware functions. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device, such as but not limited to a personal computer, a server, or a network device, to execute all or part of the steps of the method according to any embodiment of the present application. The aforementioned storage medium may include: various media capable of storing computer program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The foregoing describes exemplary embodiments of the present application, and it is to be understood that the above-described exemplary embodiments are not limiting, but rather are illustrative and that the scope of the present application is not limited thereto. It is to be understood that modifications and variations may be made in the embodiments of the present application by those skilled in the art without departing from the spirit and scope of the present application, and that such modifications and variations are intended to be within the scope of the present application.

Claims (10)

1. A data processing method of a distributed multi-level cache is characterized by comprising the following steps:
respectively constructing a corresponding local cache for each application instance in a plurality of application instances of the target application, and obtaining a plurality of local caches respectively corresponding to the plurality of application instances;
respectively constructing a pre-priority list for each local cache in the plurality of local caches, obtaining a plurality of pre-priority lists respectively associated with the plurality of local caches, wherein the pre-priority lists are used for recording the unique identifiers and the heat metric values of a first number of data objects with the highest heat metric values accessed by the client in each application instance in real time, and sorting the unique identifiers and the heat metric values according to the heat metric values of the data objects;
acquiring unique identifier sets of a second number of data objects with highest heat degree metric values from the unique identifier sets of the first number of data objects in the pre-priority list associated with each local cache, acquiring the second number of data objects according to the unique identifier sets of the second number of data objects, writing the second number of data objects and the heat degree metric values thereof into each local cache, acquiring a third number of data objects according to the unique identifier sets of the third number of data objects except the unique identifier sets of the second number of data objects in the unique identifier sets of the first number of data objects, and distributively writing the third number of data objects into each cache node in a second-level distributed cache.
2. The method of claim 1, wherein the measure of popularity comprises a difference between a number of reads and a number of updates of each data object monitored in real-time by each application instance.
3. The method of data processing for distributed multi-level caching of claim 2, wherein the method further comprises:
each application instance responds to an access request of a client to a target data object, calculates the heat metric value of the target data object in real time, and updates a front priority list associated with a local cache corresponding to each application instance according to the heat metric value of the target data object;
judging whether the target data object is hit in the local cache corresponding to each application instance, if not, searching the target data object from the second-level distributed cache or a database node at the rear end;
judging whether the heat metric value of the target data object is larger than the minimum heat metric value of the data object in the local cache corresponding to each application example; if so, replacing the data object with the minimum hot metric value and the hot metric value thereof in the local cache corresponding to each application instance by the target data object and the hot metric value thereof.
4. The data processing method of the distributed multi-level cache according to claim 3, wherein the updating the pre-priority list associated with the local cache corresponding to each application instance according to the hot metric value of the target data object comprises:
determining the position of the unique identifier of the target data object in a pre-priority list according to the comparison between the heat metric value of the target data object and the heat metric value of the data object in the pre-priority list associated with the local cache corresponding to each application instance;
updating the pre-priority list according to the position of the unique identifier of the target data object in the pre-priority list, so that the pre-priority list keeps recording the unique identifiers and the heat degree metric values of the first number of data objects with the highest heat degree metric values.
5. The method of data processing for distributed multi-level caching of claim 4, wherein the method further comprises:
and if the target data object is hit in the local cache corresponding to each application example, updating the position and the heat metric value of the target data object in the local cache corresponding to each application example according to the heat metric value of the target data object.
6. The method of data processing for distributed multi-level caching of claim 1, wherein the method further comprises:
merging and sorting the plurality of pre-priority lists to obtain a global pre-priority list, wherein the global pre-priority list records unique identifiers and global heat metric values of a first number of data objects with highest global heat metric values accessed by clients in the plurality of application instances;
comparing the global pre-priority list with the pre-priority list associated with each local cache to obtain a difference set between the unique identifier sets of the second number of data objects with the highest global heat metric value in the global pre-priority list and the unique identifier sets of the second number of data objects with the highest heat metric value in the pre-priority list associated with each local cache;
updating the pre-priority list associated with each local cache according to the global heat metric value of any data object identified by the unique identifier in the difference set;
judging whether the global heat metric value of any data object is larger than the minimum heat metric value of the data object in the local cache or not; if yes, searching any data object from the second-level distributed cache or a database node at the back end, and replacing the data object with the minimum hot metric value and the hot metric value thereof in each local cache by using any data object and the global hot metric value thereof.
7. The method of data processing for a distributed multi-level cache according to claim 6, wherein said updating the pre-priority list associated with each local cache according to the global measure of popularity of any data object identified by a unique identifier in the differential set comprises:
determining the position of the unique identifier of any data object in the pre-priority list associated with each local cache according to the comparison of the global heat metric value of any data object and the heat metric values of the data objects in the pre-priority list associated with each local cache;
updating the pre-priority list associated with each local cache according to the position of the unique identifier of any data object in the pre-priority list associated with each local cache, so that the pre-priority list associated with each local cache keeps recording the unique identifiers and the heat degree metric values of the first number of data objects with the highest heat degree metric value.
8. The method of data processing for distributed multi-level caching of claim 1, further comprising:
calculating a first average hit rate of the second number of unique identifier sets of the data objects in the pre-priority list associated with each local cache in the local cache and a second average hit rate of the third number of unique identifier sets of the data objects in the second-level distributed cache in each metric cycle;
and judging whether the first average hit rate and the second average hit rate meet the condition that the first average hit rate is smaller than a preset threshold and the second average hit rate is larger than the preset threshold, if so, proportionally attenuating the heat metric values of all data objects in the preposed priority list and the local cache until the first average hit rate is larger than or equal to the preset threshold in a subsequent metric period.
9. The data processing method of the distributed multi-level cache according to claim 8, wherein the first average hit rate is a ratio of a total number of hits of the unique identifier sets of the second number of data objects in the local cache to the second number, and the second average hit rate is a ratio of a total number of hits of the unique identifier sets of the third number of data objects in the second-level distributed cache to the third number.
10. A data processing apparatus for distributed multi-level caching, comprising:
the cache construction unit is used for respectively constructing a corresponding local cache for each application instance in a plurality of application instances of the target application to obtain a plurality of local caches respectively corresponding to the plurality of application instances;
the data monitoring unit is used for respectively constructing a pre-priority list for each local cache in the plurality of local caches, obtaining a plurality of pre-priority lists respectively associated with the plurality of local caches, and the pre-priority lists are used for recording the unique identifiers and the heat metric values of a first number of data objects with the highest heat metric value accessed by the client in each application instance in real time and sorting the data objects according to the heat metric values of the data objects;
a cache processing unit, configured to obtain a second number of unique identifier sets of data objects with the highest heat metric value from the first number of unique identifier sets of data objects in the pre-priority list associated with each local cache, obtain the second number of data objects according to the second number of unique identifier sets of data objects, write the second number of data objects and their heat metric values into each local cache, obtain a third number of data objects according to a third number of unique identifier sets of data objects, excluding the second number of unique identifier sets of data objects, in the first number of unique identifier sets of data objects, and distributively write the third number of data objects into each cache node in the second-level distributed cache.
CN202310086503.4A 2023-02-09 2023-02-09 Data processing method and device for distributed multi-level cache Active CN115878677B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310086503.4A CN115878677B (en) 2023-02-09 2023-02-09 Data processing method and device for distributed multi-level cache

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310086503.4A CN115878677B (en) 2023-02-09 2023-02-09 Data processing method and device for distributed multi-level cache

Publications (2)

Publication Number Publication Date
CN115878677A true CN115878677A (en) 2023-03-31
CN115878677B CN115878677B (en) 2023-05-12

Family

ID=85760859

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310086503.4A Active CN115878677B (en) 2023-02-09 2023-02-09 Data processing method and device for distributed multi-level cache

Country Status (1)

Country Link
CN (1) CN115878677B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117785949A (en) * 2024-02-28 2024-03-29 云南省地矿测绘院有限公司 Data caching method, electronic equipment, storage medium and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106527988A (en) * 2016-11-04 2017-03-22 郑州云海信息技术有限公司 SSD (Solid State Drive) data migration method and device
CN112506973A (en) * 2020-12-14 2021-03-16 中国银联股份有限公司 Method and device for managing stored data
CN113761321A (en) * 2021-08-06 2021-12-07 广州华多网络科技有限公司 Data access control method, data cache control method, data access control device, data cache control device, and medium
CN115168244A (en) * 2022-07-29 2022-10-11 苏州浪潮智能科技有限公司 Data updating method, device, equipment and readable storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106527988A (en) * 2016-11-04 2017-03-22 郑州云海信息技术有限公司 SSD (Solid State Drive) data migration method and device
CN112506973A (en) * 2020-12-14 2021-03-16 中国银联股份有限公司 Method and device for managing stored data
CN113761321A (en) * 2021-08-06 2021-12-07 广州华多网络科技有限公司 Data access control method, data cache control method, data access control device, data cache control device, and medium
CN115168244A (en) * 2022-07-29 2022-10-11 苏州浪潮智能科技有限公司 Data updating method, device, equipment and readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117785949A (en) * 2024-02-28 2024-03-29 云南省地矿测绘院有限公司 Data caching method, electronic equipment, storage medium and device
CN117785949B (en) * 2024-02-28 2024-05-10 云南省地矿测绘院有限公司 Data caching method, electronic equipment, storage medium and device

Also Published As

Publication number Publication date
CN115878677B (en) 2023-05-12

Similar Documents

Publication Publication Date Title
CN108810041B (en) Data writing and capacity expansion method and device for distributed cache system
US9235508B2 (en) Buffer management strategies for flash-based storage systems
EP3210121B1 (en) Cache optimization technique for large working data sets
US10198363B2 (en) Reducing data I/O using in-memory data structures
US8760956B1 (en) Data processing method and apparatus
US10409728B2 (en) File access predication using counter based eviction policies at the file and page level
Liu et al. Hybrid storage management for database systems
CN106406759B (en) Data storage method and device
WO2018040167A1 (en) Data caching method and apparatus
JP6402647B2 (en) Data arrangement program, data arrangement apparatus, and data arrangement method
US11461239B2 (en) Method and apparatus for buffering data blocks, computer device, and computer-readable storage medium
CN115878677B (en) Data processing method and device for distributed multi-level cache
CN112148690A (en) File caching method, file access request processing method and device
CN111581218A (en) Method for accelerating access to key value data storage based on log structure merged tree by using double granularity
CN109002400B (en) Content-aware computer cache management system and method
Ungureanu et al. TBF: A memory-efficient replacement policy for flash-based caches
CN113867627B (en) Storage system performance optimization method and system
CN115129618A (en) Method and apparatus for optimizing data caching
CN115934583A (en) Hierarchical caching method, device and system
CN112445794B (en) Caching method of big data system
US11899642B2 (en) System and method using hash table with a set of frequently-accessed buckets and a set of less frequently-accessed buckets
US8028128B2 (en) Method for increasing cache directory associativity classes in a system with a register space memory
CN114296635A (en) Cache elimination method and device of cache data, terminal and storage medium
CN115793994B (en) Packet data processing method and device for local cache in distributed environment
CN113296686A (en) Data processing method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant