A multi-tenant cache method based on a distributed heterogeneous storage architecture

By combining tenant priority and storage service cluster load in a distributed heterogeneous storage architecture, calculating data priority and cache affinity, and adopting cache replacement and eviction strategies, the problem of indiscriminate tenant priority in heterogeneous storage architecture is solved, achieving efficient cache management and stability.

CN115658318BActive Publication Date: 2026-05-29UNIV OF SCI & TECH OF CHINA

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
UNIV OF SCI & TECH OF CHINA
Filing Date
2022-11-10
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing caching strategies cannot effectively differentiate the priorities of different tenants in heterogeneous storage architectures, making it easy for storage services with low load capacity to be penetrated, failing to provide higher protection for high-priority users, and making it difficult for fair strategies to achieve differentiated services in multi-tenant scenarios.

Method used

By combining tenant priority, data hit frequency, and storage service cluster idle load, the priority and cache affinity values ​​of data are calculated. Cache replacement and eviction strategies are adopted to prioritize services for high-priority tenants, make reasonable use of cache space, and avoid cache avalanche.

Benefits of technology

It enables the provision of differentiated services to different tenants in a distributed heterogeneous storage architecture, improves cache hit rate, maximizes cache space utilization, avoids cache avalanche, and ensures the stability and security of the caching solution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115658318B_ABST
    Figure CN115658318B_ABST
Patent Text Reader

Abstract

The application discloses a multi-tenant cache method based on a distributed heterogeneous storage architecture, on one hand, the tenant priority and the cache structure are combined, the read-write performance of the cache structure is fully used, and different priority tenants can be better provided with differential services. On the other hand, considering the boundary condition of cache penetration, the idle load of the storage service cluster is utilized, the cache space is maximally utilized, and the cache avalanche is avoided as much as possible; meanwhile, the application is oriented to the distributed heterogeneous storage architecture, compared with the conventional distributed storage system, the problems are more complex, and the application is more in line with the real scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of distributed systems, heterogeneous storage architectures, and multi-tenant caching strategies, and particularly to a multi-tenant caching method based on a distributed heterogeneous storage architecture. Background Technology

[0002] Since the beginning of the 21st century, China's internet has developed rapidly, with the number of internet users growing rapidly in the past decade, especially with the emergence of mobile internet and the widespread adoption of smartphones, which have permeated all aspects of our lives. The large number of internet users has provided new business opportunities and promoted the development of internet technology and applications. However, the massive amount of data proportional to the number of users has brought new challenges to storage technology.

[0003] In the current big data field, traditional network storage systems use centralized storage servers to store all data. These storage servers become the bottleneck for system performance and a focal point for reliability and security, failing to meet the demands of large-scale storage applications. To address the big data storage problem, the industry commonly uses multiple storage servers and various storage technologies to form a distributed heterogeneous storage architecture to replace traditional network storage systems. Distributed heterogeneous storage architectures still require caching technology to improve request response speed and provide better service to users. However, inappropriate caching strategies can lead to problems such as cache penetration, cache breakdown, and cache avalanche.

[0004] Currently, there are many solutions for data caching technology. At the application process level, implementations such as LRUHashMap (a data structure for key-value pairs using a least recently used hash table), Guava Cache (a local caching mechanism), EhCache (an in-process caching framework for Java), and Caffeine (a caching library based on Java 8) update the cache based on different eviction algorithms. On the server side, solutions such as CDN (Content Delivery Network) caching and reverse proxy caching compress cached data by distributing cache servers geographically and separating static and dynamic resources. On the application request side, solutions such as HTTP (Hypertext Transfer Protocol) caching, browser caching, and APP (application-level) caching cache resources that users may access repeatedly, reducing the number of requests to the server. Other technical frameworks include Memcached (a distributed high-speed caching system), Redis (a remote dictionary service), and ATS (a tiered caching architecture). Although these solutions can achieve caching techniques with high hit rates to a certain extent, they are generally only suitable for single-tenant distributed storage architectures. Currently, there are few caching strategies that consider heterogeneous storage architectures and multi-tenant memory space reuse. Therefore, it is crucial to implement a caching strategy based on a distributed heterogeneous storage architecture in multi-tenant memory reuse scenarios, which has high practical application value.

[0005] Currently, there are two main technical solutions: 1. Least Recently Used (LRU) based caching strategy. 2. Least Frequently Used (LFU) based caching strategy.

[0006] However, the above two technical solutions have the following technical problems:

[0007] 1. Current caching strategies are mostly fair strategies. In complex heterogeneous caching systems, fair strategies cannot eliminate cached data based on the actual load of the backend when the cache is full. This can easily lead to some low-load storage services being penetrated first, causing a service avalanche.

[0008] 2. In multi-tenant scenarios, fair storage strategies cannot effectively allocate cache based on user priority, making it difficult to provide different protection levels for users with different priorities and to ensure that high-priority users receive higher protection levels. Summary of the Invention

[0009] The purpose of this invention is to provide a multi-tenant caching method based on a distributed heterogeneous storage architecture, which can balance the caching of data in a heterogeneous storage service cluster in a distributed heterogeneous storage architecture scenario, and then match different response speeds according to the priority of different tenants, thereby achieving a safe and reliable caching strategy.

[0010] The objective of this invention is achieved through the following technical solution:

[0011] A multi-tenant caching method based on a distributed heterogeneous storage architecture includes:

[0012] Receive data requests from tenants and determine whether the data is matched by the cache structure; if the data is matched by the cache structure, return the corresponding data in the cache structure to the tenant.

[0013] If the data is not hit by the cache structure, the corresponding data is obtained from the heterogeneous storage service cluster and returned to the tenant, and it is determined whether the cache structure is full.

[0014] If the first-level cache in the cache structure is not full, the cache initialization strategy is used: the corresponding data is written to the first-level cache;

[0015] If the first-level cache in the cache structure is full and the second-level cache is not full, a cache replacement strategy is used: calculate the priority value of the corresponding data based on the tenant's priority, and determine whether to write the corresponding data to the first-level cache or the second-level cache based on the relationship between the priority value and the minimum priority value in the first-level cache.

[0016] If both the first-level cache and the second-level cache in the cache structure are full, a cache eviction policy is used: the cache affinity value of the data is calculated based on the idle load of the heterogeneous storage service cluster where the data resides, and the relationship between the data and the minimum cache affinity value in the second-level cache is used to determine whether to write the corresponding data into the cache structure.

[0017] As can be seen from the technical solution provided by the present invention, on the one hand, combining tenant priority and cache structure to fully utilize the read and write performance of the cache structure can better provide differentiated services to tenants with different priorities. On the other hand, considering the boundary conditions of cache penetration, the idle load of the storage service cluster is utilized to maximize the utilization of cache space and minimize cache avalanche. At the same time, the present invention is designed for distributed heterogeneous storage architectures, which face more complex problems and are more in line with real-world scenarios compared to conventional distributed storage systems. Attached Figure Description

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

[0019] Figure 1 A flowchart illustrating a multi-tenant caching method based on a distributed heterogeneous storage architecture, provided in an embodiment of the present invention;

[0020] Figure 2 This is a schematic diagram of the overall architecture of a multi-tenant caching method based on a distributed heterogeneous storage architecture provided by an embodiment of the present invention;

[0021] Figure 3 This is a weight (size) discrete graph provided in an embodiment of the present invention. Detailed Implementation

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

[0023] First, the following explanations are provided for the terms that may be used in this article:

[0024] The term "and / or" means that either or both can be achieved simultaneously. For example, X and / or Y means that it includes both "X" or "Y" as well as the three cases of "X and Y".

[0025] The terms “including,” “comprising,” “containing,” “having,” or other similar semantic descriptions should be interpreted as non-exclusive inclusion. For example, “including a technical feature element (such as raw material, component, ingredient, carrier, dosage form, material, size, part, component, mechanism, device, step, process, method, reaction conditions, processing conditions, parameter, algorithm, signal, data, product or article of manufacture, etc.)” should be interpreted as including not only the expressly listed technical feature element, but also other technical feature elements that are not expressly listed and are well-known in the art.

[0026] The following provides a detailed description of a multi-tenant caching method based on a distributed heterogeneous storage architecture provided by this invention. Contents not described in detail in the embodiments of this invention are prior art known to those skilled in the art. Where specific conditions are not specified in the embodiments of this invention, they shall be performed according to conventional conditions in the art or conditions recommended by the manufacturer. Where the manufacturers of the instruments used in the embodiments of this invention are not specified, they are all conventional products that can be purchased commercially.

[0027] This invention discloses a multi-tenant caching method based on a distributed heterogeneous storage architecture. It calculates data priority based on tenant priority, data hit frequency, and data weight value, and determines the cache replacement strategy by comparing the data priorities. It also calculates data affinity based on data hit frequency, data weight value, and the idle load of the storage service cluster, and determines the cache eviction strategy by comparing the data affinity. Finally, it implements the caching scheme based on the cache replacement and eviction strategies. This invention comprehensively considers tenant priority, the idle load of the heterogeneous storage service cluster, and the cache structure. While improving cache hit rate and maximizing cache space utilization, it can effectively provide differentiated services to tenants with different priorities and minimize cache avalanche, ensuring the stability of the caching scheme. Figure 1 As shown, the method provided by the present invention mainly includes:

[0028] Step 1: Receive the tenant's data request and determine whether the data is cached. If the data is cached, proceed to Step 2; if the data is not cached, proceed to Step 3.

[0029] In this embodiment of the invention, the cache structure is divided into two levels: a first-level cache and a second-level cache, wherein the capacity of the first-level cache is lower than that of the second-level cache, and the read / write speed of the first-level cache is higher than that of the second-level cache.

[0030] Step 2: Return the corresponding data in the cache structure to the tenant.

[0031] In this step, the relevant data cached in the cache structure is directly fed back to the tenant.

[0032] Step 3: Obtain the corresponding data from the heterogeneous storage service cluster and return it to the tenant, and determine whether the cache structure is full; if the first-level cache in the cache structure is not full, proceed to step 4; if the first-level cache in the cache structure is full and the second-level cache is not full, proceed to step 5; if both the first-level cache and the second-level cache in the cache structure are full, proceed to step 6.

[0033] In this embodiment of the invention, for data that is not hit by the cache structure, it is necessary to obtain it from the heterogeneous storage service cluster, and different strategies are triggered depending on whether the cache structure is full.

[0034] Step 4: Use the cache initialization strategy: Write the corresponding data into the first-level cache.

[0035] In this embodiment of the invention, when the first-level cache in the cache structure is not full, data is written to the first-level cache firstly until the first-level cache is full (or the current data size to be written exceeds the remaining capacity of the first-level cache), and then other strategies are considered.

[0036] Step 5: Use a cache replacement strategy: Calculate the priority value of the corresponding data based on the tenant's priority, and determine whether to write the corresponding data to the first-level cache or the second-level cache based on the relationship between the priority value and the minimum priority value in the first-level cache.

[0037] In this embodiment of the invention, when the priority value of the data is higher than the minimum priority value in the first-level cache, the data is stored in the first-level cache (the size of the data must not exceed the remaining capacity of the first-level cache), and the cached data corresponding to the minimum priority value in the first-level cache is written to the second-level cache; when the priority value of the data is not higher than the minimum priority value in the first-level cache, the corresponding data is written to the second-level cache (the size of the data must not exceed the remaining capacity of the second-level cache).

[0038] In addition, a weak consistency synchronization mechanism is used: when cached data within the first-level cache is updated, the minimum priority value is updated synchronously; when cached data within the second-level cache is updated, the maximum priority value is updated synchronously. It is determined whether the maximum priority value in the second-level cache is greater than the minimum priority value in the first-level cache. If so, the cached data corresponding to the minimum priority value in the first-level cache is written to the second-level cache, and the cached data corresponding to the maximum priority value in the second-level cache is written to the first-level cache. When replacing this part of the data, it is also necessary to ensure that the size of the replaced data does not exceed the remaining capacity of the corresponding cache.

[0039] In this embodiment of the invention, the priority value of the data is calculated as follows:

[0040] cachePriority i =priority i×freq i / weight(size i )

[0041] Among them, cachePriority i The priority value represents the value of data i. i freq indicates the priority of the tenant requesting data i. i Indicates the access frequency of data i, weight(size) i ) indicates that the size is based on the data i. i Calculated weight values.

[0042] Of course, the priority values ​​of the cached data in the first-level cache and the second-level cache are also calculated using the above formula.

[0043] Step 6: Use a cache eviction policy: Calculate the cache affinity value of the data based on the idle load of the heterogeneous storage service cluster where the data resides, and determine whether to write the corresponding data into the cache structure based on the relationship between the data and the minimum cache affinity value in the second-level cache.

[0044] In this embodiment of the invention, if the cache affinity value of the data is higher than the minimum cache affinity value in the second-level cache, then the data corresponding to the minimum cache affinity value in the second-level cache is cleared, and the data is written into the cache structure according to the cache replacement strategy (i.e., according to the cache replacement strategy described above, the data is written into the first-level or second-level cache based on the data priority); otherwise, the data is not written into the second-level cache.

[0045] In this embodiment of the invention, the calculation method for the data cache affinity value is expressed as follows:

[0046]

[0047] Among them, freq i Indicates the access frequency of data i, weight(size) i ) indicates that the size is based on the data i. i Calculated weight values, SLI i This indicates the idle load status of the heterogeneous storage service cluster where data i resides.

[0048] In this embodiment of the invention, the weight value used when calculating the data priority value and the data cache affinity value uses the same calculation method, and the weight value is weight(size). i The formula for calculating ) is:

[0049]

[0050] In the above formula, the size of data i is 'size'.i The access frequency of data i, freq i The power of.

[0051] In this embodiment of the invention, the above steps can be performed by a separately configured controller or other similar device.

[0052] To more clearly demonstrate the technical solution and its effects provided by the present invention, a multi-tenant caching method based on a distributed heterogeneous storage architecture provided by the present invention will be described in detail below with specific embodiments.

[0053] I. Overall Architecture.

[0054] Figure 2 The overall architecture of the above-described solution of this invention is mainly divided into three parts, from left to right: User, Cache, and Storage. User represents the tenant list, Cache represents the cache structure, and Storage represents the heterogeneous storage service cluster. Each tenant in the tenant list has a priority attribute; the higher the tenant's priority, the larger the priority value. The cache structure is divided into two levels: Level 1 cache (MEM) and Level 2 cache (DISK). MEM has a higher read / write speed than DISK, but its capacity is much smaller than DISK. It should be noted that DISK here does not refer to the disk in the storage architecture, but rather to the Level 2 cache in the Cache. Each piece of data in Storage corresponds to a different type of storage service cluster, such as HBase, S3, or MySQL. Each storage instance has an idle load attribute, where the idle value represents the maximum acceptable load for the storage instance. It should be noted that... Figure 2 The provided values ​​for the number of tenants, tenant priority, number of storage service clusters, and their idle load attributes are for illustrative purposes only and are not intended to constitute a limitation. In actual applications, the specific values ​​for each type of value need to be determined based on the actual situation.

[0055] II. Cache initialization strategy.

[0056] When the distributed heterogeneous storage architecture first starts running, the cache is empty. At this time, tenants cannot hit the cache when requesting data and must retrieve the data from the heterogeneous storage service cluster. When data is returned, it is simultaneously returned to both the tenant and the cache. Data is preferentially written to the memory cache (MEM) in the cache. Only when the MEM is full will data be written to the disk. When the MEM is full, a cache replacement policy is triggered; when both the MEM and the disk (i.e., the entire cache) are full, a cache eviction policy is triggered.

[0057] III. Cache replacement strategy.

[0058] When a tenant's request fails to hit the cache, data needs to be retrieved from the heterogeneous storage service cluster to respond to the tenant's request and written to the cache. If the MEM (Memory Service Center) is full at this time, a cache replacement strategy needs to be followed to determine whether the data should be written to the MEM or the DISK (Disk). The cache replacement strategy combines the data access frequency (freq), data size (size), and tenant priority to determine the location of the data cache, thereby ensuring maximum cache utilization and providing higher-priority tenants with better cache quality.

[0059] Assume there are M data entries in the first-level cache MEM, numbered 1, 2, 3, ..., M. Calculate the priority value (cachePriority) for each cached data entry, where the cachePriority of data entry i is recorded as Priority. i The conditions for replacing data from the Level 1 cache (MEM) to the Level 2 cache (DISK) are that the data has a lower priority and the MEM cache is already full.

[0060] 1. Data priority numerical calculation method.

[0061] The data mentioned here includes data returned by the heterogeneous storage service cluster, as well as cached data in MEM and DISK. The calculation formula is as follows:

[0062] cachePriority i =priority i ×freq i / weight(size i )

[0063] Among them: priority i : The priority of the tenant requesting data i; freq i : The most recent hit frequency of data i (freq) (the ratio of the number of times the cache was hit to the number of times data was hit in the last X minutes, where X is determined based on the actual situation); weight (size) i ): Based on the size of data i i Calculated weight values.

[0064] weight(size i The definition is as follows: weight(size) i ) is used to determine the data size. i The relationship between the cache and its weight, the pressure the cache can withstand, and the data size. i The relationship is not linear, therefore determining a reasonable weighting function is crucial. For example... Figure 3As shown, a weight (size) discrete graph is displayed; therefore, the present invention sets... Where size i The unit is KB.

[0065] 2. Replace cached data.

[0066] When a cache miss occurs: retrieve data x from the heterogeneous storage service cluster and calculate the priority of x: cachePriority. x At this point, compare cachePriority. x and If cachePriority x > Then Write the corresponding data to the DISK and write data x to MEM; otherwise, write data x to the DISK.

[0067] In addition, when the Level 1 cache MEM is full and the data within it has a low priority, a data swap from the Level 1 cache MEM to the Level 2 cache DISK will be triggered. This will be done by continuously updating the minimum priority value in the Level 1 cache MEM. and the maximum priority value in the secondary cache disk Compare and if Then exchange their corresponding data (requiring that the corresponding cache can accommodate the exchanged data), that is... The corresponding data is written to the DISK and then The corresponding data is written to MEM, and updated simultaneously. and When a cache miss occurs, and data retrieved from the heterogeneous storage service cluster is written to the first-level or second-level cache according to the cache replacement policy, the minimum or maximum priority value of the corresponding cache needs to be updated because the cached data within the cache is being updated. Conversely, when a first-level or second-level cache hit occurs, the priority value of the data changes due to variations in data access frequency, thus also requiring an update of the minimum or maximum priority value of the corresponding cache. Updating the minimum or maximum priority value of the corresponding cache may also trigger a cache replacement policy.

[0068] IV. Cache eviction strategy.

[0069] Cache eviction policies refer to the methods used to determine which cached data will be evicted when the entire cache is full and no user requests are being fulfilled, in order to minimize the negative impact of cache penetration on the storage engine. The cache eviction policy proposed in this embodiment prioritizes cleaning up caches with low access volume and idle storage service clusters. The specific cache eviction policy is as follows:

[0070] Assume the cache contains N data items, numbered 1, 2, 3, ..., N. Calculate the cache affinity value for each data item, and record the affinity of data item i as affinity. i When clearing the cache, the affinity of the data is calculated according to the following formula. i Clean up affinity one by one i The formula for calculating the smallest value is as follows:

[0071]

[0072] Among them, freq i with weight(size) i The meaning of ) is the same as the definition in the cache replacement strategy, SLI i The idle load status (Storage Load Idle, SLI) of the heterogeneous storage service cluster where data i resides, for example, Figure 2 Provided idle values ​​(1000 / 2000 / 5000).

[0073] When the cache is full and a tenant request is being received, there are two possible scenarios:

[0074] 1) Cache hit: Cache eviction policy is not triggered.

[0075] 2) Cache miss: Retrieve data x from the heterogeneous storage service cluster and calculate the affinity of data x. x Comparison of affinity x Minimum affinity value in DISK min If affinity x Affinity min Then eliminate affinity min The corresponding data, x, is written into the cache according to the cache replacement strategy; otherwise, data x is not written into the cache.

[0076] The above-mentioned solution provided in this invention is designed for distributed heterogeneous storage architectures. Combining the structure of a cache and comprehensively considering tenant priorities and the idle load of heterogeneous storage service clusters, it realizes a multi-tenant caching scheme based on distributed heterogeneous storage architectures. Its main advantages are as follows: 1) It is the first to propose a caching method based on distributed heterogeneous storage architectures, designing and implementing a caching scheme based on such architectures. 2) It fully considers practical scenarios, taking into account the different priorities of different tenants, providing faster request responses for high-priority tenants. 3) This solution also considers the different idle loads of the heterogeneous storage service clusters themselves, and provides a better cache penetration solution for cases where data is directly retrieved from the storage service cluster when the cache is not hit.

[0077] To more intuitively demonstrate the superiority of this invention over existing solutions, two examples are provided below, both of which are examples of requesting model training resources.

[0078] Example 1:

[0079] Currently, two tenants, A and B, are requesting model training resources. A is a free user with priority 1, while B is a paid user with priority 4. They request resources x and y of the same size from the same service storage cluster, but neither x nor y is cache-hunted. Consider the following scenarios: the cache memory (MEM) can write to both x and y simultaneously; the MEM can only write to either x or y; the MEM is fully loaded; and the disk is fully loaded.

[0080] According to the traditional LRU caching scheme (based on LRU, the least recently used caching strategy), in any case, the most recently requested resources x and y are put into the first-level cache MEM. If the cache is full, the least recently used resource is evicted.

[0081] According to the above-described scheme provided by the present invention, user B has a priority four times that of user A, therefore resource y has a higher priority and affinity than resource x:

[0082] 1) When the Level 1 cache MEM can write x and y simultaneously, put resources x and y into MEM.

[0083] 2) When MEM can only write x or y, write y to MEM, and write x to MEM or DISK according to the cache replacement strategy.

[0084] 3) When MEM is fully loaded, first determine whether y should be written to MEM or DISK according to the cache replacement strategy. If y can only be written to DISK, then x can only be written to DISK or not written at all.

[0085] 4) When the disk is full, first determine whether y should be written to the cache or not according to the cache eviction policy. If y cannot be written to the cache, then x must not be written.

[0086] Compared to the traditional LRU caching scheme, this invention can better differentiate the processing of resources x and y, providing differentiated services for tenants A and B.

[0087] Example 2:

[0088] There are two tenants, A and B, requesting model training resources. A is a free user with priority 1, and B is a paid user with priority 2. They request resources x and y of different sizes from different service storage clusters C1 and C2: resource x is 1 / 10 the size of resource y, and the idle load of C1 is 1 / 10 of that of C2. Consider the following scenarios: the Cache memory can write to both x and y simultaneously; the Cache memory can only write to either x or y; the Cache memory is fully loaded; and the Disk is fully loaded.

[0089] In the traditional LRU caching scheme, in any case, the most recently requested resources x and y are put into the first-level cache MEM. If the cache is full, the least used resource is evicted.

[0090] According to the above-described scheme provided by the present invention, although user B's priority is twice that of user A, the size of resource x is 1 / 10 of resource y, and the idle load of C1 is 1 / 10 of C2. Therefore, the priority and affinity of resource x are both higher than those of resource y.

[0091] 1) When the Level 1 cache MEM can write x and y simultaneously, put resources x and y into MEM.

[0092] 2) When MEM can only write x or y, write x to MEM, and write y to MEM or DISK according to the cache replacement strategy.

[0093] 3) When MEM is fully loaded, first determine whether x should be written to MEM or DISK according to the cache replacement strategy. If x can only be written to DISK, then y can only be written to DISK or not written at all.

[0094] 4) When the DISK is full, first determine whether x should be written to the Cache or not according to the cache eviction policy. If x cannot be written to the Cache, then y must not be written.

[0095] Compared to the traditional LRU caching scheme, this invention not only considers the priorities of tenants A and B, but also comprehensively measures the size of resources x and y as well as the idle load capacity of different service clusters, maximizing the utilization of memory space and minimizing cache avalanche, thus ensuring the stability of the caching scheme.

[0096] Through the above description of the embodiments, those skilled in the art can clearly understand that the above embodiments can be implemented by software, or by using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solutions of the above embodiments can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.), including several instructions to cause a computer device (such as a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0097] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A multi-tenant caching method based on a distributed heterogeneous storage architecture, characterized in that, include: Receive data requests from tenants and determine whether the data is cached. If the data is hit by the cache structure, the corresponding data in the cache structure will be returned to the tenant. If the data is not hit by the cache structure, the corresponding data is obtained from the heterogeneous storage service cluster and returned to the tenant, and it is determined whether the cache structure is full. If the first-level cache in the cache structure is not full, the cache initialization strategy is used: the corresponding data is written to the first-level cache; If the first-level cache in the cache structure is full and the second-level cache is not full, a cache replacement strategy is used: calculate the priority value of the corresponding data based on the tenant's priority, and determine whether to write the corresponding data to the first-level cache or the second-level cache based on the relationship between the priority value and the minimum priority value in the first-level cache. If both the first-level cache and the second-level cache in the cache structure are full, a cache eviction policy is used: the cache affinity value of the data is calculated based on the idle load of the heterogeneous storage service cluster where the data resides, and the corresponding data is written into the cache structure based on the relationship with the minimum cache affinity value in the second-level cache. When calculating the priority value and cache affinity value of data, it is also necessary to calculate the weight value based on the size of the data, and then combine the weight value to calculate the priority value or cache affinity value of the data. The weight of data i is denoted as weight(size). i The calculation formula is: Among them, freq i Indicates the access frequency of data i, size i This indicates the size of data i.

2. The multi-tenant caching method based on a distributed heterogeneous storage architecture according to claim 1, characterized in that, The capacity of the first-level cache is lower than that of the second-level cache, and the read / write speed of the first-level cache is higher than that of the second-level cache.

3. The multi-tenant caching method based on a distributed heterogeneous storage architecture according to claim 1, characterized in that, The step of determining whether to write the corresponding data to the first-level cache or the second-level cache based on its relationship with the minimum priority value in the first-level cache includes: When the priority value of data is higher than the minimum priority value in the first-level cache, the data is stored in the first-level cache, and the cached data corresponding to the minimum priority value in the first-level cache is written to the second-level cache; when the priority value of data is not higher than the minimum priority value in the first-level cache, the corresponding data is written to the second-level cache.

4. The multi-tenant caching method based on a distributed heterogeneous storage architecture according to claim 1, characterized in that, The cache replacement strategy also includes: When cached data within the first-level cache is updated, the minimum priority value is updated synchronously; when cached data within the second-level cache is updated, the maximum priority value is updated synchronously. Determine if the maximum priority value in the second-level cache is greater than the minimum priority value in the first-level cache; if so, write the cache data corresponding to the minimum priority value in the first-level cache to the second-level cache, and write the cache data corresponding to the maximum priority value in the second-level cache to the first-level cache.

5. A multi-tenant caching method based on a distributed heterogeneous storage architecture according to claim 1, 3, or 4, characterized in that, The data priority numerical calculation method is expressed as follows: cachePriority i =priority i ×freq i / weight(size i ) Among them, cachePriority i The priority value represents the value of data i. i freq indicates the priority of the tenant requesting data i. i Indicates the access frequency of data i, weight(size) i ) indicates that the size is based on the data i. i Calculated weight values.

6. A multi-tenant caching method based on a distributed heterogeneous storage architecture according to claim 1, characterized in that, The step of determining whether to write the corresponding data into the cache structure based on the relationship with the minimum cache affinity value in the second-level cache includes: If the cache affinity value of the data is higher than the minimum cache affinity value in the second-level cache, then the data corresponding to the minimum cache affinity value in the second-level cache is cleared, and the data is written to the cache structure according to the cache replacement strategy; otherwise, the data is not written to the second-level cache.

7. A multi-tenant caching method based on a distributed heterogeneous storage architecture according to claim 1 or 6, characterized in that, The data cache affinity is calculated as follows: Among them, freq i Indicates the access frequency of data i, weight(size) i ) indicates that the size is based on the data i. i Calculated weight values, SLI i This indicates the idle load status of the heterogeneous storage service cluster where data i resides.