Call stack-based cache grouping method and device, storage medium and related equipment

CN120541109BActive Publication Date: 2026-09-22GUANGZHOU PINWEI SOFTWARE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510699781.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-28
Publication Date
2026-09-22
Estimated Expiration
2045-05-28

AI Technical Summary

Benefits of technology

[0037]本申请提供的基于调用栈的缓存分组方法、装置、存储介质及相关设备,在对缓存key进行分组时,可以先获取监控插件在监听到目标应用发送数据请求时异步发送的压缩数据,由于该压缩数据中至少包括与数据请求对应的线程调用栈和新增value;因此,本申请可以将线程调用栈中与目标应用相关的类名和方法名进行拼接,并使用MD5加密算法对拼接后的类名和方法名进行加密得到MD5值,由于本申请的数据库中存储有不同的线程调用栈及其MD5值对应的历史记录,且同一种线程调用栈生成的缓存key为同一种类型;因此,为了能够将庞大的数据进行去重,本申请可以将加密后得到的MD5值与数据库中存储的MD5值进行比对,以确定数据库中是否存在该MD5值,若不存在,则表明当前数据库中不存在与该线程调用栈对应的历史记录,此时可以在数据库中新增与该MD5值对应的记录;若存在,则表明数据库中已存在与该线程调用栈对应的历史记录,此时可以根据新增value对数据库中与MD5值对应的历史记录中的value进行更新,并通过更新后的value计算对应的缓存key,这样便可以将同一种线程调用栈生成的缓存key保存为同一种key,进而达到缓存分组的效果。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120541109B_ABST
    Figure CN120541109B_ABST
Patent Text Reader

Abstract

The application provides a cache grouping method and device based on a call stack, a storage medium and related equipment. When compressed data is obtained, the class name and method name related to a target application in the thread call stack of the compressed data are spliced, and the MD5 value is obtained by encrypting the spliced class name and method name using the MD5 encryption algorithm. Then, it is determined whether the MD5 value exists in the database. If the MD5 value does not exist, a record corresponding to the MD5 value can be added in the database. If the MD5 value exists, the value in the historical record corresponding to the MD5 value in the database is updated according to the new value in the compressed data, and the corresponding cache key is calculated through the updated value. In this way, the cache keys generated by the same thread call stack can be saved as the same key, thereby achieving the effect of cache grouping.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus, storage medium and related equipment for cache grouping based on call stack. Background Technology

[0002] Applications using Redis as a cache often encounter issues such as large keys and hot keys. Large keys are typically determined by a combination of key size and the number of members within the key. Examples include: a key with excessively large data volume (e.g., a String key with a value of 5 MB); a key with too many members (e.g., a ZSET key with 10,000 members); and a key with excessively large member data volume (e.g., a Hash key with only 2,000 members but a total value size of 100 MB). Hot keys are usually determined by the frequency of requests received for frequently accessed keys, such as the key's query rate per second (QPS) or accesses per second (APS).

[0003] Failure to promptly identify and address large or frequently accessed keys can lead to decreased service performance, a degraded user experience, and even widespread outages. Therefore, to proactively identify cache-related issues, it's crucial to group a large number of keys for targeted analysis. However, current technology lacks a method to group different keys to reduce the amount of data to be analyzed and improve cache analysis efficiency. Summary of the Invention

[0004] The purpose of this application is to at least address one of the aforementioned technical deficiencies, particularly the lack of a method in the prior art that can group different keys to reduce the amount of data to be analyzed and improve the efficiency of cache analysis.

[0005] This application provides a cache grouping method based on the call stack, the method comprising:

[0006] Obtain compressed data asynchronously sent by the monitoring plugin when it detects a data request from the target application. The compressed data includes at least the thread call stack corresponding to the data request and the newly added value.

[0007] The class names and method names related to the target application in the thread call stack are concatenated, and the concatenated class names and method names are encrypted using the MD5 encryption algorithm to obtain the MD5 value.

[0008] Determine whether the MD5 value exists in the database, wherein the database stores different thread call stacks and their corresponding historical records of MD5 values, and the cache key generated by the same thread call stack is of the same type;

[0009] If it does not exist, a new record corresponding to the MD5 value is added to the database;

[0010] If it exists, the value in the historical record corresponding to the MD5 value in the database is updated according to the newly added value, and the corresponding cache key is calculated using the updated value.

[0011] Optionally, the data request includes a read request;

[0012] The compressed data asynchronously sent by the monitoring plugin when it detects a data request from the target application includes:

[0013] The monitoring plugin asynchronously sends compressed data when it detects the target application sending the read request. The compressed data includes data assembled and compressed from the read cache domain name, key, newly added value, and thread call stack of the read request.

[0014] Optionally, the data request includes a write request;

[0015] The compressed data asynchronously sent by the monitoring plugin when it detects a data request from the target application includes:

[0016] The monitoring plugin asynchronously sends compressed data when it detects the target application sending the write request. The compressed data includes data assembled and compressed from the read cache domain name, key, newly added value, and thread call stack of the write request.

[0017] Optionally, the monitoring plugin is configured to send the compressed data according to the sending frequency of the key in the compressed data.

[0018] Optionally, concatenating the class names and method names related to the target application in the thread call stack to obtain the concatenated class names and method names includes:

[0019] Traverse the thread call stack and obtain the class name and method name of each method in the thread call stack;

[0020] Filter out the class names and method names that are relevant to the target application from multiple class names and method names;

[0021] The class name and method name related to the target application are concatenated to obtain the concatenated class name and method name.

[0022] Optionally, updating the value in the historical records corresponding to the MD5 value in the database based on the newly added value includes:

[0023] The newly added value is compared with the length of the value in the database and the historical record corresponding to the MD5 value, and the value in the historical record is updated according to the comparison result.

[0024] Optionally, updating the value in the historical record based on the comparison result includes:

[0025] When the comparison result shows that the length of the newly added value is longer than the length of the value in the history record, the value in the history record is replaced with the newly added value;

[0026] If the comparison result indicates that the length of the newly added value is not longer than the length of the value in the historical record, the value in the historical record will not be updated, and the newly added value will be discarded.

[0027] This application also provides a call stack-based cache grouping device, including:

[0028] The data acquisition module is used to acquire compressed data asynchronously sent by the monitoring plugin when it detects a data request sent by the target application. The compressed data includes at least the thread call stack and the newly added value corresponding to the data request.

[0029] The concatenation encryption module is used to concatenate the class names and method names related to the target application in the thread call stack, and encrypt the concatenated class names and method names using the MD5 encryption algorithm to obtain the MD5 value;

[0030] The lookup and comparison module is used to determine whether the MD5 value exists in the database. The database stores different thread call stacks and their corresponding historical records of MD5 values, and the cache keys generated by the same thread call stack are of the same type.

[0031] The new record module is used to add a record corresponding to the MD5 value in the database if the record does not exist.

[0032] The record update module is used to update the value in the historical record corresponding to the MD5 value in the database according to the newly added value if it exists, and to calculate the corresponding cache key using the updated value.

[0033] This application also provides a computer-readable storage medium storing computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the call stack-based cache grouping method as described in any of the above embodiments.

[0034] This application also provides a computer device, including: one or more processors, and memory;

[0035] The memory stores computer-readable instructions that, when executed by the one or more processors, perform the steps of the call stack-based cache grouping method as described in any of the above embodiments.

[0036] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:

[0037] This application provides a call stack-based cache grouping method, apparatus, storage medium, and related devices. When grouping cache keys, it first obtains compressed data asynchronously sent by a monitoring plugin when it detects a data request from the target application. Since this compressed data includes at least the thread call stack corresponding to the data request and the newly added value, this application can concatenate the class names and method names related to the target application in the thread call stack and encrypt the concatenated class names and method names using the MD5 encryption algorithm to obtain the MD5 value. Because this application's database stores historical records of different thread call stacks and their corresponding MD5 values, and cache keys generated by the same thread call stack are of the same type, in order to group the massive... To deduplicate the data, this application compares the encrypted MD5 value with the MD5 value stored in the database to determine if the MD5 value exists in the database. If it does not exist, it means that there is no historical record corresponding to the thread's call stack in the current database, and a new record corresponding to the MD5 value can be added to the database. If it exists, it means that there is already a historical record corresponding to the thread's call stack in the database, and the value in the historical record corresponding to the MD5 value in the database can be updated according to the newly added value. The corresponding cache key is then calculated using the updated value. In this way, cache keys generated by the same type of thread call stack can be saved as the same key, thereby achieving the effect of cache grouping. Attached Figure Description

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

[0039] Figure 1 A flowchart illustrating a call stack-based cache grouping method provided in this application embodiment;

[0040] Figure 2 A schematic diagram illustrating the process of concatenating class names and method names related to the target application in the thread call stack, as provided in an embodiment of this application;

[0041] Figure 3 A schematic diagram of a call stack-based cache grouping device provided in an embodiment of this application;

[0042] Figure 4 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0043] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0044] In one embodiment, such as Figure 1 As shown, Figure 1 A flowchart illustrating a call stack-based cache grouping method is provided in this application embodiment; this application provides a call stack-based cache grouping method, which may include:

[0045] S110: Obtain compressed data asynchronously sent by the monitoring plugin when it detects a data request from the target application.

[0046] In this step, when obtaining relevant data about the target application using the target cache, a monitoring plugin can be installed in the target application first. This monitoring plugin can then be used to listen for whether the target application sends a data request. If a data request is sent, the target application can send compressed data along with the data request and asynchronously send the compressed data to the server. Once the server receives the compressed data, it can use it to perform cache grouping.

[0047] The monitoring plugin in this application can be the jvm-sandbox plugin, or other plugins capable of event listening and message sending. For example, after installing the jvm-sandbox plugin in the target application, the jvm-sandbox plugin can be used to dynamically listen to the underlying methods of the target application's write cache or read cache. Then, when the target application sends a data request to the server for writing cache or reading cache, the corresponding compressed data can be asynchronously sent to the server.

[0048] Understandably, synchronous sending would cause noticeable lag and slower interface response for users during the call process; asynchronous sending, on the other hand, sends the data to a background task for consumption without affecting the current request. Therefore, to avoid impacting the current data request, this application can use asynchronous sending to send compressed data to the server. After receiving the compressed data, the server can perform certain processing on it for caching and grouping.

[0049] In one specific implementation, the compressed data of this application may include at least the thread call stack and newly added value corresponding to the data request. Of course, it may also include the domain name, key, etc. of the read / write cache. After the monitoring plugin obtains this data, it can assemble the domain name, key, newly added value and thread call stack into a JSON string, and then call the compression tool to compress it to obtain compressed data. After the monitoring plugin sends the compressed data to the server, the server can group and save the current data according to the thread call stack and newly added value in the compressed data, and perform data deduplication operation in the process to improve the efficiency of subsequent cache analysis.

[0050] S120: Concatenate the class names and method names related to the target application in the thread call stack, and encrypt the concatenated class names and method names using the MD5 encryption algorithm to obtain the MD5 value.

[0051] In this step, after obtaining the compressed data asynchronously sent by the monitoring plugin when it detects a data request from the target application via S110, this application can concatenate the class names and method names related to the target application in the thread call stack. Then, the concatenated class names and method names can be encrypted using the MD5 encryption algorithm. The encryption process can be found in existing technologies using the MD5 encryption algorithm, and will not be elaborated here. After encrypting the concatenated class names and method names using the MD5 encryption algorithm, the MD5 value corresponding to the thread call stack can be obtained. This application can use this MD5 value to group and cache the currently obtained compressed data.

[0052] S130: Determine if an MD5 value exists in the database. If it does not exist, proceed to S140; if it does exist, proceed to S150.

[0053] S140: Add a new record in the database corresponding to the MD5 value.

[0054] S150: Update the value in the historical records corresponding to the MD5 value in the database based on the newly added value, and calculate the corresponding cache key using the updated value.

[0055] In this step, the concatenated class name and method name are encrypted using the MD5 encryption algorithm in S120. After obtaining the MD5 value, this application can compare the MD5 value with the various MD5 values ​​pre-stored in the database to determine whether the MD5 value exists in the current database.

[0056] In this application, the database stores historical records of different thread call stacks and their corresponding MD5 values, and the cache keys generated for the same type of thread call stack are of the same type. Therefore, when this application encrypts the current thread call stack using the MD5 encryption algorithm and obtains the MD5 value, it can compare it with the MD5 value in the historical records in the database. If the MD5 value exists in the database, it means that the current thread call stack and the thread call stack stored in the database are the same type of thread call stack. In this case, the historical records in the database can be partially updated or not updated. If the MD5 value does not exist in the database, it means that the current thread call stack and the thread call stack stored in the database are not the same type of thread call stack. In this case, a new record corresponding to the current thread call stack can be added to the database for data updates.

[0057] Furthermore, since the cache keys generated by the same thread call stack in this application are of the same type, and the values ​​in the historical records corresponding to that thread call stack are used to calculate the corresponding cache keys, this application, in order to improve the efficiency of subsequent cache analysis and to find large and hot keys more quickly, can update the values ​​in the historical records corresponding to the MD5 values ​​in the database based on the newly added values. This allows the corresponding cache keys to be calculated using the updated values, thereby enabling early detection of cache-related issues based on the cache keys in the various historical records of the database.

[0058] In the above embodiments, when grouping cache keys, the compressed data asynchronously sent by the monitoring plugin when it detects a data request from the target application can be obtained first. Since this compressed data includes at least the thread call stack corresponding to the data request and the newly added value, this application can concatenate the class names and method names related to the target application in the thread call stack and encrypt the concatenated class names and method names using the MD5 encryption algorithm to obtain the MD5 value. Because the database of this application stores historical records of different thread call stacks and their corresponding MD5 values, and cache keys generated by the same thread call stack are of the same type, this application can deduplicate the massive amount of data by... The encrypted MD5 value is compared with the MD5 value stored in the database to determine if the MD5 value exists in the database. If it does not exist, it means that there is no historical record corresponding to the thread's call stack in the current database. At this time, a record corresponding to the MD5 value can be added to the database. If it exists, it means that there is already a historical record corresponding to the thread's call stack in the database. At this time, the value in the historical record corresponding to the MD5 value in the database can be updated according to the added value. The corresponding cache key is calculated using the updated value. In this way, cache keys generated by the same thread call stack can be saved as the same key, thereby achieving the effect of cache grouping.

[0059] In one embodiment, the data request may include a read request.

[0060] The compressed data asynchronously sent by the monitoring plugin when it detects a data request from the target application in S110 can include:

[0061] S111: Obtain compressed data asynchronously sent by the monitoring plugin when it detects the target application sending the read request. The compressed data includes data formed by assembling and compressing the read cache domain name, key, newly added value, and thread call stack of the read request.

[0062] In this embodiment, when the monitoring plugin listens to the underlying methods of the target application, if it detects that the target application has sent a read request, since the read request contains relevant information about this request, such as the domain name and thread call stack, this application can obtain the read cache domain name, key, newly added value, and thread call stack corresponding to the read request, assemble and compress them to form compressed data, and then send the compressed data asynchronously to the server so that the server can perform cache grouping operations based on the compressed data.

[0063] In one embodiment, the data request may include a write request.

[0064] The compressed data asynchronously sent by the monitoring plugin when it detects a data request from the target application, as described in S110, may include:

[0065] S112: Obtain compressed data asynchronously sent by the monitoring plugin when it detects the target application sending the write request. The compressed data includes data formed by assembling and compressing the read cache domain name, key, newly added value, and thread call stack of the write request.

[0066] In this embodiment, when the monitoring plugin listens to the underlying methods of the target application, if it detects that the target application has sent a write request, since the write request contains relevant information about this request, such as the domain name and thread call stack, this application can obtain the read cache domain name, key, newly added value, and thread call stack corresponding to the write request, assemble and compress them to form compressed data, and then send the compressed data asynchronously to the server so that the server can perform cache grouping operations based on the compressed data.

[0067] In one embodiment, the monitoring plugin is configured to send the compressed data according to the sending frequency of the key in the compressed data.

[0068] In this embodiment, considering that sending data corresponding to every read / write operation of the target application to the server would result in an excessively large amount of data on the server, this application configures the monitoring plugin to send compressed data according to the sending frequency of the key in the compressed data. For example, for the same key, this application can agree on its sending frequency, such as sending it once per minute or once every two minutes. The specific sending frequency can be set according to the actual situation and is not limited here. After setting the sending frequency of the same key, the monitoring plugin can send compressed data according to this sending frequency, thereby reducing the amount of data on the server and improving the efficiency of subsequent cache analysis.

[0069] In one embodiment, such as Figure 2 As shown, Figure 2 This is a flowchart illustrating the process of concatenating class names and method names related to the target application in the thread call stack, as provided in an embodiment of this application. In step S120, concatenating the class names and method names related to the target application in the thread call stack to obtain the concatenated class names and method names may include:

[0070] S121: Traverse the thread call stack and obtain the class name and method name of each method in the thread call stack.

[0071] S122: Filter out class names and method names that are relevant to the target application from multiple class names and method names.

[0072] S123: Concatenate the class name and method name related to the target application to obtain the concatenated class name and method name.

[0073] In this embodiment, as Figure 2 As shown, when concatenating class names and method names related to the target application in the thread call stack, the thread call stack can first be traversed to obtain the class name and method name of each method in the thread call stack. Then, the class names and method names related to the target application can be filtered out from the class names and method names of multiple methods. For example, when filtering class names, this application can exclude the package names of framework classes, such as classes that do not start with .com. This method can filter out the class names and method names related to the target application.

[0074] Next, this application can concatenate these class names and method names into a String, and use the MD5 encryption algorithm to encrypt the concatenated class names and method names to obtain the corresponding MD5 value.

[0075] In one embodiment, updating the value in the historical record corresponding to the MD5 value in the database according to the newly added value in step S150 may include:

[0076] S151: Compare the newly added value with the length of the value in the database and the historical record corresponding to the MD5 value, and update the value in the historical record according to the comparison result.

[0077] In this embodiment, when updating the value in the historical record corresponding to the MD5 value in the database based on the newly added value, this application can first compare the length of the newly added value with the length of the value in the historical record corresponding to the MD5 value in the database, and update the value in the historical record based on the comparison result.

[0078] It is understandable that since the value in this application is used to calculate the big key, the big key is only considered to be a big key when the value is greater than a certain value. If the known value is already greater than the value of the newly added value, then the problems found by the newly added value will not be more than those found by the known value. In this case, the value in the history can be left unupdated. If the known value is not greater than the value of the newly added value, then it can be updated by the value of the newly added value.

[0079] In one embodiment, updating the value in the historical record based on the comparison result in S151 may include:

[0080] S1511: When the comparison result shows that the length of the newly added value is longer than the length of the value in the historical record, the value in the historical record is replaced with the newly added value.

[0081] S1512: When the comparison result indicates that the length of the newly added value is not longer than the length of the value in the historical record, the value in the historical record is not updated, and the newly added value is discarded.

[0082] In this embodiment, after comparing the length of the newly added value with the length of the value in the historical records corresponding to the MD5 value in the database, the value in the historical records can be updated based on the comparison result. For example, if the comparison result shows that the length of the newly added value is longer than the length of the value in the historical records, it indicates that the value in the historical records is not the maximum value, and the value in the historical records can be replaced with the newly added value. Conversely, if the comparison result shows that the length of the newly added value is not longer than the length of the value in the historical records, it indicates that the value in the historical records is the maximum value, and the value in the historical records can be left unupdated. Considering the server's resource space, the newly added value can be discarded.

[0083] The call stack-based cache grouping device provided in the embodiments of this application will be described below. The call stack-based cache grouping device described below can be referred to in correspondence with the call stack-based cache grouping method described above.

[0084] In one embodiment, such as Figure 3 As shown, Figure 3 This application provides a schematic diagram of a call stack-based cache grouping device according to an embodiment of the present application. The present application also provides a call stack-based cache grouping device, which may include a data acquisition module 210, a concatenation and encryption module 220, a lookup and comparison module 230, a new record addition module 240, and a record update module 250, specifically including the following:

[0085] The data acquisition module 210 is used to acquire compressed data asynchronously sent by the monitoring plugin when it detects a data request sent by the target application. The compressed data includes at least the thread call stack and the newly added value corresponding to the data request.

[0086] The concatenation encryption module 220 is used to concatenate the class names and method names related to the target application in the thread call stack, and encrypt the concatenated class names and method names using the MD5 encryption algorithm to obtain the MD5 value.

[0087] The lookup and comparison module 230 is used to determine whether the MD5 value exists in the database. The database stores different thread call stacks and their corresponding historical records of MD5 values, and the cache keys generated by the same thread call stack are of the same type.

[0088] The new record module 240 is used to add a record corresponding to the MD5 value in the database if the record does not exist.

[0089] The record update module 250 is used to update the value in the historical record corresponding to the MD5 value in the database according to the newly added value if the record exists, and to calculate the corresponding cache key using the updated value.

[0090] In the above embodiments, when grouping cache keys, the compressed data asynchronously sent by the monitoring plugin when it detects a data request from the target application can be obtained first. Since this compressed data includes at least the thread call stack corresponding to the data request and the newly added value, this application can concatenate the class names and method names related to the target application in the thread call stack and encrypt the concatenated class names and method names using the MD5 encryption algorithm to obtain the MD5 value. Because the database of this application stores historical records of different thread call stacks and their corresponding MD5 values, and cache keys generated by the same thread call stack are of the same type, this application can deduplicate the massive amount of data by... The encrypted MD5 value is compared with the MD5 value stored in the database to determine if the MD5 value exists in the database. If it does not exist, it means that there is no historical record corresponding to the thread's call stack in the current database. At this time, a record corresponding to the MD5 value can be added to the database. If it exists, it means that there is already a historical record corresponding to the thread's call stack in the database. At this time, the value in the historical record corresponding to the MD5 value in the database can be updated according to the added value. The corresponding cache key is calculated using the updated value. In this way, cache keys generated by the same thread call stack can be saved as the same key, thereby achieving the effect of cache grouping.

[0091] In one embodiment, this application also provides a computer-readable storage medium storing computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the call stack-based cache grouping method as described in any of the above embodiments.

[0092] In one embodiment, this application also provides a computer device, including: one or more processors, and memory.

[0093] The memory stores computer-readable instructions that, when executed by the one or more processors, perform the steps of the call stack-based cache grouping method as described in any of the above embodiments.

[0094] Indicatively, such as Figure 4 As shown, Figure 4 This is a schematic diagram of the internal structure of a computer device 300 provided in an embodiment of this application. The computer device 300 can be provided as a server. (Refer to...) Figure 4 The computer device 300 includes a processing component 302, which further includes one or more processors, and memory resources represented by memory 301 for storing instructions, such as application programs, that can be executed by the processing component 302. The application programs stored in memory 301 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 302 is configured to execute instructions to perform the call stack-based cache grouping method of any of the above embodiments.

[0095] The computer device 300 may also include a power supply component 303 configured to perform power management of the computer device 300, a wired or wireless network interface 304 configured to connect the computer device 300 to a network, and an input / output (I / O) interface 305. The computer device 300 may operate on an operating system stored in memory 301, such as Windows Server™, Mac OS X™, Unix™, Linux™, Free BSD™, or similar.

[0096] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0097] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0098] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.

[0099] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A cache grouping method based on the call stack, characterized in that, The method includes: Obtain compressed data asynchronously sent by the monitoring plugin when it detects a data request from the target application. The compressed data includes at least the thread call stack corresponding to the data request and the newly added value. The class names and method names related to the target application in the thread call stack are concatenated, and the concatenated class names and method names are encrypted using the MD5 encryption algorithm to obtain the MD5 value. Determine whether the MD5 value exists in the database, wherein the database stores different thread call stacks and their corresponding historical records of MD5 values, and the cache key generated by the same thread call stack is of the same type; If it does not exist, a new record corresponding to the MD5 value is added to the database; If it exists, the value in the historical record corresponding to the MD5 value in the database is updated according to the newly added value, and the corresponding cache key is calculated using the updated value.

2. The cache grouping method based on the call stack according to claim 1, characterized in that, The data request includes a read request; The compressed data asynchronously sent by the monitoring plugin when it detects a data request from the target application includes: The monitoring plugin asynchronously sends compressed data when it detects the target application sending the read request. The compressed data includes data assembled and compressed from the read cache domain name, key, newly added value, and thread call stack of the read request.

3. The cache grouping method based on the call stack according to claim 1, characterized in that, The data request includes a write request; The compressed data asynchronously sent by the monitoring plugin when it detects a data request from the target application includes: The monitoring plugin asynchronously sends compressed data when it detects the target application sending the write request. The compressed data includes data assembled and compressed from the read cache domain name, key, newly added value, and thread call stack of the write request.

4. The cache grouping method based on the call stack according to any one of claims 1-3, characterized in that, The monitoring plugin is configured to send the compressed data according to the sending frequency of the key in the compressed data.

5. The cache grouping method based on the call stack according to claim 1, characterized in that, The step of concatenating the class names and method names related to the target application in the thread call stack to obtain the concatenated class names and method names includes: Traverse the thread call stack and obtain the class name and method name of each method in the thread call stack; Filter out the class names and method names that are relevant to the target application from multiple class names and method names; The class name and method name related to the target application are concatenated to obtain the concatenated class name and method name.

6. The call stack-based cache grouping method according to claim 1, 2, 3, or 5, characterized in that, The step of updating the value in the historical records corresponding to the MD5 value in the database according to the newly added value includes: The newly added value is compared with the length of the value in the database and the historical record corresponding to the MD5 value, and the value in the historical record is updated according to the comparison result.

7. The cache grouping method based on the call stack according to claim 6, characterized in that, The step of updating the value in the historical record based on the comparison result includes: When the comparison result shows that the length of the newly added value is longer than the length of the value in the history record, the value in the history record is replaced with the newly added value; If the comparison result indicates that the length of the newly added value is not longer than the length of the value in the historical record, the value in the historical record will not be updated, and the newly added value will be discarded.

8. A cache grouping device based on a call stack, characterized in that, include: The data acquisition module is used to acquire compressed data asynchronously sent by the monitoring plugin when it detects a data request sent by the target application. The compressed data includes at least the thread call stack and the newly added value corresponding to the data request. The concatenation encryption module is used to concatenate the class names and method names related to the target application in the thread call stack, and encrypt the concatenated class names and method names using the MD5 encryption algorithm to obtain the MD5 value; The lookup and comparison module is used to determine whether the MD5 value exists in the database. The database stores different thread call stacks and their corresponding historical records of MD5 values, and the cache keys generated by the same thread call stack are of the same type. The new record module is used to add a record corresponding to the MD5 value in the database if the record does not exist. The record update module is used to update the value in the historical record corresponding to the MD5 value in the database according to the newly added value if it exists, and to calculate the corresponding cache key using the updated value.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the call stack-based cache grouping method as described in any one of claims 1 to 7.

10. A computer device, characterized in that, include: One or more processors, and memory; The memory stores computer-readable instructions that, when executed by the one or more processors, perform the steps of the call stack-based cache grouping method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Methods and apparatus for soft-partitioning of a data cache for stack data

    US20140143495A1

  • Cache processing method, apparatus and device, and computer readable storage medium

    WO2020211554A1