Cache hot key management method and device, electronic equipment and storage medium

By implementing tracking points on the target application's cache template and using preset cache hitters and spatiotemporal hitters to determine the real hotspot keys, a multi-level caching mechanism is adopted. This solves the problem of cache middleware being easily compromised, improving system stability and user experience.

CN120631700BActive Publication Date: 2026-02-06HANGZHOU NEWGRAND TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510796211.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-16
Publication Date
2026-02-06
Estimated Expiration
2045-06-16

AI Technical Summary

Technical Problem

In existing technologies, caching middleware is easily compromised by bot requests, leading to system crashes, affecting the normal operation of applications and user experience. How to prevent caching middleware from being compromised and ensure system stability has become an urgent problem to be solved.

Method used

By embedding data points into the target application's cache template, cache operations are monitored in real time. Candidate hot keys are identified using preset cache hitters and spatiotemporal hitters. A multi-level caching mechanism is then used to cache the real hot keys, including caching hot data locally in the application and on the client side.

Benefits of technology

It enables self-management of hotspot keys, improves system stability, prevents cache middleware from being compromised, and ensures normal application operation and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120631700B_ABST
    Figure CN120631700B_ABST
Patent Text Reader

Abstract

The application discloses a cache hot key management method and device, electronic equipment and a storage medium. The method comprises the following steps: determining the access frequency of each cache key based on a preset cache hit device when a target application performs a cache acquisition operation on a cache middleware through a buried point; determining a candidate hot key and the type of the candidate hot key according to the access frequency of each cache key or according to the access frequency of each cache key and the cache value corresponding to the cache key; determining the distribution state of the access frequency and the total access frequency of the candidate hot key within a preset time length through a preset space-time hit device; determining whether the candidate hot key is a real hot key according to the type of the candidate hot key, the distribution state of the access frequency and the total access frequency within the preset time length; and broadcasting the real hot key to the target application, so that the target application adopts a multi-level cache mechanism to perform cache processing on the cache value corresponding to the real hot key. The application can realize self-management of hot keys and improve the stability of the system.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, and in particular to a cache hot key management method and device, electronic equipment and storage medium. BACKGROUND

[0002] In the digital era, various applications are booming. Phenomenal applications or functions frequently emerge, however, which brings serious challenges, such as triggering a surge in access volume. In addition, the network environment is complex, and a large number of robots suddenly emerge to initiate extremely intensive requests at a speed far exceeding that of normal users. These robots only need to pay a small cost to send a request volume that is one hundred times that of ordinary users, which not only increases the burden on the system, but also greatly occupies the resources of normal users. The surge in access volume can easily cause the cache middleware to be broken, causing all access traffic to be dumped to the database, which may eventually lead to a system avalanche, seriously affecting the normal operation of the application and user experience. Therefore, how to avoid the cache middleware from being broken and ensure system stability has become a technical problem to be solved. SUMMARY

[0003] The present application provides a cache hot key management method and device, electronic equipment and storage medium.

[0004] According to another aspect of the present application, a cache hot key management method is provided, comprising:

[0005] The call of the cache template of the target application is handled by burying points, and the cache operation of the target application on the cache middleware is monitored in real time through the burying points; wherein the cache operation at least includes a cache acquisition operation;

[0006] In response to the cache acquisition operation of the target application, the access frequency of each cache key at different times is determined by a preset cache hit detector;

[0007] According to the access frequency of each cache key or according to the access frequency of each cache key and the cache value corresponding to the cache key obtained, the candidate hot key and the type of the candidate hot key are determined;

[0008] For the candidate hot key, the distribution state and the total access frequency of the access frequency of the candidate hot key within a preset time length are determined by a preset space-time hit detector;

[0009] According to the type of the candidate hot key, and the distribution state and the total access frequency of the access frequency of the candidate hot key within a preset time length, it is determined whether the candidate hot key is a real hot key;

[0010] Broadcast the determined real hot key to the target application, so that the target application adopts a multi-level cache mechanism to cache the cache value corresponding to the real hot key.

[0011] According to another aspect of the present application, a cache hot key management device is provided, comprising:

[0012] The cache template of the target application is instrumented, and the cache operation of the target application on the cache middleware is monitored in real time through the instrumentation; wherein the cache operation at least includes a cache obtaining operation;

[0013] In response to the cache obtaining operation of the target application, the access frequency of each cache key at different time points is determined through a preset cache hit detector;

[0014] According to the access frequency of each cache key or according to the access frequency of each cache key and the obtained cache value corresponding to the cache key, a candidate hot key and the type of the candidate hot key are determined;

[0015] For the candidate hot key, the distribution state and the total access frequency of the access frequency of the candidate hot key within a preset time length are determined through a preset space-time hit detector;

[0016] According to the type of the candidate hot key and the distribution state and the total access frequency of the access frequency of the candidate hot key within a preset time length, it is determined whether the candidate hot key is a real hot key;

[0017] Broadcast the determined real hot key to the target application, so that the target application adopts a multi-level cache mechanism to cache the cache value corresponding to the real hot key.

[0018] According to another aspect of the present application, an electronic device is provided, comprising:

[0019] at least one processor; and

[0020] a memory in communication connection with the at least one processor; wherein,

[0021] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the cache hot key management method according to the embodiments of the present application.

[0022] According to another aspect of the present application, a computer readable storage medium is provided, which stores computer instructions for enabling a processor to execute the cache hot key management method according to the embodiments of the present application when executed.

[0023] The technical solution of this invention can realize self-management of hotspot keys and improve system stability.

[0024] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0025] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0026] Figure 1 This is a flowchart illustrating a cache hotspot key management method according to an embodiment of the present invention;

[0027] Figure 2 This is a flowchart illustrating a cache hotspot key management method according to an embodiment of the present invention;

[0028] Figure 3 This is a schematic diagram of a cache hotspot key management device according to an embodiment of the present invention;

[0029] Figure 4 This is a schematic diagram of the structure of an electronic device that implements the cache hotspot key management method of this invention. Detailed Implementation

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

[0031] Example 1

[0032] Figure 1 The present invention provides a flowchart of a cache hotspot key management method. This embodiment is applicable to high-concurrency scenarios. The method can be executed by a cache hotspot key management device, which can be implemented in hardware and / or software. The cache hotspot key management device can be configured in an electronic device, such as in a server device.

[0033] like Figure 1As shown, this cache hotspot key management method includes:

[0034] S101. Perform event tracking on the call to the cache template of the target application, and monitor the cache operation of the target application on the cache middleware in real time through event tracking.

[0035] In this embodiment of the invention, the target application may be a Spring application, which refers to a Java application developed based on the Spring Framework and its ecosystem (such as Spring Boot, Spring Cloud, etc.). The Spring Framework is a lightweight, open-source enterprise application development framework designed to simplify the Java development process and provide modular and scalable solutions.

[0036] The target application's cache template refers to `RedisTemplate`. `RedisTemplate` is a core class provided by the Spring DataRedis framework. It's a template class for manipulating Redis cache, allowing Spring applications to easily interact with Redis (the cache middleware). It's important to note that `RedisTemplate` encapsulates various Redis operation commands, such as reading, writing, deleting, and setting expiration times. Developers don't need to write complex Redis client code; they can complete these operations simply by calling the methods provided by `RedisTemplate`, reducing the difficulty of using Redis. Furthermore, by instrumenting the calls to the target application's cache template, we can monitor whether the methods provided by `RedisTemplate` are called and determine the target application's caching operations on the cache middleware based on the called methods. These caching operations include at least cache fetching and cache creation operations. A cache fetching operation refers to the process of retrieving or reading cached data from the cache middleware; a cache creation operation refers to the process of storing data in the cache middleware.

[0037] In this embodiment of the invention, the invocation of the target application's cache template is instrumented. This mainly involves setting instrumentation points (e.g., injecting AOP aspects or proxy classes) at the locations where the target application invokes the cache template. These locations are typically lines of code that call cache read, write, or delete methods. Setting instrumentation points involves inserting code at these locations that can capture / monitor calls to cache read, write, and delete methods. Subsequently, as the instrumented code continues to run, it can monitor the target application's caching operations on the cache middleware.

[0038] S102. In response to the target application performing a cache retrieval operation, the access frequency of each cache key at different times is determined by a preset cache hitter.

[0039] In this embodiment of the invention, to achieve self-management of hotspot keys, a separate cache manager is pre-established. This cache manager consists of a cache hitter and a spatiotemporal hitter. The pre-defined cache hitter can be a tool or component used to monitor and statistically analyze cache hits. The spatiotemporal hitter is a tool or component used to perform spatiotemporal characteristic analysis on the access frequency of a subset of cache keys filtered by the cache hitter. Based on this, if a target application is detected to perform cache retrieval operations on the cache middleware, the access frequency of each cache key at different times can be determined through the pre-defined cache hitter. The access frequency refers to the number of times a cache key is hit within a unit of time. A cache key is a string or identifier used to uniquely identify the data stored in the cache middleware.

[0040] In one optional implementation, the cache hitter pre-establishes a time slider that slides at preset time intervals, for example, with a 1-second interval. Thus, in response to a cache fetch operation by the target application, the access frequency of each cache key at different times is determined through the preset cache hitter. This includes: in response to the target application's cache fetch operation, sequentially counting the access frequency of each cache key at different times as the time slider slides at the preset time intervals. Here, when the time interval of the time slider is 1 second, "different times" refers to different seconds; therefore, sequentially counting the access frequency of each cache key at different times is essentially counting the number of times each cache key is accessed per second.

[0041] S103. Determine the candidate hotspot key and the type of the candidate hotspot key based on the access frequency of each cache key or based on the access frequency of each cache key and the cache value corresponding to the obtained cache key.

[0042] In one optional implementation, candidate hotspot keys and their types are determined based on the access frequency of each cache key. This includes: if the access frequency of any cache key exceeds a first frequency threshold, then the cache key is determined as a candidate hotspot key, and the type of the candidate hotspot key is High Heat (GRL). The first frequency threshold can be 100, or other values, and is not specifically limited here. That is, as long as the access frequency of a cache key exceeds the threshold, this cache key is considered likely to become a hotspot key (i.e., a cache key that is likely to be accessed frequently within a certain period of time), and therefore selected as a candidate hotspot key for further evaluation.

[0043] In one optional implementation, candidate hotspot keys and their types are determined based on the access frequency of each cache key and the cached value corresponding to the obtained cache key. This includes: if the data size of the cached value corresponding to any cache key is within a first interval, and the access frequency of the cache key is greater than a second frequency threshold, then the cache key is determined to be a candidate hotspot key, and the type of the candidate hotspot key is high bandwidth (GDK). The first interval can be an interval with a data size greater than 100K; the second frequency threshold can be 10. It is understood that both 100K and 10 are examples and can be set to other values, which are not specifically limited here.

[0044] In one optional implementation, determining candidate hotspot keys and their types based on the access frequency of each cache key and the cached value corresponding to that cache key further includes: if the data size of the cached value corresponding to any cache key is within a second range, and the access frequency of that cache key is greater than a third frequency threshold, then that cache key is determined to be a candidate hotspot key, and the type of the candidate hotspot key is suspected high bandwidth (YSGDK); wherein, the second range can be a numerical range with 50K as the midpoint; the third frequency threshold can be 50. It is understood that both 50K and 50 are examples, and other values ​​are possible; no specific limitation is made here.

[0045] It should be noted that the cache hitter continuously counts the access frequency of each cache key, which can promptly discover more candidate hot keys so that the subsequent spatiotemporal hitter can continue to judge and select the real hot keys. For details, please refer to steps S104 and S105.

[0046] S104. For the candidate hotspot key, the distribution of the access frequency and the total access frequency of the candidate hotspot key within a preset time period are determined by a preset spatiotemporal hitter.

[0047] Candidate hotspot keys identified by the cache hitter can proceed to the spatiotemporal hitter for further hotspot detection. The spatiotemporal hitter consists of a preset number of cache hitters. For example, if the preset number is 30, the spatiotemporal hitter consists of 30 layers of cache hitters, each of which includes a time slider with a 1-second interval. In this case, the preset duration is 30 seconds.

[0048] Based on the above, for the candidate hot keys, a preset spatiotemporal hit analyzer is used to determine the distribution and total access frequency of the candidate hot keys within a preset time period. This includes: determining the access frequency of the candidate hot keys at different times within the preset time period based on the access frequency of the candidate hot keys counted by each cache hit analyzer in the spatiotemporal hit analyzer; determining the distribution of the access frequency of the candidate hot keys within the preset time period based on the access frequency at different times within the preset time period; wherein, the distribution state can be, for example, a decreasing state or a geometrically increasing state; summing the access frequencies at different times within the preset time period to obtain the total access frequency of the candidate hot keys within the preset time period; for example, adding the access frequencies at different times within the preset time period to obtain the total access frequency. It is understandable that the higher the access frequency, the higher the probability of becoming a hot key. Therefore, the access frequency of a cache key can be regarded as its popularity, that is, the access frequency of a cache key can be used as a metric to measure whether a cache key is a hot key.

[0049] S105. Based on the type of the candidate hotspot key, the distribution of the access frequency of the candidate hotspot key within a preset time period, and the total access frequency, determine whether the candidate hotspot key is a real hotspot key.

[0050] In one optional implementation, for candidate hotspot keys of type "high heat," if the distribution of the access frequency of the candidate hotspot key shows a geometric increase within a preset time period, then the candidate hotspot key is determined to be a real hotspot key; if the distribution of the access frequency of the candidate hotspot key does not show a geometric increase within the preset time period, but the access frequency at a single moment within the preset time period exceeds a fourth frequency threshold, then the candidate hotspot key is determined to be a real hotspot key; wherein, the fourth frequency threshold can be selected as 500. It should be noted that if a candidate hotspot key is not determined to be a real hotspot key, then the determination continues according to the time interval, based on the total access frequency and the distribution of access frequency within the next preset time period.

[0051] For candidate hotspot keys of type high bandwidth, if the total access frequency of the candidate hotspot key exceeds the fifth frequency threshold, the candidate hotspot key is determined to be a real hotspot key; wherein, the fifth frequency threshold can be 50, or other values, and is not specifically limited here.

[0052] For candidate hotspot keys of type suspected high bandwidth, if the total access frequency of the candidate hotspot key exceeds the sixth frequency threshold, the candidate hotspot key is determined to be a real hotspot key; wherein, the sixth frequency threshold can be 100 or other values, as long as it is greater than the fifth frequency threshold.

[0053] S106. Broadcast the determined real hotspot key to the target application, so that the target application uses a multi-level caching mechanism to cache the cache value corresponding to the real hotspot key.

[0054] After identifying the real hotspot key through the above steps, a hotspot emergency response plan can be activated. For example, the cache manager can broadcast the real hotspot key to the target application, enabling the target application to use a multi-level caching mechanism to cache the cache value corresponding to the real hotspot key. Specifically, the cache value corresponding to the obtained real hotspot key is cached in the target application's memory, and the cached value is marked as a hotspot to distinguish hot data from ordinary data. Furthermore, a unique identifier (which can be generated based on the called method and parameters) and an expiration time (e.g., 5 seconds) are generated for the cached value, and the cached value, its unique identifier, and expiration time are cached locally on the target application's client. Thus, when the client makes another request, it retrieves the required cached value sequentially from the client's local cache and the target application's memory. That is, when the client makes another request, it first generates a unique identifier for the requested URL and parameters, and checks whether the client cache exists. If it exists, the data is used directly; if it does not exist, it requests the backend target application, which then retrieves the data from its local cache (e.g., application memory). If the data exists, it is returned. It should be noted that if the cached key does not exist in the application memory and is a real hot key, the thread that calls the current cached key will be blocked and added to the processing queue for queuing. During the processing, it will first try to retrieve the key from the local application cache. If it is not found there, it will retrieve it from the database and cache it.

[0055] In this embodiment of the invention, the real hotspot key can be accurately determined through two-level judgment; moreover, the cache value corresponding to the real hotspot key is cached both locally in the application and locally on the client, so that the relevant data can be read from the local client or the local application when a subsequent request is made. This can ensure that the cache middleware of the target application is not broken, and improve the stability of the application system.

[0056] Example 2

[0057] Figure 2 This invention provides a flowchart of a method for managing cached hotspot keys. This embodiment adds a cache creation process, as well as a hotspot failure judgment and hotspot cleanup process. See also... Figure 2 The method for managing cached hot keys includes the following steps:

[0058] S201. Perform event tracking on the call to the cache template of the target application, and monitor the cache operation of the target application on the cache middleware in real time through event tracking.

[0059] The caching operation includes at least a cache retrieval operation and a cache creation operation. If the detected cache operation is a cache retrieval operation, then steps S202-S206 are executed; if the detected cache operation is a cache creation operation, then information including the cache key, cache type, and cache expiration time is extracted and transmitted to the cache hitter. In the cache hitter, the cache key is checked for a cache expiration time. If the cache expiration time is less than 5 minutes, it is determined to be temporary cached data.

[0060] S202. In response to the target application performing a cache retrieval operation, the access frequency of each cache key at different times is determined by a preset cache hitter.

[0061] S203. Determine the candidate hotspot key and the type of the candidate hotspot key based on the access frequency of each cache key or based on the access frequency of each cache key and the cache value corresponding to the obtained cache key.

[0062] S204. For the candidate hotspot key, the distribution of the access frequency and the total access frequency of the candidate hotspot key within a preset time period are determined by a preset spatiotemporal hitter.

[0063] S205. Based on the type of the candidate hotspot key, the distribution of the access frequency of the candidate hotspot key within a preset time period, and the total access frequency, determine whether the candidate hotspot key is a real hotspot key.

[0064] S206. Broadcast the determined real hotspot key to the target application, so that the target application uses a multi-level caching mechanism to cache the cache value corresponding to the real hotspot key.

[0065] In this embodiment of the invention, the specific implementation process of steps S202-S206 can be found in the description of the above embodiments, and will not be repeated here.

[0066] S207. For any of the real hotspot keys, if it is determined that the distribution of the access frequency of the real hotspot key within a preset time period shows a downward trend, then it is determined whether the hotspot failure condition is met.

[0067] In this embodiment of the invention, when it is determined that the distribution of the access frequency of the real hotspot key within a preset time period shows a downward trend, it can be determined whether the access frequency of the real hotspot key meets the hotspot failure condition; wherein, the hotspot failure condition may be that the access frequency is continuously lower than a certain threshold.

[0068] S208. If satisfied, broadcast to the target application, causing the target application to mark the real hotspot key as a hotspot invalid.

[0069] When a genuine hotspot key is determined to be invalid, the target application can be notified promptly, causing it to mark the key as invalid. After confirming the invalidity of the genuine hotspot key, the cached value corresponding to that key can be cleared according to step S209.

[0070] S209. The target application's local cache is cleared based on the invalid real hotspot key, and the invalid real hotspot key is sent to the client so that the client can clear its local cache based on the invalid real hotspot key.

[0071] In this embodiment of the invention, the cached data corresponding to the expired real hotspot key cached locally by the target application can be cleared first, thereby ensuring that the target application has enough space to cache the cached value of the new hotspot key. At the same time, the expired real hotspot key can be actively sent to the client, or the expired real hotspot key can be sent to the client when the client requests the backend target application, so that the client can clean up the client's local cache according to the expired real hotspot key.

[0072] In this embodiment of the invention, invalid hot keys can be detected in a timely manner and their caches can be cleared, preventing the cached values ​​corresponding to invalid hot keys from occupying space on the application's local or client's local storage.

[0073] Example 3

[0074] Figure 3 This is a schematic diagram of a cache hotspot key management device provided in an embodiment of the present invention. This embodiment is applicable to high-concurrency scenarios. Figure 3 As shown, the device includes:

[0075] The event tracking module 301 is used to perform event tracking on the calls to the cache template of the target application, and to monitor the cache operations of the target application on the cache middleware in real time through event tracking; wherein, the cache operations include at least cache retrieval operations;

[0076] The first hit record module 302 is used to respond to the target application's cache retrieval operation and determine the access frequency of each cache key at different times by using a preset cache hitter.

[0077] The first hotspot determination module 303 is used to determine the candidate hotspot key and the type of the candidate hotspot key based on the access frequency of each cache key or based on the access frequency of each cache key and the cache value corresponding to the obtained cache key.

[0078] The second hit recording module 304 is used to determine the distribution of the access frequency and the total access frequency of the candidate hotspot key within a preset time period by using a preset spatiotemporal hitter.

[0079] The second hotspot judgment module 305 is used to determine whether the candidate hotspot key is a real hotspot key based on the type of the candidate hotspot key, the distribution of the access frequency of the candidate hotspot key within a preset time period and the total access frequency.

[0080] The broadcast module 306 is used to broadcast the determined real hotspot key to the target application, so that the target application uses a multi-level caching mechanism to cache the cache value corresponding to the real hotspot key.

[0081] In some embodiments, the cache hitter is pre-established with a time slider that slides at preset time intervals;

[0082] In responding to the target application's cache retrieval operation, and determining the access frequency of each cache key at different times through a preset cache hitter, the first hit recording module is specifically used for:

[0083] In response to the target application performing a cache retrieval operation, the access frequency of each cache key at different times is counted sequentially as the time slider slides at a preset time interval.

[0084] In some embodiments, the first hotspot determination module is specifically used to determine candidate hotspot keys and the type of the candidate hotspot keys based on the access frequency of each cache key or based on the access frequency of each cache key and the cache value corresponding to the obtained cache key:

[0085] If the access frequency of any cache key exceeds the first frequency threshold, then the cache key is determined to be a candidate hot key, and the type of the candidate hot key is high heat.

[0086] If the data size of the cached value corresponding to any cache key is within the first range, and the access frequency of the cache key is greater than the second frequency threshold, then the cache key is determined to be a candidate hot key, and the type of the candidate hot key is high bandwidth.

[0087] If the data size of the cached value corresponding to any cache key is in the second range, and the access frequency of the cache key is greater than the third frequency threshold, then the cache key is determined to be a candidate hot spot key, and the type of the candidate hot spot key is suspected high bandwidth.

[0088] In some embodiments, the spatiotemporal hitter is composed of a preset number of the cache hitters;

[0089] Regarding the determination of the distribution and total access frequency of the candidate hotspot keys within a preset time period using a preset spatiotemporal hit detector, the second hit recording module is specifically used for:

[0090] Based on the access frequency of the candidate hotspot key counted by each cache hitter in the spatiotemporal hitter, the access frequency of the candidate hotspot key at different times within a preset time period is determined.

[0091] Based on the access frequency at different times within a preset time period, determine the distribution of the access frequency of the candidate hotspot key within the preset time period;

[0092] The access frequencies at different times within a preset time period are summarized to obtain the total access frequency of the candidate hotspot key within the preset time period.

[0093] In some embodiments, the second hotspot determination module is specifically used to determine whether a candidate hotspot key is a real hotspot key based on the type of the candidate hotspot key, the distribution of the access frequency of the candidate hotspot key within a preset time period, and the total access frequency.

[0094] For candidate hotspot keys of type high heat, if the distribution of the access frequency of the candidate hotspot key within a preset time period shows a geometric increase or the access frequency at a single moment within the preset time period exceeds the fourth frequency threshold, then the candidate hotspot key is determined to be a real hotspot key.

[0095] For candidate hotspot keys of type high bandwidth, if the total access frequency of the candidate hotspot key exceeds the fifth frequency threshold, then the candidate hotspot key is determined to be a real hotspot key.

[0096] For candidate hotspot keys of type suspected high bandwidth, if the total access frequency of the candidate hotspot key exceeds the sixth frequency threshold, then the candidate hotspot key is determined to be a real hotspot key.

[0097] In some embodiments, the target application employs a multi-level caching mechanism to cache the cached value corresponding to the real hotspot key, including:

[0098] The cached value corresponding to the real hotspot key is cached in the memory of the target application, and the cached value is marked as a hotspot.

[0099] A unique identifier and expiration time are generated for the cached value, and the cached value, along with its unique identifier and expiration time, are cached locally on the client side of the target application. This allows the client to retrieve the required cached value from the client's local storage and the target application's memory in sequence when it makes another request.

[0100] In some embodiments, it also includes

[0101] The failure judgment module is used to determine whether the hotspot failure condition is met if the distribution of the access frequency of any of the real hotspot keys shows a downward trend within a preset time period.

[0102] The cache processing module is configured to, if satisfied, broadcast to the target application, causing the target application to mark the real hotspot key as a hotspot invalid; clean up the target application's local cache based on the invalid real hotspot key, and send the invalid real hotspot key to the client so that the client can clean up its local cache based on the invalid real hotspot key.

[0103] The cache hotspot key management device provided in this embodiment of the invention can execute the cache hotspot key management method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method execution.

[0104] Example 4

[0105] Figure 4 A schematic diagram of an electronic device 10, which can be used to implement embodiments of the present invention, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0106] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0107] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0108] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as performing cache hotspot key management methods.

[0109] In some embodiments, the cache hotspot key management method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the cache hotspot key management method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to execute the cache hotspot key management method by any other suitable means (e.g., by means of firmware).

[0110] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include: implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0111] Computer programs used to implement the methods of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to the processor of a general-purpose computer, a special-purpose computer, or other programmable cache hotspot key management device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The computer programs can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0112] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0113] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0114] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0115] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0116] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0117] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for managing cached hotspot keys, characterized in that, include: The system performs event tracking on the calls to the cache template of the target application and monitors the cache operations of the target application to the cache middleware in real time through event tracking; wherein the cache operations include at least cache retrieval operations; In response to the target application performing a cache retrieval operation, the access frequency of each cache key at different times is determined by a preset cache hitter. Candidate hotspot keys and their types are determined based on the access frequency of each cache key or based on the access frequency of each cache key and the cache value corresponding to the obtained cache key. For the candidate hotspot keys, a preset spatiotemporal hitter is used to determine the distribution of the access frequency and the total access frequency of the candidate hotspot keys within a preset time period. Based on the type of the candidate hotspot key, the distribution of the access frequency of the candidate hotspot key within a preset time period, and the total access frequency, determine whether the candidate hotspot key is a real hotspot key. The determined real hotspot key is broadcast to the target application, so that the target application uses a multi-level caching mechanism to cache the cache value corresponding to the real hotspot key.

2. The method according to claim 1, characterized in that, The cache hitter has a time slider that slides at a preset time interval. The response to the target application's cache retrieval operation, using a preset cache hitter, determines the access frequency of each cache key at different times, including: In response to the target application performing a cache retrieval operation, the access frequency of each cache key at different times is counted sequentially as the time slider slides at a preset time interval.

3. The method according to claim 2, characterized in that, The step of determining candidate hotspot keys and their types based on the access frequency of each cache key or based on the access frequency of each cache key and the cache value corresponding to the obtained cache key includes: If the access frequency of any cache key exceeds the first frequency threshold, then the cache key is determined to be a candidate hot key, and the type of the candidate hot key is high heat. If the data size of the cached value corresponding to any cache key is within the first range, and the access frequency of the cache key is greater than the second frequency threshold, then the cache key is determined to be a candidate hot key, and the type of the candidate hot key is high bandwidth. If the data size of the cached value corresponding to any cache key is in the second range, and the access frequency of the cache key is greater than the third frequency threshold, then the cache key is determined to be a candidate hot spot key, and the type of the candidate hot spot key is suspected high bandwidth.

4. The method according to claim 3, characterized in that, The spatiotemporal hitter is composed of a preset number of the cache hitters; The step of determining the distribution of access frequencies and the total access frequency of the candidate hotspot keys within a preset time period using a preset spatiotemporal hitter includes: Based on the access frequency of the candidate hotspot key counted by each cache hitter in the spatiotemporal hitter, the access frequency of the candidate hotspot key at different times within a preset time period is determined. Based on the access frequency at different times within a preset time period, determine the distribution of the access frequency of the candidate hotspot key within the preset time period; The access frequencies at different times within a preset time period are summarized to obtain the total access frequency of the candidate hotspot key within the preset time period.

5. The method according to claim 3, characterized in that, The step of determining whether a candidate hotspot key is a real hotspot key based on the type of the candidate hotspot key, the distribution of the access frequency of the candidate hotspot key within a preset time period, and the total access frequency includes: For candidate hotspot keys of type high heat, if the distribution of the access frequency of the candidate hotspot key within a preset time period shows a geometric increase or the access frequency at a single moment within the preset time period exceeds the fourth frequency threshold, then the candidate hotspot key is determined to be a real hotspot key. For candidate hotspot keys of type high bandwidth, if the total access frequency of the candidate hotspot key exceeds the fifth frequency threshold, then the candidate hotspot key is determined to be a real hotspot key. For candidate hotspot keys of type suspected high bandwidth, if the total access frequency of the candidate hotspot key exceeds the sixth frequency threshold, then the candidate hotspot key is determined to be a real hotspot key.

6. The method according to claim 1, characterized in that, The target application employs a multi-level caching mechanism to cache the cached values ​​corresponding to the real hotspot keys, including: The cached value corresponding to the real hotspot key is cached in the memory of the target application, and the cached value is marked as a hotspot. A unique identifier and expiration time are generated for the cached value, and the cached value, along with its unique identifier and expiration time, are cached locally on the client side of the target application. This allows the client to retrieve the required cached value from the client's local storage and the target application's memory in sequence when it makes another request.

7. The method according to claim 5, characterized in that, Also includes For any of the aforementioned real hotspot keys, if it is determined that the distribution of the access frequency of the real hotspot key within a preset time period shows a downward trend, then it is determined whether the hotspot failure condition is met. If the condition is met, the message is broadcast to the target application, causing the target application to mark the real hotspot key as a hotspot invalid. The target application's local cache is cleared based on the invalid real hotspot key, and the invalid real hotspot key is sent to the client so that the client can clear its local cache based on the invalid real hotspot key.

8. A cache hotspot key management device, characterized in that, include: The event tracking module is used to perform event tracking on the calls to the cache template of the target application, and to monitor the cache operations of the target application on the cache middleware in real time through event tracking; wherein, the cache operations include at least cache retrieval operations; The first hit record module is used to respond to the target application's cache retrieval operation and determine the access frequency of each cache key at different times by using a preset cache hitter. The first hotspot determination module is used to determine candidate hotspot keys and the type of the candidate hotspot keys based on the access frequency of each cache key or based on the access frequency of each cache key and the cache value corresponding to the obtained cache key. The second hit recording module is used to determine the distribution of the access frequency and the total access frequency of the candidate hotspot key within a preset time period by using a preset spatiotemporal hitter. The second hotspot judgment module is used to determine whether the candidate hotspot key is a real hotspot key based on the type of the candidate hotspot key, the distribution of the access frequency of the candidate hotspot key within a preset time period and the total access frequency. The broadcast module is used to broadcast the determined real hotspot key to the target application, so that the target application can use a multi-level caching mechanism to cache the cache value corresponding to the real hotspot key.

9. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the method of any one of claims 1-7.

Citation Information

Patent Citations

  • A cloud cache operation method and system

    CN109739516A

  • Data caching method, electronic equipment and computer readable medium

    CN111831699A