Distributed caching method and device, equipment and storage medium

By performing resource isolation checksum affinity label algorithm on tenant requests, the target distributed cache cluster is determined, which solves the stability problem caused by multi-tenant sharing of cache nodes, and achieves multi-tenant resource isolation and performance improvement.

CN120475034APending Publication Date: 2025-08-12AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510651431.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-20
Publication Date
2025-08-12

AI Technical Summary

Technical Problem

Traditional distributed caching technology cannot effectively isolate multi-tenant data, computing and storage resources, resulting in different tenants reading and writing the same cache node, affecting the stability of the business system.

Method used

By receiving tenant request information, data, calculation and storage resource isolation verification are performed, and affinity tag algorithm is used to determine the target cluster from multiple distributed cache clusters, establish routing connections, and generate request results.

Benefits of technology

Resource isolation of multiple tenants in the same distributed cache cluster is realized, which avoids the problem of multi-tenants reading and writing the same cache node, ensures business stability and improves distributed cache performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120475034A_ABST
    Figure CN120475034A_ABST
Patent Text Reader

Abstract

The invention discloses a distributed caching method and device, equipment and a storage medium, and relates to the technical field of computers. The method comprises the steps of receiving request information sent by a tenant, and performing resource isolation verification according to the request information to obtain a verification result; based on the verification result, establishing a routing connection between the tenant and a target distributed cache cluster; and generating a request result based on the routing connection and the request instruction, and sending the request result to the tenant. According to the technical scheme, multi-tenant resource isolation in the same distributed cache cluster is achieved, multi-tenant peak shifting access to the cluster is achieved, the problem that other systems cannot obtain timely response of distributed cache due to the fact that the same cache node is read and written by multiple tenants is solved, service stability is guaranteed, and distributed cache performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a distributed caching method, apparatus, device, and storage medium. Background Art

[0002] As businesses accelerate their digital transformation and online operations, events attract massive customer traffic, forcing their business systems to handle the surge in online requests.

[0003] Currently, business systems primarily utilize distributed caching technology. By caching hot data, this technology reduces database access pressure and prevents short-term traffic spikes from overwhelming the database's capacity and paralyzing the entire business system. Distributed caching can significantly increase business system throughput, allowing it to easily handle traffic spikes. To improve daily distributed cache cluster resource utilization and reduce resource waste, multiple business systems often share a single distributed cache cluster.

[0004] However, traditional distributed caching technology often fails to effectively isolate the data, computing, and storage resources of multiple tenants. Different tenants may read and write the same cache node, resulting in other systems being unable to obtain timely responses from the distributed cache, seriously affecting business stability. Summary of the Invention

[0005] The present invention provides a distributed caching method, apparatus, device and storage medium to solve the problem of multi-tenant distributed caching.

[0006] In a first aspect, the present invention provides a distributed caching method, comprising:

[0007] Receive request information sent by the tenant, and perform resource isolation verification according to the request information to obtain a verification result, wherein the request information includes the request instruction and the associated information of the resource isolation verification, and the resource isolation verification includes data resource isolation verification, computing resource isolation verification, and storage resource isolation verification;

[0008] Based on the verification result, establishing a routing connection between the tenant and a target distributed cache cluster, wherein the target distributed cache cluster is determined from multiple distributed cache clusters by using an affinity tag algorithm;

[0009] A request result is generated based on the routing connection and the request instruction, and the request result is sent to the tenant.

[0010] In a second aspect, the present invention provides a distributed cache device, comprising:

[0011] A verification module is configured to receive a request message sent by a tenant and perform a resource isolation check based on the request message to obtain a verification result, wherein the request message includes associated information of the request instruction and the resource isolation check, and the resource isolation check includes a data resource isolation check, a computing resource isolation check, and a storage resource isolation check;

[0012] a connection establishing module, configured to establish a routing connection between the tenant and a target distributed cache cluster based on the verification result, wherein the target distributed cache cluster is determined from a plurality of distributed cache clusters by using an affinity tag algorithm;

[0013] A request result sending module is used to generate a request result based on the routing connection and the request instruction, and send the request result to the tenant.

[0014] In a third aspect, the present invention provides an electronic device, comprising:

[0015] at least one processor;

[0016] and a memory communicatively coupled to the at least one processor;

[0017] The memory stores a computer program that can be executed by at least one processor, and the computer program is executed by at least one processor to enable the at least one processor to execute the distributed caching method of the first aspect.

[0018] In a fourth aspect, the present invention provides a computer-readable storage medium storing computer instructions, which are used to enable a processor to implement the distributed caching method of the first aspect when executed.

[0019] The distributed cache solution provided by the present invention performs data resource isolation verification, computing resource isolation verification, and storage resource isolation verification according to the requests sent by the tenants, thereby realizing resource isolation of multiple tenants within the same distributed cache cluster, and using the affinity label algorithm to determine the distributed cache cluster that establishes a route with the tenant from multiple distributed cache clusters, which can realize multi-tenant staggered access to the cluster, avoid the problem that multiple tenants read and write the same cache node, resulting in other systems being unable to obtain timely responses from the distributed cache, thereby ensuring business stability and improving distributed cache performance.

[0020] It should be understood that the content described in this section is not intended to identify the key or important features of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0022] Figure 1 This is a flowchart of a distributed caching method provided according to the first embodiment of the present invention;

[0023] Figure 2 This is a flow chart of a distributed caching method provided according to the second embodiment of the present invention;

[0024] Figure 3 This is a schematic structural diagram of a distributed cache device provided according to Embodiment 3 of the present invention;

[0025] Figure 4 It is a structural diagram of an electronic device provided according to the fourth embodiment of the present invention. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0027] It should be noted that the terms "first," "second," and the like in the specification and claims of the present invention and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than that illustrated or described herein. In the description of the present invention, unless otherwise specified, "plurality" refers to two or more. "And / or" describes an association relationship between associated objects, indicating that three relationships can exist. For example, "A and / or B" can mean: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship. In addition, the terms "including" and "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such process, method, product, or device.

[0028] Distributed caching involves storing data in memory across multiple physical locations for faster access and processing. It offers high availability, scalability, and distribution. Common open-source distributed caching implementations include Redis and Memcached.

[0029] A tenant is someone who places a distributed cache system (such as servers, storage, and networks) in a server cluster provided by a third party and uses these resources on a leased basis. Multiple tenants share the same distributed cache cluster.

[0030] Example 1

[0031] Figure 1 A flowchart of a distributed caching method is provided for the first embodiment of the present invention. This embodiment is applicable to the case of distributed caching. The method can be executed by a distributed caching device. The distributed caching device can be implemented in the form of hardware and / or software. The distributed caching device can be configured in an electronic device. The electronic device can be composed of two or more physical entities or one physical entity.

[0032] like Figure 1 As shown, the distributed caching method provided in the first embodiment of the present invention can be applied to a server and specifically includes the following steps:

[0033] S101. Receive the request information sent by the tenant, and perform resource isolation verification based on the request information to obtain a verification result, wherein the request information includes the request instruction and the associated information of the resource isolation verification, and the resource isolation verification includes data resource isolation verification, computing resource isolation verification and storage resource isolation verification.

[0034] In this embodiment, a distributed cache SDK module can be built into the client where the tenant is located. The module can have built-in SDKs (Software Development Kits) in at least two languages, Java and Node.js, and provide an API (Application Programming Interface) to the tenant. The tenant can send a request (information) through the API, such as an HTTP request. The request information sent includes associated information of resource isolation verification such as the tenant ID and the request instruction. After receiving the request information, data resource isolation verification, computing resource isolation verification and storage resource isolation verification can be performed on the request information to obtain the verification results of each verification. Among them, data resource isolation verification is the process of ensuring that data is correctly verified and processed in an isolated environment, computing resource isolation verification is the process of ensuring that computing resources are correctly allocated and used in an isolated environment, and storage resource isolation verification is the process of ensuring that storage resources are correctly allocated and used in an isolated environment.

[0035] S102: Based on the verification result, establish a routing connection between the tenant and a target distributed cache cluster, wherein the target distributed cache cluster is determined from multiple distributed cache clusters by using an affinity tag algorithm.

[0036] In this embodiment, based on the verification results, Kubernetes (K8s) can be used to establish a routing connection between the tenant and the target distributed cache cluster. The affinity label algorithm can be used in advance to determine the target distributed cache cluster suitable for the tenant based on the tenant label. If the verification results meet the preset conditions, such as the data resource isolation verification, the computing resource isolation verification, and the storage resource isolation verification are all passed, a routing connection between the tenant and the target distributed cache cluster can be established. Among them, the affinity label algorithm is mainly used for scheduling and managing containerized applications, especially the deployment and scheduling of Pods in K8s. The affinity label algorithm helps to achieve optimal configuration and efficient utilization of resources by defining the affinity or anti-affinity relationship between nodes and Pods.

[0037] S103: Generate a request result based on the routing connection and the request instruction, and send the request result to the tenant.

[0038] In this embodiment, based on the routing connection, the tenant can implement operations such as reading or writing on the target distributed cache cluster according to the request instruction, and return the transaction result (ie, the request result) to the tenant.

[0039] The distributed caching method provided in an embodiment of the present invention performs data resource isolation verification, computing resource isolation verification, and storage resource isolation verification according to the request sent by the tenant, thereby realizing resource isolation of multiple tenants within the same distributed cache cluster, and using the affinity label algorithm to determine the distributed cache cluster that establishes a route with the tenant from multiple distributed cache clusters, which can realize multi-tenant staggered access to the cluster, avoid the problem that multiple tenants read and write the same cache node, resulting in other systems being unable to obtain timely responses from the distributed cache, thereby ensuring business stability and improving distributed cache performance.

[0040] Optionally, before receiving the request information sent by the tenant, it also includes: using the connection pool ConnectionPool mechanism to configure cache parameters to manage the multiple distributed cache clusters; wherein, after receiving the request information sent by the tenant, it also includes: if it is determined that the storage resources of the distributed cache cluster are expanded, then using the ConnectionPool mechanism to configure the address of the distributed cache cluster.

[0041] Specifically, the connection pool mechanism can be used to centrally configure distributed cache parameters, such as the number of distributed cache connections, maximum idle connections, retry method, and retry time. When distributed cache cluster resources are insufficient, Kubernetes can be used to increase the number of distributed cache workload nodes in the distributed cache cluster, horizontally scaling resources to support access requests from more tenants. The connection pool mechanism dynamically manages the distributed cache cluster based on the distributed cache cluster address and ID name, eliminating the need for individual tenants to worry about distributed cache parameter settings and reducing maintenance workload.

[0042] Optionally, the method further includes: counting the success rate of the request instruction, and if the success rate is less than a third preset threshold, sending a request warning message to the tenant, wherein the request warning message is used to prompt the success rate of the request instruction sent by the tenant.

[0043] Specifically, a counter can be set for each tenant to count the tenant's request instructions according to a preset period, such as minutes. The data format of the counter can be "tenant id: statistical dimension: timestamp". The success rate of the request instruction is calculated as follows: the success rate of the tenant's request instruction is counted by minute, and the success rate = the number of successful instructions / the total number of instructions. If the success rate is less than the third preset threshold, a request warning message is sent to the corresponding tenant to remind the tenant that the success rate of the request instructions sent within the preset period is too low.

[0044] Optionally, before performing resource isolation verification based on the request information to obtain a verification result, it also includes: determining whether the tenant storage status corresponding to the second tenant ID is valid; if valid, using a private key to parse the authentication token to obtain a security authentication result, wherein the associated information of the resource isolation verification includes the second tenant ID, and the request information also includes the authentication token.

[0045] Specifically, the request information includes the associated information of the resource isolation verification and the tenant's authentication token Token, and the associated information of the resource isolation verification includes at least the (second) tenant ID. The header of the HTTP request message contains the request information. After receiving the message, the second tenant ID can be used to query whether the tenant storage status corresponding to the second tenant ID is valid. If valid, the authentication token Token is parsed using the pre-stored private key to obtain the security authentication result, such as the validity period and legitimacy of the authentication token Token.

[0046] Optionally, before establishing a routing connection between the tenant and the target distributed cache cluster based on the verification result, it also includes: determining the first affinity tag of the tenant and the second affinity tags of multiple distributed cache clusters; based on the first affinity tag and the second affinity tag, using an affinity tag algorithm to determine the target distributed cache cluster that matches the tenant from the multiple distributed cache clusters.

[0047] Specifically, labels can be configured for tenants and distributed cache clusters in advance, and an affinity label algorithm can be used to determine a target distributed cache cluster suitable for the tenant based on the labels.

[0048] For example, if the affinity tags include business level, exclusive, computing type, storage type and business peak period. If the business level in the tenant's first affinity tag is high, the tenant will be affinity assigned to a cluster with a higher distributed cache level. Matching clusters according to business peak periods can achieve multi-tenant staggered use, maximize resource savings, and improve system performance. Among them, routing rules include variable matching and regular expressions. The variable matching method is: the cluster in the distributed cache cluster ID that is consistent with the routing rule variable is determined as the target distributed cache cluster. The regular expression method is: the distributed cache cluster ID is calculated through a regular expression, and the first distributed cache cluster hit is determined as the target distributed cache cluster.

[0049] Example 2

[0050] Figure 2 This is a flow chart of a distributed caching method provided in the second embodiment of the present invention. The technical solution of the embodiment of the present invention is further optimized on the basis of the above optional technical solutions, and provides a specific method of distributed caching.

[0051] Optionally, the resource isolation check is performed according to the request information to obtain a check result, including: obtaining the first tenant ID by parsing the cache variable key value, and obtaining the data resource isolation check result by judging whether the first tenant ID is consistent with the second tenant ID, wherein the associated information of the resource isolation check includes the second tenant ID, the cache variable key value and the cache variable value; if the data resource isolation check result is passed, the cumulative value of the tenant's request times is determined, and the computing resource isolation check result is obtained by judging whether the cumulative value of the request times is greater than a first preset threshold; if the computing resource isolation check result is passed, the cache cumulative value is determined using the cache variable value and the historical cache cumulative value, and the storage resource isolation check result is obtained by judging whether the cache cumulative value is greater than a second preset threshold; wherein, establishing a routing connection between the tenant and the target distributed cache cluster based on the check result includes: if the storage resource isolation check result is passed, establishing a routing connection between the tenant and the cache node in the target distributed cache cluster.

[0052] Optionally, before establishing the routing connection between the tenant and the target distributed cache cluster based on the verification result, it also includes: matching the request instruction with the instructions in the preset blacklist to obtain a matching result; wherein, establishing the routing connection between the tenant and the target distributed cache cluster based on the verification result includes: establishing the routing connection between the tenant whose matching result is mismatch and the target distributed cache cluster based on the verification result.

[0053] like Figure 2 As shown, a distributed caching method provided in the second embodiment of the present invention specifically includes the following steps:

[0054] S201. Receive request information sent by the tenant and determine whether the tenant storage status corresponding to the second tenant ID is valid. If valid, use the private key to parse the authentication token to obtain a security authentication result.

[0055] The associated information of the resource isolation verification includes the second tenant ID, and the request information also includes the authentication token.

[0056] S202. If the security authentication result is passed, the first tenant ID is obtained by parsing the cache variable key value, and the data resource isolation verification result is obtained by judging whether the first tenant ID is consistent with the second tenant ID, wherein the associated information of the resource isolation verification includes the second tenant ID, the cache variable key value and the cache variable value.

[0057] Specifically, the cache variable key value key may include the first tenant ID. If the first tenant ID is consistent with the second tenant ID in the application information, the obtained data resource isolation verification result is passed; otherwise, it is failed.

[0058] S203. If the data resource isolation check result is passed, determine the cumulative value of the number of requests of the tenant, and obtain the computing resource isolation check result by judging whether the cumulative value of the number of requests is greater than a first preset threshold.

[0059] Specifically, a counter can be set for each tenant, and the counter can accumulate computing resource usage. The data format of the counter is "tenant ID: timestamp: computing resource". The number of requests for tenants to access the cache can be counted in minutes. If the cumulative value of the number of requests is greater than the first preset threshold, it is determined that the current tenant exceeds the computing resources applied for, and the computing resource isolation check result is failed, otherwise it is passed.

[0060] S204. If the computing resource isolation check result is passed, the cache cumulative value is determined using the cache variable value and the historical cache cumulative value, and the storage resource isolation check result is obtained by judging whether the cache cumulative value is greater than a second preset threshold.

[0061] Specifically, a counter can be set for each tenant, and the counter can accumulate the storage resource usage. The data format of the counter is "tenant ID: storage resource". When the request instruction is a storage instruction, the storage amount requested for storage (i.e., the cache variable value) is added to the cumulative value of the counter (i.e., the historical cache cumulative value). When the request instruction is a deletion instruction, the storage amount requested for deletion (i.e., the cache variable value) is subtracted from the historical cache cumulative value. Determine whether the result is greater than the second preset threshold. If so, the storage resource isolation check result is failed, otherwise, it is passed.

[0062] S205: Match the request instruction with instructions in a preset blacklist to obtain a matching result; and based on the verification result, establish a routing connection between the tenant whose matching result is mismatch and the target distributed cache cluster.

[0063] Specifically, distributed caches typically use single-threaded processing. When a single command is too numerous, it can severely block normal requests for other commands, potentially causing the distributed cache service to crash during peak transaction volumes. Request instructions can be matched against a preset blacklist. If a blacklist match is found, the tenant's request can be blocked, improving the reliability of the distributed cache. Blacklisted instructions can include blocking, time-consuming, and high-risk instructions such as obtaining all cached data, deleting cache libraries, obtaining all dictionary values, and blocking waits.

[0064] S206: Generate a request result based on the routing connection and the request instruction, and send the request result to the tenant.

[0065] The distributed cache method provided by the embodiment of the present invention is that tenants directly call the distributed cache through the built-in SDK to perform cache data operations, without having to worry about the specific physical location and operation and maintenance of the distributed cache cluster. The cache data can be quickly accessed, which can greatly improve the throughput of the IT system and calmly deal with traffic peaks. By performing identity authentication and permission verification, tenants are prevented from accessing other tenants' data, and through data resource isolation verification, computing resource isolation verification, and storage resource isolation verification, resource isolation of multiple tenants in the same distributed cache cluster is achieved. By configuring a blacklist, dangerous instructions such as blocking and high time consumption are prohibited, preventing a tenant from using dangerous instructions, which would cause the distributed cache cluster to crash. By monitoring and alerting indicators such as the transaction volume and success rate of multi-tenant distributed caches, a complete multi-tenant operation and maintenance is provided. The present invention solves the problem that the distributed cache cluster does not support multiple tenants, realizes the effective isolation of data, computing, and storage resources of multiple tenants, prohibits the execution of dangerous instructions, ensures the stability of the distributed cache cluster business system, improves the efficiency of distributed cache resource utilization, reduces enterprise costs, and enhances customer experience.

[0066] Example 3

[0067] Figure 3 This is a structural diagram of a distributed cache device provided by the third embodiment of the present invention. Figure 3 As shown, the device includes: a verification module 301, a connection establishment module 302 and a request result sending module 303, wherein:

[0068] A verification module is configured to receive a request message sent by a tenant and perform a resource isolation check based on the request message to obtain a verification result, wherein the request message includes associated information of the request instruction and the resource isolation check, and the resource isolation check includes a data resource isolation check, a computing resource isolation check, and a storage resource isolation check;

[0069] a connection establishing module, configured to establish a routing connection between the tenant and a target distributed cache cluster based on the verification result, wherein the target distributed cache cluster is determined from a plurality of distributed cache clusters by using an affinity tag algorithm;

[0070] A request result sending module is used to generate a request result based on the routing connection and the request instruction, and send the request result to the tenant.

[0071] The distributed cache device provided by the embodiment of the present invention performs data resource isolation verification, computing resource isolation verification and storage resource isolation verification according to the request sent by the tenant, thereby realizing resource isolation of multiple tenants in the same distributed cache cluster, and using the affinity label algorithm to determine the distributed cache cluster that establishes a route with the tenant from multiple distributed cache clusters, which can realize multi-tenant staggered access to the cluster, avoid the problem that multiple tenants read and write the same cache node, resulting in other systems being unable to obtain timely responses from the distributed cache, thereby ensuring business stability and improving distributed cache performance.

[0072] Optionally, the verification module includes:

[0073] a resource isolation verification unit, configured to obtain a first tenant ID by parsing a cache variable key value, and obtain a data resource isolation verification result by determining whether the first tenant ID is consistent with a second tenant ID, wherein associated information of the resource isolation verification includes the second tenant ID, the cache variable key value, and the cache variable value;

[0074] a computing resource isolation verification unit, configured to determine a cumulative value of the number of requests of the tenant if the data resource isolation verification result is passed, and obtain a computing resource isolation verification result by judging whether the cumulative value of the number of requests is greater than a first preset threshold;

[0075] a storage resource isolation verification unit, configured to determine a cache cumulative value using the cache variable value and the historical cache cumulative value if the computing resource isolation verification result is passed, and obtain a storage resource isolation verification result by determining whether the cache cumulative value is greater than a second preset threshold;

[0076] The connection establishment module is specifically configured to establish a routing connection between the tenant and a cache node in a target distributed cache cluster if the storage resource isolation check result is passed.

[0077] Optionally, the device further includes:

[0078] a label determination module, configured to determine a first affinity label of the tenant and second affinity labels of a plurality of distributed cache clusters before establishing a routing connection between the tenant and the target distributed cache cluster based on the verification result;

[0079] A cluster matching module is configured to determine a target distributed cache cluster that matches the tenant from the multiple distributed cache clusters using an affinity tag algorithm based on the first affinity tag and the second affinity tag.

[0080] Optionally, the device further includes:

[0081] An instruction matching module is used to match the request instruction with instructions in a preset blacklist to obtain a matching result before establishing a routing connection between the tenant and the target distributed cache cluster based on the verification result;

[0082] The connection establishing module is specifically configured to establish a routing connection between the tenant whose matching result is mismatch and the target distributed cache cluster based on the verification result.

[0083] Optionally, the device further includes:

[0084] A parameter configuration module, configured to configure cache parameters using a connection pool mechanism before receiving request information sent by the tenant, so as to manage the multiple distributed cache clusters;

[0085] The address configuration module is configured to configure the address of the distributed cache cluster by using the Connection Pool mechanism if it is determined that the storage resources of the distributed cache cluster need to be expanded after receiving the request information sent by the tenant.

[0086] Optionally, the device further includes:

[0087] An early warning module is used to count the success rate of the request instruction, and if the success rate is less than a third preset threshold, send a request early warning message to the tenant, wherein the request early warning message is used to prompt the success rate of the request instruction sent by the tenant.

[0088] Optionally, the device further includes:

[0089] A security authentication module is used to determine whether the tenant storage status corresponding to the second tenant ID is valid before performing resource isolation verification based on the request information to obtain a verification result; if valid, the authentication token is parsed using a private key to obtain a security authentication result, wherein the associated information of the resource isolation verification includes the second tenant ID, and the request information also includes the authentication token.

[0090] The distributed cache device provided in the embodiment of the present invention can execute the distributed cache method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0091] Example 4

[0092] Figure 4A schematic diagram of the structure of an electronic device 40 that can be used to implement an embodiment 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 processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0093] like Figure 4 As shown, the electronic device 40 includes at least one processor 41 and a memory, such as a read-only memory (ROM) 42, a random access memory (RAM) 43, etc., which is communicatively connected to the at least one processor 41. The memory stores a computer program that can be executed by the at least one processor, and the processor 41 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 42 or the computer program loaded from the storage unit 48 into the random access memory (RAM) 43. Various programs and data required for the operation of the electronic device 40 can also be stored in the RAM 43. The processor 41, ROM 42, and RAM 43 are connected to each other via a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.

[0094] Multiple components in the electronic device 40 are connected to the I / O interface 45, including an input unit 46, such as a keyboard, a mouse, etc.; an output unit 47, such as various types of displays, speakers, etc.; a storage unit 48, such as a magnetic disk, an optical disk, etc.; and a communication unit 49, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 49 allows the electronic device 40 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0095] Processor 41 can be various general-purpose and / or specialized processing components with processing and computing capabilities. Some examples of processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. Processor 41 executes the various methods and processes described above, such as the distributed caching method.

[0096] In some embodiments, the distributed caching method can be implemented as a computer program that is tangibly contained in a computer-readable storage medium, such as storage unit 48. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 40 via ROM 42 and / or communication unit 49. When the computer program is loaded into RAM 43 and executed by processor 41, one or more steps of the distributed caching method described above can be performed. Alternatively, in other embodiments, processor 41 can be configured to perform the distributed caching method in any other appropriate manner (e.g., by means of firmware).

[0097] Various embodiments of the systems and techniques described 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), system-on-chip (SOC) systems, complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0098] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0099] The computer device provided above can be used to execute the distributed caching method provided in any of the above embodiments, and has corresponding functions and beneficial effects.

[0100] Example 5

[0101] In the context of the present invention, a computer-readable storage medium may be a tangible medium having computer-executable instructions for performing a distributed caching method when executed by a computer processor, the method comprising:

[0102] Receive request information sent by the tenant, and perform resource isolation verification according to the request information to obtain a verification result, wherein the request information includes the request instruction and the associated information of the resource isolation verification, and the resource isolation verification includes data resource isolation verification, computing resource isolation verification, and storage resource isolation verification;

[0103] Based on the verification result, establishing a routing connection between the tenant and a target distributed cache cluster, wherein the target distributed cache cluster is determined from multiple distributed cache clusters by using an affinity tag algorithm;

[0104] A request result is generated based on the routing connection and the request instruction, and the request result is sent to the tenant.

[0105] In the context of the present invention, computer-readable storage medium can be a tangible medium that can contain or store a computer program for use with an instruction execution system, device or equipment or used in conjunction with an instruction execution system, device or equipment. Computer-readable storage medium can include but is not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage medium can be a machine-readable signal medium. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0106] The computer device provided above can be used to execute the distributed caching method provided in any of the above embodiments, and has corresponding functions and beneficial effects.

[0107] It is worth noting that in the embodiment of the above-mentioned distributed cache device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0108] Note that the above are only preferred embodiments of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments and may include many other equivalent embodiments without departing from the concept of the present invention. The scope of the present invention is determined by the scope of the appended claims.

Claims

1. A distributed caching method, characterized in that: include: Receive request information sent by the tenant, and perform resource isolation verification according to the request information to obtain a verification result, wherein the request information includes the request instruction and the associated information of the resource isolation verification, and the resource isolation verification includes data resource isolation verification, computing resource isolation verification, and storage resource isolation verification; Based on the verification result, establishing a routing connection between the tenant and a target distributed cache cluster, wherein the target distributed cache cluster is determined from multiple distributed cache clusters by using an affinity tag algorithm; A request result is generated based on the routing connection and the request instruction, and the request result is sent to the tenant.

2. The method according to claim 1, characterized in that The performing resource isolation verification according to the request information to obtain a verification result includes: Obtaining a first tenant ID by parsing a cache variable key, and determining whether the first tenant ID is consistent with a second tenant ID, thereby obtaining a data resource isolation verification result, wherein associated information of the resource isolation verification includes the second tenant ID, the cache variable key, and the cache variable value; If the data resource isolation check result is passed, determining the cumulative value of the number of requests of the tenant, and obtaining the computing resource isolation check result by judging whether the cumulative value of the number of requests is greater than a first preset threshold; If the computing resource isolation check result is passed, determining a cache cumulative value using the cache variable value and the historical cache cumulative value, and obtaining a storage resource isolation check result by judging whether the cache cumulative value is greater than a second preset threshold; The establishing of a routing connection between the tenant and the target distributed cache cluster based on the verification result includes: If the storage resource isolation check result is passed, a routing connection is established between the tenant and a cache node in the target distributed cache cluster.

3. The method according to claim 1, characterized in that Before establishing a routing connection between the tenant and the target distributed cache cluster based on the verification result, the method further includes: Determining a first affinity tag for the tenant and second affinity tags for a plurality of distributed cache clusters; Based on the first affinity tag and the second affinity tag, an affinity tag algorithm is used to determine a target distributed cache cluster that matches the tenant from the multiple distributed cache clusters.

4. The method according to claim 1, wherein Before establishing a routing connection between the tenant and the target distributed cache cluster based on the verification result, the method further includes: Matching the request instruction with instructions in a preset blacklist to obtain a matching result; The establishing of a routing connection between the tenant and the target distributed cache cluster based on the verification result includes: Based on the verification result, a routing connection is established between the tenant whose matching result is mismatch and the target distributed cache cluster.

5. The method according to any one of claims 1 to 4, characterized in that Before receiving the request information sent by the tenant, the method further includes: Utilize the connection pool mechanism to configure cache parameters to manage the multiple distributed cache clusters; After receiving the request information sent by the tenant, the method further includes: If it is determined that the storage resources of the distributed cache cluster need to be expanded, the address of the distributed cache cluster is configured using the Connection Pool mechanism.

6. The method according to claim 1, wherein The method further comprises: The success rate of the request instruction is counted, and if the success rate is less than a third preset threshold, a request warning message is sent to the tenant, wherein the request warning message is used to prompt the success rate of the request instruction sent by the tenant.

7. The method according to claim 1 or 2, characterized in that Before performing resource isolation verification according to the request information to obtain a verification result, the method further includes: Determine whether the tenant storage status corresponding to the second tenant ID is valid. If valid, use the private key to parse the authentication token to obtain a security authentication result, wherein the associated information of the resource isolation verification includes the second tenant ID, and the request information also includes the authentication token.

8. A distributed cache device, characterized in that: include: A verification module is configured to receive a request message sent by a tenant and perform a resource isolation check based on the request message to obtain a verification result, wherein the request message includes associated information of the request instruction and the resource isolation check, and the resource isolation check includes a data resource isolation check, a computing resource isolation check, and a storage resource isolation check; a connection establishing module, configured to establish a routing connection between the tenant and a target distributed cache cluster based on the verification result, wherein the target distributed cache cluster is determined from a plurality of distributed cache clusters by using an affinity tag algorithm; A request result sending module is used to generate a request result based on the routing connection and the request instruction, and send the request result to the tenant.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and 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. The computer program is executed by the at least one processor to enable the at least one processor to perform the distributed caching method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the distributed cache method according to any one of claims 1 to 7 when executed.