[go: up one dir, main page]

CN106648469B - A cache data processing method, device and storage controller - Google Patents

A cache data processing method, device and storage controller Download PDF

Info

Publication number
CN106648469B
CN106648469B CN201611248587.3A CN201611248587A CN106648469B CN 106648469 B CN106648469 B CN 106648469B CN 201611248587 A CN201611248587 A CN 201611248587A CN 106648469 B CN106648469 B CN 106648469B
Authority
CN
China
Prior art keywords
data
stripe
cache
target stripe
size
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201611248587.3A
Other languages
Chinese (zh)
Other versions
CN106648469A (en
Inventor
江武汉
门勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201611248587.3A priority Critical patent/CN106648469B/en
Publication of CN106648469A publication Critical patent/CN106648469A/en
Priority to PCT/CN2017/118147 priority patent/WO2018121455A1/en
Application granted granted Critical
Publication of CN106648469B publication Critical patent/CN106648469B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • G06F3/0607Improving or facilitating administration, e.g. storage management by facilitating the process of upgrading existing storage systems, e.g. for improving compatibility between host and storage device
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0656Data buffering arrangements

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

揭露一种数据处理方法,以及对应的装置和存储控制器。其中,数据处理方法包括:获取数据的压缩比D、重删比C、平均分条填充率I、缓存中目标分条大小S、所述目标分条中有效数据大小W;根据获取的这几项参数,使用公式

Figure DDA0001197606350000011
,获取淘汰数据量N,根据N的取值执行下述操作中的一个:在Tmin≤N≤Tmax的情况下,将大小为N的数据写入所述目标分条,把所述目标分条的数据淘汰给存储介质,其中当Tmin是预设的第一阈值,Tmax是预设的第二阈值;在N>Tmax的情况下,将大小为N的数据写入所述目标分条;在N<Tmin的情况下,把所述目标分条的数据淘汰给所述存储介质。使用该方案对缓存数据下盘的时间点进行了更合理的设计。

Figure 201611248587

A data processing method, a corresponding device and a storage controller are disclosed. Wherein, the data processing method includes: obtaining data compression ratio D, deduplication ratio C, average stripe filling rate I, target stripe size S in the cache, and valid data size W in the target stripe; item parameter, using the formula

Figure DDA0001197606350000011
, obtain the amount of eliminated data N, and perform one of the following operations according to the value of N: in the case of T min ≤ N ≤ T max , write data of size N into the target The striped data is eliminated to the storage medium, wherein when T min is a preset first threshold value, T max is a preset second threshold value; in the case of N>T max , data of size N is written into the Target stripe; in the case of N<T min , the data of the target stripe is eliminated to the storage medium. Using this scheme, a more reasonable design is made for the time point when the cached data is downloaded to the disk.

Figure 201611248587

Description

一种缓存数据处理方法、装置和存储控制器A cache data processing method, device and storage controller

技术领域technical field

本发明涉发明存储技术,特别涉及于存储领域技术的日志领域。The present invention relates to inventing storage technology, in particular to the field of logs of storage technology.

背景技术Background technique

缓存(cache)是一种为了解决高、低速设备之间速度不匹配而采用的一项重要技术,广泛应用于各种领域如存储系统中,可以减少应用响应时间、提升效率。Cache (cache) is an important technology used to solve the speed mismatch between high-speed and low-speed devices. It is widely used in various fields such as storage systems, which can reduce application response time and improve efficiency.

在存储系统中,为了提升存储系统的性能,通常在处理设备和硬盘之间增加一个缓存层(也称为回写缓存,write-back cache)。缓存层可以提高系统读写性能,所以有时候也把缓存层称为性能层。In a storage system, in order to improve the performance of the storage system, a cache layer (also called write-back cache, write-back cache) is usually added between the processing device and the hard disk. The cache layer can improve the system read and write performance, so sometimes the cache layer is also called the performance layer.

缓存使用的介质例如是固态硬盘(solid state disk,SSD),其其读写性能优于持久化存储介质(例如硬盘)。相对于硬盘,可以更快速处理来自主机应用程序的写请求。缓存的存储容量有限,因此当空闲空间不足时,需要根据淘汰算法把一部分缓存介质数据淘汰到硬盘中,以便腾出空间为后续的写请求使用。这部分从缓存下发到硬盘的数据称为脏数据。The medium used for the cache is, for example, a solid state disk (SSD), whose read and write performance is better than that of a persistent storage medium (such as a hard disk). Write requests from host applications can be processed more quickly than hard drives. The storage capacity of the cache is limited, so when the free space is insufficient, a part of the cache medium data needs to be eliminated to the hard disk according to the elimination algorithm, so as to free up space for subsequent write requests. This part of the data sent from the cache to the hard disk is called dirty data.

为了尽快的让缓存拥有足够的空闲空间,在空闲空间不足时需要尽快把脏数据淘汰到硬盘中去。否则会造成写请求难以被及时处理。In order to make the cache have enough free space as soon as possible, it is necessary to eliminate the dirty data to the hard disk as soon as possible when the free space is insufficient. Otherwise, it will be difficult for the write request to be processed in time.

存储领域中,缓存中脏数据通常是以分条作为粒度下发到硬盘。分条是逻辑概念,类似于一个装数据的容器。如果下发的数据不足一个分条,意味着分条中仅有部分位置有效数据,分条中存在空闲位置。参见图1中的分条,其利用率只有50%。这种没有被有效数据“装满”的分条,和被有效数据“装满”的分条一样,都会占用硬盘中一个完整分条的存储空间,而且会产生一组元数据。因此,如果分条中有效数据和空闲位置的比例越大。可以节约越多的硬盘存储空间,以及减少元数据的数量。如果分条完全“装满”有效数据后再下发,可以最大化的利用硬盘存储空间,以及产生最少的元数据。In the storage field, dirty data in the cache is usually delivered to the hard disk in stripes. Striping is a logical concept, similar to a container for data. If the delivered data is less than one strip, it means that there are only some valid data in the strip, and there are free positions in the strip. See the strip in Figure 1, which is only 50% utilized. This stripe that is not "filled" with valid data, like a stripe that is "filled" with valid data, will occupy the storage space of a complete stripe on the hard disk, and will generate a set of metadata. Therefore, if the proportion of valid data and free space in the stripe is larger. You can save more hard disk storage space and reduce the amount of metadata. If the stripe is completely "filled" with valid data and then distributed, the hard disk storage space can be maximized and the least metadata can be generated.

由此可见,脏数据的淘汰方式存在两个矛盾的需求:从尽快获取更多空闲缓存空间这个需求考虑,脏数据需要尽快淘汰到硬盘,最好是一旦空闲空间不足,立刻执行淘汰操作;而从提高硬盘利用率和减少元数据这个需求考虑,需要尽量凑满分条后再把脏数据淘汰到硬盘,最好是把脏数据凑满完整的分条后再执行淘汰操作。如何在二者中寻求一个平衡,是业界需要解决的问题。It can be seen that there are two contradictory requirements for the elimination of dirty data: considering the need to obtain more free cache space as soon as possible, dirty data needs to be eliminated to the hard disk as soon as possible, and it is best to perform the elimination operation immediately once the free space is insufficient; and Considering the need to improve hard disk utilization and reduce metadata, it is necessary to fill up the stripes as much as possible and then eliminate the dirty data to the hard disk. How to find a balance between the two is a problem that the industry needs to solve.

现有技术中并没有很好的解决这个问题。每秒读写次数(IOPS)抖动过大,以及硬盘存储空间利用不足的情况时有发生。This problem is not well solved in the prior art. The number of reads and writes per second (IOPS) jitter is too large, and the hard disk storage space is insufficiently utilized.

发明内容SUMMARY OF THE INVENTION

本发明实施例提供一种缓存数据处理方法、装置和存储控制器,可以缓解IOPS的严重波动,使存储系统的性能越稳定。Embodiments of the present invention provide a cache data processing method, device, and storage controller, which can alleviate severe fluctuations in IOPS and make the performance of the storage system more stable.

本发明第一方面,本发明提供一种缓存数据处理方法,该方法包括:获取数据的压缩比D、重删比C、以及平均分条填充率I、缓存中目标分条大小S、以及所述目标分条中有效数据大小W;按照公式

Figure BDA0001197606330000021
Figure BDA0001197606330000022
获取淘汰数据量N,在Tmin≤N≤Tmax的情况下,将大小为N的数据写入所述目标分条,把所述目标分条的数据淘汰给存储介质,其中当Tmin是预设的第一阈值,Tmax是预设的第二阈值。在另外一种可选方式中,在N>Tmax的情况下,将大小为N的数据写入所述目标分条。在另外一种可选方式中,在N<Tmin的情况下,把所述目标分条的数据淘汰给所述存储介质。这三种可选方式都是可选的,执行其中任意一个即可形成一个完整的流程。基于该方法,在对缓存没有明显影响的情况下,分条容纳尽量多的数据后再淘汰到存储介质中。在尽早获得空闲的缓存空间以及提高磁盘利用率这两个互相矛盾的需求之间获得平衡。使得缓存数据更平滑的淘汰给存储介质,减少了IOPS严重波动的情况,使存储系统更加稳定。In a first aspect of the present invention, the present invention provides a cache data processing method, the method comprising: obtaining data compression ratio D, deduplication ratio C, average stripe filling rate I, target stripe size S in the cache, and all Describe the effective data size W in the target strip; according to the formula
Figure BDA0001197606330000021
Figure BDA0001197606330000022
Acquire the amount of eliminated data N, in the case of T min ≤ N ≤ T max , write the data of size N into the target stripe, and eliminate the data of the target stripe to the storage medium, where when T min is A preset first threshold, T max is a preset second threshold. In another optional manner, in the case of N>T max , data of size N is written into the target stripe. In another optional manner, in the case of N<T min , the data of the target stripe is eliminated to the storage medium. These three optional methods are all optional, and a complete process can be formed by executing any one of them. Based on this method, under the condition that there is no obvious impact on the cache, the stripe accommodates as much data as possible before being eliminated into the storage medium. Strike a balance between the conflicting needs of getting free cache space early and improving disk utilization. The cached data is eliminated to the storage medium more smoothly, which reduces the severe fluctuation of IOPS and makes the storage system more stable.

在第一方面的第一种可能实现方式中,其中,将大小为N的数据写入所述目标分条之后,进一步包括:在所述目标分条被后续数据写满以后,把所述目标分条淘汰到所述存储介质。该可能实现方式提出了N>Tm的情况下,淘汰数据的方案。In a first possible implementation manner of the first aspect, after writing data of size N into the target stripe, the method further includes: after the target stripe is filled with subsequent data, writing the target stripe to the target stripe. Stripe out to the storage medium. This possible implementation proposes a solution for eliminating data in the case of N>T m .

在第一方面的第二种可能实现方式中,根据权利要求1所述的缓存数据淘汰方法,所述D、C和I是统计值,其初始值均为1。In a second possible implementation manner of the first aspect, according to the method for eliminating cached data according to claim 1, the D, C, and I are statistical values, and their initial values are all 1.

在第一方面的第三种可能实现方式中,其中S用从缓存下发数据到存储介质的最小单位(或者最小单位的整数倍)的数量进行描述,例如用缓存页的数量描述。In a third possible implementation manner of the first aspect, S is described by the number of the smallest unit (or an integer multiple of the smallest unit) for delivering data from the cache to the storage medium, for example, by the number of cache pages.

本发明第二方面,提供一种缓存数据处理装置,该装置包括:获取模块,可以用于获取数据的压缩比D、重删比C以及平均分条填充率I,还可以用于获取缓存中目标分条大小S、所述目标分条中有效数据大小W;计算模块,用于按照公式

Figure BDA0001197606330000031
计算从淘汰数据量N;数据处理模块,用于在Tmin≤N≤Tmax的情况下,将大小为N的数据写入所述目标分条,把所述目标分条的数据淘汰给存储介质,其中当Tmin是预设的第一阈值,Tmax是预设的第二阈值。在另外一种可选方式中,数据处理模块用于在N>Tmax的情况下,将大小为N的数据写入所述目标分条。在另外一种可选方式中,在N<Tmin的情况下,数据处理模块用于把所述目标分条的数据淘汰给所述存储介质。这三种可选方式都是可选的,执行其中任意一个即可形成一个完整的流程。基于该缓存数据处理装置,在对缓存没有明显影响的情况下,分条容纳尽量多的数据后再淘汰到存储介质中。在尽早获得空闲的缓存空间以及提高磁盘利用率这两个互相矛盾的需求之间获得平衡。使得缓存数据更平滑的淘汰给存储介质,减少了IOPS严重波动的情况,使存储系统更加稳定。A second aspect of the present invention provides a cache data processing device, the device includes: an acquisition module, which can be used to acquire the compression ratio D, deduplication ratio C and average stripe filling rate I of data, and can also be used to acquire data in the cache The target strip size S, the effective data size W in the target strip; the calculation module, used for formulating
Figure BDA0001197606330000031
Calculate the amount of eliminated data N; the data processing module is used to write data of size N into the target strip under the condition of T min≤N≤Tmax , and eliminate the data of the target strip to storage medium, wherein when T min is a preset first threshold value, and T max is a preset second threshold value. In another optional manner, the data processing module is configured to write data of size N into the target strip under the condition of N>T max . In another optional manner, in the case of N<T min , the data processing module is configured to eliminate the data of the target stripe to the storage medium. These three optional methods are all optional, and a complete process can be formed by executing any one of them. Based on the cache data processing device, under the condition that there is no obvious impact on the cache, the strips accommodate as much data as possible before being eliminated into the storage medium. Strike a balance between the conflicting needs of getting free cache space early and improving disk utilization. The cached data is eliminated to the storage medium more smoothly, which reduces the severe fluctuation of IOPS and makes the storage system more stable.

本发明第二方面的第一种可能实现方式,所述处理模块还用于:在大小为N的数据写入所述目标分条之后,如果所述目标分条被后续数据写满以后,把所述目标分条淘汰到所述存储介质。该可能实现方式提出了N>Tm的情况下,淘汰数据的方案。In the first possible implementation manner of the second aspect of the present invention, the processing module is further configured to: after data of size N is written into the target stripe, if the target stripe is filled with subsequent data, write The target stripes out to the storage medium. This possible implementation proposes a solution for eliminating data in the case of N>T m .

本发明第二方面的第二种可能实现方式,所述D、C和I是统计值,其初始值均为1。In the second possible implementation manner of the second aspect of the present invention, the D, C and I are statistical values, and their initial values are all 1.

本发明第二方面的第三种可能实现方式,S用从缓存下发数据到存储介质的最小单位(或者最小单位的整数倍)的数量进行描述,例如用缓存页的数量描述。In a third possible implementation manner of the second aspect of the present invention, S is described by the number of the smallest unit (or an integer multiple of the smallest unit) for delivering data from the cache to the storage medium, for example, by the number of cache pages.

本发明第三方面提供一种存储控制器,所述存储控制器包括处理器和缓存,缓存用于暂存数据,可选的还可以包括存储淘汰数据的存储介质(例如硬盘或者固态硬盘)。所述处理器通过运行程序执行下面的步骤:获取数据的压缩比D、重删比C、以及平均分条填充率I,还用于获取缓存中目标分条大小S、所述目标分条中有效数据大小W;按照公式

Figure BDA0001197606330000041
Figure BDA0001197606330000042
获取淘汰数据量N;在Tmin≤N≤Tmax的情况下,将大小为N的数据写入所述目标分条,把所述目标分条的数据淘汰给存储介质,其中当Tmin是预设的第一阈值,Tmax是预设的第二阈值。在另外一种可选方式中,在N>Tmax的情况下,将大小为N的数据写入所述目标分条。在另外一种可选方式中,在N<Tmin的情况下,把所述目标分条的数据淘汰给所述存储介质。这三种可选方式都是可选的,执行其中任意一个即可形成一个完整的流程。基于该存储控制器,在对缓存没有明显影响的情况下,分条容纳尽量多的数据后再淘汰到存储介质中。在尽早获得空闲的缓存空间以及提高磁盘利用率这两个互相矛盾的需求之间获得平衡。A third aspect of the present invention provides a storage controller, the storage controller includes a processor and a cache, the cache is used to temporarily store data, and optionally, a storage medium (eg, a hard disk or a solid-state disk) for storing obsolete data. The processor executes the following steps by running a program: obtaining the compression ratio D, the deduplication ratio C, and the average stripe filling rate I of the data, and is also used to obtain the target stripe size S in the cache, and the target stripe size S in the cache. Effective data size W; according to the formula
Figure BDA0001197606330000041
Figure BDA0001197606330000042
Obtain the amount of eliminated data N; in the case of T min ≤ N ≤ T max , write the data of size N into the target stripe, and eliminate the data of the target stripe to the storage medium, where T min is A preset first threshold, T max is a preset second threshold. In another optional manner, in the case of N>T max , data of size N is written into the target stripe. In another optional manner, in the case of N<T min , the data of the target stripe is eliminated to the storage medium. These three optional methods are all optional, and a complete process can be formed by executing any one of them. Based on the storage controller, under the condition that there is no obvious impact on the cache, the stripe accommodates as much data as possible before being eliminated into the storage medium. Strike a balance between the conflicting needs of getting free cache space early and improving disk utilization.

本发明第三方面的第一种可能实现方式,所述处理器还用于执行:在大小为N的数据写入所述目标分条之后,如果所述目标分条被后续数据写满以后,把所述目标分条淘汰到所述存储介质。该可能实现方式提出了N>Tm的情况下,淘汰数据的方案。In the first possible implementation manner of the third aspect of the present invention, the processor is further configured to execute: after data of size N is written into the target stripe, if the target stripe is filled with subsequent data, Retire the target stripe to the storage medium. This possible implementation proposes a solution for eliminating data in the case of N>T m .

本发明第三方面的第二种可能实现方式,所述D、C和I是统计值,其初始值均为1。In the second possible implementation manner of the third aspect of the present invention, the D, C and I are statistical values, and their initial values are all 1.

本发明第三方面的第三种可能实现方式,S用从缓存下发数据到存储介质的最小单位(或者最小单位的整数倍)的数量进行描述,例如用缓存页的数量描述。In a third possible implementation manner of the third aspect of the present invention, S is described by the number of the smallest unit (or an integer multiple of the smallest unit) of delivering data from the cache to the storage medium, for example, by the number of cache pages.

本发明第四方面,还提供一种存储系统,包括上述的存储控制器和存储介质(例如硬盘、固态硬盘),存储介质用于存储被淘汰的数据。In a fourth aspect of the present invention, a storage system is further provided, including the above-mentioned storage controller and a storage medium (eg, a hard disk, a solid-state hard disk), and the storage medium is used for storing obsolete data.

本发明第五方面,还提供一种存储系统,包括上述的数据处理装置和存储介质(例如硬盘、固态硬盘),存储介质用于存储被淘汰的数据。In a fifth aspect of the present invention, a storage system is further provided, including the above-mentioned data processing device and a storage medium (eg, a hard disk, a solid-state hard disk), and the storage medium is used to store discarded data.

附图说明Description of drawings

图1是分条使用情况示意图;Figure 1 is a schematic diagram of the use of strips;

图2是本发明存储系统实施例结构图;2 is a structural diagram of an embodiment of a storage system of the present invention;

图3是本发明缓存数据处理方法一种实施例流程图;3 is a flowchart of an embodiment of a method for processing cached data according to the present invention;

图4是一种缓存数据处理装置实施例拓扑图。FIG. 4 is a topology diagram of an embodiment of a cache data processing apparatus.

具体实施方式Detailed ways

本申请方案可以适用于存储设备。存储设备例如是存储控制器。存储控制器和存储介质(例如硬盘、固态硬盘等)相对独立,它们共同组成存储系统。除非特别说明,后续实施例以这种情况为例介绍本发明实施例方案,存储介质以硬盘进行举例。The solution of the present application can be applied to a storage device. The storage device is, for example, a storage controller. The storage controller and storage medium (such as hard disk, solid-state disk, etc.) are relatively independent, and together they constitute a storage system. Unless otherwise specified, the following embodiments take this situation as an example to describe the solutions of the embodiments of the present invention, and the storage medium takes a hard disk as an example.

需要说明的是,存储设备还可以是既有运算管理能力又有存储介质的存储设备,例如服务器。服务器中拥有运算管理能力的那部分相当于存储控制器。存储控制器和存储设备内部的存储介质通信,或者和存储设备外部的存储介质通信。由于原理类似,因此不做详述。It should be noted that the storage device may also be a storage device having both computing management capabilities and storage media, such as a server. The part of the server that has computing management capabilities is equivalent to the storage controller. The storage controller communicates with a storage medium inside the storage device, or communicates with a storage medium outside the storage device. Since the principle is similar, it will not be described in detail.

参见图2是本发明存储系统实施例结构图。主机11和存储系统12通信,存储系统包括存储控制器12和存储介质13。存储控制器12中有处理器121,缓存122,还可以有内存123。内存123可以为处理器121运行程序提供存储空间,通过运行程序,处理器可以执行本发明提供的缓存数据处理方法实施例。内存123和缓存122可以集成在一起,也可以分开。在图中存储控制器12和财产介质13是独立的。在其他实施例中,存储控制器12中也可以集成存储介质13,例如通用服务器。Referring to FIG. 2, it is a structural diagram of an embodiment of the storage system of the present invention. The host 11 communicates with the storage system 12 , and the storage system includes a storage controller 12 and a storage medium 13 . The storage controller 12 includes a processor 121 , a cache 122 and a memory 123 . The memory 123 may provide storage space for the processor 121 to run a program, and by running the program, the processor may execute the embodiment of the cache data processing method provided by the present invention. The memory 123 and the cache 122 can be integrated or separated. The storage controller 12 and the property medium 13 are independent in the figure. In other embodiments, the storage controller 12 may also integrate the storage medium 13, such as a general-purpose server.

缓存可以供主机11读写。由于缓存空间有限,因此在缓存空间变小时,需要把缓存中数据迁移到存储介质13中。具体而言是以分条为单位,把位于缓存121的分条的有效数据迁移到存储介质13中,这种迁移也称为下盘,下盘的越早,缓存能越早的腾出来空隙空间。The cache can be read and written by the host 11 . Since the cache space is limited, the data in the cache needs to be migrated to the storage medium 13 when the cache space becomes small. Specifically, the effective data of the stripes located in the cache 121 is migrated to the storage medium 13 in the unit of stripes. This migration is also called downloading the disk. The earlier the disk is downloaded, the earlier the cache can vacate the space. space.

在块(block)存储技术中,把缓存数据下盘是以分条作为粒度的,分条是逻辑单位,每个分条(stripe)由多个条带(strip)组成。在把数据从缓存下盘时,每个/每组硬盘存储所述分条的一个条带。以分条作为粒度把把缓存迁移到硬盘的过程中,并不意味着整个分条都是有效数据,可能分条的一部分是没有有效数据的,例如只有部分条带是有效数据,其余条带无有效数据。In the block storage technology, the cache data is downloaded to the disk with the granularity of stripes. A stripe is a logical unit, and each stripe is composed of multiple stripes. Each/each group of hard disks stores one stripe of the stripe when data is unloaded from the cache. In the process of migrating the cache to the hard disk with the stripe as the granularity, it does not mean that the entire stripe is valid data. It is possible that a part of the stripe has no valid data. For example, only part of the stripe is valid data, and the remaining stripes are valid data. No valid data.

一方面,是尽早下盘可以让缓存尽早获取空闲存储空间;另一方面,分条下盘后,分条中的有效数据和无效数据都会占用磁盘空间,如果分条尚未容纳尽量多的有效数据就下盘,会造成硬盘的利用率不高,因此从提高磁盘利用率的角度考虑,最好是不要尽早下盘,而是凑满分条再下盘。应用本发明实施例按照的算法,可以在这两个矛盾的需求之间做出更好的平衡。On the one hand, downloading the disk as soon as possible allows the cache to obtain free storage space as soon as possible; on the other hand, after the stripe is removed from the disk, the valid data and invalid data in the stripe will occupy the disk space. If the stripe has not yet accommodated as much valid data as possible Just downloading the disk will cause the utilization rate of the hard disk to be low. Therefore, from the perspective of improving the disk utilization rate, it is best not to download the disk as soon as possible, but to fill up the strips and then download the disk. By applying the algorithm according to the embodiment of the present invention, a better balance can be made between these two contradictory requirements.

参见附图3,是本发明缓存数据处理方法一种实施例流程图,可以由存储控制器执行。Referring to FIG. 3 , it is a flowchart of an embodiment of a cache data processing method of the present invention, which can be executed by a storage controller.

21,从内存中获取数据的重删比C,数据的压缩比D、以及平均分条填充率I。21. Obtain the data deduplication ratio C, the data compression ratio D, and the average stripe filling ratio I from the memory.

重删比C、压缩比D和平均分摊填充率I都是对历史数据的统计值。初始化的时候,都是1;但是随着系统的运行,由于不断有新分条被重删、压缩、填充处理,这3个值会动态变化的。这些数据被统计后可以存储在内存中,也可以存储在其他介质。The deduplication ratio C, the compression ratio D, and the average allocation fill rate I are all statistical values for historical data. When initialized, it is all 1; but with the operation of the system, these three values will change dynamically due to the continuous deduplication, compression, and filling of new stripes. After these data are counted, they can be stored in memory or other media.

对缓存中的各个分条而言,在被下盘前,可以对分条内的有效数据进行重复数据删除。对于分条中的每个块,如果硬盘中已经存在相同的块,说明这个块和硬盘现有的块重复,这个块可以不用下盘。这样可以减少下盘的数据量以及节约磁盘的存储空间。重删比C是统计过去一段时间内,缓存中分条重删前和重删后的数据量的比值。统计的分条范围可以是缓存中所有分条;也可以是一部分分条,例如下盘后的数据属于特定LUN的分条。重删比C最小值为1(在重复数据删除过程中,没有数据块因为重复被被删除,或者不执行重删)。在分条下盘前对分条数据进行重删,可以节约磁盘空间。For each stripe in the cache, before being removed from the disk, the valid data in the stripe can be deduplicated. For each block in the stripe, if the same block already exists in the hard disk, it means that this block is duplicated with the existing block on the hard disk, and this block does not need to be removed from the disk. This can reduce the amount of data to be downloaded and save the storage space of the disk. The deduplication ratio C is the ratio of the amount of data before and after deduplication in the cache over a period of time. The statistical stripe range can be all the stripes in the cache; it can also be a part of the stripes, for example, the data after downloading belongs to the stripes of a specific LUN. The minimum value of the deduplication ratio C is 1 (during the deduplication process, no data blocks are deleted due to duplication, or no deduplication is performed). The stripe data is deduplicated before the stripe is downloaded to save disk space.

对缓存中的各个分条而言,在被下盘前,除了进行重复数据删除,还可以对分条内的有效数据进行压缩。压缩可以在重复数据删除操作之后执行。压缩比D是统计过去一段时间内,缓存中的分条压缩前和压缩后的数据量的比值。理论上,压缩比D的最小值是1(执行了压缩操作,但是没有数据被压缩成功;或者没有执行压缩操作)。在分条下盘前对分条数据进行压缩,可以节约磁盘空间。统计的分条范围可以是缓存中所有分条;也可以是一部分分条,例如下盘后的数据属于特定LUN的分条。For each stripe in the cache, before being removed from the disk, in addition to deduplication, the valid data in the stripe can also be compressed. Compression can be performed after deduplication operations. The compression ratio D is the ratio of the amount of data before and after the stripe compression in the cache in the past period of time. Theoretically, the minimum value of the compression ratio D is 1 (the compression operation is performed, but no data is successfully compressed; or the compression operation is not performed). The stripe data is compressed before the stripe is downloaded to the disk, which can save disk space. The statistical stripe range can be all the stripes in the cache; it can also be a part of the stripes, for example, the data after downloading belongs to the stripes of a specific LUN.

平均分条填充率I,是统计过去一段时间内,缓存中各分条有效数据占分条总长度的比值的平均值。其中,计算平均分条填充率I时,统计的有效数据可以是执行完压缩操作和重删操作之后的有效数据。统计的分条范围可以是缓存中所有分条;也可以是一部分分条,例如下盘后的数据属于特定LUN的分条。The average stripe filling rate I is the average value of the ratio of the valid data of each stripe in the cache to the total stripe length in the past period of time. Wherein, when calculating the average stripe filling rate I, the effective data to be counted may be the effective data after the compression operation and the deduplication operation are performed. The statistical stripe range can be all the stripes in the cache; it can also be a part of the stripes, for example, the data after downloading belongs to the stripes of a specific LUN.

需要说明的是,本发明实施例描述了内存和缓存这两个概念。缓本发明实施例中的内存(memory)例如是RAM,可以暂时存放CPU中的运算数据,为计算机运行程序提供空间。存可以是内存的一部分,也可以和内存是在物理上分开。缓存(cache)在本发明实施例中可以用于暂时存放分条;缓存可以同样是RAM,也可以是固态硬盘SSD等其他介质。It should be noted that the embodiments of the present invention describe two concepts of memory and cache. The memory in the embodiment of the present invention is, for example, a RAM, which can temporarily store operation data in the CPU and provide space for the computer to run programs. Memory can be part of memory, or it can be physically separate from memory. In this embodiment of the present invention, a cache (cache) may be used to temporarily store stripes; the cache may also be RAM, or may be other media such as solid-state drives (SSDs).

22,获取内存中目标分条大小S、所述目标分条中有效数据大小W。22. Obtain the target stripe size S in the memory and the effective data size W in the target stripe.

目标分条大小S可以用目标分条的长度进行描述,单位例如是字节(Byte)。也可以用单位长度的数量描述,比如用目标分条占用的缓存页(cache page)的数量来描述。The target strip size S can be described by the length of the target strip, and the unit is, for example, bytes. It can also be described in terms of unit length, such as the number of cache pages occupied by the target stripe.

类似的,目标分条中有效数据大小W可以用目标分条的长度进行描述,单位是字节(Byte);也可以用单位长度的数量描述。目标分条中有效数据大小W的描述方式和目标分条大小S的描述方式保持一致。Similarly, the effective data size W in the target stripe can be described by the length of the target stripe, and the unit is Byte; it can also be described by the quantity of the unit length. The description method of the effective data size W in the target stripe is consistent with the description method of the target stripe size S.

按照公式N=(S*D*C-W)/I,获取淘汰数据量N,按照N的取值范围执行下述操作中的一个:According to the formula N=(S*D*C-W)/I, obtain the amount of eliminated data N, and perform one of the following operations according to the value range of N:

23,按照公式

Figure BDA0001197606330000081
获取淘汰数据量N。23, according to the formula
Figure BDA0001197606330000081
Get the amount of obsolete data N.

其中,压缩比C、重删比D是可选的。如果没有压缩,则没有压缩比C;如果没有重删,则没有重删比D。The compression ratio C and the deduplication ratio D are optional. If there is no compression, there is no compression ratio C; if there is no deduplication, there is no deduplication ratio D.

在首次对缓存中的的数据使用本实施例进行处理时,由于历史上没有分条被处理,因此可以缺省为D=1,C=1,I=1。When using this embodiment to process the data in the cache for the first time, since no stripe has been processed in the history, D=1, C=1, and I=1 by default.

显然,N的单位和S、W保持一致。当S的单位是字节时,N的单位也是字节。N的实际取值可以是下盘的最小单位的整数倍,并且与(S*D*C-W)/I的差值小于一个最小单位。例如下盘的最小单位是10字节,(S*D*C-W)/I的计算结果是54字节,那么一种可选方式是N的值是50字节;另外一种可选方式是N的值是60字节。Obviously, the unit of N is the same as that of S and W. When the unit of S is bytes, the unit of N is also bytes. The actual value of N may be an integer multiple of the minimum unit of the lower disk, and the difference from (S*D*C-W)/I is less than one minimum unit. For example, the minimum unit of the lower disk is 10 bytes, and the calculation result of (S*D*C-W)/I is 54 bytes, then an optional method is that the value of N is 50 bytes; another optional method is The value of N is 60 bytes.

当S由缓存页的数量描述时,N也是缓存页的数量。此时,如果(S*D*C-W)/I的计算结果是小数,N的实际取值可以是(S*D*C-W)/I进行取整后的值,一种可选方式是向下取整例如(S*D*C-W)/I的计算结果是10.3个缓存页,那么N的取值可以是10个缓存页。在另外一种实施方式中,也可以是向上取整,10.3个缓存页取整为11个缓存页。While S is described by the number of cached pages, N is also the number of cached pages. At this time, if the calculation result of (S*D*C-W)/I is a decimal, the actual value of N can be the rounded value of (S*D*C-W)/I, an optional way is to down For example, if the calculation result of (S*D*C-W)/I is 10.3 cache pages, the value of N can be 10 cache pages. In another implementation manner, it may also be rounded up, and 10.3 cache pages are rounded up to 11 cache pages.

24,按照淘汰数据量N的值,执行相应的操作。24. Perform a corresponding operation according to the value of the eliminated data amount N.

(1)在Tmin≤N≤Tmax的情况下,将大小为N的数据写入所述目标分条,然后把所述目标分条的数据淘汰到持久化存储介质(SSD、硬盘等)。在把大小为N的数据写入所述目标分条后,目标分条的当前数据=大小为N的数据+目标分条原有数据。(1) In the case of T min ≤ N ≤ T max , write the data of size N into the target stripe, and then eliminate the data of the target stripe to the persistent storage medium (SSD, hard disk, etc.) . After data of size N is written into the target strip, current data of the target strip = data of size N + original data of the target strip.

其中Tmin是预设的第一阈值,TmaX是预设的第二阈值。Tmin和Tmax。的单位和N一致。Tmin和Tmax在不同的场景下,可以需求的不同,可以有不同的设置,因此不做限定。例如Tmin的取值可以为分条长度*C*D的10%,而Tmax的取值可以为分条长度*C*D的80%。Wherein T min is a preset first threshold value, and T maX is a preset second threshold value. Tmin and Tmax . The unit is the same as N. In different scenarios, T min and T max may have different requirements and may have different settings, so they are not limited. For example, the value of T min may be 10% of the strip length*C*D, and the value of T max may be 80% of the strip length*C*D.

(2)在N>Tmax的情况下,将大小为N的数据写入所述目标分条。和(1)的区别是,可以暂时不对目标分条执行下盘操作。在后续有新的数据被写入这个分条,使得分条被写满后再把这个分条淘汰到持久化存储介质存储介质。(2) In the case of N>T max , write data of size N into the target stripe. The difference from (1) is that the target stripe operation can be temporarily not performed. Later, new data is written to this stripe, so that the stripe is full, and then this stripe is eliminated to the persistent storage medium storage medium.

(3)在N<Tmin的情况下,把所述目标分条的数据淘汰到持久化存储介质。和(1)的区别是,不把大小为N的数据的数据写入目标分条,直接对目标分条进行下盘。(3) In the case of N<T min , the data of the target stripe is eliminated to the persistent storage medium. The difference from (1) is that the data of the size N is not written into the target stripe, and the target stripe is directly unloaded.

需要说明的是,上述(1)和(2)都涉及把缓存的数据写入目标分条。这种写操作逻辑上的,可以理解为把不属于目标分条的数据归属于目标分条。写操作执行完以后,被写的数据在物理上仍然位于缓存中。但是在逻辑层面,把大小为N的数据写入目标分条,是把位于缓存层的数据写入了存储池(storage pool)层。缓存层用于为主机提供读写,主要和主机进行交互;而存储池是用于暂存准备写入硬盘的数据,主要和硬盘进行交互,因此这是两个不同的功能层。It should be noted that both (1) and (2) above involve writing the cached data to the target stripe. Logically, this write operation can be understood as attributing data that does not belong to the target stripe to the target stripe. After the write operation is performed, the written data is still physically located in the cache. But at the logical level, writing data of size N to the target stripe writes the data in the cache layer to the storage pool layer. The cache layer is used to provide read and write for the host and mainly interacts with the host; while the storage pool is used to temporarily store the data to be written to the hard disk and mainly interact with the hard disk, so these are two different functional layers.

为了方便理解,下面以一个具体的示例对上述实施例进行介绍。For the convenience of understanding, the foregoing embodiment is described below with a specific example.

例如:从内存中获取:当前的重删率为2,当前的压缩率为4,当前的统计的分条平均填充率I=0.9。缓存页的大小为4KB,分条大小为8MB,即S=(8MB/4KB)=2K,当前分条已经写入了15K个缓存页,假设Tmin=128,Tmax=4K。For example, obtain from memory: the current deduplication rate is 2, the current compression rate is 4, and the current statistical average fill rate of stripes is I=0.9. The size of the cache page is 4KB, and the stripe size is 8MB, that is, S=(8MB/4KB)=2K. The current stripe has written 15K cache pages, assuming Tmin=128, Tmax=4K.

根据公式(S*D*C-W)/I=(2K*2*4-15K)/0.9≈1137.8。向下取整为N=1137。According to the formula (S*D*C-W)/I=(2K*2*4-15K)/0.9≈1137.8. Round down to N=1137.

符合第(2)种情形Tmin<N<Tmax。因此,按照本发明实施例,将1137个缓存页的数据写入当前分条,然后把当前分条中的所有数据发送到硬盘中去。发送完成后,释放目标分条在缓存中占用的存储空间。在这个示例中,之所以使用缓存页的数量作为S,是考虑到把缓存中的数据下发到硬盘中时,以缓存页作为粒度是一种常见的做法。在其他实施例中可以有其他方案,例如以分条大小除以缓存页的倍数作为S。在另外的实施例中,可能没有缓存页的概念,以分条大小下盘的最小粒度或者最小粒度的整数倍即可。或者直接以分条大小作为S,在算出来N的值以后,再换算成缓存页的数量。Consistent with the case (2) Tmin<N<Tmax. Therefore, according to the embodiment of the present invention, the data of 1137 cache pages is written into the current stripe, and then all the data in the current stripe is sent to the hard disk. After the sending is completed, the storage space occupied by the target stripe in the cache is released. In this example, the number of cached pages is used as S because it is a common practice to use cached pages as the granularity when sending data in the cache to the hard disk. In other embodiments, there may be other schemes, for example, the stripe size divided by the multiple of the cache page is used as S. In another embodiment, there may be no concept of cache pages, and the minimum granularity of the disk or an integer multiple of the minimum granularity may be used as the stripe size. Or directly use the stripe size as S, and after calculating the value of N, convert it into the number of cache pages.

参见图4,本发明还提供一种缓存数据处理装置实施例。缓存数据处理装置3是硬件或者程序虚拟装置,可以执行上述方法。缓存数据处理装置3包括:参数获取模块,和参数获取模块连接的计算模块32,和计算模块32连接的数据处理模块33。Referring to FIG. 4 , the present invention further provides an embodiment of an apparatus for processing cached data. The cache data processing device 3 is a hardware or program virtual device, and can execute the above method. The cache data processing device 3 includes: a parameter acquisition module, a calculation module 32 connected to the parameter acquisition module, and a data processing module 33 connected to the calculation module 32 .

所述参数获取模块,用于获取数据的压缩比D、重删比C、以及平均分条填充率I,还用于获取缓存中目标分条大小S、所述目标分条中有效数据大小W。The parameter obtaining module is used to obtain the compression ratio D, the deduplication ratio C, and the average strip filling rate I of the data, and is also used to obtain the target strip size S in the cache and the effective data size W in the target strip .

所述计算模块32,用于按照公式获取淘汰数据量N。The calculation module 32 is used to calculate according to the formula Get the amount of obsolete data N.

所述数据处理模块33,用于根据N的取值执行下述操作中的一个:在Tmin≤N≤Tmax的情况下,将大小为N的数据写入所述目标分条,把所述目标分条的数据淘汰给存储介质,其中当Tmin是预设的第一阈值,Tmax是预设的第二阈值;在N>Tmax的情况下,将大小为N的数据写入所述目标分条;在N<Tmin的情况下,把所述目标分条的数据淘汰给所述存储介质。The data processing module 33 is configured to perform one of the following operations according to the value of N: in the case of T min ≤ N ≤ T max , write data with a size of N into the target stripe, and The data of the target stripe is eliminated to the storage medium, wherein when T min is the preset first threshold value, T max is the preset second threshold value; in the case of N>T max , the data of size N is written into the target stripe; in the case of N<T min , the data of the target stripe is eliminated to the storage medium.

下面对各模块功能进行具体介绍。The function of each module is introduced in detail below.

参数获取模块,用于从内存中获取数据的重删比C,数据的压缩比D、以及平均分条填充率I。The parameter obtaining module is used to obtain the data deduplication ratio C, the data compression ratio D, and the average stripe filling ratio I from the memory.

重删比C、压缩比D和平均分摊填充率I都是对历史数据的统计值。初始化的时候,都是1;但是随着系统的运行,由于不断有新分条被重删、压缩、填充处理,这3个值会动态变化的。这些数据被统计后可以存储在内存中,也可以存储在其他介质。The deduplication ratio C, the compression ratio D, and the average allocation fill rate I are all statistical values for historical data. When initialized, it is all 1; but with the operation of the system, these three values will change dynamically due to the continuous deduplication, compression, and filling of new stripes. After these data are counted, they can be stored in memory or other media.

对缓存中的各个分条而言,在被下盘前,可以对分条内的有效数据进行重复数据删除。对于分条中的每个块,如果硬盘中已经存在相同的块,说明这个块和硬盘现有的块重复,这个块可以不用下盘。这样可以减少下盘的数据量以及节约磁盘的存储空间。重删比C是统计过去一段时间内,缓存中分条重删前和重删后的数据量的比值。统计的分条范围可以是缓存中所有分条;也可以是一部分分条,例如下盘后的数据属于特定LUN的分条。重删比C最小值为1(在重复数据删除过程中,没有数据块因为重复被被删除,或者不执行重删)。在分条下盘前对分条数据进行重删,可以节约磁盘空间。For each stripe in the cache, before being removed from the disk, the valid data in the stripe can be deduplicated. For each block in the stripe, if the same block already exists in the hard disk, it means that this block is duplicated with the existing block on the hard disk, and this block does not need to be removed from the disk. This can reduce the amount of data to be downloaded and save the storage space of the disk. The deduplication ratio C is the ratio of the amount of data before and after deduplication in the cache over a period of time. The statistical stripe range can be all the stripes in the cache; it can also be a part of the stripes, for example, the data after downloading belongs to the stripes of a specific LUN. The minimum value of the deduplication ratio C is 1 (during the deduplication process, no data blocks are deleted due to duplication, or no deduplication is performed). The stripe data is deduplicated before the stripe is downloaded to save disk space.

对缓存中的各个分条而言,在被下盘前,除了进行重复数据删除,还可以对分条内的有效数据进行压缩。压缩可以在重复数据删除操作之后执行。压缩比D是统计过去一段时间内,缓存中的分条压缩前和压缩后的数据量的比值。理论上,压缩比D的最小值是1(执行了压缩操作,但是没有数据被压缩成功;或者没有执行压缩操作)。在分条下盘前对分条数据进行压缩,可以节约磁盘空间。统计的分条范围可以是缓存中所有分条;也可以是一部分分条,例如下盘后的数据属于特定LUN的分条。For each stripe in the cache, before being removed from the disk, in addition to deduplication, the valid data in the stripe can also be compressed. Compression can be performed after deduplication operations. The compression ratio D is the ratio of the amount of data before and after the stripe compression in the cache in the past period of time. Theoretically, the minimum value of the compression ratio D is 1 (the compression operation is performed, but no data is successfully compressed; or the compression operation is not performed). The stripe data is compressed before the stripe is downloaded to the disk, which can save disk space. The statistical stripe range can be all the stripes in the cache; it can also be a part of the stripes, for example, the data after downloading belongs to the stripes of a specific LUN.

平均分条填充率I,是统计过去一段时间内,缓存中各分条有效数据占分条总长度的比值的平均值。其中,计算平均分条填充率I时,统计的有效数据可以是执行完压缩操作和重删操作之后的有效数据。统计的分条范围可以是缓存中所有分条;也可以是一部分分条,例如下盘后的数据属于特定LUN的分条。The average stripe filling rate I is the average value of the ratio of the valid data of each stripe in the cache to the total stripe length in the past period of time. Wherein, when calculating the average stripe filling rate I, the effective data to be counted may be the effective data after the compression operation and the deduplication operation are performed. The statistical stripe range can be all the stripes in the cache; it can also be a part of the stripes, for example, the data after downloading belongs to the stripes of a specific LUN.

需要说明的是,本发明实施例描述了内存和缓存这两个概念。缓本发明实施例中的内存(memory)例如是RAM,可以暂时存放CPU中的运算数据,为计算机运行程序提供空间。存可以是内存的一部分,也可以和内存是在物理上分开。缓存(cache)在本发明实施例中可以用于暂时存放分条;缓存可以同样是RAM,也可以是固态硬盘SSD等其他介质。It should be noted that the embodiments of the present invention describe two concepts of memory and cache. The memory in the embodiment of the present invention is, for example, a RAM, which can temporarily store operation data in the CPU and provide space for the computer to run programs. Memory can be part of memory, or it can be physically separate from memory. In this embodiment of the present invention, a cache (cache) may be used to temporarily store stripes; the cache may also be RAM, or may be other media such as solid-state drives (SSDs).

参数获取模块,用于获取内存中目标分条大小S、所述目标分条中有效数据大小W。The parameter obtaining module is used to obtain the target strip size S in the memory and the effective data size W in the target strip.

目标分条大小S可以用目标分条的长度进行描述,单位例如是字节(Byte)。也可以用单位长度的数量描述,比如用目标分条占用的缓存页(cache page)的数量来描述。The target strip size S can be described by the length of the target strip, and the unit is, for example, bytes. It can also be described in terms of unit length, such as the number of cache pages occupied by the target stripe.

类似的,目标分条中有效数据大小W可以用目标分条的长度进行描述,单位是字节(Byte);也可以用单位长度的数量描述。目标分条中有效数据大小W的描述方式和目标分条大小S的描述方式保持一致。Similarly, the effective data size W in the target stripe can be described by the length of the target stripe, and the unit is Byte; it can also be described by the quantity of the unit length. The description method of the effective data size W in the target stripe is consistent with the description method of the target stripe size S.

按照公式N=(S*D*C-W)/I,获取淘汰数据量N,按照N的取值范围执行下述操作中的一个:According to the formula N=(S*D*C-W)/I, obtain the amount of eliminated data N, and perform one of the following operations according to the value range of N:

计算模块32,用于按照公式

Figure BDA0001197606330000121
获取淘汰数据量N。calculation module 32 for following the formula
Figure BDA0001197606330000121
Get the amount of obsolete data N.

其中,压缩比C、重删比D是可选的。如果没有压缩,则没有压缩比C;如果没有重删,则没有重删比D。The compression ratio C and the deduplication ratio D are optional. If there is no compression, there is no compression ratio C; if there is no deduplication, there is no deduplication ratio D.

在首次对缓存中的的数据使用本实施例进行处理时,由于历史上没有分条被处理,因此可以缺省为D=1,C=1,I=1。When using this embodiment to process the data in the cache for the first time, since no stripe has been processed in the history, D=1, C=1, and I=1 by default.

显然,N的单位和S、W保持一致。当S的单位是字节时,N的单位也是字节。N的实际取值可以是下盘的最小单位的整数倍,并且与Obviously, the unit of N is the same as that of S and W. When the unit of S is bytes, the unit of N is also bytes. The actual value of N can be an integer multiple of the minimum unit of the lower disk, and is the same as

(S*D*C-W)/I的差值小于一个最小单位。例如下盘的最小单位是10字节,(S*D*C-W)/I的计算结果是54字节,那么一种可选方式是N的值是50字节;另外一种可选方式是N的值是60字节。The difference of (S*D*C-W)/I is less than one minimum unit. For example, the minimum unit of the lower disk is 10 bytes, and the calculation result of (S*D*C-W)/I is 54 bytes, then an optional method is that the value of N is 50 bytes; another optional method is The value of N is 60 bytes.

当S由缓存页的数量描述时,N也是缓存页的数量。此时,如果(S*D*C-W)/I的计算结果是小数,N的实际取值可以是(S*D*C-W)/I进行取整后的值,一种可选方式是向下取整例如(S*D*C-W)/I的计算结果是10.3个缓存页,那么N的取值可以是10个缓存页。在另外一种实施方式中,也可以是向上取整,10.3个缓存页取整为11个缓存页。While S is described by the number of cached pages, N is also the number of cached pages. At this time, if the calculation result of (S*D*C-W)/I is a decimal, the actual value of N can be the rounded value of (S*D*C-W)/I, an optional way is to down For example, if the calculation result of (S*D*C-W)/I is 10.3 cache pages, the value of N can be 10 cache pages. In another implementation manner, it may also be rounded up, and 10.3 cache pages are rounded up to 11 cache pages.

34,按照淘汰数据量N的值,执行相应的操作。34. Perform a corresponding operation according to the value of the eliminated data amount N.

(1)在Tmin≤N≤TmaX的情况下,将大小为N的数据写入所述目标分条,然后把所述目标分条的数据淘汰到持久化存储介质(SSD、硬盘等)。在把大小为N的数据写入所述目标分条后,目标分条的当前数据=大小为N的数据+目标分条原有数据。(1) In the case of T min≤N≤T maX , write the data of size N into the target stripe, and then eliminate the data of the target stripe to the persistent storage medium (SSD, hard disk, etc.) . After data of size N is written into the target strip, current data of the target strip = data of size N + original data of the target strip.

其中Tmin是预设的第一阈值,Tmax是预设的第二阈值。Tmin和Tmax。的单位和N一致。Tmin和Tmax在不同的场景下,可以需求的不同,可以有不同的设置,因此不做限定。例如Tmin的取值可以为分条长度*C*D的10%,而Tmax的取值可以为分条长度*C*D的80%。Wherein T min is a preset first threshold value, and T max is a preset second threshold value. Tmin and Tmax . The unit is the same as N. In different scenarios, T min and T max may have different requirements and may have different settings, so they are not limited. For example, the value of T min may be 10% of the strip length*C*D, and the value of T max may be 80% of the strip length*C*D.

(2)在N>Tmax的情况下,将大小为N的数据写入所述目标分条。和(1)的区别是,可以暂时不对目标分条执行下盘操作。在后续有新的数据被写入这个分条,使得分条被写满后再把这个分条淘汰到持久化存储介质存储介质。(2) In the case of N>T max , write data of size N into the target stripe. The difference from (1) is that the target stripe operation can be temporarily not performed. Later, new data is written to this stripe, so that the stripe is full, and then this stripe is eliminated to the persistent storage medium storage medium.

(3)在N<Tmin的情况下,把所述目标分条的数据淘汰到持久化存储介质。和(1)的区别是,不把大小为N的数据的数据写入目标分条,直接对目标分条进行下盘。(3) In the case of N<T min , the data of the target stripe is eliminated to the persistent storage medium. The difference from (1) is that the data of the size N is not written into the target stripe, and the target stripe is directly unloaded.

需要说明的是,上述(1)和(2)都涉及把缓存的数据写入分条。这种写操作逻辑上的,把不属于目标分条的数据归属于目标分条。写操作执行完以后,被写的数据在物理上仍然位于缓存中。但是在逻辑层面,这是把缓存层的数据写入了存储池(storage pool)。缓存层用于为主机提供读写,主要和主机进行交互;而存储池是用于暂存准备写入硬盘的数据,主要和硬盘进行交互,因此这是两个不同的功能层。步骤31、32和33是由缓存池层执行的。It should be noted that both (1) and (2) above involve writing the cached data to the stripe. This write operation logically attributes data that does not belong to the target stripe to the target stripe. After the write operation is performed, the written data is still physically located in the cache. But at the logical level, this is writing the data of the cache layer to the storage pool. The cache layer is used to provide read and write for the host and mainly interacts with the host; while the storage pool is used to temporarily store the data to be written to the hard disk and mainly interact with the hard disk, so these are two different functional layers. Steps 31, 32 and 33 are performed by the buffer pool layer.

为了方便理解,下面以一个具体的示例对上述实施例进行介绍。For the convenience of understanding, the foregoing embodiment is described below with a specific example.

例如:从内存中获取:当前的重删率为2,当前的压缩率为4,当前的统计的分条平均填充率I=0.9。缓存页的大小为4KB,分条大小为8MB,即S=(8MB/4KB)=2K,当前分条已经写入了15K个缓存页,假设Tmin=128,Tmax=4K。For example, obtain from memory: the current deduplication rate is 2, the current compression rate is 4, and the current statistical average fill rate of stripes is I=0.9. The size of the cache page is 4KB, and the stripe size is 8MB, that is, S=(8MB/4KB)=2K. The current stripe has written 15K cache pages, assuming Tmin=128, Tmax=4K.

根据公式(S*D*C-W)/I=(2K*2*4-15K)/0.9≈1137.8。向下取整为N=1137。According to the formula (S*D*C-W)/I=(2K*2*4-15K)/0.9≈1137.8. Round down to N=1137.

符合第(2)种情形Tmin<N<Tmax。因此,按照本发明实施例,将1137个缓存页的数据写入当前分条,然后把当前分条中的所有数据发送到硬盘中去。发送完成后,释放目标分条在缓存中占用的存储空间。在这个示例中,之所以使用缓存页的数量作为S,是考虑到把缓存中的数据下发到硬盘中时,以缓存页作为粒度是一种常见的做法。在其他实施例中可以有其他方案,例如以分条大小除以缓存页的倍数作为S。在另外的实施例中,可能没有缓存页的概念,以分条大小下盘的最小粒度或者最小粒度的整数倍即可。或者直接以分条大小作为S,在算出来N的值以后,再换算成缓存页的数量。Consistent with the case (2) Tmin<N<Tmax. Therefore, according to the embodiment of the present invention, the data of 1137 cache pages is written into the current stripe, and then all the data in the current stripe is sent to the hard disk. After the sending is completed, the storage space occupied by the target stripe in the cache is released. In this example, the number of cached pages is used as S because it is a common practice to use cached pages as the granularity when sending data in the cache to the hard disk. In other embodiments, there may be other schemes, for example, the stripe size divided by the multiple of the cache page is used as S. In another embodiment, there may be no concept of cache pages, and the minimum granularity of the disk or an integer multiple of the minimum granularity may be used as the stripe size. Or directly use the stripe size as S, and after calculating the value of N, convert it into the number of cache pages.

结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。The units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of the present invention.

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,基于本发明的变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应所述以权利要求的保护范围为准。The above descriptions are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto, and changes or substitutions based on the present invention should be included within the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims (11)

1. A method for processing cache data, the method comprising:
acquiring a compression ratio D, a deduplication ratio C and an average stripe filling rate I of data, and acquiring a target stripe size S in a cache and an effective data size W in the target stripe;
according to the formula
Figure FDA0002207518490000011
Obtaining eliminated data quantity N, and executing one of the following operations according to the value of N:
at Tmin≤N≤TmaxWriting data of size N into the target stripe, and eliminating the data of the target stripe to the storage medium, wherein when T isminIs a preset first threshold value, TmaxIs a preset second threshold;
at N > TmaxWriting data of size N into the target stripe;
at N < TminIn case of (2), evicting the target stripe data to the storage medium.
2. The method of cache data processing according to claim 1, wherein after writing data of size N to the target stripe, further comprising:
and eliminating the target stripe to the storage medium after the target stripe is fully written with subsequent data.
3. The cache data processing method according to claim 1, wherein:
the initial values of D, C and I are both 1.
4. The cache data processing method of claim 1, further comprising:
where S is described by the number of cache pages.
5. A cache data processing apparatus, comprising:
the device comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a compression ratio D, a deduplication ratio C and an average stripe filling rate I of data, and is also used for acquiring a target stripe size S in a cache and an effective data size W in the target stripe;
a calculation module for following the formula
Figure FDA0002207518490000012
Obtaining eliminated data quantity N;
a data processing module, configured to perform one of the following operations according to the value of N:
at Tmin≤N≤TmaxWriting data of size N into the target stripe, and eliminating the data of the target stripe to the storage medium, wherein when T isminIs a preset first threshold value, TmaxIs a preset second threshold;
at N > TmaxWriting data of size N into the target stripe;
at N < TminIn case of (2), evicting the target stripe data to the storage medium.
6. The cache data processing apparatus of claim 5, wherein the processing module is further to:
after data of size N is written into the target stripe, if the target stripe is full of subsequent data, the target stripe is evicted to the storage medium.
7. The cache data processing apparatus of claim 5, wherein:
the initial values of D, C and I are both 1.
8. The cache data processing apparatus of claim 5, wherein:
the S is described by the number of cache pages.
9. A memory controller, comprising a processor and a buffer for temporarily storing data, wherein the processor executes by running a program to:
the method comprises the steps of obtaining a compression ratio D, a deduplication ratio C and an average stripe filling rate I of data, and also obtaining a target stripe size S in a cache and an effective data size W in the target stripe;
according to the formulaObtaining eliminated data quantity N;
and executing one of the following operations according to the value of N: at Tmin≤N≤TmaxWriting data of size N into the target stripe, and eliminating the data of the target stripe to the storage medium, wherein when T isminIs a preset first threshold value, TmaxIs a preset second threshold; at N > TmaxWriting data of size N into the target stripe; at N < TminIn case of (2), evicting the target stripe data to the storage medium.
10. The storage controller of claim 9, the processor further to:
after data of size N is written into the target stripe, if the target stripe is full of subsequent data, the target stripe is evicted to the storage medium.
11. A storage medium characterized in that,
the storage medium stores a computer program which, when executed by a processor, is capable of implementing the method of any one of claims 1 to 4.
CN201611248587.3A 2016-12-29 2016-12-29 A cache data processing method, device and storage controller Active CN106648469B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201611248587.3A CN106648469B (en) 2016-12-29 2016-12-29 A cache data processing method, device and storage controller
PCT/CN2017/118147 WO2018121455A1 (en) 2016-12-29 2017-12-23 Cached-data processing method and device, and storage controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611248587.3A CN106648469B (en) 2016-12-29 2016-12-29 A cache data processing method, device and storage controller

Publications (2)

Publication Number Publication Date
CN106648469A CN106648469A (en) 2017-05-10
CN106648469B true CN106648469B (en) 2020-01-17

Family

ID=58836364

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611248587.3A Active CN106648469B (en) 2016-12-29 2016-12-29 A cache data processing method, device and storage controller

Country Status (2)

Country Link
CN (1) CN106648469B (en)
WO (1) WO2018121455A1 (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106648469B (en) * 2016-12-29 2020-01-17 华为技术有限公司 A cache data processing method, device and storage controller
CN107153619A (en) * 2017-06-14 2017-09-12 湖南国科微电子股份有限公司 Solid state hard disc data cache method and device
WO2019084917A1 (en) 2017-11-03 2019-05-09 华为技术有限公司 Method and apparatus for calculating available capacity of storage system
CN109086172B (en) * 2018-09-21 2022-12-06 郑州云海信息技术有限公司 A data processing method and related device
CN110222048B (en) * 2019-05-06 2023-06-23 平安科技(深圳)有限公司 Sequence generation method, device, computer equipment and storage medium
CN110765031B (en) * 2019-09-27 2022-08-12 Oppo广东移动通信有限公司 Data storage method, device, mobile terminal and storage medium
CN111124307B (en) * 2019-12-20 2022-06-07 北京浪潮数据技术有限公司 Data downloading and brushing method, device, equipment and readable storage medium
CN112799978B (en) * 2021-01-20 2023-03-21 网易(杭州)网络有限公司 Cache design management method, device, equipment and computer readable storage medium
CN113726341B (en) * 2021-08-25 2023-09-01 杭州海康威视数字技术股份有限公司 Data processing method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102023810A (en) * 2009-09-10 2011-04-20 成都市华为赛门铁克科技有限公司 Method and device for writing data and redundant array of inexpensive disk
CN102223510A (en) * 2011-06-03 2011-10-19 杭州华三通信技术有限公司 Method and device for scheduling cache
CN103729149A (en) * 2013-12-31 2014-04-16 创新科存储技术有限公司 Data storage method
CN105389387A (en) * 2015-12-11 2016-03-09 上海爱数信息技术股份有限公司 Compression based deduplication performance and deduplication rate improving method and system

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2366014B (en) * 2000-08-19 2004-10-13 Ibm Free space collection in information storage systems
US8060715B2 (en) * 2009-03-31 2011-11-15 Symantec Corporation Systems and methods for controlling initialization of a fingerprint cache for data deduplication
CN106681934B (en) * 2014-03-19 2020-09-11 华为技术有限公司 Method and device for recycling garbage of storage device
CN106648469B (en) * 2016-12-29 2020-01-17 华为技术有限公司 A cache data processing method, device and storage controller

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102023810A (en) * 2009-09-10 2011-04-20 成都市华为赛门铁克科技有限公司 Method and device for writing data and redundant array of inexpensive disk
CN102223510A (en) * 2011-06-03 2011-10-19 杭州华三通信技术有限公司 Method and device for scheduling cache
CN103729149A (en) * 2013-12-31 2014-04-16 创新科存储技术有限公司 Data storage method
CN105389387A (en) * 2015-12-11 2016-03-09 上海爱数信息技术股份有限公司 Compression based deduplication performance and deduplication rate improving method and system

Also Published As

Publication number Publication date
WO2018121455A1 (en) 2018-07-05
CN106648469A (en) 2017-05-10

Similar Documents

Publication Publication Date Title
CN106648469B (en) A cache data processing method, device and storage controller
US11119668B1 (en) Managing incompressible data in a compression-enabled log-structured array storage system
US8645626B2 (en) Hard disk drive with attached solid state drive cache
US10216446B2 (en) Method for deduplication in storage system, storage system, and controller
US10747440B2 (en) Storage system and storage system management method
US20150363134A1 (en) Storage apparatus and data management
CN108108311A (en) The control method of storage device and storage device
US11740792B2 (en) Techniques for data storage management
CN108604165A (en) Storage device
US11630779B2 (en) Hybrid storage device with three-level memory mapping
US11093134B2 (en) Storage device, management method, and program in tiered storage system
WO2023065654A1 (en) Data writing method and related device
US12066929B2 (en) Techniques for efficient address translation using metadata with mixed mapping schemes
US11487456B1 (en) Updating stored content in an architecture utilizing a middle map between logical and physical block addresses
US11579786B2 (en) Architecture utilizing a middle map between logical to physical address mapping to support metadata updates for dynamic block relocation
US12229056B2 (en) Caching techniques using a mapping cache and maintaining cache coherency using hash values
WO2025021047A1 (en) Command processing method, log processing method, and storage device
US12393516B2 (en) Efficient deduplication in a metadata delta log architecture
US12093183B1 (en) Caching techniques using a mapping cache and maintaining cache coherency using physical to logical address mapping
US12307105B1 (en) Storage space accounting techniques allowing storage object identifier reuse and reassignment
US12164770B2 (en) Caching techniques using a unified cache of metadata leaf objects with mixed pointer types and lazy content resolution
US12222862B2 (en) Caching techniques using a two-level read cache
US20250328469A1 (en) Caching techniques using a mapping cache and a data cache
US12299303B2 (en) Dynamic reserve capacity in storage systems
US11748300B2 (en) Reverse deletion of a chain of snapshots

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant