WO2015100653A1 - Data caching method, device and system - Google Patents

Data caching method, device and system Download PDF

Info

Publication number
WO2015100653A1
WO2015100653A1 PCT/CN2013/091194 CN2013091194W WO2015100653A1 WO 2015100653 A1 WO2015100653 A1 WO 2015100653A1 CN 2013091194 W CN2013091194 W CN 2013091194W WO 2015100653 A1 WO2015100653 A1 WO 2015100653A1
Authority
WO
WIPO (PCT)
Prior art keywords
cache
memory
data
level cache
storage space
Prior art date
Application number
PCT/CN2013/091194
Other languages
French (fr)
Chinese (zh)
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/CN2013/091194 priority Critical patent/WO2015100653A1/en
Priority to CN201380002567.6A priority patent/CN103858112A/en
Publication of WO2015100653A1 publication Critical patent/WO2015100653A1/en

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/0806Multiuser, multiprocessor or multiprocessing cache systems
    • G06F12/0811Multiuser, multiprocessor or multiprocessing cache systems with multilevel cache hierarchies

Definitions

  • the present invention relates to the field of IT, and in particular to a storage technology. Background technique
  • a cache is used to temporarily store data.
  • the host reads data
  • the data is first read from the disk into the controller's cache and then sent to the host.
  • the host writes data to the disk, it first sends the data to the cache, and then writes the data from the cache to the host.
  • a common storage medium as a cache such as a Synchronous Dynamic Random Access Memory (SDRAM)
  • SDRAM Synchronous Dynamic Random Access Memory
  • some manufacturers use multi-level cache technology, the original SDRAM as a level 1 cache, and add relatively inexpensive Flash memory media such as Solid State Disk (SSD) as a second level outside the SDRAM.
  • the cache called SSD Cache.
  • the SSD Cache is located between the SDRAM and the disk. When the SDRAM space is insufficient, the data in the SDRAM is forwarded to the SSD Cache, and then the SSD Cache writes the data to the disk.
  • the invention provides a data caching technology, which can improve the hit rate of the second level cache.
  • the present invention provides a data caching method, which is applied to a controller, where the controller is connected to a storage device, the controller includes a level 1 cache, and the storage device includes a secondary buffer, the second level.
  • Cache is used to store data that is sent to the memory by the first level cache, and the method includes: querying a hit rate of the second level cache to the read request; determining whether the hit ratio is lower than a capacity expansion threshold, and if the value is lower than the expansion threshold, Obtaining a storage space in the storage for use by the secondary cache, where the storage space obtained from the storage is a newly added storage space; using the newly added storage space in the secondary cache, buffering the first-level slow transmission Store data.
  • the present invention provides a data cache device for managing a storage space of a storage device, where the storage device includes a secondary cache and a memory, and the device includes: a hit ratio query module, configured to query a secondary cache to read The hit rate of the request, the level 2 cache is used to cache the data sent by the level 1 cache; the expansion module is configured to determine whether the hit ratio is lower than the capacity expansion threshold, and if the volume is lower than the capacity expansion threshold, the storage space is obtained from the memory. Used for the secondary cache, where the storage space obtained from the storage is a newly added storage space; a cache module, configured to use the newly added storage space, and buffer the first-level cache to send to the storage Store data.
  • the invention uses the storage space of the memory to expand the secondary cache, and improves the hit rate of the secondary cache.
  • Figure 1 is a structural view of an embodiment of the present invention
  • FIG. 2 is a flow chart of an embodiment of a data caching method of the present invention.
  • FIG. 3 is a structural diagram of an embodiment of a data buffer device of the present invention. detailed description
  • the storage system of the present invention is composed of a controller and a storage device.
  • the storage device provides storage space
  • the controller provides management of the storage device, and provides read/write access to the host.
  • the storage device may be invisible.
  • the storage device and the controller can be physically separate devices; they can also be integrated into one device, and when they are integrated into one device, they can be called storage servers.
  • the controller includes a processor and a cache, and the cache in the controller is referred to as a level cache in the embodiment of the present invention.
  • the storage device is composed of a cache and a plurality of memories.
  • the cache provided by the storage device is referred to as a secondary cache.
  • the data sent by the controller to the storage device is first stored in the level 1 cache and stored in the level 1 cache.
  • the data in the Level 1 cache can periodically transfer relatively cold data to the Level 2 cache based on the degree of heat and cold of the data.
  • the data in the L2 cache periodically transfers relatively cold data to the memory.
  • the process of transferring relatively cold data from a higher-level storage device to a lower-level storage device is also referred to as elimination.
  • the controller may send a write completion response message to the host to inform the host that the write operation has been completed; or after the data is written into the memory, send a write completion response message to the host. , tells the host that the write operation has been completed.
  • the level 1 cache and the level 2 cache may be the same storage medium or different.
  • the L1 cache read/write speed can be faster and the cost is higher than the L2 cache.
  • the L1 cache is
  • the storage medium used by the level 1 cache and the level 2 cache may be a random access memory (RAM) or a nonvolatile storage. But for the controller, they are used as volatile storage.
  • the data stored in the L1 cache and the L2 cache can be eliminated by the aging algorithm, for example, using the identification method of hot and cold data to eliminate them. Utilization.
  • the level 1 cache can be subdivided into a plurality of different small levels, and different storage media can be used for each level, and the small-level storage mediums are connected in series, and the data is transmitted through the elimination algorithm.
  • the controller when receiving the read data of the host, preferentially acquires the read request data from the level 1 cache and the level 1 cache, and if not found, then obtains the read request data in the memory. Finding the read request data in a certain medium is called hit, at a certain number In a read request, the ratio of a medium hit is called the hit ratio of the medium. The hit ratio is used to record the number or proportion of successful reads when reading the pending data from the secondary cache.
  • the level 1 cache sends the read request data to the host; if the level 2 cache is hit, the read request data is from the level 2 cache. The first level cache is sent to the host, and then sent to the host from the level 1 cache. If the memory is hit, the read request data is sent from the memory to the level 1 cache and then sent from the level 1 cache to the host.
  • the storage space of the L2 cache SSD is limited.
  • the L2 cache hit rate is often reduced.
  • this problem can be partially solved by increasing the total capacity of the L2 cache, this increase in the total capacity will cause the total utilization of the L2 cache to decrease, which is contrary to the goal of reducing the cost of the L2 cache.
  • the storage device is installed at the factory, it has installed various components such as L2 cache and memory. Users want to add extra cache. There may not be enough space inside the storage device to install. Even with space, the process of installing additional caches is complex and difficult for ordinary users to implement. In the embodiment of the present invention, the symbol "Yes" or ".”
  • the embodiment of the invention can temporarily increase the storage space of the second-level cache, meet the sudden demand, and is convenient to implement, and the cost increase is not obvious.
  • FIG. 1 it is a structural diagram of an embodiment of the present invention.
  • the host 1 accesses the storage device 3 through the controller 2, and the processor 21 in the controller 2 communicates with the level 1 cache 22.
  • the primary cache 22 communicates with the secondary cache 31, the primary cache and the memory communication 32, the memory 34, and the memory 34 communicate, and the primary cache 22 communicates with the host 1.
  • the controller 2 can exchange data through the secondary cache 31 and the memory in the storage device 3; optionally, the secondary cache 31 can also be bypassed, and the primary cache 22 accesses the memory through the direct connection channel.
  • the following steps can be divided: the host sends a write request to the level 1 cache 22; the level cache 22 can be an SDRAM; then the level 1 cache 22 caches the data to the level 2 cache 3 1 Then, the secondary cache writes data into the storage device 3.
  • the storage device 3 includes a plurality of types of memories, for example, the memory 32 is an SSD, the memory 33 is a SAS (Serial Attached SCSI) disk, and the memory 34 is a SATA (Serial ATA) disk, and the read and write speeds of the three memories are sequentially lowered.
  • the storage device 3 stores data in storage media of different speeds according to different degrees of data heat and cold.
  • the hot data is stored in the SSD
  • the normal data is stored in the SAS disk
  • the cold data is stored in the SATA disk.
  • the degree of heat and cold of data can be described as the frequency with which data is accessed. The more frequently the data is accessed, the hotter it is, and vice versa.
  • the storage space 321 in the storage 32 is used as the storage space 311 in the secondary cache 31, and the storage space of the secondary cache 31 is increased.
  • the L2 cache hit rate is too high, and this part of the moved space can be returned to the memory 32.
  • the storage space originally belonging to the L2 cache 31 may be transferred to the memory 32 even when the SSD Cache hit ratio is higher than the preset value or when the storage space of the memory 32 is insufficient. If the storage space of the memory 33 is moved to the secondary cache 31, the cache 31 will be composed of different storage media.
  • Table 1 is an example of a policy.
  • the controller 21 periodically queries the hit rate of the L2 cache 31 (specifically, the query can be executed by the processor 21).
  • the lower the hit ratio the smaller the hit rate needs to be from the SSD memory 32.
  • space can also be allocated by capacity, for example, for every 5% drop in hit rate, 1 GB (gigabit) of storage space is allocated from SSD memory 32 to secondary cache 31. It is also possible to divide the space into the secondary buffer 31 by an integer multiple of a fixed size, and detect the change in the hit ratio after the division until the condition is satisfied. For example, the storage space in the SSD memory 32 is allocated to the secondary cache 31 by an integer multiple of 100 MB (megabits) until the hit rate reaches 95%, and the allocation is stopped.
  • Figure 2 provides a flow chart of an embodiment of a data caching method.
  • the method embodiments of the present invention may be implemented by the controller 2 executing the method steps, and in particular may be implemented by the processor 21 of the controller 2 of Fig. 1.
  • the first level cache 22 stores computer instructions, and the processor 21 executes the following method by executing computer instructions of the level one cache 22.
  • the storage space for storing this computer instruction can also be separated as a separate running memory.
  • Step 11 Query the hit rate of the secondary cache to the read request.
  • the hit ratio can describe the amount of read request data from the secondary cache when processing a read request.
  • the read request data is also the data requested to be read by the read request.
  • the data stored in the L2 cache is hotter than in the memory.
  • the read request data for a period of time can be found from the secondary cache if it cannot be found from the L1 cache.
  • the controller can preferentially find the level 1 cache. If the data with the read is not found in the level 1 cache, the second level cache is further searched. If the level 2 cache is not found, the memory is searched. If the storage capacity of the L2 cache is insufficient and there is not enough hot data stored, then there will be some read request data not found in the L1 cache, and not found in the L2 cache. The controller needs to obtain from the memory. Read the request data. This means that the secondary cache is not hit. For example, if, within a period of time, 80 of the 100 read requests to the L2 cache are found in the L2 cache and 20 are not found, the hit rate is 80%. This step can be performed periodically or after each read/write request.
  • Step 12 If the hit ratio is lower than the capacity expansion threshold, the storage space is used from the memory to be used by the second level cache, thereby expanding the storage space of the second level cache.
  • the storage device includes a plurality of storage media of a specification, one of which is the same as the secondary cache, for example, both are SSD memories.
  • the storage space of the SSD memory can be transferred to the secondary cache.
  • the entire SSD disk can be used as a range that can be used, or a part of the shared space can be opened in the SSD memory, and it can be used to the secondary cache within the shared space.
  • the controller records and manages the storage space of each memory, and the controller also records and manages the storage space of the caches (e.g., the primary cache and the secondary cache), such as the addresses of various types of storage media in the memory and cache.
  • the storage medium address originally marked as belonging to the memory may be marked by the controller as the storage medium address belonging to the secondary cache.
  • the identifier can also be used to record which memory the storage space comes from. When the free space of the secondary cache is too large, the storage space originally belonging to the storage device can be preferentially returned to the storage device.
  • the hit ratio is used to describe the extent to which the L2 cache is utilized, so that when the L2 cache utilization is reduced, the L2 cache is expanded. Therefore, the performance of the hit rate can be implemented in a variety of ways, except expressed as a percentage. It can also be expressed by the size of the storage space. For example, in the process of obtaining data from the secondary cache, if the average data of 100 MB (megabytes) per second cannot be found, the hit rate is considered to reach the capacity expansion threshold, and the secondary cache can be Expand the capacity.
  • the hit rate can also be expressed in terms of the number of read requests. For example, when more than 10 read requests for the L2 cache are not successfully responded to each second, it is considered that the expansion threshold is met, and the storage space of the L2 cache is expanded.
  • Step 13 Use the new storage space in the L2 cache to cache the data.
  • the relatively cold data can be transferred to the newly added storage space of the secondary cache. After the transferred data is cached in the secondary cache, it can be used by subsequent read requests to improve the hit rate of the secondary cache.
  • the cache is used as a verb, it means temporary storage.
  • the storage space occupied by the cached data can be replaced by new data. After receiving the instruction to cancel the cache, the storage space occupied for buffering data can be interpreted.
  • the medium of the second level cache may be either volatile or non-volatile. It can be logically set to be volatile and free up storage space for caching new data.
  • Step 14 Send the data buffered by the second level cache to the next level storage device.
  • the next level of memory is, for example, a memory.
  • the colder data can be transferred to the memory according to the elimination algorithm, and the relatively hot data is retained in the secondary cache.
  • the storage device is composed of a plurality of memories, and different levels of different memories are different.
  • the hot and the cold there is also a difference between the hot and the cold.
  • the hot data is preferentially stored in the high-speed memory of the storage device, and the cold data is preferentially stored in the low-speed memory of the storage device. It is also possible to analyze the importance of the data, and the more important the data is stored in the more reliable memory.
  • the storage space occupied by the data can be translated. So that the L2 cache can cache new data again. There are two ways to release the data, one is to actively erase the storage space occupied by the data; the other can mark the storage space occupied by the data as being able to be written again.
  • Step 15 When the hit rate is raised to the volume reduction threshold, the newly added storage space is returned to the memory. Step 15 is an optional step.
  • the storage space originally belonging to the memory is shared for use in the cache.
  • the cached storage space may also be shared for memory use; third-party storage space independent of the storage device and the cache may also be set, and used by the memory and the cache.
  • the embodiment of the present invention introduces a technique for buffering and memory sharing storage space, and the cache is divided into two levels.
  • the level 1 cache or the level 2 cache may be only one level or subdivided into more levels, and the read and write speeds of different levels are different.
  • the storage medium flash memory (Flash Memory) of the same specification exists in the cache and the memory, and in other embodiments, the storage space may be shared between the storage media of different specifications.
  • the memory is composed of a disk
  • the secondary cache is composed of an SSD
  • the disk space of the memory is shared by the secondary cache
  • the memory is composed of an SSD and a disk
  • the primary cache is composed of SDRAM, and the SSD or the disk in the memory is used.
  • the storage space is shared with the primary cache, and the controller uses the storage space shared with itself and the original SDRAM as the primary cache.
  • the storage space of the L2 cache provided by the controller may be 0. That is to say, the memory does not provide the second level cache, and the storage space of the storage device is directly provided as the second level cache, which simplifies the structure of the controller.
  • a direct connection channel may also be set between the level 1 cache and the memory. When the level 2 cache space is insufficient, the level 2 cache is bypassed by the direct connection channel, and the data exchanged between the level 1 cache and the memory is transmitted through the direct connection channel.
  • the data cache device 4 includes a level 1 cache 41, a hit ratio query module 42, a expansion module 43, a cache module 44, and a sending module 45.
  • the data buffer device 4 is connected to the storage device 3, and the storage device 3 includes a secondary cache 31 and a memory 32.
  • Level 1 cache 41 used to cache data. Reading and writing data can be faster than L2 cache 31 and storage device 3.
  • the secondary cache 31 is connected to the primary cache 41 and the storage device 3.
  • the write data between the level 1 cache and the memory may be relayed, and the data is first transferred from the level 1 cache to the level 2 cache, and then transferred from the level 2 cache to the disk.
  • the level 2 cache 31 can read and write data faster than the memory 3.
  • the hit rate query module 42 is used to query the hit rate of the second level cache 31.
  • the data carried in the write request passes through the controller and reaches the L1 cache 41, and the L1 cache 41 transfers the relatively cold data through the elimination algorithm. Go to the secondary cache 31.
  • the data in the secondary cache 31 is periodically phased out, and the colder data is transferred to the memory 32.
  • the memory 32 is divided into different levels, and the hotter data is stored in the memory 32 having a faster read speed.
  • the data stored in the L1 cache 41 is the hottest data
  • the L2 cache is 31 times
  • the memory 32 has a higher data read speed
  • the memory with the lowest data read speed is the coldest. The data.
  • the L2 cache 31 can be bypassed, and the data requested by the host is directly read from the memory 32 to the L1 cache. 41. For example, if, within a certain period of time, 80 of the average of 100 read requests to the L2 cache 31 have found the requested data from the L2 cache 31, and 20 read requests are not found, the hit rate is 80. %.
  • the query operation of the hit ratio query module 42 may be performed periodically, or may be performed each time a write request is received.
  • the expansion module 43 is configured to determine whether the hit ratio is lower than a preset expansion threshold, and if the value is lower than the expansion threshold, the storage space is obtained from the memory 32 of the storage device 3 for use by the secondary cache 31, wherein the secondary storage 31 is used.
  • the storage space obtained in 32 is called new storage space.
  • the memory 32 includes a plurality of specifications of storage media, one of which is the same as the secondary cache 31, such as a solid state drive SSD memory using flash memory as a storage medium.
  • the storage space of the SSD memory can be transferred to the secondary cache 31 for use.
  • the entire SSD disk can be used as a range that can be used, or a part of the shared space can be opened in the SSD memory, and it is used in the shared space to the secondary cache 31.
  • the expansion module 43 records the storage space of the memory 32 and manages the storage space, and the expansion module 43 also records the storage space of the cache (including the primary cache 41 and the secondary cache 31) and manages, for example, recording Memory 32 and the address of various types of storage media in the cache.
  • Data can be written to the storage medium by writing data according to the address provided by the storage medium.
  • the address originally marked as belonging to the memory 32 can be marked by the controller as belonging to the secondary cache 31 to effect the transfer of the storage space.
  • the storage space may be recorded by the identifier from the memory 32. When the free space of the secondary cache 31 is too large, the storage space originally belonging to the memory 32 may be preferentially returned to the memory 32.
  • the hit ratio is used to describe the availability of the L2 cache 31 to initiate the expansion of the L2 cache 31 when the L2 cache utilization is reduced (up to the preset expansion threshold).
  • the expansion module 43 may return the newly added storage space to the memory 32.
  • the cache module 44 is configured to cache data from the first level cache 41 by using the newly added storage space in the second level cache 31.
  • the cache module 44 has a scheduling function, which can schedule the storage space in the secondary cache 31, and the cache module 44 itself can have no storage space.
  • the cache module 44 can also instruct the data in the level 1 cache 41 to be directly sent to the memory 32 without passing through the level 2 cache 31.
  • the secondary cache 31 is The write data is obtained in the level 1 cache 41 and then cached.
  • the medium of the second level cache 31 may be either volatile or non-volatile. It can be logically set to be volatile.
  • the device may receive a read request for the stored data, and the cache module 44 may obtain the stored data from the newly added storage space and send the storage data to the first level cache.
  • the cache module 44 is further configured to: when the secondary cache fails to hit, obtain data from the memory to the primary cache through a direct connection channel.
  • the cache module 44 is further configured to send the data buffered in the newly added storage space to the secondary cache 31 memory 32. This feature is optional.
  • the hot data can be preferentially stored in the high speed memory 32 in accordance with the degree of heat and cold of the data, and the cold data is preferentially stored in the low speed memory 32. It is also possible to analyze the importance of the data, and the more important data is stored in the memory 32 with higher reliability.
  • the storage space occupied by the data can be used for the data to be cached for the next time; or it can be uninterpreted for subsequent reading. There are two ways to release the data, one is to actively erase the storage space occupied by the data; the other can mark the storage space occupied by the data as being able to be written again.
  • the data caching device 4 may not include the L1 cache 41, that is, the data caching device 4 has the functions of the hit rate query module 42, the expansion module 43, the cache module 44, and the transmitting module 45.
  • the data cache device 4 is software or hardware integrated in the controller, and the controller further includes a level 1 cache 41.
  • the storage space originally belonging to the memory 32 is shared for use in the secondary cache 31.
  • the storage space of the L2 cache 31 can also be shared with the memory 32.
  • Third-party storage space independent of the storage 32 and the L2 cache 31 can also be set.
  • the embodiment of the present invention introduces a technique for sharing storage space between a cache and a memory 32.
  • the cache is divided into two levels, and the memory 32 is also composed of different memories.
  • the controller manages the L2 cache 31 and the memory 32 in a similar manner.
  • the controller manages the L1 cache 41 in a different manner. Therefore, it is easier to transfer the storage space of the memory 32 to the secondary cache 31 than to transfer the storage space of the memory 32 to the cache 41.
  • aspects of the invention, or aspects of various aspects may be embodied as a system, method, or computer program product.
  • a storage medium is provided for storing the program product of the above method embodiment.
  • aspects of the invention, or possible implementations of various aspects may be in the form of an entirely hardware embodiment, an entirely software embodiment (including firmware, resident software, etc.), or a combination of software and hardware aspects, They are collectively referred to herein as "circuits," “modules,” or “systems.”
  • various aspects of the invention, or possible implementations of various aspects may take the form of a computer program product, which is stored in a computer readable form Computer readable program code in the medium.
  • the computer readable medium can be a computer readable signal medium or a computer readable storage medium.
  • the computer readable storage medium includes, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing, such as a random access memory device (RAM), a read only memory device (ROM). , erasable programmable read-only storage devices (EPROM or flash storage devices), optical fibers, portable read-only storage devices (CD-ROM:).
  • the processor in the computer reads the computer readable program code stored in the computer readable medium, such that the processor can perform the functional actions specified in each step or combination of steps in the flowchart; A device that functions as specified in each block, or combination of blocks.

Abstract

The present invention provides a data caching method and device used in a controller. The controller is connected with a storage device; the controller includes a first level cache; the storage device includes a second level cache and a memory; and the second level cache is used to relay the interactive data between the first level cache and the memory. The method includes: querying the hit rate of the second level cache, and if less than a capacity expansion threshold, acquiring a storage space from the memory for use in the second level cache. The present invention can improve the hit rate of the second level cache.

Description

一种数据緩存方法、 装置及系统 技术领域  Data buffering method, device and system
本发明涉及 IT领域, 特别涉及一种存储技术。 背景技术  The present invention relates to the field of IT, and in particular to a storage technology. Background technique
在存储领域中, 磁盘等存储介质虽然可以提供大量的存储空间, 但数据的 读 /写 ( Input/Output, I/O )的速度往往不高。 为了提高数据的读 /写速度, 会使用 緩存(Cache )来暂存数据。 主机读数据时, 数据先从磁盘读取到控制器的緩存 中, 再发给主机; 主机往磁盘写数据时, 先把数据发送给緩存, 再从緩存把数 据写入主机中。  In the storage field, although storage media such as disks can provide a large amount of storage space, the data read/write (I/O) speed is often not high. In order to improve the read/write speed of data, a cache is used to temporarily store data. When the host reads data, the data is first read from the disk into the controller's cache and then sent to the host. When the host writes data to the disk, it first sends the data to the cache, and then writes the data from the cache to the host.
控制器中, 常见的作为緩存的存储介质例如同步动态随机存储设备 ( Synchronous Dynamic Random Access Memory, SDRAM ), 往往成本较高, 因 此厂商为存储系统提供的 SDRAM存储空间有限。 为了节约成本, 部分厂商使 用了多级緩存技术, 把原来的 SDRAM作为一级緩存, 在 SDRAM之外增加相 对廉价的闪存( Flash Memory )介质例如固态硬盘( Solid state disk, SSD )作为 第二级的緩存, 称为 SSD Cache ( SSD緩存)。 SSD Cache位于 SDRAM和磁盘 之间,当 SDRAM的空间不够用时,把 SDRAM中的数据转发到 SSD Cache中, 然后由 SSD Cache把数据写入磁盘。  In the controller, a common storage medium as a cache, such as a Synchronous Dynamic Random Access Memory (SDRAM), is often costly, so the SDRAM storage space provided by the manufacturer for the storage system is limited. In order to save costs, some manufacturers use multi-level cache technology, the original SDRAM as a level 1 cache, and add relatively inexpensive Flash memory media such as Solid State Disk (SSD) as a second level outside the SDRAM. The cache, called SSD Cache. The SSD Cache is located between the SDRAM and the disk. When the SDRAM space is insufficient, the data in the SDRAM is forwarded to the SSD Cache, and then the SSD Cache writes the data to the disk.
然而, 由于 SSD的成本仍然比磁盘等介质更高, 因此二级緩存的空间仍然 是有限的。 当短时间内出现有大量的数据读 /写操作时, SSD的存储空间无法满 足需求, 造成 SSD和 SDRAM之间会出现数据阻塞。 以至于对部分读 /写请求所 对应的数据而言,存储系统不得不绕过 SSD Cache,直接在 SDRAM和磁盘之间 进行传递。 这种绕开二级緩存 SSD的做法也称为 SSD没有命中, 由于磁盘的读 /写速度比 SDRAM、 SSD都低, SSD命中率越低, 对存储系统整体效率的影响 越明显。  However, since the cost of SSDs is still higher than media such as disks, the space for L2 caches is still limited. When there are a large number of data read/write operations in a short period of time, the storage space of the SSD cannot meet the demand, resulting in data blocking between the SSD and the SDRAM. So that for the data corresponding to some read/write requests, the storage system has to bypass the SSD Cache and pass directly between the SDRAM and the disk. This practice of bypassing the L2 cache SSD is also called SSD miss. Since the read/write speed of the disk is lower than that of SDRAM and SSD, the lower the SSD hit rate, the more obvious the impact on the overall efficiency of the storage system.
如何提高二级緩存的命中率, 是需要解决的问题。 发明内容 How to improve the hit rate of the secondary cache is a problem that needs to be solved. Summary of the invention
本发明提供一种数据緩存技术, 可以提高二级緩存的命中率。  The invention provides a data caching technology, which can improve the hit rate of the second level cache.
第一方面, 本发明提供一种数据緩存方法, 应用于控制器中, 所述控制器 和存储设备连接, 控制器包括一级緩存, 所述存储设备包括二级緩与存储器, 所述二级緩存用于存储一级緩存发往存储器的数据, 所述方法包括: 查询所述 二级緩存对读请求的命中率; 判断命中率是否低于扩容阈值, 如果低于所述扩 容阈值, 从所述存储器中获取存储空间给所述二级緩存使用, 其中, 从所述存 储器中获取的存储空间是新增存储空间; 使用所述二级緩存中新增存储空间, 緩存所述一级緩发送的存储数据。  In a first aspect, the present invention provides a data caching method, which is applied to a controller, where the controller is connected to a storage device, the controller includes a level 1 cache, and the storage device includes a secondary buffer, the second level. Cache is used to store data that is sent to the memory by the first level cache, and the method includes: querying a hit rate of the second level cache to the read request; determining whether the hit ratio is lower than a capacity expansion threshold, and if the value is lower than the expansion threshold, Obtaining a storage space in the storage for use by the secondary cache, where the storage space obtained from the storage is a newly added storage space; using the newly added storage space in the secondary cache, buffering the first-level slow transmission Store data.
第二方面, 本发明提供一种数据緩存装置, 用于对存储设备的存储空间进 行管理, 存储设备包括二级緩存与存储器, 该装置包括: 命中率查询模块, 用 于查询二级緩存对读请求的命中率, 所述二级緩存用于緩存一级緩存发送的数 据; 扩容模块, 用于判断命中率是否低于扩容阈值, 如果低于所述扩容阈值, 从所述存储器中获取存储空间给所述二级緩存使用, 其中, 从所述存储器中获 取的存储空间是新增存储空间; 緩存模块, 用于使用所述新增存储空间, 緩存 所述一级緩存发往所述存储器发送的存储数据。  In a second aspect, the present invention provides a data cache device for managing a storage space of a storage device, where the storage device includes a secondary cache and a memory, and the device includes: a hit ratio query module, configured to query a secondary cache to read The hit rate of the request, the level 2 cache is used to cache the data sent by the level 1 cache; the expansion module is configured to determine whether the hit ratio is lower than the capacity expansion threshold, and if the volume is lower than the capacity expansion threshold, the storage space is obtained from the memory. Used for the secondary cache, where the storage space obtained from the storage is a newly added storage space; a cache module, configured to use the newly added storage space, and buffer the first-level cache to send to the storage Store data.
本发明用存储器的存储空间对二级緩存扩容, 提高了二级緩存的命中率。 附图说明  The invention uses the storage space of the memory to expand the secondary cache, and improves the hit rate of the secondary cache. DRAWINGS
为了更清楚地说明本发明实施例技术方案, 下面将对实施例所需要使用的 附图作简单地介绍, 下面描述中的附图仅仅是本发明的一些实施例, 还可以根 据这些附图获得其他的附图。  In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings to be used in the embodiments will be briefly described below. The drawings in the following description are only some embodiments of the present invention, and can also be obtained according to the drawings. Other drawings.
图 1是本发明实施例结构图;  Figure 1 is a structural view of an embodiment of the present invention;
图 2是本发明一种数据緩存方法的实施例流程图;  2 is a flow chart of an embodiment of a data caching method of the present invention;
图 3是本发明一种数据緩存装置实施例的结构图。 具体实施方式  3 is a structural diagram of an embodiment of a data buffer device of the present invention. detailed description
下面将结合本发明实施例中的附图, 对本发明的技术方案进行清楚、 完整 地描述, 显然, 所描述的实施例仅仅是本发明一部分实施例, 而不是全部的实 施例。 基于本发明中的实施例所获得的所有其他实施例, 都属于本发明保护的 范围。 The technical solutions of the present invention will be clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of them. Example. All other embodiments obtained based on the embodiments of the present invention are within the scope of the present invention.
本发明存储系统由控制器和存储设备组成。 存储设备提供存储空间, 控制 器对存储设备提供管理, 并对主机提供读 /写访问, 对主机而言, 存储设备可以 是不可见的。 存储设备和控制器在物理上可以是分开的两个设备; 也可以集成 在一个设备内, 二者集成在一个设备时可以称为存储服务器。  The storage system of the present invention is composed of a controller and a storage device. The storage device provides storage space, the controller provides management of the storage device, and provides read/write access to the host. For the host, the storage device may be invisible. The storage device and the controller can be physically separate devices; they can also be integrated into one device, and when they are integrated into one device, they can be called storage servers.
控制器包括处理器和緩存, 本发明实施例中把控制器中的緩存称为一级緩 存。 存储设备由緩存和多个存储器组成, 本发明实施例把存储设备提供的緩存 称为二级緩存。 控制器发往存储设备的数据, 先存入一级緩存, 存入一级緩存 以后。 一级緩存中的数据可以根据数据的冷热程度, 周期性的把相对冷的数据 转移到二级緩存。 二级緩存中的数据, 周期性的把相对冷的数据转移到存储器 中。 把上一级存储器件中相对较冷的数据转移到下一级存储器件的过程, 也称 为淘汰。 此外, 控制器可以在数据写入一级緩存后, 发送写入完成的响应消息 给主机, 告诉主机已经完成写入操作; 也可以在数据写入存储器后, 发送写入 完成的响应消息给主机, 告诉主机已经完成写入操作。  The controller includes a processor and a cache, and the cache in the controller is referred to as a level cache in the embodiment of the present invention. The storage device is composed of a cache and a plurality of memories. In the embodiment of the present invention, the cache provided by the storage device is referred to as a secondary cache. The data sent by the controller to the storage device is first stored in the level 1 cache and stored in the level 1 cache. The data in the Level 1 cache can periodically transfer relatively cold data to the Level 2 cache based on the degree of heat and cold of the data. The data in the L2 cache periodically transfers relatively cold data to the memory. The process of transferring relatively cold data from a higher-level storage device to a lower-level storage device is also referred to as elimination. In addition, after the data is written into the level 1 cache, the controller may send a write completion response message to the host to inform the host that the write operation has been completed; or after the data is written into the memory, send a write completion response message to the host. , tells the host that the write operation has been completed.
一级緩存和二级緩存可以是同一种存储介质, 也可以不同。 当采用不同介 质时, 一级緩存读 /写速度可以比二级緩存更快, 成本也更高, 例如一级緩存是 The level 1 cache and the level 2 cache may be the same storage medium or different. When using different media, the L1 cache read/write speed can be faster and the cost is higher than the L2 cache. For example, the L1 cache is
SDRAM, 而二级緩存 31是 SSD。 一级緩存和二级緩存使用的存储介质本身, 可以是易失性存储 RAM ( Random Access Memory ), 也可以是非易失性存储。 但是对控制器而言, 把他们作为易失性存储使用, 一级緩存和二级緩存中的存 储的数据都可以通过老化算法进行淘汰, 例如使用冷热数据的识别方法进行淘 汰, 以提高它们的利用率。 本发明实施例中, 一级緩存可以再次细分为多个不 同的小级别, 可以每个级别采用不同的存储介质, 小级别存储介质之间串联, 并通过淘汰算法进行数据传递。 SDRAM, and the secondary cache 31 is an SSD. The storage medium used by the level 1 cache and the level 2 cache may be a random access memory (RAM) or a nonvolatile storage. But for the controller, they are used as volatile storage. The data stored in the L1 cache and the L2 cache can be eliminated by the aging algorithm, for example, using the identification method of hot and cold data to eliminate them. Utilization. In the embodiment of the present invention, the level 1 cache can be subdivided into a plurality of different small levels, and different storage media can be used for each level, and the small-level storage mediums are connected in series, and the data is transmitted through the elimination algorithm.
由于緩存的读写速度总体比存储器更高。 因此在接收到主机的读数据时, 控制器优先从一级緩存、 一级緩存中获取读请求数据, 如果没有找到, 再到存 储器中获取读请求数据。 在某一个介质中找到读请求数据称为命中, 在一定数 量的读请求中, 某个介质被命中的比例, 称为这个介质的命中率, 命中率用于 记录从二级緩存中读取待数据时, 成功读取的数量或者比例。 Because the cache read and write speed is generally higher than the memory. Therefore, when receiving the read data of the host, the controller preferentially acquires the read request data from the level 1 cache and the level 1 cache, and if not found, then obtains the read request data in the memory. Finding the read request data in a certain medium is called hit, at a certain number In a read request, the ratio of a medium hit is called the hit ratio of the medium. The hit ratio is used to record the number or proportion of successful reads when reading the pending data from the secondary cache.
具体而言, 如果一级緩存被命中, 也就是说一级緩存中存在读请求数据, 则一级緩存把读请求数据发送给主机; 如果二级緩存被命中, 则读请求数据从 二级緩存发给一级緩存, 然后从一级緩存发送给主机; 如果存储器被命中, 贝' J , 则读请求数据从存储器发给一级緩存, 然后从一级緩存发送给主机。  Specifically, if the level 1 cache is hit, that is, there is read request data in the level 1 cache, the level 1 cache sends the read request data to the host; if the level 2 cache is hit, the read request data is from the level 2 cache. The first level cache is sent to the host, and then sent to the host from the level 1 cache. If the memory is hit, the read request data is sent from the memory to the level 1 cache and then sent from the level 1 cache to the host.
出于成本的考虑, 二级緩存 SSD的存储空间是有限的, 当短期有大量读请 求时, 往往会导致二级緩存命中率降低。 虽然可以通过增加二级緩存的总容量 来部分的解决这个问题, 然而这种提高总容量后, 会引起二级緩存的总利用率 降低, 这与降低二级緩存的成本这一目标是背道而驰的。 此外, 存储设备在出 厂时其内部已经安装二级緩存、存储器等各个部件,用户想要增加额外的緩存, 可能存储设备内部已经没有足够的空间安装。 即使有空间, 这个安装额外緩存 的过程也比较复杂, 普通用户难以实施。 本发明实施例中, 符号 " 是 "或" 的意思。  Due to cost considerations, the storage space of the L2 cache SSD is limited. When there are a large number of read requests in the short term, the L2 cache hit rate is often reduced. Although this problem can be partially solved by increasing the total capacity of the L2 cache, this increase in the total capacity will cause the total utilization of the L2 cache to decrease, which is contrary to the goal of reducing the cost of the L2 cache. . In addition, when the storage device is installed at the factory, it has installed various components such as L2 cache and memory. Users want to add extra cache. There may not be enough space inside the storage device to install. Even with space, the process of installing additional caches is complex and difficult for ordinary users to implement. In the embodiment of the present invention, the symbol "Yes" or "."
本发明实施例可以临时增加二级緩存的存储空间, 满足突发性需求, 而且 实施方便, 对成本增加不明显。  The embodiment of the invention can temporarily increase the storage space of the second-level cache, meet the sudden demand, and is convenient to implement, and the cost increase is not obvious.
如图 1所示,是本发明实施例结构图。主机 1通过控制器 2访问存储设备 3 , 控制器 2中处理器 21和一级緩存 22通信。 一级緩存 22和二级緩存 31通信, 一级緩存和存储器通信 32、存储器 34以及存储器 34通信,一级緩存 22和主机 1通信。控制器 2可以通过二级緩存 31和存储设备 3中的存储器进行数据交换; 可选的, 也可以绕过二级緩存 31 , 由一级緩存 22经过直连通道访问存储器。  As shown in FIG. 1, it is a structural diagram of an embodiment of the present invention. The host 1 accesses the storage device 3 through the controller 2, and the processor 21 in the controller 2 communicates with the level 1 cache 22. The primary cache 22 communicates with the secondary cache 31, the primary cache and the memory communication 32, the memory 34, and the memory 34 communicate, and the primary cache 22 communicates with the host 1. The controller 2 can exchange data through the secondary cache 31 and the memory in the storage device 3; optionally, the secondary cache 31 can also be bypassed, and the primary cache 22 accesses the memory through the direct connection channel.
基于图 1 的架构, 以写数据为例, 可以划分为以下步骤: 主机发送写请求 给一级緩存 22; —级緩存 22可以是 SDRAM; 然后一级緩存 22把数据緩存到 二级緩存 3 1中, 接着, 二级緩存把数据写入存储设备 3中。 存储设备 3包括多 种类型的存储器,例如存储器 32是 SSD ,存储器 33是 SAS( Serial Attached SCSI ) 盘, 存储器 34是 SATA ( Serial ATA )盘, 这三种存储器的读写速度依次降低。 存储设备 3根据数据冷热程度不同 ,把数据分别存储在不同速度的存储介质中。 例如把热数据存储到 SSD盘中,普通数据存储到 SAS盘中,冷数据存储到 SATA 盘中。 数据的冷热程度可以描述指数据被访问的频度, 越频繁被访问的数据越 热, 反之越冷。 Based on the architecture of FIG. 1, taking write data as an example, the following steps can be divided: the host sends a write request to the level 1 cache 22; the level cache 22 can be an SDRAM; then the level 1 cache 22 caches the data to the level 2 cache 3 1 Then, the secondary cache writes data into the storage device 3. The storage device 3 includes a plurality of types of memories, for example, the memory 32 is an SSD, the memory 33 is a SAS (Serial Attached SCSI) disk, and the memory 34 is a SATA (Serial ATA) disk, and the read and write speeds of the three memories are sequentially lowered. The storage device 3 stores data in storage media of different speeds according to different degrees of data heat and cold. For example, the hot data is stored in the SSD, the normal data is stored in the SAS disk, and the cold data is stored in the SATA disk. The degree of heat and cold of data can be described as the frequency with which data is accessed. The more frequently the data is accessed, the hotter it is, and vice versa.
本发明实施例中, 当出现读 /写高峰以至二级緩存 31命中率降低时, 可以把 存储器 32的一部分存储空间在逻辑上挪给二级緩存使用。 如图中所示, 把存储 器 32中的存储空间 321挪作二级緩存 31 中的存储空间 311使用, 增加了二级 緩存 31的存储空间。 当读 /写高峰过去后, 二级緩存命中率过高, 可以把这部分 挪来的空间返还给存储器 32。 更进一步的, 甚至可以在 SSD Cache命中率高于 预设值时, 或者存储器 32的存储空间不足时, 把原本属于二级緩存 31 的存储 空间挪给存储器 32使用。 如果把存储器 33的存储空间挪给二级緩存 31使用 , 则緩存 31将由不同存储介质组成。  In the embodiment of the present invention, when the read/write peak occurs and the hit rate of the L2 cache 31 decreases, a part of the storage space of the memory 32 can be logically transferred to the L2 cache. As shown in the figure, the storage space 321 in the storage 32 is used as the storage space 311 in the secondary cache 31, and the storage space of the secondary cache 31 is increased. When the read/write peak has elapsed, the L2 cache hit rate is too high, and this part of the moved space can be returned to the memory 32. Further, the storage space originally belonging to the L2 cache 31 may be transferred to the memory 32 even when the SSD Cache hit ratio is higher than the preset value or when the storage space of the memory 32 is insufficient. If the storage space of the memory 33 is moved to the secondary cache 31, the cache 31 will be composed of different storage media.
表 1是一种策略示例, 控制器 21周期性查询二级緩存 31的命中率(具体 而言, 可以由处理器 21执行这个查询), 命中率越低, 需要从 SSD存储器 32 分片给二级緩存 31的空间越多。 除了按比例来分配空间, 也可以按容量大小来 分配空间, 例如命中率每下降 5%, 从 SSD存储器 32中分配 1GB (吉比特 )存 储空间给二级緩存 31。 还可以以固定大小整数倍划分空间给二级緩存 31 , 并且 检测划分后命中率的变化情况, 直至满足条件。 例如以 100MB (兆比特) 的整 数倍把 SSD存储器 32中存储空间分配给二级緩存 31使用,直至命中率达到 95% 后, 才停止分配。  Table 1 is an example of a policy. The controller 21 periodically queries the hit rate of the L2 cache 31 (specifically, the query can be executed by the processor 21). The lower the hit ratio, the smaller the hit rate needs to be from the SSD memory 32. The more space the level cache 31 has. In addition to allocating space proportionally, space can also be allocated by capacity, for example, for every 5% drop in hit rate, 1 GB (gigabit) of storage space is allocated from SSD memory 32 to secondary cache 31. It is also possible to divide the space into the secondary buffer 31 by an integer multiple of a fixed size, and detect the change in the hit ratio after the division until the condition is satisfied. For example, the storage space in the SSD memory 32 is allocated to the secondary cache 31 by an integer multiple of 100 MB (megabits) until the hit rate reaches 95%, and the allocation is stopped.
Figure imgf000006_0001
(60%,70%] 20%
Figure imgf000006_0001
(60%, 70%) 20%
(50%,60%] 25%  (50%, 60%) 25%
(40%,50%] 30%  (40%, 50%) 30%
(30%,40%] 35%  (30%, 40%) 35%
(20%,30%] 40%  (20%, 30%) 40%
(10%,20%] 45%  (10%, 20%) 45%
<10% 50%  <10% 50%
表 1  Table 1
图 2提供了一种数据緩存方法的实施例流程图。 本发明各方法实施例, 可 以由控制器 2执行方法步骤来实现, 具体而言可以由图 1 中的控制器 2的处理 器 21执行方法来实现。 一级緩存 22中存储有计算机指令, 处理器 21通过执行 一级緩存 22的计算机指令, 来执行下面的方法。 除了和一级緩存 22集成在一 起,也可以把存储这个计算机指令的存储空间独立出来,作为单独的运行内存。  Figure 2 provides a flow chart of an embodiment of a data caching method. The method embodiments of the present invention may be implemented by the controller 2 executing the method steps, and in particular may be implemented by the processor 21 of the controller 2 of Fig. 1. The first level cache 22 stores computer instructions, and the processor 21 executes the following method by executing computer instructions of the level one cache 22. In addition to being integrated with the Level 1 cache 22, the storage space for storing this computer instruction can also be separated as a separate running memory.
步骤 11 ,查询二级緩存对读请求的命中率。命中率可以描述处理读请求时, 从二级緩存中得到读请求数据的数量。 读请求数据也就是读请求所请求读取的 数据。  Step 11: Query the hit rate of the secondary cache to the read request. The hit ratio can describe the amount of read request data from the secondary cache when processing a read request. The read request data is also the data requested to be read by the read request.
二级緩存中存储的数据的热度比存储器中更高。 当二级緩存的存储空间足 够时, 在一段时间内的读请求数据, 如果无法从一级緩存无法中找到, 都可以 从二级緩中找到。  The data stored in the L2 cache is hotter than in the memory. When the storage space of the L2 cache is sufficient, the read request data for a period of time can be found from the secondary cache if it cannot be found from the L1 cache.
控制器可以优先查找一级緩存, 如果在一级緩存中没有找到带读取的数据 , 进一步找二级緩存, 如果二级緩存中也没有找到, 就到存储器中查找。 如果二 级緩存的存储空间不足, 没有存储足够多的热数据, 那么就会存在一部分读请 求数据在一级緩存中没有找到后, 在二级緩存中也没有找到, 控制器要从存储 器中获得读请求数据。 也就是说二级緩存没有被命中。 例如, 如果在一段时间 内,平均 100个对二级緩存的读请求中,有 80个在二级緩存中找到读请求数据, 有 20个没有找到, 那么命中率就是 80%。 本步骤可以周期性执行, 也可以在每次收到读 /写请求后执行。 The controller can preferentially find the level 1 cache. If the data with the read is not found in the level 1 cache, the second level cache is further searched. If the level 2 cache is not found, the memory is searched. If the storage capacity of the L2 cache is insufficient and there is not enough hot data stored, then there will be some read request data not found in the L1 cache, and not found in the L2 cache. The controller needs to obtain from the memory. Read the request data. This means that the secondary cache is not hit. For example, if, within a period of time, 80 of the 100 read requests to the L2 cache are found in the L2 cache and 20 are not found, the hit rate is 80%. This step can be performed periodically or after each read/write request.
步骤 12, 如果命中率低于扩容阈值, 从存储器中挪用存储空间给二级緩存 使用, 从而扩大二级緩存的存储空间。  Step 12: If the hit ratio is lower than the capacity expansion threshold, the storage space is used from the memory to be used by the second level cache, thereby expanding the storage space of the second level cache.
存储设备中包括多种规格存储介质的存储器, 其中一种和二级緩存相同, 例如都是 SSD存储器。 可以将 SSD存储器的存储空间挪给二级緩存使用。 可以 把整个 SSD磁盘作为可以被挪用的范围,也可以在 SSD存储器中开辟一部分共 享空间, 在共享空间的范围内, 挪用给二级緩存。  The storage device includes a plurality of storage media of a specification, one of which is the same as the secondary cache, for example, both are SSD memories. The storage space of the SSD memory can be transferred to the secondary cache. The entire SSD disk can be used as a range that can be used, or a part of the shared space can be opened in the SSD memory, and it can be used to the secondary cache within the shared space.
具体而言, 控制器记录并管理各存储器的存储空间, 控制器还记录并管理 緩存(例如一级緩存和二级緩存) 的存储空间, 例如记录有存储器和緩存中各 类存储介质的地址。 按照这个地址写入数据, 就可以把数据写入存储介质中。 步骤 12中, 可以由控制器把原本标记为属于存储器的存储介质地址, 标记为属 于二级緩存的存储介质地址。 此外, 还可以用标识记录这部分存储空间来源于 哪个存储器, 当二级緩存的空闲空间太大时, 可以优先把这部分原本属于存储 设备的存储空间返还给存储设备。  Specifically, the controller records and manages the storage space of each memory, and the controller also records and manages the storage space of the caches (e.g., the primary cache and the secondary cache), such as the addresses of various types of storage media in the memory and cache. By writing data according to this address, data can be written to the storage medium. In step 12, the storage medium address originally marked as belonging to the memory may be marked by the controller as the storage medium address belonging to the secondary cache. In addition, the identifier can also be used to record which memory the storage space comes from. When the free space of the secondary cache is too large, the storage space originally belonging to the storage device can be preferentially returned to the storage device.
命中率用于描述二级緩存的被利用的程度, 以便当二级緩存利用率降低时, 启动对二级緩存进行扩容。 因此命中率的表现实现可以有多种, 除了用百分比 表示。 也可以用存储空间大小表示, 例如在从二级緩存中获取数据的过程中, 如果平均每秒有 100MB (兆字节) 的数据无法找到, 就认为命中率达到扩容阈 值, 可以对二级緩存进行扩容。 命中率还可以用读请求的数量表示。 比如当每 秒超过 10个针对二级緩存的读请求没有成功响应时, 认为符合扩容阈值, 扩大 二级緩存的存储空间。  The hit ratio is used to describe the extent to which the L2 cache is utilized, so that when the L2 cache utilization is reduced, the L2 cache is expanded. Therefore, the performance of the hit rate can be implemented in a variety of ways, except expressed as a percentage. It can also be expressed by the size of the storage space. For example, in the process of obtaining data from the secondary cache, if the average data of 100 MB (megabytes) per second cannot be found, the hit rate is considered to reach the capacity expansion threshold, and the secondary cache can be Expand the capacity. The hit rate can also be expressed in terms of the number of read requests. For example, when more than 10 read requests for the L2 cache are not successfully responded to each second, it is considered that the expansion threshold is met, and the storage space of the L2 cache is expanded.
步骤 13 , 使用二级緩存中新增的存储空间来緩存数据。 当一级緩存通过老 化算法进行数据淘汰时, 可以把相对较冷的数据转移到二级緩存新增的存储空 间中。 转移来的数据緩存到二级緩存后, 可以供后续读请求使用, 提高二级緩 存的命中率。 緩存作为动词时, 是临时存储的意思, 被緩存的数据所占用的存 储空间可以被新数据替换; 收到取消緩存的指令后, 可以译放为了緩存数据而 占用的存储空间。 本发明实施例中, 二级緩存的介质在物理上可以是易失性的也可以是非易 失性的。 在逻辑上可以设置为易失性的, 可以为緩存新的数据腾出存储空间。 Step 13. Use the new storage space in the L2 cache to cache the data. When the primary cache is eliminated by the aging algorithm, the relatively cold data can be transferred to the newly added storage space of the secondary cache. After the transferred data is cached in the secondary cache, it can be used by subsequent read requests to improve the hit rate of the secondary cache. When the cache is used as a verb, it means temporary storage. The storage space occupied by the cached data can be replaced by new data. After receiving the instruction to cancel the cache, the storage space occupied for buffering data can be interpreted. In the embodiment of the present invention, the medium of the second level cache may be either volatile or non-volatile. It can be logically set to be volatile and free up storage space for caching new data.
步骤 14, 把二级緩存所緩存的数据发送给下一级存储器件。 下一级存储器 件例如是存储器。 当二级緩存被写满后, 可以根据淘汰算法, 把较冷的数据转 移到存储器中, 二级緩存中保留相对较热的数据。 本发明实施例中, 存储设备 由多个存储器组成, 不同存储器的层级不同。 在被转移到存储器的数据中, 相 互之间也存在冷热区别, 可以依据数据的冷热程度, 热数据优先存储到存储设 备的高速存储器中, 冷数据优先存储到存储设备的低速存储器中。 也可以按照 数据的重要性分析, 越重要的数据存放到可靠性越高的存储器中。  Step 14. Send the data buffered by the second level cache to the next level storage device. The next level of memory is, for example, a memory. When the secondary cache is full, the colder data can be transferred to the memory according to the elimination algorithm, and the relatively hot data is retained in the secondary cache. In the embodiment of the present invention, the storage device is composed of a plurality of memories, and different levels of different memories are different. In the data transferred to the memory, there is also a difference between the hot and the cold. Depending on the degree of heat and cold of the data, the hot data is preferentially stored in the high-speed memory of the storage device, and the cold data is preferentially stored in the low-speed memory of the storage device. It is also possible to analyze the importance of the data, and the more important the data is stored in the more reliable memory.
把緩存的数据传递到下一级存储器件后, 即可译放数据所占用的存储空间。 以便二级緩存可以再次緩存新的数据。 译放方式有两种, 一种是主动擦除数据 占用的存储空间; 另一种可以把数据占用的存储空间标记为可以被再次写入。  After the cached data is transferred to the next-level storage device, the storage space occupied by the data can be translated. So that the L2 cache can cache new data again. There are two ways to release the data, one is to actively erase the storage space occupied by the data; the other can mark the storage space occupied by the data as being able to be written again.
步骤 15, 当所述命中率升高至减容阈值时, 把所述新增存储空间返还给存 储器。 步骤 15是可选步骤。  Step 15. When the hit rate is raised to the volume reduction threshold, the newly added storage space is returned to the memory. Step 15 is an optional step.
本发明实施例中, 介绍了把原本属于存储器的存储空间共享给緩存使用。 在其他实施例中, 也可以把緩存的存储空间共享给存储器使用; 还可以设置独 立于存储设备和緩存的第三方存储空间, 由存储器和緩存共同使用。 此外, 本 发明实施例介绍了一种緩存和存储器共享存储空间的技术,緩存分为 2个层级。  In the embodiment of the present invention, the storage space originally belonging to the memory is shared for use in the cache. In other embodiments, the cached storage space may also be shared for memory use; third-party storage space independent of the storage device and the cache may also be set, and used by the memory and the cache. In addition, the embodiment of the present invention introduces a technique for buffering and memory sharing storage space, and the cache is divided into two levels.
在其他实施例中, 一级緩存或者二级緩存可以只有一级或者细分成更多层 级, 不同层级读写速度不同。 再者, 本发明实施例中, 緩存和存储器存在同样 规格的存储介质闪存( Flash Memory ), 在其他实施例中, 可以是不同规格的存 储介质之间共享存储空间。  In other embodiments, the level 1 cache or the level 2 cache may be only one level or subdivided into more levels, and the read and write speeds of different levels are different. Furthermore, in the embodiment of the present invention, the storage medium flash memory (Flash Memory) of the same specification exists in the cache and the memory, and in other embodiments, the storage space may be shared between the storage media of different specifications.
例如把存储器由磁盘组成, 二级緩存由 SSD组成, 把存储器的磁盘空间共 享给二级緩存使用; 或者存储器由 SSD和磁盘组成, 一级级緩存由 SDRAM组 成, 把存储器中的 SSD或者磁盘的存储空间共享给一级緩存, 控制器把共享给 自己的存储空间和原本的 SDRAM—起作为一级緩存使用。  For example, the memory is composed of a disk, the secondary cache is composed of an SSD, and the disk space of the memory is shared by the secondary cache; or the memory is composed of an SSD and a disk, and the primary cache is composed of SDRAM, and the SSD or the disk in the memory is used. The storage space is shared with the primary cache, and the controller uses the storage space shared with itself and the original SDRAM as the primary cache.
在本发明另外一种实施例中,由控制器提供的二级緩存的存储空间可以为 0, 也就是说存储器不提供二级緩存, 直接由存储设备的存储器提供存储空间作为 二级緩存, 这样可以简化控制器的结构。 In another embodiment of the present invention, the storage space of the L2 cache provided by the controller may be 0. That is to say, the memory does not provide the second level cache, and the storage space of the storage device is directly provided as the second level cache, which simplifies the structure of the controller.
一级緩存和存储器之间还可以设置直连通道, 当二级緩存空间不足时, 由 直连通道旁路二级緩存, 通过直连通道传递一级緩存和所述存储器之间交互的 数据。  A direct connection channel may also be set between the level 1 cache and the memory. When the level 2 cache space is insufficient, the level 2 cache is bypassed by the direct connection channel, and the data exchanged between the level 1 cache and the memory is transmitted through the direct connection channel.
如图 3 所示, 是本发明数据緩存装置一种实施例的结构图, 可以执行前述 的方法实施例。 数据緩存装置 4包括一级緩存 41、 命中率查询模块 42、 扩容模 块 43、 緩存模块 44以及发送模块 45。 数据緩存装置 4和存储设备 3连接, 存 储设备 3包括二级緩存 31以及存储器 32。  As shown in FIG. 3, it is a structural diagram of an embodiment of the data buffering apparatus of the present invention, which can execute the foregoing method embodiments. The data cache device 4 includes a level 1 cache 41, a hit ratio query module 42, a expansion module 43, a cache module 44, and a sending module 45. The data buffer device 4 is connected to the storage device 3, and the storage device 3 includes a secondary cache 31 and a memory 32.
一级緩存 41 , 用于緩存数据。读写数据的速度可以比二级緩存 31以及存储 设备 3更快。  Level 1 cache 41, used to cache data. Reading and writing data can be faster than L2 cache 31 and storage device 3.
二级緩存 31 , 和所述一级緩存 41以及所述存储设备 3连接。 可以中继所述 一级緩存与所述存储器之间的写数据, 数据先从一级緩存转移到二级緩存, 再 从二级緩存转移到磁盘。 二级緩存 31的读写数据的速度可以比存储器 3更快。  The secondary cache 31 is connected to the primary cache 41 and the storage device 3. The write data between the level 1 cache and the memory may be relayed, and the data is first transferred from the level 1 cache to the level 2 cache, and then transferred from the level 2 cache to the disk. The level 2 cache 31 can read and write data faster than the memory 3.
命中率查询模块 42, 用于查询二级緩存 31的命中率。  The hit rate query module 42 is used to query the hit rate of the second level cache 31.
当二级緩存 31的存储空间足够时, 如果主机发出的是写请求, 写请求中携 带的数据经过控制器到达一级緩存 41后, 一级緩存 41通过淘汰算法, 把相对 较冷的数据转移到二级緩存 31。 对二级緩存 31中的数据定期进行淘汰, 把较冷 的数据转移到存储器 32。 按照数据读取速度的不同, 存储器 32分为不同等级, 较热的数据存储到读取速度较快的存储器 32 中。 在存储系统中, 一级緩存 41 中存储的数据是最热的数据, 二级緩存 31次之,数据读取速度较高的存储器 32 再其次, 数据读取速度最低的存储器存储的是最冷的数据。  When the storage space of the L2 cache 31 is sufficient, if the host issues a write request, the data carried in the write request passes through the controller and reaches the L1 cache 41, and the L1 cache 41 transfers the relatively cold data through the elimination algorithm. Go to the secondary cache 31. The data in the secondary cache 31 is periodically phased out, and the colder data is transferred to the memory 32. Depending on the data read speed, the memory 32 is divided into different levels, and the hotter data is stored in the memory 32 having a faster read speed. In the storage system, the data stored in the L1 cache 41 is the hottest data, the L2 cache is 31 times, the memory 32 has a higher data read speed, and the memory with the lowest data read speed is the coldest. The data.
如果在二级緩存 31 中没有找到带读取的数据, 也就是说二级緩存 31没有 被命中, 那么可以绕开二级緩存 31 , 直接从存储器 32中读取主机请求的数据给 一级緩存 41。 例如, 如果在一段时间内, 对二级緩存 31的读请求中, 平均 100 个中有 80个从二级緩存 31中找到了请求的数据, 有 20个读请求没有找到, 那 么命中率就是 80%。 命中率查询模块 42的查询操作可以周期性执行, 也可以在每次收到写请求 后执行。 If the data with the read is not found in the L2 cache 31, that is, the L2 cache 31 is not hit, the L2 cache 31 can be bypassed, and the data requested by the host is directly read from the memory 32 to the L1 cache. 41. For example, if, within a certain period of time, 80 of the average of 100 read requests to the L2 cache 31 have found the requested data from the L2 cache 31, and 20 read requests are not found, the hit rate is 80. %. The query operation of the hit ratio query module 42 may be performed periodically, or may be performed each time a write request is received.
扩容模块 43 , 用于判断命中率是否低于预设的扩容阈值, 如果低于扩容阈 值, 从所述存储设备 3的存储器 32中获取存储空间给所述二级緩存 31使用, 其中, 从存储器 32中获取的存储空间我们称为新增存储空间。  The expansion module 43 is configured to determine whether the hit ratio is lower than a preset expansion threshold, and if the value is lower than the expansion threshold, the storage space is obtained from the memory 32 of the storage device 3 for use by the secondary cache 31, wherein the secondary storage 31 is used. The storage space obtained in 32 is called new storage space.
存储器 32包括多种规格的存储介质, 其中一种和二级緩存 31相同, 例如 以闪存 ( Flash )作为存储介质的固态硬盘 SSD存储器。 可以将 SSD存储器的存 储空间挪给二级緩存 31使用。可以把整个 SSD磁盘作为可以被挪用的范围,也 可以在 SSD存储器中开辟一部分共享空间, 在共享空间的范围内, 挪用给二级 緩存 31。  The memory 32 includes a plurality of specifications of storage media, one of which is the same as the secondary cache 31, such as a solid state drive SSD memory using flash memory as a storage medium. The storage space of the SSD memory can be transferred to the secondary cache 31 for use. The entire SSD disk can be used as a range that can be used, or a part of the shared space can be opened in the SSD memory, and it is used in the shared space to the secondary cache 31.
具体而言, 扩容模块 43记录有存储器 32的存储空间并对存储空间进行管 理, 扩容模块 43还记录有緩存 (包括一级緩存 41和二级緩存 31 ) 的存储空间 并进行管理, 例如记录有存储器 32和緩存中各类存储介质的地址。 按照存储介 质提供的地址写入数据, 就可以把数据写入存储介质中。 可以由控制器把原本 标记为归属于存储器 32的的地址, 标记为归属于二级緩存 31 , 实现存储空间的 转移。 此外, 还可以用标识记录这部分存储空间来源于存储器 32, 当二级緩存 31的空闲空间太大时,可以优先把这部分原本属于存储器 32的存储空间返还给 存储器 32。  Specifically, the expansion module 43 records the storage space of the memory 32 and manages the storage space, and the expansion module 43 also records the storage space of the cache (including the primary cache 41 and the secondary cache 31) and manages, for example, recording Memory 32 and the address of various types of storage media in the cache. Data can be written to the storage medium by writing data according to the address provided by the storage medium. The address originally marked as belonging to the memory 32 can be marked by the controller as belonging to the secondary cache 31 to effect the transfer of the storage space. In addition, the storage space may be recorded by the identifier from the memory 32. When the free space of the secondary cache 31 is too large, the storage space originally belonging to the memory 32 may be preferentially returned to the memory 32.
命中率用于描述二级緩存 31 的可利用程度, 以便当二级緩存 31利用率降 低(达到预设的扩容阈值) 时, 启动对二级緩存 31进行扩容。  The hit ratio is used to describe the availability of the L2 cache 31 to initiate the expansion of the L2 cache 31 when the L2 cache utilization is reduced (up to the preset expansion threshold).
可选的, 当所述命中率升高至减容阈值时, 扩容模块 43可以把所述新增存 储空间返还给存储器 32。  Optionally, when the hit rate is raised to a volume reduction threshold, the expansion module 43 may return the newly added storage space to the memory 32.
緩存模块 44, 用于使用所述二级緩存 31中新增存储空间, 緩存来自一级緩 存 41的数据。緩存模块 44拥有调度功能,可以调度二级緩存 31中的存储空间, 緩存模块 44本身可以没有存储空间。 緩存模块 44, 还可以指令把一级緩存 41 中的数据不经过二级緩存 31直接发给存储器 32。  The cache module 44 is configured to cache data from the first level cache 41 by using the newly added storage space in the second level cache 31. The cache module 44 has a scheduling function, which can schedule the storage space in the secondary cache 31, and the cache module 44 itself can have no storage space. The cache module 44 can also instruct the data in the level 1 cache 41 to be directly sent to the memory 32 without passing through the level 2 cache 31.
如果控制器收到的是写请求所请求的数据, 称为写数据, 则二级緩存 31从 一级緩存 41中获得写数据然后緩存。 If the controller receives the data requested by the write request, called write data, the secondary cache 31 is The write data is obtained in the level 1 cache 41 and then cached.
本发明实施例中, 二级緩存 31的介质在物理上可以是易失性的也可以是非 易失性的。 在逻辑上可以设置为易失性的。  In the embodiment of the present invention, the medium of the second level cache 31 may be either volatile or non-volatile. It can be logically set to be volatile.
对所述装置收到对所述存储数据的读请求, 緩存模块 44可以从所述新增存 储空间中 , 获得所述存储数据发送给一级緩存。  The device may receive a read request for the stored data, and the cache module 44 may obtain the stored data from the newly added storage space and send the storage data to the first level cache.
緩存模块 44还用于, 当所述二级緩存无法命中时, 通过直连通道从所述存 储器获得数据到所述一级緩存。  The cache module 44 is further configured to: when the secondary cache fails to hit, obtain data from the memory to the primary cache through a direct connection channel.
緩存模块 44, 还可以用于把新增存储空间中緩存的数据, 发送给所述二级 緩存 31存储器 32。 这个功能是可选的。  The cache module 44 is further configured to send the data buffered in the newly added storage space to the secondary cache 31 memory 32. This feature is optional.
本发明实施例中, 存储器 32有多个, 不同存储器 32的层级不同。 可以依 据数据的冷热程度, 热数据优先存储到高速存储器 32中, 冷数据优先存储到低 速存储器 32中。 也可以按照数据的重要性分析, 越重要的数据存放到可靠性越 高的存储器 32中。  In the embodiment of the present invention, there are multiple memories 32, and different memories 32 have different levels. The hot data can be preferentially stored in the high speed memory 32 in accordance with the degree of heat and cold of the data, and the cold data is preferentially stored in the low speed memory 32. It is also possible to analyze the importance of the data, and the more important data is stored in the memory 32 with higher reliability.
把二级緩存的数据传递到下一级存储器件后, 可用译放数据所占用的存储 空间供緩存下一次写入的数据使用; 也可以不译放, 供后续读取。 译放方式有 两种, 一种是主动擦除数据占用的存储空间; 另一种可以把数据占用的存储空 间标记为可以被再次写入。  After the data of the second-level cache is transferred to the next-level storage device, the storage space occupied by the data can be used for the data to be cached for the next time; or it can be uninterpreted for subsequent reading. There are two ways to release the data, one is to actively erase the storage space occupied by the data; the other can mark the storage space occupied by the data as being able to be written again.
在另外一种实施方式中, 数据緩存装置 4可以不包括一级緩存 41 , 也就是 说数据緩存装置 4由命中率查询模块 42、 扩容模块 43、 緩存模块 44以及发送 模块 45的功能不变。 例如数据緩存装置 4是集成在控制器中的软件或硬件, 控 制器还包括一级緩存 41。  In another embodiment, the data caching device 4 may not include the L1 cache 41, that is, the data caching device 4 has the functions of the hit rate query module 42, the expansion module 43, the cache module 44, and the transmitting module 45. For example, the data cache device 4 is software or hardware integrated in the controller, and the controller further includes a level 1 cache 41.
本实施例中, 介绍了把原本属于存储器 32 的存储空间共享给二级緩存 31 使用。 在其他实施例中, 也可以把二级緩存 31 的存储空间共享给存储器 32使 用; 还可以设置独立于存储器 32和二级緩存 31 的第三方存储空间, 由存储器 In this embodiment, the storage space originally belonging to the memory 32 is shared for use in the secondary cache 31. In other embodiments, the storage space of the L2 cache 31 can also be shared with the memory 32. Third-party storage space independent of the storage 32 and the L2 cache 31 can also be set.
32和二级緩存 31共同使用。 本发明实施例介绍了一种緩存和存储器 32共享存 储空间的技术, 緩存分为 2个层级, 存储器 32也由不同存储器组成。 32 is used in conjunction with the secondary cache 31. The embodiment of the present invention introduces a technique for sharing storage space between a cache and a memory 32. The cache is divided into two levels, and the memory 32 is also composed of different memories.
由于二级緩存 31和存储器 32在物理位置上都位于存储设备 3中, 而且控 制器对二级緩存 31和存储器 32的管理方式接近, 相对而言, 控制器对一级緩 存 41的管理方式差别比较明显。 因此把存储器 32的存储空间挪给二级緩存 31 的做法, 比把存储器 32的存储空间挪给以及緩存 41更加简单易行。 Since the L2 cache 31 and the memory 32 are physically located in the storage device 3, and are controlled The controller manages the L2 cache 31 and the memory 32 in a similar manner. In contrast, the controller manages the L1 cache 41 in a different manner. Therefore, it is easier to transfer the storage space of the memory 32 to the secondary cache 31 than to transfer the storage space of the memory 32 to the cache 41.
本领域普通技术人员将会理解, 本发明的各个方面、 或各个方面的可能实 现方式可以被具体实施为系统、 方法或者计算机程序产品。 例如提供一次存储 介质, 用于存储上述方法实施例的程序产品。 因此, 本发明的各方面、 或各个 方面的可能实现方式可以采用完全硬件实施例、 完全软件实施例 (包括固件、驻 留软件等等),或者组合软件和硬件方面的实施例的形式,在这里都统称为"电路"、 "模块,,或者"系统"。 此外, 本发明的各方面、 或各个方面的可能实现方式可以采 用计算机程序产品的形式, 计算机程序产品是指存储在计算机可读介质中的计 算机可读程序代码。  Those of ordinary skill in the art will appreciate that aspects of the invention, or aspects of various aspects, may be embodied as a system, method, or computer program product. For example, a storage medium is provided for storing the program product of the above method embodiment. Thus, aspects of the invention, or possible implementations of various aspects, may be in the form of an entirely hardware embodiment, an entirely software embodiment (including firmware, resident software, etc.), or a combination of software and hardware aspects, They are collectively referred to herein as "circuits," "modules," or "systems." Further, various aspects of the invention, or possible implementations of various aspects, may take the form of a computer program product, which is stored in a computer readable form Computer readable program code in the medium.
计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质。 计 算机可读存储介质包含但不限于电子、磁性、 光学、 电磁、 红外或半导体系统、 设备或者装置, 或者前述的任意适当组合, 如随机存取存储设备 (RAM), 只读 存储设备 (ROM),可擦除可编程只读存储设备 (EPROM或者快闪存储设备)、 光 纤、 便携式只读存储设备 (CD-ROM:)。  The computer readable medium can be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium includes, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing, such as a random access memory device (RAM), a read only memory device (ROM). , erasable programmable read-only storage devices (EPROM or flash storage devices), optical fibers, portable read-only storage devices (CD-ROM:).
计算机中的处理器读取存储在计算机可读介质中的计算机可读程序代码, 使得处理器能够执行在流程图中每个步骤、 或各步骤的组合中规定的功能动作; 生成实施在框图的每一块、 或各块的组合中规定的功能动作的装置。  The processor in the computer reads the computer readable program code stored in the computer readable medium, such that the processor can perform the functional actions specified in each step or combination of steps in the flowchart; A device that functions as specified in each block, or combination of blocks.

Claims

权利 要求 书 claims
1、 一种数据緩存方法, 应用于控制器中, 所述控制器和存储设备连接, 其 特征在于, 控制器包括一级緩存, 所述存储设备包括二级緩与存储器, 所述二 级緩存用于存储一级緩存发往存储器的数据, 所述方法包括: 1. A data caching method, applied to a controller, the controller is connected to a storage device, characterized in that the controller includes a first-level cache, the storage device includes a second-level cache and memory, and the second-level cache For storing data sent from the first-level cache to the memory, the method includes:
查询所述二级緩存对读请求的命中率; Query the hit rate of the second-level cache for read requests;
判断命中率是否低于扩容阈值, 如果低于所述扩容阈值, 从所述存储器中 获取存储空间给所述二级緩存使用, 其中, 从所述存储器中获取的存储空间是 新增存储空间; Determine whether the hit rate is lower than the expansion threshold. If it is lower than the expansion threshold, obtain storage space from the memory for use by the secondary cache, wherein the storage space obtained from the memory is a newly added storage space;
使用所述二级緩存中新增存储空间, 緩存所述一级緩发送的存储数据。 Use the newly added storage space in the second-level cache to cache the storage data sent by the first-level cache.
2、 如权利要求 1所述的方法, 其特征在于: 2. The method according to claim 1, characterized in that:
所述存储器的存储介质与所述二级緩存的存储介质相同。 The storage medium of the memory is the same as the storage medium of the second level cache.
3、 如权利要求 2所述的方法, 其特征在于: 3. The method of claim 2, characterized in that:
所述存储介质是闪存。 The storage medium is flash memory.
4、 如权利要求 1所述的方法, 其特征在于, 所述緩存所述一级緩发送的存 待储数据之后, 进一步包括: 4. The method of claim 1, wherein, after caching the data to be stored sent by the first-level buffer, further comprising:
如果控制器收到对所述存储数据的读请求, 则从所述新增存储空间中, 获 得所述存储数据。 If the controller receives a read request for the storage data, it obtains the storage data from the newly added storage space.
5、 如权利要求 1所述的方法, 其特征在于: 5. The method of claim 1, characterized in that:
所述一级緩存和所述存储器之间存在直连通道, 所述直连通道旁路所述二 级緩存, 当所述二级緩存无法命中时, 所述一级緩存通过所述直连通道从所述 存储器获得数据。 There is a direct connection channel between the first-level cache and the memory, and the direct connection channel bypasses the second-level cache. When the second-level cache fails to hit, the first-level cache passes through the direct connection channel. Obtain data from the memory.
6、 如权利要求 1所述的方法, 其特征在于: 6. The method of claim 1, characterized in that:
当所述命中率升高至减容阈值时, 把所述新增存储空间返还给所述存储器。 When the hit rate increases to the capacity reduction threshold, the newly added storage space is returned to the memory.
7、 一种数据緩存装置, 用于对存储设备的存储空间进行管理, 存储设备包 括二级緩存与存储器, 其特征在于, 该装置包括: 7. A data caching device used to manage the storage space of a storage device. The storage device includes a secondary cache and a memory. It is characterized in that the device includes:
命中率查询模块, 用于查询二级緩存对读请求的命中率, 所述二级緩存用 于緩存一级緩存发送的数据; 扩容模块, 用于判断命中率是否低于扩容阈值, 如果低于所述扩容阈值, 从所述存储器中获取存储空间给所述二级緩存使用, 其中, 从所述存储器中获 取的存储空间是新增存储空间; The hit rate query module is used to query the hit rate of read requests in the second-level cache, which is used to cache data sent by the first-level cache; The expansion module is used to determine whether the hit rate is lower than the expansion threshold. If it is lower than the expansion threshold, obtain storage space from the memory for use by the second-level cache, wherein the storage space obtained from the memory is Add new storage space;
緩存模块, 用于使用所述新增存储空间, 緩存所述一级緩存发往所述存储 器发送的存储数据。 A cache module, configured to use the newly added storage space to cache the storage data sent by the first-level cache to the memory.
8、 如权利要求 7所述的装置, 其特征在于: 8. The device according to claim 7, characterized in that:
所述存储器的存储介质与所述二级緩存的存储介质相同。 The storage medium of the memory is the same as the storage medium of the second level cache.
9、 如权利要求 8所述的装置, 其特征在于: 9. The device according to claim 8, characterized in that:
所述存储介质是闪存。 The storage medium is flash memory.
10、 如权利要求 7所述的装置, 其特征在于, 所述緩存模块进一步用于: 对所述装置收到对所述存储数据的读请求, 从所述新增存储空间中, 获得 所述存储数据。 10. The device of claim 7, wherein the cache module is further configured to: upon receiving a read request for the stored data from the device, obtain the new storage space from the new storage space. Storing data.
11、 如权利要求 7 所述的装置, 其特征在于, 所述一级緩存和所述存储器 之间存在直连通道, 所述直连通道旁路所述二级緩存, 所述緩存模块用于: 当所述二级緩存无法命中时, 通过所述直连通道从所述存储器获得数据到 所述一级緩存。 11. The device of claim 7, wherein a direct connection channel exists between the first-level cache and the memory, the direct connection channel bypasses the second-level cache, and the cache module is used to : When the second-level cache fails to hit, obtain data from the memory to the first-level cache through the direct connection channel.
12、 如权利要求 7 所述的装置, 其特征在于, 所示扩容模块进一步用于: 当所述命中率升高至减容阈值时, 把所述新增存储空间返还给所述存储器。 12. The device of claim 7, wherein the capacity expansion module is further configured to: return the newly added storage space to the memory when the hit rate rises to a capacity reduction threshold.
13、 如权利要求 7 所述的装置, 其特征在于, 所述装置进一步包括一级緩 存, 用于緩存数据。 13. The device of claim 7, wherein the device further includes a level one cache for caching data.
14、一种存储系统,其特征在于: 包括权 7-13任一项所述的数据緩存装置, 以及存储装置, 所述存储装置包括二级緩存以及存储器。 14. A storage system, characterized by: including the data caching device according to any one of claims 7-13, and a storage device, wherein the storage device includes a secondary cache and a memory.
15、 一种控制器, 所述控制器和存储设备连接, 所述存储设备包括存储器 与二级緩存, 其中, 所述控制器包括: 15. A controller, the controller is connected to a storage device, the storage device includes a memory and a secondary cache, wherein the controller includes:
一级緩存, 用于緩存数据以及用于存储程序指令, 和所述二级緩存连接; 处理器, 和所述一级緩存连接, 通过运行所述程序指令, 执行以下步骤: 查询所述二级緩存对读请求的命中率; 判断命中率是否低于扩容阈值, 如果低于所述扩容阈值, 从所述存储器中 获取存储空间给所述二级緩存使用, 其中, 从所述存储器中获取的存储空间是 新增存储空间; The first-level cache, used to cache data and store program instructions, is connected to the second-level cache; the processor, connected to the first-level cache, executes the following steps by running the program instructions: Query the second-level cache Cache hit rate for read requests; Determine whether the hit rate is lower than the expansion threshold. If it is lower than the expansion threshold, obtain storage space from the memory for use by the secondary cache, wherein the storage space obtained from the memory is a newly added storage space;
使用所述二级緩存中新增存储空间, 緩存所述一级緩发送的存储数据。 Use the newly added storage space in the second-level cache to cache the storage data sent by the first-level cache.
16、 如权利要求 15所述的控制器, 所述处理器进一步用于执行: 16. The controller of claim 15, the processor is further configured to execute:
所述存储器的存储介质与所述二级緩存的存储介质相同。 The storage medium of the memory is the same as the storage medium of the second level cache.
17、 如权利要求 16所述的控制器, 所述处理器进一步用于执行: 17. The controller of claim 16, the processor is further configured to execute:
所述存储介质是闪存。 The storage medium is flash memory.
18、 如权利要求 15所述的控制器, 所述处理器进一步用于执行: 18. The controller of claim 15, the processor is further configured to execute:
在所述緩存所述一级緩发送的存待储数据之后, 如果收到对所述存储数据 的读请求, 则从所述新增存储空间中, 获得所述存储数据。 After caching the data to be stored sent by the first-level cache, if a read request for the stored data is received, the stored data is obtained from the newly added storage space.
19、 如权利要求 15所述的控制器, 其中, 所述一级緩存和所述存储器之间 存在直连通道,所述直连通道旁路所述二级緩存,所述处理器进一步用于执行: 当所述二级緩存无法命中时, 通过所述直连通道从所述存储器获得数据发 送给所述一级緩存。 19. The controller of claim 15, wherein a direct connection channel exists between the first level cache and the memory, the direct connection channel bypasses the second level cache, and the processor is further configured to Execution: When the second-level cache fails to hit, obtain data from the memory through the direct connection channel and send it to the first-level cache.
20、 如权利要求 15所述的控制器, 其中: 20. The controller of claim 15, wherein:
当所述命中率升高至减容阈值时, 把所述新增存储空间返还给所述存储器。 When the hit rate increases to the capacity reduction threshold, the newly added storage space is returned to the memory.
21、 一种存储系统, 包括控制器和存储设备, 所述控制器和所述存储设备 连接, 所述存储设备包括存储器与二级緩存, 其中, 所述控制器包括: 21. A storage system, including a controller and a storage device, the controller is connected to the storage device, the storage device includes a memory and a secondary cache, wherein the controller includes:
一级緩存, 用于緩存数据以及用于存储程序指令, 和所述二级緩存连接; 处理器, 和所述一级緩存连接, 通过运行所述程序指令, 执行以下步骤: 查询所述二级緩存对读请求的命中率; The first-level cache, used to cache data and store program instructions, is connected to the second-level cache; the processor, connected to the first-level cache, executes the following steps by running the program instructions: Query the second-level cache Cache hit rate for read requests;
判断命中率是否低于扩容阈值, 如果低于所述扩容阈值, 从所述存储器中 获取存储空间给所述二级緩存使用, 其中, 从所述存储器中获取的存储空间是 新增存储空间; Determine whether the hit rate is lower than the expansion threshold. If it is lower than the expansion threshold, obtain storage space from the memory for use by the secondary cache, wherein the storage space obtained from the memory is a newly added storage space;
使用所述二级緩存中新增存储空间, 緩存所述一级緩发送的存储数据。 Use the newly added storage space in the second-level cache to cache the storage data sent by the first-level cache.
PCT/CN2013/091194 2013-12-31 2013-12-31 Data caching method, device and system WO2015100653A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2013/091194 WO2015100653A1 (en) 2013-12-31 2013-12-31 Data caching method, device and system
CN201380002567.6A CN103858112A (en) 2013-12-31 2013-12-31 Data-caching method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2013/091194 WO2015100653A1 (en) 2013-12-31 2013-12-31 Data caching method, device and system

Publications (1)

Publication Number Publication Date
WO2015100653A1 true WO2015100653A1 (en) 2015-07-09

Family

ID=50864335

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/091194 WO2015100653A1 (en) 2013-12-31 2013-12-31 Data caching method, device and system

Country Status (2)

Country Link
CN (1) CN103858112A (en)
WO (1) WO2015100653A1 (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104298471A (en) * 2014-09-16 2015-01-21 青岛海信信芯科技有限公司 High-speed cache data writing method and device
CN105630698A (en) * 2014-10-28 2016-06-01 华为技术有限公司 Extension cache configuration method and device and extension cache
WO2016082205A1 (en) * 2014-11-28 2016-06-02 华为技术有限公司 Method, apparatus and device for controlling power consumption of multi-level cache
KR20170008339A (en) * 2015-07-13 2017-01-24 에스케이하이닉스 주식회사 Memory system and operating method of memory system
CN105138292A (en) * 2015-09-07 2015-12-09 四川神琥科技有限公司 Disk data reading method
CN105183394B (en) * 2015-09-21 2018-09-04 北京奇虎科技有限公司 A kind of data storage handling method and device
CN106789431B (en) 2016-12-26 2019-12-06 中国银联股份有限公司 Overtime monitoring method and device
KR20190023433A (en) * 2017-08-29 2019-03-08 에스케이하이닉스 주식회사 Memory system and operating method thereof
CN108287793B (en) * 2018-01-09 2020-12-25 网宿科技股份有限公司 Response message buffering method and server
CN112860599B (en) * 2019-11-28 2024-02-02 中国电信股份有限公司 Data caching processing method and device and storage medium
CN112199383A (en) * 2020-10-19 2021-01-08 珠海金山网络游戏科技有限公司 Data updating method and device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080028150A1 (en) * 2006-07-28 2008-01-31 Farnaz Toussi Autonomic Mode Switching for L2 Cache Speculative Accesses Based on L1 Cache Hit Rate
CN101196852A (en) * 2008-01-03 2008-06-11 杭州华三通信技术有限公司 Distributed caching method and system, caching equipment and non-caching equipment
US7519775B2 (en) * 2006-02-23 2009-04-14 Sun Microsystems, Inc. Enforcing memory-reference ordering requirements at the L2 cache level
CN101493795A (en) * 2008-01-24 2009-07-29 杭州华三通信技术有限公司 Storage system, storage controller, and cache implementing method in the storage system
CN101510176A (en) * 2009-03-26 2009-08-19 浙江大学 Control method of general-purpose operating system for accessing CPU two stage caching
CN102231137A (en) * 2011-05-26 2011-11-02 浪潮(北京)电子信息产业有限公司 Data memory system and method
CN103383666A (en) * 2013-07-16 2013-11-06 中国科学院计算技术研究所 Method and system for improving cache prefetch data locality and cache assess method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100505762C (en) * 2006-04-19 2009-06-24 华中科技大学 Distributed multi-stage buffer storage system suitable for object network storage

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7519775B2 (en) * 2006-02-23 2009-04-14 Sun Microsystems, Inc. Enforcing memory-reference ordering requirements at the L2 cache level
US20080028150A1 (en) * 2006-07-28 2008-01-31 Farnaz Toussi Autonomic Mode Switching for L2 Cache Speculative Accesses Based on L1 Cache Hit Rate
CN101196852A (en) * 2008-01-03 2008-06-11 杭州华三通信技术有限公司 Distributed caching method and system, caching equipment and non-caching equipment
CN101493795A (en) * 2008-01-24 2009-07-29 杭州华三通信技术有限公司 Storage system, storage controller, and cache implementing method in the storage system
CN101510176A (en) * 2009-03-26 2009-08-19 浙江大学 Control method of general-purpose operating system for accessing CPU two stage caching
CN102231137A (en) * 2011-05-26 2011-11-02 浪潮(北京)电子信息产业有限公司 Data memory system and method
CN103383666A (en) * 2013-07-16 2013-11-06 中国科学院计算技术研究所 Method and system for improving cache prefetch data locality and cache assess method

Also Published As

Publication number Publication date
CN103858112A (en) 2014-06-11

Similar Documents

Publication Publication Date Title
WO2015100653A1 (en) Data caching method, device and system
US9229653B2 (en) Write spike performance enhancement in hybrid storage systems
US9612964B2 (en) Multi-tier file storage management using file access and cache profile information
US7979631B2 (en) Method of prefetching data in hard disk drive, recording medium including program to execute the method, and apparatus to perform the method
US8751725B1 (en) Hybrid storage aggregate
US8392670B2 (en) Performance management of access to flash memory in a storage device
US20130080679A1 (en) System and method for optimizing thermal management for a storage controller cache
WO2017025039A1 (en) Flash storage oriented data access method and device
US9047068B2 (en) Information handling system storage device management information access
WO2017148242A1 (en) Method for accessing shingled magnetic recording (smr) hard disk, and server
WO2014209234A1 (en) Method and apparatus for hot data region optimized dynamic management
WO2021036689A1 (en) Cache space management method and device
KR20130112210A (en) Page replace method and memory system using the same
WO2023035646A1 (en) Method and apparatus for expanding memory, and related device
JP2012533781A (en) Computer system and load equalization control method thereof
TWI584120B (en) Method and system for dynamically adaptive caching
US10282291B2 (en) Storage system with data management mechanism and method of operation thereof
US20200133543A1 (en) Locality-aware, memory-efficient, time-efficient hot data identification using count-min-sketch for flash or streaming applications
KR20210008826A (en) Logical block addressing range collision crawler
JP2017097466A (en) Storage control device, storage control method, and storage control program
US9542326B1 (en) Managing tiering in cache-based systems
US11474750B2 (en) Storage control apparatus and storage medium
US11016692B2 (en) Dynamically switching between memory copy and memory mapping to optimize I/O performance
CN115268763A (en) Cache management method, device and equipment
US20060143378A1 (en) Information processing apparatus and control method for this information processing apparatus

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

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

Country of ref document: EP

Kind code of ref document: A1