WO2013075627A1 - 一种数据的缓存方法、装置和服务器 - Google Patents

一种数据的缓存方法、装置和服务器 Download PDF

Info

Publication number
WO2013075627A1
WO2013075627A1 PCT/CN2012/084951 CN2012084951W WO2013075627A1 WO 2013075627 A1 WO2013075627 A1 WO 2013075627A1 CN 2012084951 W CN2012084951 W CN 2012084951W WO 2013075627 A1 WO2013075627 A1 WO 2013075627A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
cache
disk
original data
replaced
Prior art date
Application number
PCT/CN2012/084951
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 华为技术有限公司
Publication of WO2013075627A1 publication Critical patent/WO2013075627A1/zh

Links

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 caching, and in particular, to a data caching method, apparatus, and server. Background technique
  • I/O (Input/Output) speed between disk and memory has always been an important bottleneck in system performance.
  • many systems add a level 1 cache between the memory and the disk to store the instructions and data that the CPU needs to run in the near future, which can improve the CPU access speed to the disk.
  • a group-associated mapping mode is mainly used between a disk and a cache, and cache data is managed in units of groups.
  • the storage space of the disk and the cache are divided into groups of the same size. Generally, the storage space of the disk is much larger than the storage space of the cache.
  • the data of multiple storage groups in the disk will be cached in the same storage group in the cache.
  • a mapping group is one or more storage groups in a disk that correspond to a storage group in the cache.
  • the cache manages the cache data in units of groups.
  • the new data in the cache is stored in the cache.
  • the original data in the cached data in the cache must be in the same mapping group as the original data in the cache.
  • the newly replaced data in the cache is replaced in the cache.
  • the data may be hot data in the entire cache, and cannot replace non-hot data or coldest data in other storage groups in the entire cache. These non-hotspot data or the coldest data occupy the cache space, and other hotspot data cannot be stored in the cache, which affects the cache hit rate and reduces the system running rate.
  • Embodiments of the present invention provide a data caching method, apparatus, and server, which are improved The hit rate and the rate at which the system is running.
  • a method of caching data including:
  • mapping group being one of the disks corresponding to a storage group in the cache or Multiple storage groups
  • the new data in the cache is in the disk.
  • the original data is migrated to the same disk mapping group in the cache where the data to be replaced is the same as the original data in the disk;
  • the newly entered data in the cache is written to the storage location of the data to be replaced in the cache in the cache.
  • a data cache device comprising:
  • the first determining unit determines whether the original data of the newly entered data in the cache and the original data in the cache in the cache are in the same mapping group in the disk, and the mapping group is a storage in the disk and the cache.
  • a disk migration unit if the original data of the new data in the cache in the cache and the original data in the cache in which the data to be replaced is not located in the same mapping group on the disk, the new data is used in the cache
  • the original data of the incoming data in the disk is migrated to the same disk mapping group in the cache where the original data of the data to be replaced is in the disk;
  • a cache write unit configured to write new data in the cache to a storage location of the data to be replaced in the cache in the cache.
  • a server comprising a cache device for the above data.
  • the embodiment of the invention provides a data caching method, device and server.
  • the mode of group connection mapping between the disk and the cache is used to cache data in groups. New data in the cache belonging to a different mapping group by the original data in the cache with the data to be replaced in the cache The original data in the disk is migrated to the cache. The data to be replaced is in the same disk mapping group as the original data in the disk. There is a target to store the new data in the cache to the cache where the data to be replaced is stored in the cache. In this way, the data that is not commonly used in the cache is removed more effectively, such as the coldest data or the non-hotspot data, so that the hotspot data is not replaced by the cache, thereby improving the cache hit rate and increasing the operating rate of the system.
  • FIG. 1 is a schematic flowchart of a data caching method according to Embodiment 1 of the present invention
  • FIG. 2 is a schematic structural diagram of a data caching apparatus according to Embodiment 1 of the present invention
  • FIG. 3 is a data caching method according to Embodiment 2 of the present invention
  • FIG. 4 is a schematic structural diagram of a data caching apparatus according to Embodiment 3 of the present invention
  • FIG. 5 is a schematic diagram of a manner in which a disk and a cache are connected by a group. detailed description
  • the embodiment of the invention provides a data caching method, as shown in FIG. 1 , including: 5101. Determine, in the cache, whether the original data in the disk in the cache and the original data in the cache in the cache are in the same mapping group in the disk, where the mapping group is a disk corresponding to a storage group in the cache.
  • One or more storage groups are included in the cache.
  • the data to be replaced in the specific cache may be obtained by counting the cached data according to the accessed time and the accessed frequency, and obtaining the coldest data or the non-hotspot data as the replacement data.
  • the embodiment of the present invention further provides a data caching device. As shown in FIG. 2, the method includes: a first judging unit 21, a disk migration unit 22, and a cache writing unit 23.
  • the first determining unit 21 is configured to determine whether the original data in the cache in the cache and the original data in the cache in the cache are in the same mapping group in the disk, where the mapping group is in the disk and the cache One or more storage groups corresponding to the storage group.
  • a disk migration unit if the original data of the new data in the cache in the cache and the original data in the cache in which the data to be replaced is not located in the same mapping group on the disk, the new data is used in the cache
  • the raw data of the incoming data on the disk is migrated to the same disk mapping group in the cache where the original data of the data to be replaced is in the disk.
  • the cache write unit 23 is configured to write new data in the cache to a storage location of the data to be replaced in the cache in the cache.
  • a server includes a cache device for the above data.
  • the embodiment of the invention provides a data caching method, device and server, and the disk is slowed down.
  • the mode of group connection mapping is used to cache data in groups.
  • the original data in the disk is migrated to the same disk mapping group in the cache as the original data in the disk.
  • Targeted storage of new data in the cache to the cache where the data to be replaced is stored in the cache. In this way, the data that is not commonly used in the cache is removed more effectively, such as the coldest data or the non-hotspot data, so that the hotspot data is not replaced by the cache, thereby improving the cache hit rate and increasing the operating rate of the system.
  • An embodiment of the present invention provides a data caching method, as shown in FIG. 3, including:
  • step S302 If the original data of the new data in the cache and the original data of the data to be replaced in the cache are not located in the same mapping group of the data in the disk, execute S302; if the cache is new The original data in the disk of the data is located in the same mapping group as the original data of the data to be replaced in the cache in the disk, and then step S305 is performed.
  • S302 Determine whether the storage space of the mapping group in the cache where the original data in the cache is located on the disk is full.
  • the original data in the cache in which the new data in the cache is migrated to the cache is to be replaced.
  • the original data in the disk is located in an idle position of the mapping group in the disk.
  • the data to be replaced in the cache may be obtained by collecting statistics on the cached data according to the accessed time and the accessed frequency, and obtaining the coldest data or the non-hotspot data as the replacement data.
  • the original data of the new data in the cache is associated with the original data in the disk.
  • the uncached data is stored in a data exchange storage location associated with the original data in the cache in which data is to be replaced in the cache
  • the cached new data is uncached data associated with the original data in the disk and the new incoming data in the cache is on the disk.
  • the original data is located in the same storage group of the disk and the physical storage address is continuous.
  • the data to be replaced in the cache is associated with the original data in the disk and the data to be replaced in the cache.
  • the original data in the disk is located in the same storage group of the disk and the physical The storage address is continuous.
  • the original data in the cache may be stored in the cache, and the original data in the disk is stored in the cache.
  • the new data in the cache is cached.
  • the uncached data associated with the original data in the disk is stored in the cache to be replaced in the free location of the mapping group to which the original data in the disk belongs, and the new data in the cache is not cached in the original data associated with the disk.
  • the data and the raw data in the cache are in the same storage group on the disk and the physical storage address is continuous.
  • the above cache may use a non-volatile storage medium such as a SSD (solid state disk) or a PCM (phase-change memory) cache medium.
  • a non-volatile storage medium such as a SSD (solid state disk) or a PCM (phase-change memory) cache medium.
  • the I/O speed between disk and memory has always been an important bottleneck in system performance. Adding a level 1 cache between disk and memory can effectively improve I/O speed.
  • the group connection mode between the disk and the disk cache manages the cache data in units of groups.
  • the disk and cache storage space is divided into the same size storage group, assuming there are N storage groups in the cache, and each storage group has M blocks of data, because the disk storage space is larger than the cache.
  • the storage space is much larger, so that multiple storage groups on the disk are mapped to the same storage group in the cache.
  • three storage groups in the disk in FIG. 5 are correspondingly mapped to the same storage group of the cache, and the three storage groups are called mapping groups of disks.
  • the three storage groups of Alcl, A2cl, and A3cl are the mapping group cl of the disk.
  • the data in the mapping group cl can only be mapped to the cached C1 storage group. It is assumed that the system uses a block of data ml in a certain storage group A3cN in the mapping group cN, and the data ml is modified after the ml is used. The modified data content becomes ml A3, and ml A3 is stored in the cache as new data in the cache. The raw data ml of mlA3 on the disk belongs to the data in the mapping group cN. Thus, in the case that the storage space of the cached CN storage group is not full, the new incoming data mlA3 in the cache can be directly stored in the idle location of the cached CN storage group.
  • the cache In the case that the storage space of the cache C1 storage group is full, in order to improve the cache hit rate and improve the running speed of the system, the cache counts the most according to the time when the data stored in the cache is accessed and the frequency of the accessed.
  • the cold data or the non-hotspot data is used as the data to be replaced in the cache, and the new data in the cache is targeted to the storage location of the data to be replaced in the cache.
  • the processing system determines whether the original data of the new data in the cache in the cache and the original data in the cache in the cache are in the same mapping group in the disk, and the mapping group is a storage group in the disk and the cache. Corresponding one or more storage groups. If the original data in the cache and the data to be replaced in the cache are in the same mapping group on the disk, according to the way of group connection mapping, the SSD cache media needs to be directly in the cache. The data to be replaced is erased, and then the new data in the cache is written to the storage location of the data to be replaced in the cache.
  • the processing system determines that the original data of the new incoming data in the cache and the original data of the data to be replaced in the cache are not located in the same mapping group in the disk, the processing system further determines that the data to be replaced in the cache is in the disk.
  • the raw data is located on the disk where the storage space of the mapped group is full.
  • the processing system will cache the original data of the newly entered data on the disk.
  • the original data in the cache where the data to be replaced in the cache is swapped with each other.
  • the processing system may further exchange the uncached data associated with the original data in the cache in the cache with the data in the cache in which the data to be replaced is associated with the original data in the disk, and the cache is newly added.
  • the uncached data associated with the raw data of the data on the disk is in the same storage group as the original data on the disk of the incoming data in the cache and the physical storage address is contiguous.
  • the data associated with the original data in the cache in the cache is associated with the original data in the cache where the data to be replaced in the cache is in the same storage group of the disk and the physical storage address is continuous.
  • the uncached data associated with the raw data of the new data in the cache needs to be stored in the cache, it is directly stored in the cache. This allows the processing system to cache the data on the disk more quickly and effectively update the data in the cache.
  • the processing system migrates the original data of the new data in the cache to the cache to be cached.
  • the raw data in the replacement data on the disk is in the free location of the mapped group in the disk.
  • the processing system may also migrate the uncached data associated with the original data of the new data in the cache to the cache, and the original data of the data to be replaced in the disk is located in the idle location of the mapping group in the disk,
  • the raw data associated with the incoming data in the cache is uncached with the original data in the disk.
  • the raw data in the cache is the same as the original data in the disk and the physical storage address is contiguous. This allows the processing system to cache the data on the disk more quickly and effectively update the data in the cache.
  • the data associated with the original data in the cache is the data associated with the original data in the disk or the data associated with the original data in the cache in the cache.
  • the association referred to herein may be data that belongs to the same file or attribute. Specifically, if different parts of an audio and video file, such as data, are the first part of the video file, the data associated with the data may be another part of the video file.
  • the file descriptor of the data includes: modifying the mapping relationship between the new data in the cache and the disk. According to the mapping relationship between the new data and the disk in the modified cache, the system automatically updates the storage group of the new data in the cache in the cache. The processing system then detects whether there is any operation on the incoming data in the cache in the I/O request queue. If the I/O request queue has an operation on the new data in the cache, the cache in the I/O request queue needs to be modified.
  • the file descriptor of the new incoming data specifically includes: Modifying the mapping relationship between the new data and the disk in the cache.
  • a mode in which a group is mapped between a disk and a cache is used to cache data in units of groups.
  • the raw data in the disk and the data to be replaced in the cache are in different mapping groups, and the original data in the cache is stored in the cache to be replaced.
  • the mapping group of the original data of the data on the disk which can replace the coldest or non-hotspot data in the cache, thereby improving the cache hit rate and increasing the operating speed of the system.
  • the embodiment of the present invention provides a data caching device. As shown in FIG. 4, the method includes: a statistical unit 41, a first determining unit 42, a disk migration unit 43, and a cache writing unit 44.
  • the statistic unit 41 is configured to perform statistics on the data in the cache according to the accessed time and the visited frequency, and obtain the coldest data or the non-hotspot data as the data to be replaced in the cache.
  • the first determining unit 42 is configured to determine whether the original data of the newly entered data in the cache and the original data in the cache in the cache are in the same mapping group in the disk, where the mapping group is in the disk and the cache One or more storage groups corresponding to the storage group.
  • the disk migration unit 43 is configured to: if the original data of the newly entered data in the cache and the original data of the data to be replaced in the cache in the cache are not located in the same mapping group in the disk, The raw data of the new incoming data in the disk is migrated to the same disk mapping group in the cache where the original data of the data to be replaced is in the disk.
  • the disk migration unit 43 specifically includes a second determination subunit 431, a switching subunit 432, and a storage subunit 433.
  • the second determining sub-unit 431 is configured to determine whether the storage space of the mapping group in the cache where the original data of the data to be replaced in the disk is located in the disk is full.
  • the switching subunit 432 if the storage space of the mapping group in the cache where the original data of the data to be replaced in the disk is located in the disk is full, the original data used in the exchange buffer and the cached data are to be replaced in the cache. The location where the raw data of the data is stored on the disk.
  • a storage subunit 433 if the storage space of the mapping group in the cache where the original data of the data to be replaced in the disk is located in the disk is not full, the original data for the new data in the cache in the cache is migrated to the The raw data in the cache where the data to be replaced is in the disk is located in the free location of the mapped group in the disk.
  • the cache write unit 44 is configured to write new data in the cache to a storage location of the data to be replaced in the cache in the cache.
  • the switching sub-unit 432 is further configured to exchange the uncached data associated with the original data of the newly entered data in the cache with the original data of the data to be replaced in the cache in the disk, the cache.
  • the new data in the disk is the original data associated with the uncached data in the disk and the new data in the cache.
  • the original data in the disk is in the same storage group of the disk and the physical storage address is continuous.
  • the data to be replaced in the cache is original in the disk.
  • the data associated with the data and the original data in the cache to be replaced on the disk are in the same storage group on the disk and the physical storage address is continuous.
  • the storage sub-unit 433 is further configured to migrate the uncached data associated with the original data of the new incoming data in the cache to the idle location of the mapping group to which the original data of the replacement data belongs in the disk, in the cache.
  • the uncached data associated with the raw data in the new data is located in the same storage group as the original data in the disk, and the physical storage address is contiguous.
  • the above cache can use non-volatile storage media, such as SSD, PCM cache. Medium.
  • the I/O speed between disk and memory has always been an important bottleneck in system performance. Adding a level 1 cache between disk and memory can effectively improve I/O speed.
  • the first determining unit of the cache device determines whether the original data in the cache in the cache and the original data in the cache in the cache are in the same mapping group in the disk, and the mapping group is in the disk and the cache.
  • One or more storage groups corresponding to the storage group If the original data of the new data in the cache is in the same mapping group as the original data in the cache in the cache, the original data in the disk is located in the disk, so according to the group connection mapping manner, for the SSD cache medium
  • the cache write unit needs to directly erase the replacement data in the cache, and then write the new data in the cache to the storage location of the replacement data in the cache.
  • the second of the disk storage unit needs to further determine whether the storage space of the mapping group in the cache where the original data of the data to be replaced in the disk is located in the disk is full.
  • the switching subunit of the disk migration unit exchanges the original data of the new data in the cache with the cache in the cache.
  • the location where the original data of the data to be replaced is stored on the disk.
  • the exchange subunit may also exchange the uncached data associated with the original data of the new data in the cache with the original data of the data to be replaced in the cache in the cache, in the cache new
  • the uncached data associated with the raw data in the disk is the same as the original data in the cache.
  • the original data in the disk is in the same storage group of the disk and the physical storage address is continuous.
  • the original data associated with the data to be replaced in the cache is in the disk.
  • the data is in the same storage group as the original data in the cache where the data to be replaced in the cache is located and the physical storage address is contiguous. This makes it possible to cache the data on the disk more quickly and effectively update the data in the cache.
  • the storage subunit of the cache device migrates the original data of the new data in the cache in the cache.
  • the raw data in the cache to be replaced in the cache is located in the free location of the mapped group in the disk.
  • the storage subunit can also migrate the uncached data associated with the original data of the new data in the cache to the cache, and the original data of the data to be replaced in the disk is located in the idle position of the mapping group in the disk.
  • the original data on the disk is in the same storage group on the disk and the physical storage address is continuous. This allows the processing system to cache the data on the disk more quickly and effectively update the data in the cache.
  • the data associated with the original data in the cache is the data associated with the original data in the disk or the data associated with the original data in the cache in the cache.
  • the association referred to herein may be data that belongs to the same file or attribute. Specifically, if different parts of an audio and video file, such as data, are the first part of the video file, the data associated with the data may be another part of the video file.
  • the cache device After migrating the original data of the new data in the cache to the cache, the cache device needs to modify the file descriptor of the new data in the cache after the data to be replaced is in the same disk mapping group as the original data in the disk. Including: Modify the mapping relationship between new data and disk in the cache. Further, according to the mapping relationship between the new data and the disk in the modified cache, the cache device automatically updates the storage group of the cached new data in the cache. Then, it is detected whether there is any operation on the new data in the cache in the I/O request queue. If there is an operation on the new data in the cache in the I/O request queue, it is necessary to modify the new cache in the I/O request queue.
  • the file descriptor of the data includes: Modifying the mapping relationship between the new data in the cache and the disk.
  • a mode of group connection mapping is used between the disk and the cache to buffer data in units of groups.
  • the first determining unit determines whether the original data of the new data in the cache in the cache and the original data in the cache in the cache are in the same mapping group.
  • the new data in the cache is waiting for the original data in the disk and the cache.
  • the original data of the new data in the cache is stored in the cache to the mapping group of the original data of the data to be replaced in the disk, such that It can replace the coldest or non-hotspot data in the cache, which can improve the cache hit rate and increase the running speed of the system.
  • the embodiment of the present invention further provides a server, including the data cache device of the first embodiment and the third embodiment, or the data cache method of the first and second embodiments.
  • the working process of the server's cache of data is not described here.

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

本发明提供了一种数据的缓存方法、装置及服务器,能够提高缓存的命中率,提高系统的运行速率。该数据的缓存方法,包括:判断缓存中新进数据在磁盘中的原始数据与缓存中待替换数据在磁盘中的原始数据是否位于磁盘中的同一映射组,所述映射组为磁盘中与缓存中一存储组对应的一个或多个存储组;若所述缓存中新进数据在磁盘中的原始数据与所述缓存中待替换数据在磁盘中的原始数据不位于磁盘中的同一映射组内,将所述缓存中新进数据在磁盘中的原始数据迁移到所述缓存中待替换数据在磁盘中的原始数据相同的磁盘映射组内;将所述缓存中新进数据写入所述缓存中待替换数据在所述缓存中的存储位置。本发明适用于数据缓存领域。

Description

一种数据的缓存方法、 装置和服务器 技术领域 本发明涉及数据缓存领域, 尤其涉及一种数据的缓存方法、 装置和服 务器。 背景技术
磁盘与内存间的 I/O (Input/Output, 输入输出)速度一直是系统性能的 一个重要瓶颈。 目前为了提高系统的速度, 很多系统在内存和磁盘之间添 加一级缓存,用于存放 CPU近期需要运行的指令和数据,可以提高 CPU对磁 盘的访问速度。
现有技术中磁盘和缓存之间主要采用组相连映射模式, 以组为单位管 理缓存数据。 磁盘和缓存的存储空间都被划分成大小相同的组, 通常磁盘 的存储空间要比缓存的存储空间大很多, 磁盘中多个存储组的数据将会对 应缓存到缓存中同一个存储组, 这样映射组为磁盘中与缓存中一存储组对 应的一个或多个存储组。
在实现上述缓存组相连映射的过程中, 缓存以组为单位管理缓存数据。 缓存中新进数据要存储到缓存中, 被替换掉的缓存中的数据在磁盘中的原 始数据必须与缓存中新进数据在磁盘中的原始数据位于同一映射组, 这样 被替换掉的缓存中的数据可能是整个缓存中较为热点的数据, 而不能替换 掉整个缓存中位于其它存储组的非热点数据或最冷数据。 而这些非热点数 据或最冷数据占用缓存空间, 不能使其它热点数据被存储到缓存中, 从而 会影响缓存的命中率, 降低系统的运行速率。 发明内容
本发明的实施例提供一种数据的缓存方法、 装置和服务器, 提高了缓 存的命中率和系统运行的速率。
为达到上述目的, 本发明的实施例采用如下技术方案:
一种数据的缓存方法, 包括:
判断缓存中新进数据在磁盘中的原始数据与缓存中待替换数据在磁盘 中的原始数据是否位于磁盘中的同一映射组, 所述映射组为磁盘中与缓存 中一存储组对应的一个或多个存储组;
若所述缓存中新进数据在磁盘中的原始数据与所述缓存中待替换数据 在磁盘中的原始数据不位于磁盘中的同一映射组内, 将所述缓存中新进数 据在磁盘中的原始数据迁移到所述缓存中待替换数据在磁盘中的原始数据 相同的磁盘映射组内;
将所述缓存中新进数据写入所述缓存中待替换数据在所述缓存中的存 储位置。
一种数据的缓存装置, 包括:
第一判断单元, 判断缓存中新进数据在磁盘中的原始数据与缓存中待 替换数据在磁盘中的原始数据是否位于磁盘中的同一映射组, 所述映射组 为磁盘中与缓存中一存储组对应的一个或多个存储组;
磁盘迁移单元, 若所述缓存中新进数据在磁盘中的原始数据与所述缓 存中待替换数据在磁盘中的原始数据不位于磁盘中的同一映射组内, 用于 将所述缓存中新进数据在磁盘中的原始数据迁移到所述缓存中待替换数据 在磁盘中的原始数据相同的磁盘映射组内;
缓存写入单元, 用于将所述缓存中新进数据写入所述缓存中待替换数 据在所述缓存中的存储位置。
一种服务器, 包括上述数据的缓存装置。
本发明实施例提供了一种数据的缓存方法、 装置和服务器, 磁盘与缓 存之间采用组相连映射的模式进行以组为单位进行数据的缓存。 通过将与 缓存中待替换数据在磁盘中的原始数据属于不同映射组的缓存中新进数据 在磁盘中的原始数据迁移到缓存中待替换数据在磁盘中的原始数据相同的 磁盘映射组内, 有目标的将缓存中新进数据存储到缓存中待替换数据在缓 存中的存储位置。 这样才能更有效的去除掉缓存中不常用的数据, 如最冷 数据或非热点数据, 使得热点数据不会被替换出缓存, 从而可以提高缓存 的命中率, 提高系统的运行速率。 附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案, 下面将对 实施例或现有技术描述中所需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是本发明的一些实施例, 对于本领域普通技术人员 来讲, 在不付出创造性劳动的前提下, 还可以根据这些附图获得其他的附 图。
图 1为本发明实施例一提供的数据的缓存方法的流程示意图; 图 2为本发明实施例一提供的数据的缓存装置的结构示意图; 图 3为本发明实施例二提供的数据的缓存方法的流程示意图; 图 4为本发明实施例三提供的数据的缓存装置的结构示意图; 图 5为磁盘与缓存采用组相连映射的方式的示意图。 具体实施方式
下面将结合本发明实施例中的附图, 对本发明实施例中的技术方案 进行清楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明一部分实施 例, 而不是全部的实施例。 基于本发明中的实施例, 本领域普通技术人员 在没有做出创造性劳动前提下所获得的所有其他实施例, 都属于本发明保 护的范围。
实施例一
本发明实施例提供了一种数据的缓存方法, 如图 1所示, 包括: 5101、 判断缓存中新进数据在磁盘中的原始数据与缓存中待替换数据 在磁盘中的原始数据是否位于磁盘中的同一映射组, 所述映射组为磁盘中 与缓存中一存储组对应的一个或多个存储组。
若所述缓存中新进数据在磁盘中的原始数据与所述缓存中待替换数据 在磁盘中的原始数据不位于磁盘中同一映射组的数据, 执行 S102歩骤; 若 缓存中新进数据在磁盘中的原始数据与缓存中待替换数据在磁盘中的原始 数据位于磁盘中同一映射组的数据, 执行 S103歩骤。
5102、 将所述缓存中新进数据在磁盘中的原始数据迁移到所述缓存中 待替换数据在磁盘中的原始数据相同的磁盘映射组内。
S 103、 将所述缓存中新进数据写入所述缓存中待替换数据在所述缓存 中的存储位置。
具体的缓存中待替换数据可以通过对缓存的数据根据被访问时间和被 访问频率进行统计, 获取最冷数据或非热点数据作为所述替换数据。
本发明实施例还提供了一种数据的缓存装置, 如图 2所示, 包括: 第 一判断单元 21、 磁盘迁移单元 22和缓存写入单元 23。
第一判断单元 21, 用于判断缓存中新进数据在磁盘中的原始数据与缓 存中待替换数据在磁盘中的原始数据是否位于磁盘中的同一映射组, 所述 映射组为磁盘中与缓存中一存储组对应的一个或多个存储组。
磁盘迁移单元, 若所述缓存中新进数据在磁盘中的原始数据与所述缓 存中待替换数据在磁盘中的原始数据不位于磁盘中的同一映射组内, 用于 将所述缓存中新进数据在磁盘中的原始数据迁移到所述缓存中待替换数据 在磁盘中的原始数据相同的磁盘映射组内。
缓存写入单元 23, 用于将所述缓存中新进数据写入所述缓存中待替换 数据在所述缓存中的存储位置。
一种服务器, 包括上述的数据的缓存装置。
本发明实施例提供了一种数据的缓存方法、 装置和服务器, 磁盘与缓 存之间采用组相连映射的模式进行以组为单位进行数据的缓存。 通过将与 缓存中待替换数据在磁盘中的原始数据属于不同映射组的缓存中新进数据 在磁盘中的原始数据迁移到缓存中待替换数据在磁盘中的原始数据相同的 磁盘映射组内, 有目标的将缓存中新进数据存储到缓存中待替换数据在缓 存中的存储位置。 这样才能更有效的去除掉缓存中不常用的数据, 如最冷 数据或非热点数据, 使得热点数据不会被替换出缓存, 从而可以提高缓存 的命中率, 提高系统的运行速率。
实施例二、
本发明实施例提供了一种数据的缓存方法, 如图 3所示, 包括:
5301、 判断缓存中新进数据在磁盘中的原始数据与缓存中待替换数据 在磁盘中的原始数据是否位于磁盘中的同一映射组, 所述映射组为磁盘中 与缓存中一存储组对应的一个或多个存储组。
若所述缓存中新进数据在磁盘中的原始数据与所述缓存中待替换数据 在磁盘中的原始数据不位于磁盘中同一映射组的数据, 则执行 S302歩骤; 若所述缓存中新进数据的在磁盘中的原始数据与所述缓存中待替换数据在 磁盘中的原始数据位于同一映射组的数据, 则执行 S305歩骤。
5302、 判断所述缓存中待替换数据在磁盘中的原始数据位于磁盘中的 映射组的存储空间是否已满。
若所述缓存中待替换数据在磁盘中的原始数据位于磁盘中的映射组的 存储空间已满, 则执行 S303 ; 若所述缓存中待替换数据在磁盘中的原始数 据位于磁盘中的映射组的存储空间未满, 则执行 S304。
5303、 交换缓存中新进数据在磁盘中的原始数据与缓存中待替换数据 在磁盘中的原始数据的存储位置。
5304、 所述缓存中新进数据在磁盘中的原始数据迁移到所述缓存中待 替换数据在磁盘中的原始数据位于磁盘中的映射组的空闲位置。
5305、 将所述缓存中新进数据写入所述缓存中待替换数据在所述缓存 中的存储位置。
其中, 所述缓存中待替换数据可以通过对缓存的数据根据被访问时间 和被访问频率进行统计, 获取最冷数据或非热点数据作为所述替换数据。
进一歩的, 还可以在交换缓存中新进数据在磁盘中的原始数据与缓存 中待替换数据在磁盘中的原始数据的存储位置后, 将缓存中新进数据在磁 盘中的原始数据关联的未缓存数据与缓存中待替换数据在磁盘中的原始数 据关联的数据交换存储位置, 所述缓存中新进数据在磁盘中的原始数据关 联的未缓存数据与缓存中新进数据在磁盘中的原始数据位于磁盘同一存储 组且物理存储地址连续, 所述缓存中待替换数据在磁盘中的原始数据关联 的数据与缓存中待替换数据在磁盘中的原始数据位于磁盘同一存储组的数 据且物理存储地址连续。
进一歩的, 还可以在所述缓存中新进数据在磁盘中的原始数据存储到 所述缓存中待替换数据在磁盘中的原始数据所属的映射组的空闲位置后, 将缓存中新进数据的在磁盘中的原始数据关联的未缓存数据存储到缓存中 待替换数据在磁盘中的原始数据所属的映射组的空闲位置, 所述缓存中新 进数据在磁盘中的原始数据关联的未缓存数据与缓存中新进数据在磁盘中 的原始数据位于磁盘同一存储组且物理存储地址连续。
上述的缓存可以采用非易失性的存储介质, 如 SSD ( solid state disk, 固态硬盘)、 PCM (phase-change memory, 相变存储器) 的高速缓存介质。
下面我们对本发明实施例提供的磁盘数据缓存方法的具体过程进行详 细说明。
磁盘与内存间的 I/O速度一直是系统性能的一个重要瓶颈,在磁盘与内 存之间添加一级缓存, 能够有效的提高 I/O速度。
磁盘和磁盘缓存之间的采用组相连模式, 以组为单位管理缓存数据。 如图 5所示, 磁盘和缓存的存储空间被分成同样大小的存储组, 假设缓存 中有 N个存储组, 每个存储组中有 M块数据, 因为磁盘的存储空间比缓存 的存储空间大很多, 这样在磁盘中有多个存储组会映射到缓存的同一存储 组。 示例性的, 图 5中磁盘中分别有 3个存储组被对应映射到缓存的同一 存储组, 这 3个存储组称为磁盘的映射组。 如图 Alcl、 A2cl、 A3cl三个 存储组为磁盘的映射组 cl, 该映射组 cl 中的数据只能被映射到缓存的 C1 存储组中。假设系统使用映射组 cN中的某一存储组 A3cN中某块数据 ml, 在 ml被使用后对数据 ml进行了修改。修改后的数据内容变为 ml A3, ml A3 作为缓存中新进数据要被存储到缓存中。而 mlA3在磁盘中的原始数据 ml 属于映射组 cN中的数据。这样在缓存 CN存储组的存储空间未满的情况下, 缓存中新进数据 mlA3就可以直接存储到缓存的 CN存储组的空闲位置。
而在缓存 C1存储组的存储空间已满的情况下, 为了提高缓存命中率, 提高系统的运行速度, 缓存会根据存储在缓存中的数据被访问的时间和被 访问的频率, 统计出了最冷数据或者非热点数据作为缓存中待替换数据, 将缓存中新进数据有目标的写入到缓存中待替换数据在缓存中的存储位置。
这样处理系统会判断缓存中新进数据在磁盘中的原始数据与缓存中待 替换数据在磁盘中的原始数据是否位于磁盘中的同一映射组, 所述映射组 为磁盘中与缓存中一存储组对应的一个或多个存储组。 若缓存中新进数据 的在磁盘中的原始数据与缓存中待替换数据在磁盘中的原始数据位于磁盘 中同一映射组, 根据组相连映射的方式, 对于 SSD缓存介质, 需要先在缓 存中直接将该待替换数据擦除, 然后将缓存中新进数据写入待替换数据在 缓存的存储位置。
若处理系统判断缓存中新进数据在磁盘中的原始数据与缓存中待替换 数据在磁盘中的原始数据不位于磁盘中同一映射组的数据, 处理系统进一 歩判断缓存中待替换数据在磁盘中的原始数据位于磁盘中的映射组的存储 空间是否已满。
若缓存中待替换数据在磁盘中的原始数据位于磁盘中的映射组的存储 空间已经被占满, 那么处理系统将缓存中新进数据在磁盘中的原始数据与 缓存中待替换数据在磁盘中的原始数据彼此交换存储位置。
进一歩的, 处理系统还可以将缓存中新进数据在磁盘中的原始数据关 联的未缓存数据与缓存中待替换数据在磁盘中的原始数据关联的数据交换 存储位置, 所述缓存中新进数据在磁盘中的原始数据关联的未缓存数据与 缓存中新进数据的在磁盘中的原始数据位于磁盘同一存储组且物理存储地 址连续。 所述缓存中待替换数据在磁盘中的原始数据关联的数据与缓存中 待替换数据在磁盘中的原始数据位于磁盘同一存储组且物理存储地址连续。 然后在需要将缓存中新进数据在磁盘中的原始数据关联的未缓存数据存储 到缓存时, 直接存储到缓存中。 这样可以使得处理系统更为快速的对磁盘 中的数据进行缓存, 有效更新缓存中的数据。
若缓存中待替换数据在磁盘中的原始数据位于磁盘中的映射组的存储 空间还没有被占满的情况下, 那么处理系统将缓存中新进数据在磁盘中的 原始数据迁移到缓存中待替换数据在磁盘中的原始数据位于磁盘中的映射 组的空闲位置。 进一歩的, 处理系统还可以将缓存中新进数据在磁盘中的 原始数据关联的未缓存数据迁移到缓存中待替换数据在磁盘中的原始数据 位于磁盘中的映射组的空闲位置, 所述缓存中新进数据在磁盘中的原始数 据关联的未缓存数据与缓存中新进数据在磁盘中的原始数据位于磁盘同一 存储组且物理存储地址连续。 这样可以使得处理系统更为快速的对磁盘中 的数据进行缓存, 有效更新缓存中的数据。
具体的, 缓存中新进数据在磁盘中的原始数据关联的数据或缓存中待 替换数据在磁盘中的原始数据关联的数据, 这里所说的关联可以是属于同 一文件或属性比较接近的数据, 具体的如一个音视频文件的不同部分, 如 数据为视频文件的第一部分, 与该数据关联的数据则可以是该视频文件的 另外部分。
在将缓存中新进数据在磁盘中的原始数据迁移到缓存中待替换数据在 磁盘中的原始数据相同的磁盘映射组内后, 处理系统还需要修改缓存中新 进数据的文件描述符,具体包括:修改缓存中新进数据与磁盘的映射关系。 进一歩的根据修改后的缓存中新进数据与磁盘的映射关系, 系统自动更新 缓存中新进数据在缓存中的存储组。然后处理系统检测 I/O请求队列中是否 有对缓存中新进数据的操作,若 I/O请求队列中有对该缓存中新进数据的操 作, 同时需要修改 I/O请求队列中该缓存中新进数据的文件描述符, 具体包 括: 修改缓存中新进数据与磁盘的映射关系。
本发明实施例提供的数据缓存方法, 磁盘与缓存之间采用组相连映射 的模式进行以组为单位进行数据的缓存。 为了有效替换缓存中的最冷数据 或非热点数据, 首先判断缓存中新进数据在磁盘中的原始数据与缓存中待 替换数据在磁盘中的原始数据是否位于同一映射组。 在缓存中新进数据在 磁盘中的原始数据与缓存中待替换数据在磁盘中的原始数据位于不同映射 组的情况下, 将缓存中新进数据在磁盘中的原始数据存储到缓存中待替换 数据在磁盘中的原始数据的映射组, 这样能够替换掉缓存中最冷或非热点 数据, 从而可以提高缓存的命中率, 提高系统的运行速率。
实施例三、
本发明实施例提供了一种数据的缓存装置, 如图 4所示, 包括: 统计 单元 41、 第一判断单元 42、 磁盘迁移单元 43、 缓存写入单元 44。
其中, 统计单元 41, 用于将所述缓存中的数据根据被访问时间和被访 问频率进行统计, 获取最冷数据或非热点数据作为所述缓存中待替换数据。
第一判断单元 42, 用于判断缓存中新进数据在磁盘中的原始数据与缓 存中待替换数据在磁盘中的原始数据是否位于磁盘中的同一映射组, 所述 映射组为磁盘中与缓存中一存储组对应的一个或多个存储组。
磁盘迁移单元 43, 若所述缓存中新进数据在磁盘中的原始数据与所述 缓存中待替换数据在磁盘中的原始数据不位于磁盘中的同一映射组内, 用 于将所述缓存中新进数据在磁盘中的原始数据迁移到所述缓存中待替换数 据在磁盘中的原始数据相同的磁盘映射组内。 磁盘迁移单元 43具体包括第二判断子单元 431、 交换子单元 432和存 储子单元 433。
第二判断子单元 431,用于判断所述缓存中待替换数据在磁盘中的原始 数据位于磁盘中的映射组的存储空间是否已满。
交换子单元 432,若所述缓存中待替换数据在磁盘中的原始数据位于磁 盘中的映射组的存储空间已满, 用于交换缓存中新进数据在磁盘中的原始 数据与缓存中待替换数据在磁盘中的原始数据的存储位置。
存储子单元 433,若所述缓存中待替换数据在磁盘中的原始数据位于磁 盘中的映射组的存储空间未满, 用于所述缓存中新进数据在磁盘中的原始 数据迁移到所述缓存中待替换数据在磁盘中的原始数据位于磁盘中的映射 组的空闲位置。
缓存写入单元 44, 用于将所述缓存中新进数据写入所述缓存中待替换 数据在所述缓存中的存储位置。
进一歩的, 交换子单元 432还用于将缓存中新进数据在磁盘中的原始 数据关联的未缓存数据与缓存中待替换数据在磁盘中的原始数据关联的数 据交换存储位置, 所述缓存中新进数据在磁盘中的原始数据关联的未缓存 数据与缓存中新进数据在磁盘中的原始数据位于磁盘同一存储组且物理存 储地址连续, 所述缓存中待替换数据在磁盘中的原始数据关联的数据与缓 存中待替换数据在磁盘中的原始数据位于磁盘同一存储组且物理存储地址 连续。
进一歩的, 存储子单元 433 还用于将缓存中新进数据在磁盘中的原始 数据关联的未缓存数据迁移到替换数据在磁盘中的原始数据所属的映射组 的空闲位置, 所述缓存中新进数据的在磁盘中的原始数据关联的未缓存数 据与缓存中新进数据的在磁盘中的原始数据位于磁盘同一存储组且物理存 储地址连续。
上述的缓存可以采用非易失性的存储介质, 如 SSD、 PCM的高速缓存 介质。
下面我们对数据的缓存装置的具体工作过程进行详细说明。
磁盘与内存间的 I/O速度一直是系统性能的一个重要瓶颈,在磁盘与内 存之间添加一级缓存, 能够有效的提高 I/O速度。
缓存装置的第一判断单元会判断缓存中新进数据在磁盘中的原始数据 与缓存中待替换数据在磁盘中的原始数据是否位于磁盘中的同一映射组, 所述映射组为磁盘中与缓存中一存储组对应的一个或多个存储组。 若所述 缓存中新进数据在磁盘中的原始数据与所述缓存中待替换数据在磁盘中的 原始数据位于磁盘中的同一映射组的数据, 这样根据组相连映射的方式, 对于 SSD缓存介质,缓存写入单元需要在缓存中先直接将该替换数据擦除, 然后将缓存中新进数据写入替换数据在缓存的存储位置。
若第一判断单元判断所述缓存中新进数据在磁盘中的原始数据与所述 缓存中待替换数据在磁盘中的原始数据不位于磁盘中的同一映射组的数据, 磁盘存储单元的第二判断子单元需要进一歩判断所述缓存中待替换数据在 磁盘中的原始数据位于磁盘中的映射组的存储空间是否已满。
若所述缓存中待替换数据在磁盘中的原始数据位于磁盘中的映射组的 存储空间已满, 那么磁盘迁移单元的交换子单元将交换缓存中新进数据在 磁盘中的原始数据与缓存中待替换数据在磁盘中的原始数据的存储位置。
进一歩的, 交换子单元还可以将缓存中新进数据在磁盘中的原始数据 关联的未缓存数据与缓存中待替换数据在磁盘中的原始数据关联的数据交 换存储位置, 所述缓存中新进数据在磁盘中的原始数据关联的未缓存数据 与缓存中新进数据在磁盘中的原始数据位于磁盘同一存储组且物理存储地 址连续, 所述缓存中待替换数据在磁盘中的原始数据关联的数据与缓存中 待替换数据在磁盘中的原始数据位于磁盘同一存储组的数据且物理存储地 址连续。 这样可以更为快速的对磁盘中的数据进行缓存, 有效更新缓存中 的数据。 若在所述缓存中待替换数据在磁盘中的原始数据位于磁盘中的映射组 的存储空间未满的情况下, 那么缓存装置的存储子单元将缓存中新进数据 在磁盘中的原始数据迁移到所述缓存中待替换数据在磁盘中的原始数据位 于磁盘中的映射组的空闲位置。 进一歩的, 存储子单元还可以将缓存中新 进数据在磁盘中的原始数据关联的未缓存数据迁移到缓存中待替换数据在 磁盘中的原始数据位于磁盘中的映射组的空闲位置, 所述缓存中新进数据 在磁盘中的原始数据关联的未缓存数据与缓存中新进数据在磁盘中的原始 数据位于磁盘同一存储组且物理存储地址连续。 这样可以使得处理系统更 为快速的对磁盘中的数据进行缓存, 有效更新缓存中的数据。
具体的, 缓存中新进数据在磁盘中的原始数据关联的数据或缓存中待 替换数据在磁盘中的原始数据关联的数据, 这里所说的关联可以是属于同 一文件或属性比较接近的数据, 具体的如一个音视频文件的不同部分, 如 数据为视频文件的第一部分, 与该数据关联的数据则可以是该视频文件的 另外部分。
在将缓存中新进数据在磁盘中的原始数据迁移到缓存中待替换数据在 磁盘中的原始数据相同的磁盘映射组内后, 缓存装置还需要修改缓存中新 进数据的文件描述符,具体包括:修改缓存中新进数据与磁盘的映射关系。 进一歩的根据修改后的缓存中新进数据与磁盘的映射关系, 缓存装置自动 更新缓存中新进数据在缓存中的存储组。然后检测 I/O请求队列中是否有对 缓存中新进数据的操作, 若 I/O请求队列中有对该缓存中新进数据的操作, 同时需要修改 I/O请求队列中该缓存中新进数据的文件描述符, 具体包括: 修改缓存中新进数据与磁盘的映射关系。
本发明实施例提供的数据的缓存装置, 磁盘与缓存之间采用组相连映 射的模式进行以组为单位进行数据的缓存。 首先第一判断单元判断缓存中 新进数据在磁盘中的原始数据与缓存中待替换数据在磁盘中的原始数据是 否位于同一映射组。 在缓存中新进数据在磁盘中的原始数据与缓存中待替 换数据在磁盘中的原始数据不位于磁盘中的不同映射组的情况下, 将缓存 中新进数据在磁盘中的原始数据存储到缓存中待替换数据在磁盘中的原始 数据的映射组, 这样能够替换掉缓存中最冷或非热点数据, 从而可以提高 缓存的命中率, 提高系统的运行速率。
本发明实施例还提供了一种服务器, 包括实施例一、 三的数据的缓存 装置或采用实施例一、 二的数据的缓存方法进行数据缓存。 服务器关于数 据的缓存的工作过程在此不再赘述。
本领域普通技术人员可以理解: 实现上述方法实施例的全部或部分歩 骤可以通过程序指令关联的硬件来完成, 前述的程序可以存储于一计算机 可读取存储介质中, 该程序在执行时, 执行包括上述方法实施例的歩骤; 而前述的存储介质包括: ROM、 RAM, 磁碟或者光盘等各种可以存储程序 代码的介质。
以上所述, 仅为本发明的具体实施方式, 但本发明的保护范围并不局 限于此, 任何熟悉本技术领域的技术人员在本发明揭露的技术范围内, 可 轻易想到变化或替换, 都应涵盖在本发明的保护范围之内。 因此, 本发明 的保护范围应以所述权利要求的保护范围为准。

Claims

权利要求
1、 一种数据的缓存方法, 其特征在于, 包括:
判断缓存中新进数据在磁盘中的原始数据与缓存中待替换数据在磁盘 中的原始数据是否位于磁盘中的同一映射组, 所述映射组为磁盘中与缓存 中一存储组对应的一个或多个存储组;
若所述缓存中新进数据在磁盘中的原始数据与所述缓存中待替换数据 在磁盘中的原始数据不位于磁盘中的同一映射组内, 将所述缓存中新进数 据在磁盘中的原始数据迁移到所述缓存中待替换数据在磁盘中的原始数据 相同的磁盘映射组内;
将所述缓存中新进数据写入所述缓存中待替换数据在所述缓存中的存 储位置。
2、 根据权利要求 1所述的方法, 其特征在于, 将所述缓存中新进数据 在磁盘中的原始数据迁移到所述缓存中待替换数据在磁盘中的原始数据相 同的磁盘映射组内包括:
判断所述缓存中待替换数据在磁盘中的原始数据位于磁盘中的映射组 的存储空间是否已满;
若所述缓存中待替换数据在磁盘中的原始数据位于磁盘中的映射组的 存储空间已满, 交换缓存中新进数据在磁盘中的原始数据与缓存中待替换 数据在磁盘中的原始数据的存储位置;
若所述缓存中待替换数据在磁盘中的原始数据位于磁盘中的映射组的 存储空间未满, 所述缓存中新进数据在磁盘中的原始数据迁移到所述缓存 中待替换数据在磁盘中的原始数据位于磁盘中的映射组的空闲位置。
3、 根据权利要求 2所述的方法, 其特征在于, 在交换缓存中新进数据 在磁盘中的原始数据与缓存中待替换数据在磁盘中的原始数据的存储位置 后, 还包括:
将缓存中新进数据在磁盘中的原始数据关联的未缓存数据与缓存中待 替换数据在磁盘中的原始数据关联的数据交换存储位置, 所述缓存中新进 数据在磁盘中的原始数据关联的未缓存数据与缓存中新进数据在磁盘中的 原始数据位于磁盘同一存储组且物理存储地址连续, 所述缓存中待替换数 据在磁盘中的原始数据关联的数据与缓存中待替换数据在磁盘中的原始数 据位于磁盘同一存储组且物理存储地址连续。
4、 根据权利要求 2所述的方法, 其特征在于, 在所述缓存中新进数据 在磁盘中的原始数据迁移到所述缓存中待替换数据在磁盘中的原始数据位 于磁盘中的映射组的空闲位置后, 还包括:
将缓存中新进数据在磁盘中的原始数据关联的未缓存数据迁移到替换 数据在磁盘中的原始数据所属的映射组的空闲位置, 所述缓存中新进数据 的在磁盘中的原始数据关联的未缓存数据与缓存中新进数据的在磁盘中的 原始数据位于磁盘同一存储组且物理存储地址连续。
5、 根据权利要求 1-4任一项所述的方法, 其特征在于, 还包括: 将所述缓存中的数据根据被访问时间和被访问频率进行统计, 获取最 冷数据或非热点数据作为所述缓存中待替换数据。
6、 一种数据的缓存装置, 其特征在于, 包括:
第一判断单元, 用于判断缓存中新进数据在磁盘中的原始数据与缓存 中待替换数据在磁盘中的原始数据是否位于磁盘中的同一映射组, 所述映 射组为磁盘中与缓存中一存储组对应的一个或多个存储组;
磁盘迁移单元, 若所述缓存中新进数据在磁盘中的原始数据与所述缓 存中待替换数据在磁盘中的原始数据不位于磁盘中的同一映射组内, 用于 将所述缓存中新进数据在磁盘中的原始数据迁移到所述缓存中待替换数据 在磁盘中的原始数据相同的磁盘映射组内;
缓存写入单元, 用于将所述缓存中新进数据写入所述缓存中待替换数 据在所述缓存中的存储位置。
7、 根据权利要求 6所述的装置, 其特征在于, 所述磁盘迁移单元还包 括:
第二判断子单元, 用于判断所述缓存中待替换数据在磁盘中的原始数 据位于磁盘中的映射组的存储空间是否已满;
交换子单元, 若所述缓存中待替换数据在磁盘中的原始数据位于磁盘 中的映射组的存储空间已满, 用于交换缓存中新进数据在磁盘中的原始数 据与缓存中待替换数据在磁盘中的原始数据的存储位置;
存储子单元, 若所述缓存中待替换数据在磁盘中的原始数据位于磁盘 中的映射组的存储空间未满, 用于所述缓存中新进数据在磁盘中的原始数 据迁移到所述缓存中待替换数据在磁盘中的原始数据位于磁盘中的映射组 的空闲位置。
8、 根据权利要求 7所述的装置, 其特征在于, 所述交换子单元, 还用 于将缓存中新进数据在磁盘中的原始数据关联的未缓存数据与缓存中待替 换数据在磁盘中的原始数据关联的数据交换存储位置, 所述缓存中新进数 据在磁盘中的原始数据关联的未缓存数据与缓存中新进数据在磁盘中的原 始数据位于磁盘同一存储组且物理存储地址连续, 所述缓存中待替换数据 在磁盘中的原始数据关联的数据与缓存中待替换数据在磁盘中的原始数据 位于磁盘同一存储组且物理存储地址连续。
9、 根据权利要求 7所述的装置, 其特征在于, 所述存储子单元还用于 将缓存中新进数据在磁盘中的原始数据关联的未缓存数据迁移到替换数据 在磁盘中的原始数据所属的映射组的空闲位置, 所述缓存中新进数据的在 磁盘中的原始数据关联的未缓存数据与缓存中新进数据的在磁盘中的原始 数据位于磁盘同一存储组且物理存储地址连续。
10、 根据权利要求 6-9任一项所述的装置, 其特征在于, 还包括: 统计单元, 用于将所述缓存中的数据根据被访问时间和被访问频率进 行统计, 获取最冷数据或非热点数据作为所述缓存中待替换数据。
11、 一种服务器, 其特征在于, 包括权利要求 6-10任一项所述的缓存
LI
TS6l780/ZlOZN3/X3d LZ^LOIZIOZ OAV
PCT/CN2012/084951 2011-11-21 2012-11-21 一种数据的缓存方法、装置和服务器 WO2013075627A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110371549.8A CN102521161B (zh) 2011-11-21 2011-11-21 一种数据的缓存方法、装置和服务器
CN201110371549.8 2011-11-21

Publications (1)

Publication Number Publication Date
WO2013075627A1 true WO2013075627A1 (zh) 2013-05-30

Family

ID=46292090

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/084951 WO2013075627A1 (zh) 2011-11-21 2012-11-21 一种数据的缓存方法、装置和服务器

Country Status (2)

Country Link
CN (1) CN102521161B (zh)
WO (1) WO2013075627A1 (zh)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102521161B (zh) * 2011-11-21 2015-01-21 华为技术有限公司 一种数据的缓存方法、装置和服务器
CN104252421A (zh) * 2013-06-25 2014-12-31 华为技术有限公司 缓存方法及装置
CN104932990B (zh) * 2015-06-03 2018-05-11 华为技术有限公司 一种高速缓冲存储器中数据块的替换方法和装置
CN107229574A (zh) * 2016-03-23 2017-10-03 上海复旦微电子集团股份有限公司 缓存及其控制方法
CN108932150B (zh) * 2017-05-24 2023-09-15 中兴通讯股份有限公司 基于ssd和磁盘混合存储的缓存方法、装置及介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5829028A (en) * 1996-05-06 1998-10-27 Advanced Micro Devices, Inc. Data cache configured to store data in a use-once manner
CN1347527A (zh) * 1999-12-17 2002-05-01 皇家菲利浦电子有限公司 带有高速缓冲存储器的数据处理器
CN101122885A (zh) * 2007-09-11 2008-02-13 腾讯科技(深圳)有限公司 一种数据缓存处理方法、系统及数据缓存装置
CN102521161A (zh) * 2011-11-21 2012-06-27 华为技术有限公司 一种数据的缓存方法、装置和服务器

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1499382A (zh) * 2002-11-05 2004-05-26 华为技术有限公司 廉价冗余磁盘阵列系统中高效高速缓存的实现方法
WO2007088591A1 (ja) * 2006-01-31 2007-08-09 Fujitsu Limited メモリアクセス制御装置およびメモリアクセス制御方法
US8171219B2 (en) * 2009-03-31 2012-05-01 Intel Corporation Method and system to perform caching based on file-level heuristics
CN102137139A (zh) * 2010-09-26 2011-07-27 华为技术有限公司 缓存替换策略的选择方法、装置、代理服务器和系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5829028A (en) * 1996-05-06 1998-10-27 Advanced Micro Devices, Inc. Data cache configured to store data in a use-once manner
CN1347527A (zh) * 1999-12-17 2002-05-01 皇家菲利浦电子有限公司 带有高速缓冲存储器的数据处理器
CN101122885A (zh) * 2007-09-11 2008-02-13 腾讯科技(深圳)有限公司 一种数据缓存处理方法、系统及数据缓存装置
CN102521161A (zh) * 2011-11-21 2012-06-27 华为技术有限公司 一种数据的缓存方法、装置和服务器

Also Published As

Publication number Publication date
CN102521161B (zh) 2015-01-21
CN102521161A (zh) 2012-06-27

Similar Documents

Publication Publication Date Title
CN105740164B (zh) 支持缓存一致性的多核处理器、读写方法、装置及设备
JP6613375B2 (ja) プロファイリングキャッシュ置換
JP4435831B2 (ja) ストレージエリアネットワークレベルにおける代替キャッシュ方式の提供
US11593186B2 (en) Multi-level caching to deploy local volatile memory, local persistent memory, and remote persistent memory
WO2021218038A1 (zh) 一种存储系统、内存管理方法和管理节点
US20180107593A1 (en) Information processing system, storage control apparatus, storage control method, and storage control program
US10579532B2 (en) Invalidating track format information for tracks in cache
WO2011000260A1 (zh) 集群系统中内存资源的管理方法、设备及网络系统
CN105095116A (zh) 缓存替换的方法、缓存控制器和处理器
WO2014000300A1 (zh) 数据缓存装置、数据存储系统及方法
US11093410B2 (en) Cache management method, storage system and computer program product
US8656119B2 (en) Storage system, control program and storage system control method
WO2013075627A1 (zh) 一种数据的缓存方法、装置和服务器
WO2014075428A1 (zh) 一种用于替换缓存模块中数据的方法及装置
US20130007341A1 (en) Apparatus and method for segmented cache utilization
WO2023066124A1 (zh) 缓存管理方法、缓存管理装置、处理器
WO2015039352A1 (zh) 缓存数据的方法和存储系统
WO2013189186A1 (zh) 非易失性存储设备的缓存管理方法及装置
US10705977B2 (en) Method of dirty cache line eviction
WO2021062982A1 (zh) 管理hmb内存的方法、装置、计算机设备及存储介质
JPWO2018211749A1 (ja) ストレージコントローラ、ストレージシステム、ストレージコントローラの制御方法およびプログラム
CN106909323A (zh) 适用于dram/pram混合主存架构的页缓存方法及混合主存架构系统
KR20140070133A (ko) 메모리 관리 장치, 방법 및 시스템
JP2013222434A (ja) キャッシュ制御装置、キャッシュ制御方法、及びそのプログラム
CN110658999B (zh) 一种信息更新方法、装置、设备及计算机可读存储介质

Legal Events

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

Ref document number: 12851470

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: 12851470

Country of ref document: EP

Kind code of ref document: A1