WO2012149815A1 - 磁盘缓存的管理方法及装置 - Google Patents

磁盘缓存的管理方法及装置 Download PDF

Info

Publication number
WO2012149815A1
WO2012149815A1 PCT/CN2011/081634 CN2011081634W WO2012149815A1 WO 2012149815 A1 WO2012149815 A1 WO 2012149815A1 CN 2011081634 W CN2011081634 W CN 2011081634W WO 2012149815 A1 WO2012149815 A1 WO 2012149815A1
Authority
WO
WIPO (PCT)
Prior art keywords
area
group
block
disk
disk cache
Prior art date
Application number
PCT/CN2011/081634
Other languages
English (en)
French (fr)
Inventor
温正湖
秦岭
王婷
章晓峰
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2011/081634 priority Critical patent/WO2012149815A1/zh
Priority to CN201180006548.1A priority patent/CN102763070B/zh
Publication of WO2012149815A1 publication Critical patent/WO2012149815A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0866Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches for peripheral storage systems, e.g. disk cache

Definitions

  • the present invention relates to the field of data storage, and in particular, to a method and an apparatus for managing a disk cache.
  • Solid state drive SSD is a flash media suitable for disk/memory cache cache. The speed is between memory and disk, and it is non-validate. Memory can basically avoid data loss.
  • a disk cache such as SSD, PCM, etc.
  • the CPU is used.
  • the group associative mode is used as the address mapping mode of the disk HDD to the cache SSD, and the space of the SSD is equally divided into several group sets, each set consists of 512 SSD data blocks by default, each data block. The default is 4KB size; the same is divided into n areas of SSD size, and the organization of each area is the same as that of SSD.
  • the invention provides a disk cache management method and device, which can dynamically adjust the size of a disk cache group associated with a disk area, improve a cache hit ratio of an application using disk data, improve space utilization of a disk cache, and thereby improve system input. Output performance.
  • the embodiment of the invention provides a method for managing a disk cache, and the method includes:
  • the size of the block is set such that the block is used to perform dynamic expansion or contraction of a group within the first region.
  • the embodiment of the invention further provides a device for managing a disk cache, the management device comprising:
  • a disk cache dividing unit configured to divide the disk cache into a first area and a second area, where the first area is used to generate a pre-allocated group set when the disk cache is created, where a disk is created for each of the groups Mapping of inner regions, and the second region is reserved;
  • a block organization unit configured to organize spaces of the second area into a series of block chunks, and set a size of the block
  • a group dynamic expansion unit is configured to perform dynamic expansion or contraction of a group in the first area by using the block.
  • the management method first divides the disk cache into a first area and a second area, where the first area is used to generate a pre-allocated group set when the disk cache is created, where Establishing a mapping with the intra-disk area for each of the groups; organizing the space of the second area into a series of block chunks; setting a size of the block, such that the block is used to perform a group in the first area Dynamically expand or contract.
  • the size of the disk cache group associated with the disk area can be dynamically adjusted, the cache hit rate of the disk data used by the application is improved, and the space utilization of the disk cache is improved, thereby improving the system input and output performance.
  • FIG. 1 is a schematic flowchart of a method for managing a disk cache according to an embodiment of the present invention
  • FIG. 2 is a schematic structural diagram of partitioning and mapping of a disk cache in a specific example according to an embodiment of the present invention
  • FIG. 3 is another schematic structural diagram of disk cache division and mapping in a specific example according to an embodiment of the present invention.
  • FIG. 4 is a schematic diagram of dynamic expansion of a group in a specific example according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of dynamic contraction of a group in a specific example according to an embodiment of the present invention.
  • FIG. 6 is a schematic structural diagram of a device for managing a disk cache according to an embodiment of the present invention.
  • Embodiments of the present invention provide a disk cache management method and apparatus, based on a disk cache cache Pre-allocating the group set and the reserved block chunk to implement dynamic adjustment of the group.
  • This method can dynamically adjust the size of the disk cache group associated with the disk area, improve the cache hit rate of the application using disk data, and improve the space utilization of the disk cache. Rate, thereby improving system input and output performance.
  • FIG. 1 is a schematic flowchart of a method for managing a disk cache according to an embodiment of the present invention.
  • the method includes:
  • Step 11 Divide the disk cache into a first area and a second area.
  • the disk cache is first divided into two areas, wherein: the first area is used to generate a pre-allocated number of group sets when the disk cache is created, wherein each group is established with the disk Mapping of inner regions; partitioned second regions reserved.
  • the above disk cache can use the solid state hard disk SSD as a disk cache, and can also be used as other non-volatile flash media, such as PCM media, etc., can be used as a disk cache medium.
  • FIG. 2 is a schematic structural diagram of partitioning and mapping of a disk cache in a specific example according to an embodiment of the present invention.
  • the disk cache is divided into two adjacent spaces, first.
  • the disk block number indicates the sector number of the disk data block
  • the disk cache size is the size of the disk cache data block
  • the set size is the number of data blocks in the group.
  • Block total number indicates the total sector number of the disk data block.
  • the disk cache is divided into two areas of 2/3 and 1/3.
  • the first area is divided into four groups, and the second area is reserved for dynamic scaling of the group.
  • the data blocks in disk area i can enter the group. Any idle buffer block in i is not affected by the position of the data block disk.
  • a data block with a disk block number of 8 can enter the disk cache block with block number 2 and a data block with disk block number 1.
  • FIG. 3 is another schematic structural diagram of partitioning and mapping of a disk cache in a specific example according to an embodiment of the present invention.
  • a disk cache is divided into multiple spaces, where An area and a second area are cross-distributed, and the first space from top to bottom is used as the second area for reserved space, and the size can be specified when the disk cache is created; the second space is the first area, the first space The area is pre-allocated with a group; the third space is used as the second area for the reserved space, which is sequentially turned down, so that the first area and the second area are cross-distributed.
  • the disk cache is more flexible than the first method.
  • Each group can be dynamically extended from beginning to end, so that the distance between the pre-allocated group and the reserved dynamically allocated blocks is shorter, which is convenient for forming a continuous Group space.
  • the starting position of each group can also be dynamically updated to better implement group dynamic scaling.
  • mapping of each of the above groups to the intra-disk area is achieved by:
  • the non-contiguous address of the group is mapped to the continuous area of the disk.
  • the area in the disk is first divided into a plurality of consecutive areas; and as shown in FIG. 2 and FIG.
  • the first region is mapped with a first group pre-allocated in the first region of the disk cache
  • the second region in the disk is mapped with a second group pre-allocated in the first region of the disk cache , and so on, eventually mapping the last region in the disk to the last group pre-allocated in the first region of the disk cache.
  • Step 12 Organize the space of the second area into a series of block chunks, and set the size of each block.
  • the space of the second area can be organized into a series of blocks, and the size of each block can be set, for example, the block can be set to a group size of 1/2.
  • These blocks are maintained with specific metadata, records whether the blocks have been allocated, are free, and the number of times the block has been read or written.
  • Step 13 Using the block to perform dynamic expansion or contraction of a group within the first area.
  • the using the block to perform dynamic expansion of the group in the first area includes:
  • each group in the first area determines whether each group satisfies The condition of the allocation block;
  • the block that is idle and the number of read/write times is lower than a set threshold is selected among the unallocated blocks reserved in the second area, and the block is allocated to the satisfaction allocation.
  • the statistical parameters of each group include one or more of the following: the number of readings of the blocks in the group, the number of writes of the blocks in the group, the cache hit ratio of the group, and the number of dirty blocks in the group.
  • FIG. 4 is a schematic diagram of dynamic expansion of a group in a specific example according to an embodiment of the present invention.
  • the disk cache is pre-allocated with 18 sets, corresponding to 18 in the disk. Space areas; and the reserved space is organized into 12 chunks.
  • chunk2,4,5,7,9,10,11,12 are blocks assigned to set; chunk1,3,6,8 are unallocated blocks; chunk 1, 6, 10 are blocks with a large number of read and write times; chunk 3 is a block with a small number of read and write times.
  • Set9, 11, 12 have obtained at least one chunk; after judging the statistical parameters of each set, judging the set 2 satisfies the condition of reallocating a chunk, and then selects the block that is idle and reads and writes less than the set threshold in the unallocated block (1, 3, 6, 8), that is, chunk 3 is assigned to set2 which satisfies the allocation block condition, and the threshold set here can be set when the disk cache is established, for example, set to 1 time or 0 times.
  • the specific selection process is: chunk 1 is empty, but is read and written too many times; looking for the next chunk 3, this chunk is empty, and the number of reads and writes is the least among unallocated chunks, so chunk 3 is assigned as the selected chunk.
  • the utilizing the block to perform dynamic shrinking of the group in the first area includes:
  • the blocks in the group that satisfy the above conditions are recovered, the recovered block is erased, and all the byte bits on it are reset.
  • FIG. 5 is a schematic diagram of dynamic contraction of a group in a specific example according to an embodiment of the present invention.
  • all chunks have been allocated, and at this time, the number of blocks is determined to reach a recovery threshold, and retrieve the eligible allocated chunks, in which the recovery threshold is 0, and other recovery thresholds can be set.
  • the intra-group block recovery threshold may be set to the number of times the block is read and written once, and of course, other values may be set.
  • the size of the disk cache group associated with the disk area can be dynamically adjusted, the cache hit rate of the disk data used by the application is improved, and the space utilization of the disk cache is improved, thereby improving the system input and output performance.
  • FIG. 6 is a schematic structural diagram of a device for managing a disk cache according to an embodiment of the present invention.
  • the management device includes:
  • a disk cache dividing unit configured to divide the disk cache into a first area and a second area, where the first area is used to generate a pre-allocated group set when the disk cache is created, where a disk is created for each of the groups
  • the mapping of the inner area, and the second area is reserved; the specific implementation process is as described in the above method embodiment.
  • the block organization unit is configured to organize the space of the second area into a series of block chunks, and set the size of the block; the specific implementation process is as described in the foregoing method embodiment.
  • a group dynamic expansion unit is configured to perform dynamic expansion or contraction of a group in the first area by using the block.
  • the specific implementation process is as described in the above method embodiment.
  • the group dynamic expansion unit may include:
  • a group dynamic expansion module configured to determine, according to statistical parameters of each group in the first area, whether each group satisfies a condition of the allocation block; if it is determined that one of the groups meets the condition of the allocation block, the group is in the second area Among the unallocated blocks, a block that is free and whose number of read/write times is lower than a set threshold is selected, and the block is allocated to the group that satisfies the allocation block condition.
  • the group dynamic expansion unit may include:
  • the dynamic shrinking module is configured to determine whether the number of blocks reserved in the second area reaches a recovery threshold. If yes, scan the statistical parameters of each group in the first area to determine whether the block recovery threshold is reached. The group; if present, the blocks in the group that satisfy the above conditions are recovered, the recovered block is erased, and all the byte bits on it are reset.
  • the specific implementation process is as described in the above method embodiment.
  • block organization unit may further include:
  • the parameter recording module is configured to record, by using specific metadata, whether a block in the second area has been allocated, whether it is idle, and the number of times the block has been read or written.
  • the specific implementation process is as described in the above method embodiment.
  • the disk cache dividing unit may further include:
  • a group mapping module configured to divide an area in the disk into a plurality of consecutive areas, and map the first area in the disk to the first group pre-allocated in the first area in the disk cache, and the intra-disk
  • the second region is mapped with a second group pre-allocated in the first region of the disk cache, and so on, and the last region in the disk is pre-allocated with the last group in the first region of the disk cache. Mapping.
  • each unit included is only divided according to functional logic, but is not limited to the foregoing division, as long as the corresponding function can be implemented;
  • the names are also for convenience of distinction from each other and are not intended to limit the scope of protection of the present invention.
  • the storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
  • the embodiment of the present invention can dynamically adjust the size of the disk cache group associated with the disk area, improve the cache hit ratio of the disk data used by the application, and improve the space utilization of the disk cache, thereby improving the system input and output performance.

Landscapes

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

Abstract

一种磁盘缓存的管理方法及装置。所述管理方法首先将磁盘缓存划分为第一区域和第二区域,第一区域用于在该磁盘缓存创建时生成预分配的若干个组set,其中为每个所述组建立与磁盘内区域的映射;将第二区域的空间组织成一系列的块chunk;设置所述块的大小,使所述块用于进行所述第一区域内的组的动态扩展或收缩。通过上述管理方法就能够动态调整与磁盘区域关联的磁盘缓存组的大小,提高应用程序使用磁盘数据的缓存命中率,提高磁盘缓存的空间利用率,从而提高系统输入输出性能。

Description

磁盘缓存的管理方法及装置
技术领域
本发明涉及数据存储领域,尤其涉及一种磁盘缓存的管理方法及装置。
发明背景
目前,磁盘与内存间的输入输出IO速度一直是系统性能的一个重要瓶颈,在IO密集型的应用场景下,CPU往往需要等待磁盘IO。很多系统采用内存或类似的validate memory介质来作为磁盘的缓存,用于提高IO速度,但内存的价格较贵,且下电后数据丢失。固态硬盘SSD是一种合适做磁盘/内存缓存cache的闪存介质,速度介于内存和磁盘之间,且是non-validate memory,可以基本避免数据丢失。
为了提高磁盘的IO性能,现有技术中可以利用磁盘缓存,例如SSD、PCM等来作为磁盘的高速缓存,采用与cpu cache相同的模式来组织磁盘的cache。以SSD来说,使用组相联模式来作为磁盘HDD到缓存SSD的地址映射方式,将SSD的空间等分为若干个组set,每个set默认由512个SSD数据块组成,每个数据块默认为4KB大小;同样的将磁盘空间分为SSD大小的n个区域,每个区域内的组织方式和SSD的组织方式相同。
但上述现有技术的方案中,磁盘缓存中每个组set空间大小固定,无法动态伸缩,在系统应用程序集中在少数set进行频繁访问时,导致各set间使用率不均,降低了磁盘缓存的空间使用率和缓存命中率,影响了系统输入输出性能。
发明内容
本发明提供一种磁盘缓存的管理方法及装置,能够动态调整与磁盘区域关联的磁盘缓存组的大小,提高应用程序使用磁盘数据的缓存命中率,提高磁盘缓存的空间利用率,从而提高系统输入输出性能。
本发明实施例提供了一种磁盘缓存的管理方法,所述方法包括:
将磁盘缓存划分为第一区域和第二区域,第一区域用于在该磁盘缓存创建时生成预分配的若干个组set,其中为每个所述组建立与磁盘内区域的映射;
将第二区域的空间组织成一系列的块chunk;
设置所述块的大小,使所述块用于进行所述第一区域内的组的动态扩展或收缩。
本发明实施例还提供了一种磁盘缓存的管理装置,所述管理装置包括:
磁盘缓存划分单元,用于将磁盘缓存划分为第一区域和第二区域,第一区域用于在该磁盘缓存创建时生成预分配的若干个组set,其中为每个所述组建立与磁盘内区域的映射,且第二个区域预留;
块组织单元,用于将第二区域的空间组织成一系列的块chunk,并设置所述块的大小;
组动态伸缩单元,用于利用所述块进行所述第一区域内的组的动态扩展或收缩。
由上述所提供的技术方案可以看出,所述管理方法首先将磁盘缓存划分为第一区域和第二区域,第一区域用于在该磁盘缓存创建时生成预分配的若干个组set,其中为每个所述组建立与磁盘内区域的映射;将第二区域的空间组织成一系列的块chunk;设置所述块的大小,使所述块用于进行所述第一区域内的组的动态扩展或收缩。通过上述管理方法就能够动态调整与磁盘区域关联的磁盘缓存组的大小,提高应用程序使用磁盘数据的缓存命中率,提高磁盘缓存的空间利用率,从而提高系统输入输出性能。
附图简要说明
图1为本发明实施例所提供磁盘缓存的管理方法的流程示意图;
图2为本发明实施例所举出的具体实例中磁盘缓存划分和映射的一种结构示意图;
图3为本发明实施例所举出的具体实例中磁盘缓存划分和映射的另一种结构示意图;
图4为本发明实施例所举出的具体实例中组的动态扩展的示意图;
图5为本发明实施例所举出的具体实例中组的动态收缩的示意图;
图6为本发明实施例所提供磁盘缓存的管理装置的结构示意图。
实施本发明的方式
本发明实施方式提供了一种磁盘缓存的管理方法及装置,基于磁盘缓存cache 预分配组set和预留的块chunk来实现组的动态调整,该方法能够动态调整与磁盘区域关联的磁盘缓存组的大小,提高应用程序使用磁盘数据的缓存命中率,提高磁盘缓存的空间利用率,从而提高系统输入输出性能。
为更好的描述本发明实施方式,现结合附图对本发明的具体实施方式进行说明,如图1所示为本发明实施例所提供磁盘缓存的管理方法的流程示意图,所述方法包括:
步骤11:将磁盘缓存划分为第一区域和第二区域。
在该步骤中,首先对磁盘缓存进行划分,将其划分为两个区域,其中:第一区域用于在该磁盘缓存创建时生成预分配的若干个组set,其中每个组均建立与磁盘内区域的映射;划分出的第二区域预留。
在具体实现过程中,上述的磁盘缓存可以使用固态硬盘SSD作为磁盘的高速缓存,也可以实用其他的非易失性闪存介质,比如PCM介质等,均可以作为磁盘的高速缓存介质。
上述将磁盘缓存划分为两个区域,具体有两种划分方式:
1)将磁盘缓存划分成相邻的两个空间,其中,第一区域和第二区域相邻。
举例来说,如图2所示为本发明实施例所举出的具体实例中磁盘缓存划分和映射的一种结构示意图,图2中:将磁盘缓存划分成相邻的两个空间,第一区域和第二区域相邻,其中,第一区域用于在磁盘缓存创建时生成预分配的组,每个组均建立与磁盘内区域的映射,映射关系可以为:target set number= (Disk block number * 磁盘缓存size)/ ( Disk block total number * set size)。Disk block number表示磁盘数据块的扇区号,磁盘缓存size为磁盘缓存数据块的大小,set size为组中数据块的数量,Disk block total number表示磁盘数据块的总扇区号。
上述图2中是将磁盘缓存划分为2/3和1/3大小的两个区域,第一区域划分为4个组,第二区域预留,用于进行组的动态伸缩。图2中,磁盘区域i中的数据块可以进入组 i中任意一个空闲的缓存块中,且不受数据块磁盘先后位置的影响,比如磁盘块号为8的数据块可以进入块号为2的磁盘缓存块中,磁盘块号为1的数据块可以进入块号为20的磁盘缓存块中;在组中的所有磁盘缓存块均放满了磁盘的数据块后,如果再有磁盘数据块要缓存入该组,则会进行缓存块的替换操作,或者组的扩展操作。
2)将磁盘缓存划分成交叉的多个空间,其中,第一区域和第二区域交叉分布。
举例来说,如图3所示为本发明实施例所举出的具体实例中磁盘缓存划分和映射的另一种结构示意图,图3中:磁盘缓存划分成交叉的多个空间,其中,第一区域和第二区域交叉分布,从上至下的第一个空间作为第二区域,用于预留空间,大小可以在磁盘缓存创建时指定;第二个空间为第一区域,该第一区域预分配有一个组;第三个空间再作为第二区域,用于预留空间,依次往下,使得第一区域和第二区域交叉分布。
该磁盘缓存的划分方式较上述第一种方式更为灵活,每个组可以进行首尾动态扩展,使得预分配的组和预留的后续动态分配的块之间的距离更短,便于形成连续的组空间。在该划分方式下,还可以动态更新每组的起始位置,以便更好的实现组动态伸缩。
除上述本实施例所述的两种划分方式之外,本领域技术人员能够根据本发明实施例想到的其他划分方式都是可以的。
另外,上述每个组均建立与磁盘内区域的映射是通过如下方式来实现的:
本发明实施例是将组的非连续地址与磁盘的连续区域进行映射,具体来说,首先将磁盘内的区域划分为若干个连续的区域;再如图2和3中所示,将磁盘内的第一个区域与所述磁盘缓存内第一区域内预分配的第一个组映射,将磁盘内的第二个区域与所述磁盘缓存内第一区域内预分配的第二个组映射,以此类推,最终将磁盘内的最后一个区域与所述磁盘缓存内第一区域内预分配的最后一个组映射。通过上述映射方式,能够减少输入输出IO次数,缩短磁盘寻道距离,从而提高回写效率。
步骤12:将第二区域的空间组织成一系列的块chunk,并设置每个块的大小。
在该步骤中,经过上述步骤11的设置后,就可以将第二区域的空间组织成一系列的块,并设置每个块的大小,例如可以将块设置为1/2的组大小。并通过特定的元数据来维护这些块,记录这些块是否已被分配,是否空闲,以及块的已读写次数。
步骤13:利用所述块来进行所述第一区域内的组的动态扩展或收缩。
在该步骤中,所述利用所述块来进行所述第一区域内的组的动态扩展,具体包括:
首先根据所述第一区域内各个组的统计参数,如组中块的读次数,组中块的写次数,组的缓存命中率,组中脏块的数目等参数,来判断各个组是否满足分配块的条件;
若判断其中一个组满足分配块的条件,则在所述第二区域所预留的未分配的块中选择空闲且读写次数低于设定阈值的块,将该块分配给所述满足分配块条件的组。
在具体实现过程中,上述的各个组的统计参数,包括如下一个或多个:组中块的读次数,组中块的写次数,组的缓存命中率,组中脏块的数目。
举例来说,如图4所示为本发明实施例所举出的具体实例中组的动态扩展的示意图,图4中:该磁盘缓存在创建时预分配了18个set,对应磁盘内的18个空间区域;且预留的空间被组织成12个chunk。
其中,chunk2、4、5、7、9、10、11、12是已分配给set的块;chunk1、3、6、8为未分配的块;chunk 1、6、10是读写次数较多的块;chunk 3是读写次数较少的块。 set9、11、12已获得至少一个chunk;经过对各个set统计参数的判断,判断set 2满足再分配一个chunk的条件,然后就可以在未分配的块(1、3、6、8)中选择空闲且读写次数低于设定阈值的块,即chunk 3分配给满足分配块条件的set2,这里设定阈值可以在磁盘缓存建立时设定,例如设定成1次或0次。具体选择过程为:chunk 1是空的,但是被读写的次数过多;寻找下一个chunk 3,此chunk为空,且读写次数在未分配的chunk中最少,所以chunk 3作为选定的chunk被分配。
另外,所述利用所述块来进行所述第一区域内的组的动态收缩,具体包括:
判断所述第二区域所预留的块数量是否达到回收阈值,若达到,则扫描所述第一区域内各个组的统计参数,判断是否存在达到组内块回收阈值的组;
若存在,则回收满足上述条件的组中的块,对所回收的块进行擦除操作,并将其上的所有字节位重置。
举例来说,如图5所示为本发明实施例所举出的具体实例中组的动态收缩的示意图,图5中:所有的chunk均已分配,此时判断块数量达到了回收阈值,需要回收符合条件的已分配chunk,在该实例中回收阈值为0,也可以设置其他的回收阈值。
然后,扫描每个set的统计参数,判断是否存在达到组内块回收阈值的set,发现set 12符合达到组内块回收阈值的条件,那么回收该set12上的chunk5,并对回收的chunk5进行擦除操作,将其上的所有字节位重置。在该实施例中,组内块回收阈值可以设定成组内块的读写次数为1次,当然也可以设置成其他的数值。
通过以上方法实施例,就能够动态调整与磁盘区域关联的磁盘缓存组的大小,提高应用程序使用磁盘数据的缓存命中率,提高磁盘缓存的空间利用率,从而提高系统输入输出性能。
本发明实施例还提供了一种磁盘缓存的管理装置,如图6所示为本发明实施例所提供磁盘缓存的管理装置的结构示意图,所述管理装置包括:
磁盘缓存划分单元,用于将磁盘缓存划分为第一区域和第二区域,第一区域用于在该磁盘缓存创建时生成预分配的若干个组set,其中为每个所述组建立与磁盘内区域的映射,且第二个区域预留;具体实现过程见以上方法实施例中所述。
块组织单元,用于将第二区域的空间组织成一系列的块chunk,并设置所述块的大小;具体实现过程见以上方法实施例中所述。
组动态伸缩单元,用于利用所述块进行所述第一区域内的组的动态扩展或收缩。具体实现过程见以上方法实施例中所述。
在具体实现过程中,所述组动态伸缩单元可包括:
组动态扩展模块,用于根据所述第一区域内各个组的统计参数,判断各个组是否满足分配块的条件;若判断其中一个组满足分配块的条件,则在所述第二区域内的未分配的块中选择空闲且读写次数低于设定阈值的块,将该块分配给所述满足分配块条件的组。具体实现过程见以上方法实施例中所述。
所述组动态伸缩单元可包括:
组动态收缩模块,用于判断所述第二区域所预留的块数量是否达到回收阈值,若达到,则扫描所述第一区域内各个组的统计参数,判断是否存在达到组内块回收阈值的组;若存在,则回收满足上述条件的组中的块,对所回收的块进行擦除操作,并将其上的所有字节位重置。具体实现过程见以上方法实施例中所述。
另外,所述块组织单元中还可包括:
参数记录模块,用于通过特定的元数据记录所述第二区域内的块是否已被分配、是否空闲,以及块的已读写次数。具体实现过程见以上方法实施例中所述。
所述磁盘缓存划分单元中还可包括:
组映射模块,用于将磁盘内的区域划分为若干个连续的区域,将磁盘内的第一个区域与所述磁盘缓存内第一区域内预分配的第一个组映射,将磁盘内的第二个区域与所述磁盘缓存内第一区域内预分配的第二个组映射,以此类推,将磁盘内的最后一个区域与所述磁盘缓存内第一区域内预分配的最后一个组映射。具体实现过程见以上方法实施例中所述。
值得注意的是,上述管理装置实施例中,所包括的各个单元只是按照功能逻辑进行划分的,但并不局限于上述的划分,只要能够实现相应的功能即可;另外,各功能单元的具体名称也只是为了便于相互区分,并不用于限制本发明的保护范围。
另外,本领域普通技术人员可以理解实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件完成,相应的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。
综上所述,本发明实施例能够动态调整与磁盘区域关联的磁盘缓存组的大小,提高应用程序使用磁盘数据的缓存命中率,提高磁盘缓存的空间利用率,从而提高系统输入输出性能。
以上所述,仅为本发明较佳的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明实施例揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应该以权利要求的保护范围为准。

Claims (12)

  1. 一种磁盘缓存的管理方法,其特征在于,所述方法包括:
    将磁盘缓存划分为第一区域和第二区域,第一区域用于在该磁盘缓存创建时生成预分配的若干个组set,其中为每个所述组建立与磁盘内区域的映射;
    将第二区域的空间组织成一系列的块chunk;
    设置所述块的大小,使所述块用于进行所述第一区域内的组的动态扩展或收缩。
  2. 根据权利要求1所述的管理方法,其特征在于,所述使所述块用于进行所述第一区域内的组的动态扩展,具体包括:
    根据所述第一区域内各个组的统计参数,判断各个组是否满足分配块的条件;
    若判断其中一个组满足分配块的条件,则在所述第二区域内未分配的块中选择空闲且读写次数低于设定阈值的块,将该块分配给所述满足分配块条件的组。
  3. 根据权利要求2所述的管理方法,其特征在于,所述各个组的统计参数,包括如下一个或多个:组中块的读次数,组中块的写次数,组的缓存命中率,组中脏块的数目。
  4. 根据权利要求1所述的管理方法,其特征在于,所述使所述块用于进行所述第一区域内的组的动态收缩,具体包括:
    判断所述第二区域内的块数量是否达到回收阈值,若达到,则扫描所述第一区域内各个组的统计参数,判断是否存在达到组内块回收阈值的组;
    若存在,则回收满足上述条件的组中的块,对所回收的块进行擦除操作,并将其上的所有字节位重置。
  5. 根据权利要求1-4其中之一所述的管理方法,其特征在于,
    通过特定的元数据记录所述第二区域内的块是否已被分配、是否空闲,以及块的已读写次数。
  6. 根据权利要求1所述的管理方法,其特征在于,所述为每个所述组建立与磁盘内区域的映射,具体包括:
    将磁盘内的区域划分为若干个连续的区域;
    将磁盘内的第一个区域与所述磁盘缓存内第一区域内预分配的第一个组映射,将磁盘内的第二个区域与所述磁盘缓存内第一区域内预分配的第二个组映射,以此类推,将磁盘内的最后一个区域与所述磁盘缓存内第一区域内预分配的最后一个组映射。
  7. 根据权利要求1所述的管理方法,其特征在于,所述将磁盘缓存划分为第一区域和第二区域,具体包括:
    将磁盘缓存划分成相邻的两个空间,其中,第一区域和第二区域相邻;
    或,将磁盘缓存划分成交叉的多个空间,其中,第一区域和第二区域交叉分布。
  8. 一种磁盘缓存的管理装置,其特征在于,所述管理装置包括:
    磁盘缓存划分单元,用于将磁盘缓存划分为第一区域和第二区域,第一区域用于在该磁盘缓存创建时生成预分配的若干个组set,其中为每个所述组建立与磁盘内区域的映射,且第二个区域预留;
    块组织单元,用于将第二区域的空间组织成一系列的块chunk,并设置所述块的大小;
    组动态伸缩单元,用于利用所述块进行所述第一区域内的组的动态扩展或收缩。
  9. 如权利要求8所述的管理装置,其特征在于,所述组动态伸缩单元包括:
    组动态扩展模块,用于根据所述第一区域内各个组的统计参数,判断各个组是否满足分配块的条件;若判断其中一个组满足分配块的条件,则在所述第二个区域内未分配的块中选择空闲且读写次数低于设定阈值的块,将该块分配给所述满足分配块条件的组。
  10. 如权利要求8所述的管理装置,其特征在于,所述组动态伸缩单元包括:
    组动态收缩模块,用于判断所述第二区域所预留的块数量是否达到回收阈值,若达到,则扫描所述第一区域内各个组的统计参数,判断是否存在达到组内块回收阈值的组;若存在,则回收满足上述条件的组中的块,对所回收的块进行擦除操作,并将其上的所有字节位重置。
  11. 如权利要求8所述的管理装置,其特征在于,所述块组织单元中还包括:
    参数记录模块,用于通过特定的元数据记录所述第二区域内的块是否已被分配、是否空闲,以及块的已读写次数。
  12. 如权利要求8所述的管理装置,其特征在于,所述磁盘缓存划分单元中包括:
    组映射模块,用于将磁盘内的区域划分为若干个连续的区域,将磁盘内的第一个区域与所述磁盘缓存内第一区域内预分配的第一个组映射,将磁盘内的第二个区域与所述磁盘缓存内第一区域内预分配的第二个组映射,以此类推,将磁盘内的最后一个区域与所述磁盘缓存内第一区域内预分配的最后一个组映射。
PCT/CN2011/081634 2011-11-01 2011-11-01 磁盘缓存的管理方法及装置 WO2012149815A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2011/081634 WO2012149815A1 (zh) 2011-11-01 2011-11-01 磁盘缓存的管理方法及装置
CN201180006548.1A CN102763070B (zh) 2011-11-01 2011-11-01 磁盘缓存的管理方法及装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2011/081634 WO2012149815A1 (zh) 2011-11-01 2011-11-01 磁盘缓存的管理方法及装置

Publications (1)

Publication Number Publication Date
WO2012149815A1 true WO2012149815A1 (zh) 2012-11-08

Family

ID=47056376

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/081634 WO2012149815A1 (zh) 2011-11-01 2011-11-01 磁盘缓存的管理方法及装置

Country Status (2)

Country Link
CN (1) CN102763070B (zh)
WO (1) WO2012149815A1 (zh)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104407986B (zh) * 2014-10-27 2018-03-13 华为技术有限公司 在存储设备中配置缓存的方法、装置及控制器
CN107305531B (zh) * 2016-04-20 2020-10-16 阿里巴巴(中国)有限公司 缓存容量限值确定方法和装置以及计算设备
CN106020718A (zh) * 2016-05-09 2016-10-12 福建联迪商用设备有限公司 一种提高虚拟磁盘写入性能的方法及系统
CN108549523A (zh) * 2018-03-14 2018-09-18 长沙开雅电子科技有限公司 一种存储虚拟化系统缓存动态分配管理方法
CN110688062B (zh) * 2019-08-26 2021-03-30 华为技术有限公司 一种缓存空间的管理方法及装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6389513B1 (en) * 1998-05-13 2002-05-14 International Business Machines Corporation Disk block cache management for a distributed shared memory computer system
US6604171B1 (en) * 2000-09-29 2003-08-05 Emc Corporation Managing a cache memory
CN1499382A (zh) * 2002-11-05 2004-05-26 华为技术有限公司 廉价冗余磁盘阵列系统中高效高速缓存的实现方法
CN1499376A (zh) * 2002-11-07 2004-05-26 华为技术有限公司 一种重构内存管理方法
CN101169759A (zh) * 2007-11-08 2008-04-30 Ut斯达康通讯有限公司 应用程序级的内存管理方法
CN101515254A (zh) * 2008-02-18 2009-08-26 鸿富锦精密工业(深圳)有限公司 存储空间管理系统和方法

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6389513B1 (en) * 1998-05-13 2002-05-14 International Business Machines Corporation Disk block cache management for a distributed shared memory computer system
US6604171B1 (en) * 2000-09-29 2003-08-05 Emc Corporation Managing a cache memory
CN1499382A (zh) * 2002-11-05 2004-05-26 华为技术有限公司 廉价冗余磁盘阵列系统中高效高速缓存的实现方法
CN1499376A (zh) * 2002-11-07 2004-05-26 华为技术有限公司 一种重构内存管理方法
CN101169759A (zh) * 2007-11-08 2008-04-30 Ut斯达康通讯有限公司 应用程序级的内存管理方法
CN101515254A (zh) * 2008-02-18 2009-08-26 鸿富锦精密工业(深圳)有限公司 存储空间管理系统和方法

Also Published As

Publication number Publication date
CN102763070B (zh) 2015-08-19
CN102763070A (zh) 2012-10-31

Similar Documents

Publication Publication Date Title
US11893238B2 (en) Method of controlling nonvolatile semiconductor memory
CN103425602B (zh) 一种闪存存储设备数据读写的方法、装置及主机系统
US10275361B2 (en) Managing multiple namespaces in a non-volatile memory (NVM)
JP5530863B2 (ja) ストレージシステムのためのi/o変換方法及び装置
JP4863749B2 (ja) フラッシュメモリを用いた記憶装置、その消去回数平準化方法、及び消去回数平準化プログラム
JP4135747B2 (ja) データ処理装置及びフラッシュメモリへのアクセス方法
US9104554B2 (en) Storage apparatus, storage controller and method for relocating data in solid state drive
WO2012126317A1 (zh) 文件存储方法和装置
WO2021218038A1 (zh) 一种存储系统、内存管理方法和管理节点
WO2012149815A1 (zh) 磁盘缓存的管理方法及装置
JP5537732B2 (ja) ストレージシステム
JPWO2015076354A1 (ja) ストレージ装置と方法並びにプログラム
JP2006293981A (ja) データベース格納方法、および、データベース格納システム
JP5597306B2 (ja) 記憶効率の高いセクタ化されたキャッシュ
WO2016195242A1 (ko) 비휘발성 메모리 시스템
CN108595349A (zh) 大容量存储设备的地址转换方法与装置
TW201508484A (zh) 資料寫入方法、硬碟模組以及資料寫入系統
CN103548004A (zh) 在文件系统中实现多级存储的方法和装置
CN102520885B (zh) 一种混合硬盘的数据管理系统
CN116364148A (zh) 一种面向分布式全闪存储系统的磨损均衡方法及系统
IE20160095A1 (en) Realm partitioning in hard drives
CN110321057A (zh) 具有增强io性能确定性的缓存的存储设备
WO2010107173A1 (ko) Ssd 컨트롤러 및 ssd 컨트롤러의 동작 방법
TW202219773A (zh) 查找表建立暨記憶體位址查詢方法、主機記憶體位址查找表建立方法與主機記憶體位址查詢方法
WO2014142427A1 (ko) 스토리지 시스템 및 이의 데이터 전송 방법

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 201180006548.1

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 11864675

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 11864675

Country of ref document: EP

Kind code of ref document: A1