Method for hierarchically caching read and write data in storage cluster

文档序号:735116 发布日期:2021-04-20 浏览:25次 中文

阅读说明:本技术 一种存储集群中分级缓存读写数据的方法 (Method for hierarchically caching read and write data in storage cluster ) 是由 齐光鹏 窦洋 张明哲 于 2021-01-15 设计创作,主要内容包括:本发明公开一种存储集群中分级缓存读写数据的方法,涉及云计算技术领域,其实现基于后端存储集群、第一级缓存、第二级缓存、api网关、日志文件系统和应用程序,后端存储集群管理原始数据,第一级缓存存储热点数据,并将热点数据划分为不同的pool,第二级缓存将pool数据按照索引抽成段后保存,api网关统一处理请求。应用程序发起读请求时,api网关处理请求并发布到第二级缓存中,第二级缓存查找相关段并定位到pool,或者,没有找到相关段,进一步向第一级缓存发起缺段请求,仍无法找到相关信息后,继续到后端存储集群查找;应用程序发起写请求时,api网关处理请求并写入日志文件系统,等事务完成时再Flush进后端存储集群。本发明能够大幅降低延时。(The invention discloses a method for caching read and write data in a storage cluster in a grading way, which relates to the technical field of cloud computing and is realized based on a back-end storage cluster, a first-level cache, a second-level cache, an api gateway, a log file system and an application program. When an application program initiates a read request, an api gateway processes the request and issues the request to a second-level cache, the second-level cache searches for a relevant segment and locates the relevant segment to a pool, or if the relevant segment is not found, further initiates a segment missing request to the first-level cache, and continues to a rear-end storage cluster for searching after the relevant information cannot be found; when the application program initiates a write request, the api gateway processes the request and writes the request into a log file system, and then Flush the request into the back-end storage cluster after the transaction is completed. The invention can greatly reduce the time delay.)

1. A method for hierarchically caching read and write data in a storage cluster is characterized in that the implementation is based on a back-end storage cluster, a first-level cache, a second-level cache, an api gateway, a log file system and an application program, wherein:

the back-end storage cluster manages the raw data,

the first-level cache stores the hot spot data which changes dynamically, the hot spot data are divided into different pool according to the pid and the service attribute of the process, the hot spot data are stored in the pool by taking the object as a unit,

the second-level cache extracts the pool data of the first-level cache into Segment segments according to the index and then stores the Segment segments,

the api gateway is used as a flow inlet of all requests, uniformly processes the requests, combines the same request data,

the log file system stores data when the write request occurs;

when an application program initiates a read request, the api gateway uniformly processes the received request and issues the request to a second-level cache, the second-level cache searches Segment according to the request, after finding related Segment, the Segment is positioned to the pool of the first-level cache, or if the related Segment is not found, the Segment-missing request is further initiated to the first-level cache, and after the related information can not be found in the first-level cache, the back-end storage cluster is searched continuously;

when an application program initiates a write request, the api gateway uniformly processes the received request and writes the request into a log file system in a WAL mode, and then Flush the request into a back-end storage cluster after the transaction is completed.

2. The method of claim 1, wherein a first background thread is defined in the first level cache, and when the storage space of the pool is insufficient, the first background thread selects a dirty object in the pool and brushes the dirty object to the back-end storage cluster, or/and at the same time, the first background thread culls a clean object in the first level cache to release more storage space.

3. The method of claim 1, wherein a second background thread is defined in the second level cache, and the second background thread is used to periodically clean the second level cache of dirty data.

4. The method of claim 1, wherein the second-level cache stores only the index and address of the pool data according to the Segment extracted from the pool data by the index; each Segment has a dynamically variable length, and the length of each Segment is freely scheduled based on the flash space of the second level cache.

5. The method of claim 1, wherein the raw data is not limited to include data initialized at environment deployment, metadata written via storage media, production data and monitoring data generated during operation;

the hot spot data is not limited to include virtual machine image related data and monitoring alarm data in a recent period of time.

6. The method for hierarchically caching read and write data in a storage Cluster as recited in any of claims 1-5, wherein a SATA Cluster is used as a storage medium by the back-end storage Cluster, and the original data is managed by a ceph Cluster or a GlusterFS Cluster.

7. The method of claim 6, wherein the first level cache uses SSD Cluster.

8. The method of claim 7, wherein the second level cache uses a NAND or SCM flash memory array.

9. The method of claim 8, wherein a ratio of a total capacity of the first level cache to the back end storage cluster is 1: 100, the ratio of the total capacity of the second-level cache to the first-level cache is 1: 10.

10. the method of claim 1 wherein the first level cache is a cache, the determining the data block formula based on the data block size and recall probability depends on performance objectives including maximizing cache hit rate, minimizing average response time and minimizing the amount of data that must be buffered in the cache due to cache misses;

when the performance goal is to maximize the cache hit rate, the formula for determining the q value of the data block is q ═ r (x, s, a)/s;

when the performance goal is to minimize the average response time, the formula used to determine the q value of the data block is q ═ (((α + β s) × r (x, s, a))/s, with α + β s representing the miss penalty, i.e., the response time for a cache miss exceeds the response time for a cache hit;

when the performance goal is to minimize the amount of data that must be temporarily stored into the cache due to a cache miss, the formula used to determine the q value of the data block is q ═ r (x, s, a);

in the above formula, s is the size of the data block, x is the unreferenced time interval of the data block, a represents an auxiliary parameter for estimating the recall probability of the data block, r (x, s, a) is the recall probability of the data block as a function of x, s and a, and α and β are constants.

Technical Field

The invention relates to the technical field of cloud computing storage, in particular to a method for caching read and write data in a storage cluster in a grading way.

Background

In a cloud computing environment, a storage Cluster generally provides all storage services for a computing Cluster and a control node, data in the storage Cluster sometimes is very disordered and massive, when a management or tenant-side program initiates a data request (such as creating a virtual machine with a specified mirror image specification or calling monitoring data of a specified node or requesting a file stream service), the data interacts with a back-end main storage node each time, the back-end main storage node generally adopts SATA Cluster, and under the condition of high concurrent I/O, the SATA Cluster has a low read-write speed and affects the performance of the whole cloud management operation.

Disclosure of Invention

Aiming at the requirements and the defects of the prior art development, the invention provides a method for caching read and write data in a storage cluster in a grading way, so that the time delay is greatly reduced, and the performance experience of cloud management is improved.

The invention discloses a method for caching read and write data in a storage cluster in a grading way, which adopts the following technical scheme for solving the technical problems:

a method for hierarchically caching read and write data in a storage cluster is realized on the basis of a back-end storage cluster, a first-level cache, a second-level cache, an api gateway, a log file system and an application program, wherein:

the back-end storage cluster manages the raw data,

the first-level cache stores the hot spot data which changes dynamically, the hot spot data are divided into different pool according to the pid and the service attribute of the process, the hot spot data are stored in the pool by taking the object as a unit,

the second-level cache extracts the pool data of the first-level cache into Segment segments according to the index and then stores the Segment segments,

the api gateway is used as a flow inlet of all requests, uniformly processes the requests, combines the same request data,

the log file system stores data when the write request occurs;

when an application program initiates a read request, the api gateway uniformly processes the received request and issues the request to a second-level cache, the second-level cache searches Segment according to the request, after finding related Segment, the Segment is positioned to the pool of the first-level cache, or if the related Segment is not found, the Segment-missing request is further initiated to the first-level cache, and after the related information can not be found in the first-level cache, the back-end storage cluster is searched continuously;

when an application program initiates a write request, the api gateway uniformly processes the received request and writes the request into a log file system in a WAL mode, and then Flush the request into a back-end storage cluster after the transaction is completed.

Furthermore, a first background thread is defined in the related first-level cache, and when the storage space of the pool is insufficient, the first background thread selects a dirty object in the pool and brushes the dirty object to the back-end storage cluster, or/and simultaneously, the first background thread rejects a clean object of the first-level cache to release more storage space.

Furthermore, a second background thread is defined in the related second-level cache, and the second background thread is used for cleaning dirty data of the second-level cache at regular time.

Furthermore, the related second-level cache only stores the index and the address of the pool data according to the Segment extracted by the index from the pool data; each Segment has a dynamically variable length, and the length of each Segment is freely scheduled based on the flash space of the second level cache.

Preferably, the original data involved is not limited to include data initialized when the environment is deployed, metadata written through a storage medium, production data generated during operation and monitoring data;

the hot spot data is not limited to include virtual machine image related data and monitoring alarm data in a recent period of time.

Preferably, the related back-end storage Cluster adopts SATA Cluster as a storage medium, and original data is managed through a ceph Cluster or a GlusterFS Cluster.

Preferably, the first-level cache is SSD Cluster.

Preferably, the second level cache involved employs a NAND or SCM flash memory array.

Preferably, the ratio of the total capacity of the first-level cache to the back-end storage cluster is 1: 100, the ratio of the total capacity of the involved second-level cache to the first-level cache is 1: 10.

furthermore, the related first-level cache is used as cache, a formula for determining the data block is determined according to the size of the data block and the recall probability and depends on performance targets, and the performance targets comprise the maximization of cache hit rate, the minimization of average response time and the minimization of data volume which must be temporarily stored in the cache due to cache miss;

when the performance goal is to maximize the cache hit rate, the formula for determining the q value of the data block is q ═ r (x, s, a)/s;

when the performance goal is to minimize the average response time, the formula used to determine the q value of the data block is q ═ (((α + β s) × r (x, s, a))/s, with α + β s representing the miss penalty, i.e., the response time for a cache miss exceeds the response time for a cache hit;

when the performance goal is to minimize the amount of data that must be temporarily stored into the cache due to a cache miss, the formula used to determine the q value of the data block is q ═ r (x, s, a);

in the above formula, s is the size of the data block, x is the unreferenced time interval of the data block, a represents an auxiliary parameter for estimating the recall probability of the data block, r (x, s, a) is the recall probability of the data block as a function of x, s and a, and α and β are constants.

Compared with the prior art, the method for caching read-write data in a storage cluster in a grading way has the beneficial effects that:

according to the invention, after two-stage cache is additionally arranged between the back-end storage cluster and the api gateway, the time delay can be greatly reduced, and the cloud management performance experience is improved.

Drawings

FIG. 1 is a block diagram of a method implementation of the first embodiment of the present invention;

fig. 2 is a flow chart of a method according to a first embodiment of the present invention.

The reference information in the drawings indicates:

l1 denotes a first level cache and L2 denotes a second level cache.

Detailed Description

In order to make the technical scheme, the technical problems to be solved and the technical effects of the present invention more clearly apparent, the following technical scheme of the present invention is clearly and completely described with reference to the specific embodiments.

The first embodiment is as follows:

referring to fig. 1, the present embodiment proposes a method for hierarchically caching read and write data in a storage cluster, which is implemented based on a back-end storage cluster, a first-level cache L1, a second-level cache L2, an api gateway, a log file system, and an application.

The back-end storage Cluster adopts SATA Cluster as a storage medium, original data are managed through the ceph Cluster, and the original data are not limited to data initialized when environment deployment, metadata written in through the storage medium, production data and monitoring data generated in the running process.

The first-level cache L1 adopts SSD Cluster for storing dynamically changing hot spot data, and divides the hot spot data into different spots according to pid and service attribute of the process. The pool is stored in an object unit, and the hot spot data is not limited to comprise virtual machine mirror image related data and monitoring alarm data in a near period of time.

The second-level cache L2 adopts a NAND flash memory array, and extracts the pool data of the first-level cache L1 into Segment segments according to the index, and further stores the Segment segments. The extracted Segment segments only store the index and address of pool data, each Segment has a dynamically variable length, and the length of each Segment is freely scheduled based on the flash space of the second-level cache L2.

The api gateway is used as a flow inlet of all requests, uniformly processes the requests and combines the same request data.

The journaling file system stores data when a write request occurs.

In this embodiment, the first-level cache is used as a cache, and a formula for determining a data block according to the size of the data block and the recall probability depends on performance objectives, which include maximizing a cache hit rate, minimizing an average response time, and minimizing an amount of data that must be temporarily stored in the cache due to a cache miss.

(i) when the performance goal is to maximize the cache hit rate, the formula used to determine the q value of the data block is q ═ r (x, s, a)/s;

(ii) when the performance goal is to minimize the average response time, the formula used to determine the q value of the block of data is q (((α + β s) × r (x, s, a))/s, with α + β s representing the miss penalty, i.e., the response time for a cache miss exceeds the response time for a cache hit;

(iii) when the performance goal is to minimize the amount of data that must be temporarily stored into the cache due to a cache miss, the formula used to determine the q value of the data block is q ═ r (x, s, a);

in the above formula, s is the size of the data block, x is the unreferenced time interval of the data block, a represents an auxiliary parameter for estimating the recall probability of the data block, r (x, s, a) is the recall probability of the data block as a function of x, s and a, and α and β are constants.

In this embodiment, referring to fig. 2, based on the back-end storage cluster, the first level cache L1, the second level cache L2, the api gateway, and the log file system,

(1) when the application program application initiates a read request, the api gateway uniformly processes the received request and issues the request to the second-level cache L2, the second-level cache L2 searches for Segment according to the request, and after finding the related Segment, locates the Segment to the first-level cache L1, or, if the related Segment is not found, further initiates a Segment-missing request to the first-level cache L1, and continues to the back-end storage cluster for searching after the related information cannot be found in the first-level cache L1.

(2) When the application program initiates a write request, the api gateway uniformly processes the received request and writes the request into a log file system in a WAL mode, and then Flush enters a back-end storage cluster after the transaction is completed.

In this embodiment, the ratio of the total capacity of the first-level cache L1 to the total capacity of the backend storage cluster is 1: 100.

in this embodiment, the ratio of the total capacity of the second-level cache L2 to the first-level cache L1 is 1: 10.

example two:

referring to fig. 1, the present embodiment proposes a method for hierarchically caching read and write data in a storage cluster, which is implemented based on a back-end storage cluster, a first-level cache L1, a second-level cache L2, an api gateway, a log file system, and an application.

The back-end storage Cluster adopts SATA Cluster as a storage medium, original data are managed through the ceph Cluster, and the original data are not limited to data initialized when environment deployment, metadata written in through the storage medium, production data and monitoring data generated in the running process.

The first-level cache L1 adopts SSD Cluster for storing dynamically changing hot spot data, and divides the hot spot data into different spots according to pid and service attribute of the process. The pool is stored in an object unit, and the hot spot data is not limited to comprise virtual machine mirror image related data and monitoring alarm data in a near period of time. A first background thread is defined in the first-level cache L1, and when the storage space of the pool is insufficient, the first background thread selects a dirty object in the pool and brushes the dirty object to the back-end storage cluster, or/and at the same time, the first background thread culls a clean object in the first-level cache L1, so as to release more storage space.

The second-level cache L2 adopts an SCM flash memory array, extracts the pool data of the first-level cache L1 into Segment segments according to indexes, and then stores the Segment segments. The extracted Segment segments only store the index and address of pool data, each Segment has a dynamically variable length, and the length of each Segment is freely scheduled based on the flash space of the second-level cache L2. A second background thread is defined in the second-level cache L2, and the second background thread is used for regularly cleaning the dirty data of the second-level cache L2.

The api gateway is used as a flow inlet of all requests, uniformly processes the requests and combines the same request data.

The journaling file system stores data when a write request occurs.

In this embodiment, the first-level cache is used as a cache, and a formula for determining a data block according to the size of the data block and the recall probability depends on performance objectives, which include maximizing a cache hit rate, minimizing an average response time, and minimizing an amount of data that must be temporarily stored in the cache due to a cache miss.

(i) when the performance goal is to maximize the cache hit rate, the formula used to determine the q value of the data block is q ═ r (x, s, a)/s;

(ii) when the performance goal is to minimize the average response time, the formula used to determine the q value of the block of data is q (((α + β s) × r (x, s, a))/s, with α + β s representing the miss penalty, i.e., the response time for a cache miss exceeds the response time for a cache hit;

(iii) when the performance goal is to minimize the amount of data that must be temporarily stored into the cache due to a cache miss, the formula used to determine the q value of the data block is q ═ r (x, s, a);

in the above formula, s is the size of the data block, x is the unreferenced time interval of the data block, a represents an auxiliary parameter for estimating the recall probability of the data block, r (x, s, a) is the recall probability of the data block as a function of x, s and a, and α and β are constants.

In this embodiment, referring to fig. 2, based on the back-end storage cluster, the first level cache L1, the second level cache L2, the api gateway, and the log file system,

(1) when the application program application initiates a read request, the api gateway uniformly processes the received request and issues the request to the second-level cache L2, the second-level cache L2 searches for Segment according to the request, and after finding the related Segment, locates the Segment to the first-level cache L1, or, if the related Segment is not found, further initiates a Segment-missing request to the first-level cache L1, and continues to the back-end storage cluster for searching after the related information cannot be found in the first-level cache L1.

(2) When the application program initiates a write request, the api gateway uniformly processes the received request and writes the request into a log file system in a WAL mode, and then Flush enters a back-end storage cluster after the transaction is completed.

In this embodiment, the ratio of the total capacity of the first-level cache L1 to the total capacity of the backend storage cluster is 1: 100.

in this embodiment, the ratio of the total capacity of the second-level cache L2 to the first-level cache L1 is 1: 10.

example three:

on the basis of the structure of the first embodiment or the second embodiment, a GlusterFS cluster can be used to replace a ceph cluster.

In summary, by adopting the method for storing the read data and the write data in the cluster by the hierarchical cache, the time delay can be greatly reduced through the two added levels of cache, and the cloud management performance experience is improved.

The principles and embodiments of the present invention have been described in detail using specific examples, which are provided only to aid in understanding the core technical content of the present invention. Based on the above embodiments of the present invention, those skilled in the art should make any improvements and modifications to the present invention without departing from the principle of the present invention, and therefore, the present invention should fall into the protection scope of the present invention.

9页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:包括安全可修补ROM的半导体装置及其修补方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类