[go: up one dir, main page]

CN107430551B - Data caching method, storage control device and storage equipment - Google Patents

Data caching method, storage control device and storage equipment Download PDF

Info

Publication number
CN107430551B
CN107430551B CN201580054160.7A CN201580054160A CN107430551B CN 107430551 B CN107430551 B CN 107430551B CN 201580054160 A CN201580054160 A CN 201580054160A CN 107430551 B CN107430551 B CN 107430551B
Authority
CN
China
Prior art keywords
cache
data block
data
stored
level
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201580054160.7A
Other languages
Chinese (zh)
Other versions
CN107430551A (en
Inventor
李夫路
蔡恩挺
林春恭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202010981446.2A priority Critical patent/CN112214420B/en
Priority to CN202010983144.9A priority patent/CN112231242B/en
Publication of CN107430551A publication Critical patent/CN107430551A/en
Application granted granted Critical
Publication of CN107430551B publication Critical patent/CN107430551B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems

Landscapes

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

Abstract

A data caching method applied to a storage device, a control device of the storage device and the storage device are provided. The storage device includes a first cache (212) and a second cache (213). When the storage device monitors that a first data block (S301) is cached in the first cache (212), the first data block is to be deleted (S601), or the time for caching the first data block in the first cache (212) exceeds a threshold (S801), acquiring feature information of the first data block, then determining whether the first data block is stored in the second cache (213) according to the feature information of the first data block, and adjusting the elimination priority level of the first data block in the second cache (213) under the condition that the first data block is determined to be stored in the second cache (213) (S303, S603, S803) (S304, S604, S804). The response speed of the IO request is improved by coordinating data in the first cache (212) and the second cache (213) in the storage device.

Description

数据缓存方法、存储控制装置、及存储设备Data caching method, storage control device, and storage device

技术领域technical field

本发明涉及数据存储技术领域,特别涉及数据缓存技术。The present invention relates to the technical field of data storage, in particular to data caching technology.

背景技术Background technique

随着大数据、移动互联、和云服务等技术和应用的快速发展,应用服务器对存储服务器的访问需求也大大增加,这就需要加快对访问存储服务器的I/O请求的处理能力,以快速响应用户的访问需求。With the rapid development of technologies and applications such as big data, mobile internet, and cloud services, the demand for application servers to access storage servers has also increased greatly. Respond to user access needs.

现有技术一般是采用缓存的方法来加快I/O请求的处理能力,即在应用服务器和存储服务器中都设置缓存。应用服务器的缓存存储应用服务器决定的热数据,存储服务器的缓存存储从硬盘中读取的数据。In the prior art, a cache method is generally used to speed up the processing capability of I/O requests, that is, caches are set in both the application server and the storage server. The cache of the application server stores the hot data determined by the application server, and the cache of the storage server stores the data read from the hard disk.

在应用服务器接收到I/O请求时,首先在应用服务器的缓存中访问数据块,若未命中,则将所述I/O请求传输至所述存储服务器,若在所述存储服务器也没有命中,则需要从硬盘中读取数据。When the application server receives the I/O request, it first accesses the data block in the cache of the application server, and if it is not hit, the I/O request is transmitted to the storage server, and if the storage server is not hit either , you need to read the data from the hard disk.

由于应用服务器的缓存的存储空间比存储服务器的缓存的存储空间小,所以缓存在上级缓存中的数据可能很快就会被淘汰掉,这样,在I/O请求所请求的数据块被应用服务器的缓存淘汰掉后,可在存储服务器的缓存中命中,从而可以快速响应I/O请求。Since the storage space of the cache of the application server is smaller than that of the cache of the storage server, the data cached in the upper-level cache may be eliminated soon. After the cache of the storage server is eliminated, it can be hit in the cache of the storage server, so that the I/O request can be quickly responded.

然而,应用服务器中的缓存和存储服务器的缓存之间缺乏协同操作的机制,可能会经常出现相同的数据在两个缓存都分别缓存而造成的存储资源浪费的问题,也有可能经常出现某热数据在两个缓存都没有缓存而需要到硬盘读取该数据而造成的数据读取速度延迟的问题。However, there is a lack of a cooperative operation mechanism between the cache in the application server and the cache in the storage server. The problem of wasting storage resources caused by the same data being cached separately in both caches may often occur, and some hot data may often appear. The problem of data read speed delay caused by the need to read the data from the hard disk without cache in both caches.

发明内容SUMMARY OF THE INVENTION

本申请提供数据缓存方法、存储设备、及数据处理系统,以提供多级缓存的协同操作机制。The present application provides a data caching method, a storage device, and a data processing system to provide a cooperative operation mechanism of multi-level caching.

本发明第一方面提供一种数据的缓存方法,所述方法应用于存储服务器,所述存储设备包括第一缓存、第二缓存和存储单元,所述第一缓存为应用服务器提供数据缓存,所述第二缓存用于为所述存储单元提供数据缓存。在所述存储服务器监测到第一触发条件的情况下,获取缓存在所述第一缓存中第一数据块的特征信息,然后根据所述第一数据块的特征信息确定所述第一数据块是否存储在所述第二缓存中;在确定所述第一数据块存储在所述第二缓存中的情况下,调整所述第一数据块在所述第二缓存中的淘汰优先级的级别。所述第一数据块的特征信息由所述第一数据块的数据内容决定。A first aspect of the present invention provides a data caching method. The method is applied to a storage server. The storage device includes a first cache, a second cache, and a storage unit. The first cache provides a data cache for the application server. The second cache is used to provide a data cache for the storage unit. In the case that the storage server detects the first trigger condition, acquire characteristic information of the first data block cached in the first cache, and then determine the first data block according to the characteristic information of the first data block Whether to store in the second cache; in the case of determining that the first data block is stored in the second cache, adjust the level of the elimination priority of the first data block in the second cache . The characteristic information of the first data block is determined by the data content of the first data block.

根据一级缓存和二级缓存所缓存数据的情况,调整对所述第二缓存所缓存的数据块的淘汰优先级的级别,从而控制第二缓存中所缓存数据的淘汰顺序,减少第一缓存和第二缓存中所缓存的重复数据,或者延长热数据的在二级缓存中的缓存时间,提高IO请求的响应速度According to the data cached in the first-level cache and the second-level cache, adjust the level of the elimination priority of the data blocks cached in the second cache, so as to control the elimination order of the data cached in the second cache, and reduce the number of the first cache. and the duplicate data cached in the second cache, or prolong the cache time of hot data in the second level cache, and improve the response speed of IO requests

可选地,所述第一触发条件为:所述存储服务器接收到数据写请求,且将所述数据写请求中包括的第一数据块写入所述第一缓存中,或者,所述第一数据块在所述第一缓存中的缓存时间超过预定时间,在这种触发条件下,在确定所述第一数据块存储在所述第二缓存中时,可以将所述第一数据块在所述第二缓存中的淘汰优先级的级别提高。Optionally, the first trigger condition is: the storage server receives a data write request, and writes the first data block included in the data write request into the first cache, or the first data block is written in the first cache. The cache time of a data block in the first cache exceeds a predetermined time. Under this trigger condition, when it is determined that the first data block is stored in the second cache, the first data block can be stored in the second cache. The level of eviction priority in the second cache is increased.

这样,在确定所述第二缓存中存在新写入所述第一缓存中的数据块相同的数据块,或者存在与所述第一缓存中的热数据相同的数据块时,则提高所述第二缓存中的相同数据块的淘汰优先级的级别,使其优先淘汰,从而减少第一缓存和第二缓存中重复存储的数据块,增加了第一缓存和第二缓存所缓存数据的总量,节省存储资源。In this way, when it is determined that there is a data block in the second cache that is the same as the data block newly written in the first cache, or there is a data block that is the same as the hot data in the first cache, then increase the The level of the elimination priority of the same data block in the second cache makes it eliminated first, thereby reducing the data blocks repeatedly stored in the first cache and the second cache, and increasing the total amount of data cached in the first cache and the second cache. to save storage resources.

可选地,所述第一触发条件为:所述存储服务器接收到从所述第一缓存中删除所述第一数据块的删除请求;在这种触发条件下,在确定所述第一数据块存储在所述第二缓存中时,将所述第一数据块在所述第二缓存中的淘汰优先级的级别降低。Optionally, the first trigger condition is: the storage server receives a deletion request to delete the first data block from the first cache; under this trigger condition, after determining the first data block When the block is stored in the second cache, the level of the elimination priority of the first data block in the second cache is lowered.

这样,当从所述第一缓存中删除数据块时,若所要删除的数据块也存储在所述第二缓存中,则将若所要删除的数据块在第二缓存中的淘汰优先级降低,这样,可以使在第一缓存中删除的数据在第二缓存中保存的时间更长一些,当下次有IO请求访问所述数据块时,可以在第二缓存中命中,而不需要从硬盘中获取,所以提高IO请求的响应速度。In this way, when deleting a data block from the first cache, if the data block to be deleted is also stored in the second cache, the elimination priority of the data block to be deleted in the second cache is lowered, In this way, the data deleted in the first cache can be kept in the second cache for a longer period of time, and when there is an IO request to access the data block next time, it can be hit in the second cache, without the need to retrieve data from the hard disk. Get, so improve the response speed of IO requests.

可选地,所述存储设备保存有所述第二缓存的索引记录,所述第二缓存的索引记录包括所述第二缓存中保存数据块的数据特征标识,所述第二缓存中保存的数据块的大小等于所述第一数据块的大小,所述每个所述第二缓存中保存的数据块的数据特征标识由所述每个所述第二缓存中保存的数据块的数据内容决定;所述第一数据块的特征信息为根据每个第一数据块的数据内容获得;根据所述第一数据块的数据特征标识查询所述第二缓存的索引记录来确定所述每个第一数据块是否存储在所述第二缓存中。Optionally, the storage device saves an index record of the second cache, and the index record of the second cache includes the data feature identifiers of the data blocks stored in the second cache, and the data stored in the second cache. The size of the data block is equal to the size of the first data block, and the data features of the data blocks stored in each of the second caches identify the data content of the data blocks stored in each of the second caches The characteristic information of the first data block is obtained according to the data content of each first data block; the index record of the second cache is queried according to the data characteristic identifier of the first data block to determine the each Whether the first data block is stored in the second cache.

通过建立索引表的方式,可以快速的确定所述第一数据块是否存储在所述第二缓存中。By establishing an index table, it can be quickly determined whether the first data block is stored in the second cache.

可选地,所述存储设备保存有地址表,所述地址表中记录了缓存在所述第二缓存中的第二数据块的特征标识及存储地址,在确定所述第一数据块存储在所述第二缓存中后,根据所述第一数据块的特征标识在所述地址表中找到所述第一数据块,然后再对所述第一数据块在所述第二缓存中的淘汰级别进行调整。通过建立地址表,可以快速的找到所述第一数据块在所述第二缓存中的位置,从而对所述第一数据块在所述第二缓存中的淘汰优先级的级别进行调整。Optionally, the storage device saves an address table, and the address table records the feature identifier and storage address of the second data block cached in the second cache, and after determining that the first data block is stored in the After the second cache, find the first data block in the address table according to the characteristic identifier of the first data block, and then eliminate the first data block in the second cache. level to adjust. By establishing an address table, the position of the first data block in the second cache can be quickly found, so that the level of the elimination priority of the first data block in the second cache can be adjusted.

可选地,所述第二缓存索引记录只记录最近一段时间写入所述第二缓存的数据块的数据标识。这样可以减少第二缓存索引记录所占用的空间,减少查表的时间。Optionally, the second cache index record only records the data identifiers of the data blocks written into the second cache in a recent period of time. In this way, the space occupied by the index records of the second cache can be reduced, and the time for table lookup can be reduced.

可选地,在所述存储服务器监测到第二触发条件的情况下,获取缓存在所述第二缓存中的第二数据块的特征信息,然后根据所述第二数据块的特征信息确定所述第二数据块是否存储在所述第一缓存中;在确定所述第二数据块存储在所述第一缓存中的情况下,调整所述第二数据块在所述第二缓存中的淘汰优先级的级别。Optionally, in the case that the storage server monitors the second trigger condition, obtain characteristic information of the second data block cached in the second cache, and then determine the characteristic information of the second data block according to the characteristic information of the second data block. whether the second data block is stored in the first cache; if it is determined that the second data block is stored in the first cache, adjust the size of the second data block in the second cache The level of elimination priority.

这样,可以监测第二缓存中的数据情况,通过判断缓存在第二缓存中数据是否缓存在第一缓存中,来调整缓存在第二缓存中的数据块的淘汰优先级级别,从而控制第二缓存中所缓存数据的淘汰顺序,从而减少第一缓存及第二缓存中所缓存的重复数据。In this way, the data situation in the second cache can be monitored, and the elimination priority level of the data blocks cached in the second cache can be adjusted by judging whether the data cached in the second cache is cached in the first cache, so as to control the second cache. The elimination order of the cached data in the cache reduces the duplicate data cached in the first cache and the second cache.

可选地,所述第二触发条件为:所述第二数据块在所述第二缓存中的缓存时间超过预定时间;在这种触发条件下,在确定所述第二数据块存储在所述第一缓存中时,将所述第二数据块从所述第二缓存中的淘汰优先级的级别提高。Optionally, the second trigger condition is: the cache time of the second data block in the second cache exceeds a predetermined time; under this trigger condition, after it is determined that the second data block is stored in the second cache When the second data block is in the first cache, the level of the elimination priority of the second data block is increased from the second cache.

这样,在确定所述第一缓存中存在与所述第二缓存中的数据相同的数据块时,则提高所述第二缓存中数据块的淘汰优先级的级别,使其优先淘汰,从而减少第一缓存和第二缓存中重复存储的数据块,增加了第一缓存和第二缓存所缓存数据的总量,从而提高IO请求的响应速度。In this way, when it is determined that the same data block exists in the first cache as the data in the second cache, the level of the elimination priority of the data block in the second cache is increased to make it eliminated first, thereby reducing the The data blocks repeatedly stored in the first cache and the second cache increase the total amount of data cached in the first cache and the second cache, thereby improving the response speed of the IO request.

可选地,所述第二触发条件为:删除所述第二缓存中的所述第二数据块,则所述方法还包括:Optionally, if the second trigger condition is: deleting the second data block in the second cache, the method further includes:

在确定所述第二数据未存储在所述第一缓存中的情况下,将所述第二数据在所述第二缓存中的淘汰优先级的级别降低。In a case where it is determined that the second data is not stored in the first cache, the level of the elimination priority of the second data in the second cache is lowered.

这样,在删除第二缓存中的数据块时,若所删除的数据块没有存储在所述第一缓存中,则提高所删除的数据块的淘汰优先级,即不删除所述数据块,这样,当有IO请求访问所述数据块时,可在第二缓存中命中,则提高的IO请求的响应速度。In this way, when deleting a data block in the second cache, if the deleted data block is not stored in the first cache, the elimination priority of the deleted data block is increased, that is, the data block is not deleted, so that , when there is an IO request to access the data block, a hit can be made in the second cache, thereby improving the response speed of the IO request.

可选地,所述第二触发条件为:将包含所述第二数据块的数据写入所述第二缓存;在这种条件下,在确定所述第二数据块存储在所述第一缓存中的情况下,将所述第二数据块在所述第二缓存中的淘汰优先级的级别提高。Optionally, the second trigger condition is: writing data including the second data block into the second cache; under this condition, after determining that the second data block is stored in the first cache In the case of being in the cache, the level of the elimination priority of the second data block in the second cache is increased.

这样,如果新缓存至所述第二缓存的数据块,也存储在第一缓存中,则提高新缓存数据块的淘汰优先级的级别,从而尽快淘汰新缓存至所述第二缓存的数据块,减少第一缓存和第二缓存中的重复数据,增加缓存数据,提高IO请求命中率。In this way, if the data block newly cached to the second cache is also stored in the first cache, the level of the elimination priority of the newly cached data block is increased, so as to eliminate the data block newly cached to the second cache as soon as possible , reduce the duplicate data in the first cache and the second cache, increase the cache data, and improve the IO request hit rate.

可选地,所述存储设备保存有所述第一缓存的索引记录,所述第一缓存的索引记录包括所述第一缓存中保存的至少一个数据块的数据特征标识,每个数据块的大小为预定大小,所述每个数据块的数据特征标识由所述每个数据块包含的数据内容决定;所述第二数据块的特征标识是根据第二数据块包含的数据内容获得的;在确定所述第二数据块是否存储在所述第一缓存中时,是根据所述每个第二数据块的数据特征标识查询所述第一缓存的索引记录来确定。Optionally, the storage device saves an index record of the first cache, and the index record of the first cache includes a data feature identifier of at least one data block stored in the first cache, and the value of each data block is The size is a predetermined size, and the data feature identifier of each data block is determined by the data content contained in each data block; the feature identifier of the second data block is obtained according to the data content contained in the second data block; When determining whether the second data block is stored in the first cache, it is determined by querying an index record of the first cache according to the data feature identifier of each second data block.

这样,通过设置所述第一缓存索引记录,可以在所述第一缓存中快速的找到与所述第二缓存中的数据相同的数据。In this way, by setting the first cache index record, the same data as the data in the second cache can be quickly found in the first cache.

可选地,所述第一缓存索引记录只记录最近一段时间写入所述第一缓存的数据块的数据标识。这样可以减少第一缓存索引记录所占用的空间,减少查表的时间。Optionally, the first cache index record only records data identifiers of data blocks written into the first cache in a recent period of time. In this way, the space occupied by the first cache index record can be reduced, and the time for table lookup can be reduced.

本发明第二方面提供一种数据的缓存方法,应用于存储设备,所述存储设备包括第一缓存、第二缓存和存储单元,所述第一缓存为应用服务器提供数据缓存,所述第二缓存用于为所述存储单元提供数据缓存,在存储服务器监测到第二触发条件的情况下,获取缓存在所述第二缓存中的第二数据块的特征信息;根据所述第二数据的特征信息确定所述第二数据块是否存储在所述第一缓存中;在确定所述第二数据块存储在所述第一缓存中的情况下,调整所述第二数据块在所述第二缓存中的淘汰优先级的级别。A second aspect of the present invention provides a data caching method, which is applied to a storage device. The storage device includes a first cache, a second cache, and a storage unit. The first cache provides a data cache for an application server, and the second cache provides a data cache. The cache is used to provide a data cache for the storage unit, and when the storage server monitors the second trigger condition, acquire feature information of the second data block cached in the second cache; The feature information determines whether the second data block is stored in the first cache; if it is determined that the second data block is stored in the first cache, adjust the second data block in the first cache. The level of eviction priority in the second cache.

这样,可以监测第二缓存中的数据情况,通过判断缓存在第二缓存中数据是否缓存在第一缓存中,来调整缓存在第二缓存中的数据块的淘汰优先级级别,从而控制第二缓存中所缓存数据的淘汰顺序,从而减少第一缓存及第二缓存中所缓存的重复数据或者延迟淘汰第二缓存中没有存储在所述第一缓存中的数据,增加IO请求的响应速度。In this way, the data situation in the second cache can be monitored, and the elimination priority level of the data blocks cached in the second cache can be adjusted by judging whether the data cached in the second cache is cached in the first cache, so as to control the second cache. The elimination sequence of cached data in the cache reduces duplicate data cached in the first cache and the second cache or delays the elimination of data in the second cache that is not stored in the first cache, thereby increasing the response speed of IO requests.

可选地,所述第二触发条件为:所述第二数据块在所述第二缓存中的缓存时间超过预定时间,在确定所述第二数据块存储在所述第一缓存中的情况下,将所述第二数据块在所述第二缓存中的淘汰优先级的级别提高。Optionally, the second trigger condition is: the cache time of the second data block in the second cache exceeds a predetermined time, and when it is determined that the second data block is stored in the first cache Next, the level of the elimination priority of the second data block in the second cache is increased.

这样,在确定所述第一缓存中存在与所述第二缓存中的数据相同的数据块时,则提高所述第二缓存中数据块的淘汰优先级的级别,使其优先淘汰,从而减少第一缓存和第二缓存中重复存储的数据块,增加了第一缓存和第二缓存所缓存数据的总量,节省存储资源。In this way, when it is determined that the same data block exists in the first cache as the data in the second cache, the level of the elimination priority of the data block in the second cache is increased to make it eliminated first, thereby reducing the The data blocks repeatedly stored in the first cache and the second cache increase the total amount of data cached in the first cache and the second cache, saving storage resources.

可选地,所述第二触发条件为:删除所述第二缓存中的所述第二数据块,则所述存储服务器在确定所述第二数据未存储在所述第一缓存中的情况下,将所述第二数据在所述第二缓存中的淘汰优先级的级别降低。Optionally, the second trigger condition is: delete the second data block in the second cache, then the storage server determines that the second data is not stored in the first cache when the second data block is not stored in the first cache and lowering the level of the elimination priority of the second data in the second cache.

这样,在删除第二缓存中的数据块时,若所删除的数据块没有存储在所述第一缓存中,则提高所删除的数据块的淘汰优先级,即不删除所述数据块,这样,当有IO请求访问所述数据块时,可在第二缓存中命中,则提高的IO请求的响应速度。In this way, when deleting a data block in the second cache, if the deleted data block is not stored in the first cache, the elimination priority of the deleted data block is increased, that is, the data block is not deleted, so that , when there is an IO request to access the data block, a hit can be made in the second cache, thereby improving the response speed of the IO request.

可选地,若所述第二触发条件为:将包含所述第二数据块的数据写入所述第二缓存;Optionally, if the second trigger condition is: writing data including the second data block into the second cache;

在确定所述第二数据块存储在所述第一缓存中的情况下,将所述第二数据块在所述第二缓存中的淘汰优先级的级别提高。When it is determined that the second data block is stored in the first cache, the level of the elimination priority of the second data block in the second cache is increased.

这样,如果新缓存至所述第二缓存的数据块,也存储在第一缓存中,则提高新缓存数据块的在所述第二缓存中淘汰优先级的级别,从而尽快淘汰新缓存至所述第二缓存的数据块,减少第一缓存和第二缓存中的重复数据,增加缓存数据,节省存储资源。In this way, if the newly cached data block in the second cache is also stored in the first cache, the priority level of the newly cached data block in the second cache is increased, so that the new cache is eliminated to the second cache as soon as possible. The data blocks in the second cache are reduced, the duplicate data in the first cache and the second cache are reduced, the cached data is increased, and storage resources are saved.

可选地,所述存储设备保存有所述第一缓存的索引记录,所述第一缓存的索引记录包括所述第一缓存中保存的数据块的数据特征标识,所述第一缓存中保存的数据块的大小等于所述第二数据块的大小,所述每个所述第二缓存中保存的数据块的数据特征标识由所述每个所述第二缓存中保存的数据块的数据内容决定;根据所述每个第二数据块的数据特征标识查询所述第一缓存的索引记录来确定所述第二数据块是否存储在所述第一缓存中。Optionally, the storage device stores an index record of the first cache, and the index record of the first cache includes data feature identifiers of data blocks stored in the first cache, and the first cache stores The size of the data block is equal to the size of the second data block, and the data characteristics of the data blocks stored in each of the second caches are identified by the data of the data blocks stored in each of the second caches. Content determination; according to the data feature identifier of each second data block, query the index record of the first cache to determine whether the second data block is stored in the first cache.

这样,通过设置所述第一缓存索引记录,可以在所述第一缓存中快速的找到与所述第二缓存中的数据相同的数据。In this way, by setting the first cache index record, the same data as the data in the second cache can be quickly found in the first cache.

可选地,所述第一缓存索引记录只记录最近一段时间写入所述第一缓存的数据块的数据标识。这样可以减少第一缓存索引记录所占用的空间,减少查表的时间。Optionally, the first cache index record only records data identifiers of data blocks written into the first cache in a recent period of time. In this way, the space occupied by the first cache index record can be reduced, and the time for table lookup can be reduced.

本发明第三方面提供一种存储控制装置,用于控制存储设备的数据存储,所述存储设备包括第一缓存、第二缓存和存储单元,所述第一缓存为应用服务器提供数据缓存,所述第二缓存用于为所述存储单元提供数据缓存,第一监测单元、第一获取单元、第一确定单元、第一调整单元,在所述第一监测单元监测所述第一触发条件的情况下,所述第一获取单元获取缓存在所述第一缓存中第一数据块的特征信息;所述第一确定单元根据所述第一数据块的特征信息确定所述第一数据块是否存储在所述第二缓存中,在所述第一确定单元确定所述第一数据块存储在所述第二缓存中的情况下,调整所述第一数据块在所述第二缓存中的淘汰优先级的级别。A third aspect of the present invention provides a storage control device for controlling data storage of a storage device, wherein the storage device includes a first cache, a second cache, and a storage unit, the first cache provides a data cache for an application server, so The second buffer is used to provide a data buffer for the storage unit, a first monitoring unit, a first acquisition unit, a first determination unit, and a first adjustment unit, and the first monitoring unit monitors the first trigger condition in the first monitoring unit. In this case, the first obtaining unit obtains the feature information of the first data block cached in the first cache; the first determining unit is stored in the second cache, and when the first determination unit determines that the first data block is stored in the second cache, adjust the size of the first data block in the second cache. The level of elimination priority.

这样,根据一级缓存和二级缓存所缓存数据的情况,调整对所述第二缓存所缓存的数据块的淘汰优先级的级别,从而控制第二缓存中所缓存数据的淘汰顺序,提高IO请求的响应速度。In this way, according to the situation of the data cached in the first-level cache and the second-level cache, the level of the elimination priority of the data blocks cached in the second cache is adjusted, so as to control the elimination order of the data cached in the second cache, and improve the IO The response speed of the request.

在第三方面的第一种实现方式中,所述第一触发条件为:根据第一数据写请求将包括至少一个所述第一数据块的待写入数据写入所述第一缓存中,或者,所述第一数据在所述第一缓存中的缓存时间超过预定时间;在确定所述第一数据块存储在所述第二缓存中的情况下,所述第一调整单元将所述第一数据块在所述第二缓存中的淘汰优先级的级别提高。In a first implementation manner of the third aspect, the first trigger condition is: writing data to be written including at least one of the first data blocks into the first cache according to a first data write request, Or, the buffering time of the first data in the first cache exceeds a predetermined time; when it is determined that the first data block is stored in the second cache, the first adjustment unit adjusts the The level of the elimination priority of the first data block in the second cache is increased.

这样,在确定所述第二缓存中存在新写入所述第一缓存中的数据块相同的数据块,或者存在与所述第一缓存中的热数据相同的数据块时,则提高所述第二缓存中的相同数据块的淘汰优先级的级别,使其优先淘汰,从而减少第一缓存和第二缓存中重复存储的数据块,增加了第一缓存和第二缓存所缓存数据的总量,从而提高IO请求的响应速度。In this way, when it is determined that there is a data block in the second cache that is the same as the data block newly written in the first cache, or there is a data block that is the same as the hot data in the first cache, then increase the The level of the elimination priority of the same data block in the second cache makes it eliminated first, thereby reducing the data blocks repeatedly stored in the first cache and the second cache, and increasing the total amount of data cached in the first cache and the second cache. amount, thereby improving the response speed of IO requests.

可选地,所述第一触发条件为:接收到在所述第一缓存中删除所述第一数据块的删除请求;Optionally, the first trigger condition is: receiving a deletion request for deleting the first data block in the first cache;

在所述第一确定单元确定所述第一数据块存储在所述第二缓存中的情况下,所述第一调整单元将所述第一数据块在所述第二缓存中的淘汰优先级的级别降低。In the case that the first determination unit determines that the first data block is stored in the second cache, the first adjustment unit adjusts the elimination priority of the first data block in the second cache level is lowered.

这样,当从所述第一缓存中删除数据块时,若所要删除的数据块也存储在所述第二缓存中,则将若所要删除的数据块在第二缓存中的淘汰优先级降低,这样,可以使在第一缓存中删除的数据在第二缓存中保存的时间更长一些,当下次有IO请求访问所述数据块时,可以在第二缓存中命中,而不需要从硬盘中获取,所以提高了IO请求的响应速度。In this way, when deleting a data block from the first cache, if the data block to be deleted is also stored in the second cache, the elimination priority of the data block to be deleted in the second cache is lowered, In this way, the data deleted in the first cache can be kept in the second cache for a longer period of time, and when there is an IO request to access the data block next time, it can be hit in the second cache, without the need to retrieve data from the hard disk. Obtained, so the response speed of IO requests is improved.

可选地,所述存储设备保存有所述第二缓存的索引记录,所述第二缓存的索引记录包括所述第二缓存中保存的至少一个第二数据块的数据特征标识,所述第二数据块的大小等于所述第一数据块的大小,所述每个第二数据块的数据特征标识由所述每个第二数据块包含的数据内容决定;Optionally, the storage device stores an index record of the second cache, and the index record of the second cache includes a data feature identifier of at least one second data block stored in the second cache, and the first cache The size of the two data blocks is equal to the size of the first data block, and the data feature identifier of each second data block is determined by the data content contained in each second data block;

所述第一确定单元根据所述第一数据块的数据特征标识查询所述第二缓存的索引记录,确定所述每个第一数据块是否存储在所述第二缓存中。通过建立索引表的方式,可以快速的确定所述第一数据块是否存储在所述第二缓存中。The first determining unit queries the index record of the second cache according to the data characteristic identifier of the first data block, and determines whether each of the first data blocks is stored in the second cache. By establishing an index table, it can be quickly determined whether the first data block is stored in the second cache.

在所述第三方面的第四种实现方式中,所述存储设备保存有地址表,所述地址表中记录了缓存在所述第二缓存中的第二数据块的特征标识及存储地址,在确定所述第一数据块存储在所述第二缓存中后,根据所述第一数据块的特征标识在所述地址表中找到所述第一数据块,然后再对所述第一数据块在所述第二缓存中的淘汰级别进行调整。通过建立地址表,可以快速的找到所述第一数据块在所述第二缓存中的位置,从而对所述第一数据块在所述第二缓存中的淘汰优先级的级别进行调整。In a fourth implementation manner of the third aspect, the storage device stores an address table, and the address table records the feature identifier and storage address of the second data block cached in the second cache, After it is determined that the first data block is stored in the second cache, the first data block is found in the address table according to the characteristic identifier of the first data block, and then the first data block is The eviction level of blocks in the second cache is adjusted. By establishing an address table, the position of the first data block in the second cache can be quickly found, so that the level of the elimination priority of the first data block in the second cache can be adjusted.

可选地,所述第二缓存索引记录只记录最近一段时间写入所述第二缓存的数据块的数据标识。这样可以减少第二缓存索引记录所占用的空间,减少查表的时间。Optionally, the second cache index record only records the data identifiers of the data blocks written into the second cache in a recent period of time. In this way, the space occupied by the index records of the second cache can be reduced, and the time for table lookup can be reduced.

可选地,所述存储控制装置还包括第二监测单元、第二获取单元、第二确定单元及第二调整单元,Optionally, the storage control device further includes a second monitoring unit, a second acquisition unit, a second determination unit, and a second adjustment unit,

在所述第二监测单元监测到所述第二触发条件的情况下,所述第二获取单元获取缓存在所述第二缓存中第二数据块的特征信息;所述第二确定单元根据所述第二数据块的特征信息确定所述第二数据块是否存储在所述第一缓存中在所述第二确定单元确定所述第二数据块存储在所述第一缓存中的情况下,所述第二调整单元调整所述第二数据块在所述第二缓存中的淘汰优先级的级别。When the second monitoring unit monitors the second trigger condition, the second obtaining unit obtains the feature information of the second data block cached in the second cache; the second determining unit The characteristic information of the second data block determines whether the second data block is stored in the first cache, and in the case that the second determination unit determines that the second data block is stored in the first cache, The second adjustment unit adjusts the level of the elimination priority of the second data block in the second cache.

这样,可以通过监测第二缓存中的数据情况,通过判断缓存在第二缓存中数据是否缓存在第一缓存中,来调整缓存在第二缓存中的数据块的淘汰优先级级别,从而控制第二缓存中所缓存数据的淘汰顺序,提高IO请求的响应速度。In this way, by monitoring the data situation in the second cache, and by judging whether the data cached in the second cache is cached in the first cache, the elimination priority level of the data blocks cached in the second cache can be adjusted, thereby controlling the first cache. The elimination order of cached data in the second cache improves the response speed of IO requests.

可选地,所述第二监测单元所监测到的所述第二触发条件为:所述第二数据块在所述第二缓存中的缓存时间超过预定时间;在所述第二确定单元确定所述第二数据块存储在所述第一缓存中的情况下,所述第二调整单元Optionally, the second trigger condition monitored by the second monitoring unit is: the cache time of the second data block in the second cache exceeds a predetermined time; When the second data block is stored in the first cache, the second adjustment unit

将所述第二数据块从所述第二缓存中的淘汰优先级的级别提高。Raising the second data block from the second cache has a higher level of eviction priority.

这样,在确定所述第一缓存中存在与所述第二缓存中的数据相同的数据块时,则提高所述第二缓存中数据块的淘汰优先级的级别,使其优先淘汰,从而减少第一缓存和第二缓存中重复存储的数据块,增加了第一缓存和第二缓存所缓存数据的总量,从而提高IO请求的响应速度。In this way, when it is determined that the same data block exists in the first cache as the data in the second cache, the level of the elimination priority of the data block in the second cache is increased to make it eliminated first, thereby reducing the The data blocks repeatedly stored in the first cache and the second cache increase the total amount of data cached in the first cache and the second cache, thereby improving the response speed of the IO request.

可选地,所述第二监测单元所监测到的所述第二触发条件为:删除所述第二缓存中的所述第二数据块,当所述第二确定单元在确定所述第二数据未存储在所述第一缓存中的情况下,所述第二调整单元将所述第二数据在所述第二缓存中的淘汰优先级的级别降低。Optionally, the second trigger condition monitored by the second monitoring unit is: delete the second data block in the second cache, when the second determining unit is determining the second When the data is not stored in the first cache, the second adjustment unit lowers the level of the elimination priority of the second data in the second cache.

这样,在删除第二缓存中的数据块时,若所删除的数据块没有存储在所述第一缓存中,则提高所删除的数据块的淘汰优先级,即不删除所述数据块,这样,当有IO请求访问所述数据块时,可在第二缓存中命中,则提高的IO请求的响应速度。In this way, when deleting a data block in the second cache, if the deleted data block is not stored in the first cache, the elimination priority of the deleted data block is increased, that is, the data block is not deleted, so that , when there is an IO request to access the data block, a hit can be made in the second cache, thereby improving the response speed of the IO request.

可选地,所述第二监测单元所监测到的所述第二触发条件为:将包含所述第二数据块的数据写入所述第二缓存;在所述第二确定单元确定所述第二数据块存储在所述第一缓存中的情况下,所述第二调整单元将所述第二数据块在所述第二缓存中的淘汰优先级的级别提高。Optionally, the second trigger condition monitored by the second monitoring unit is: writing data including the second data block into the second cache; determining, in the second determining unit, the When the second data block is stored in the first cache, the second adjustment unit increases the level of the elimination priority of the second data block in the second cache.

这样,如果新缓存至所述第二缓存的数据块,也存储在第一缓存中,则提高新缓存数据块的淘汰优先级的级别,从而尽快淘汰新缓存至所述第二缓存的数据块,减少第一缓存和第二缓存中的重复数据,增加缓存数据,提高IO请求命中率。In this way, if the data block newly cached to the second cache is also stored in the first cache, the level of the elimination priority of the newly cached data block is increased, so as to eliminate the data block newly cached to the second cache as soon as possible , reduce the duplicate data in the first cache and the second cache, increase the cache data, and improve the IO request hit rate.

可选地,所述存储设备保存有所述第一缓存的索引记录,所述第一缓存的索引记录包括所述第一缓存中保存的数据块的数据特征标识,每个所述第一缓存中保存的数据块的大小等于所述第二数据块的大小,所述每个数据块的数据特征标识由所述每个数据块的数据内容决定;Optionally, the storage device stores an index record of the first cache, and the index record of the first cache includes a data feature identifier of a data block stored in the first cache, and each of the first cache The size of the data block stored in the data block is equal to the size of the second data block, and the data feature identifier of each data block is determined by the data content of each data block;

单元所述第二确认单元根据所述每个第二数据块的数据特征标识查询所述第一缓存的索引记录,确定所述第二数据块是否存储在所述第一缓存中。The second confirmation unit queries the index record of the first cache according to the data feature identifier of each second data block, and determines whether the second data block is stored in the first cache.

这样,通过设置所述第一缓存索引记录,可以在所述第一缓存中快速的找到与所述第二缓存中的数据相同的数据。In this way, by setting the first cache index record, the same data as the data in the second cache can be quickly found in the first cache.

可选地,所述第一缓存索引记录只记录最近一段时间写入所述第一缓存的数据块的数据标识。这样可以减少第一缓存索引记录所占用的空间,减少查表的时间。Optionally, the first cache index record only records data identifiers of data blocks written into the first cache in a recent period of time. In this way, the space occupied by the first cache index record can be reduced, and the time for table lookup can be reduced.

本发明第四方面提供一种存储控制装置,用于控制存储设备的数据存储,所述存储设备包括第一缓存、第二缓存和存储单元,所述第一缓存为应用服务器提供数据缓存,所述第二缓存用于为所述存储单元提供数据缓存,所述存储控制装置包括:第二监测单元、第二获取单元,第二确定单元及第二调整单元。在所述第二监测单元监测到所述第二触发条件的情况下,所述第二获取单元获取缓存在所述第二缓存中的第二数据块的特征信息;所述第二确定单元根据所述第二数据块的特征信息确定所述第二数据块是否存储在所述第一缓存中;A fourth aspect of the present invention provides a storage control device for controlling data storage of a storage device, wherein the storage device includes a first cache, a second cache, and a storage unit, the first cache provides a data cache for an application server, so The second cache is used to provide a data cache for the storage unit, and the storage control device includes: a second monitoring unit, a second acquiring unit, a second determining unit and a second adjusting unit. In the case where the second monitoring unit monitors the second trigger condition, the second obtaining unit obtains the characteristic information of the second data block buffered in the second buffer; the second determining unit according to The feature information of the second data block determines whether the second data block is stored in the first cache;

所述第二调整单元在所述第二确定单元确定所述第二数据块存储在所述第一缓存中的情况下,调整所述第二数据块在所述第二缓存中的淘汰优先级的级别。The second adjustment unit adjusts the elimination priority of the second data block in the second cache when the second determination unit determines that the second data block is stored in the first cache level.

这样,可以监测第二缓存中的数据情况,通过判断缓存在第二缓存中数据是否缓存在第一缓存中,来调整缓存在第二缓存中的数据块的淘汰优先级级别,从而控制第二缓存中所缓存数据的淘汰顺序,提高IO请求的响应速度。In this way, the data situation in the second cache can be monitored, and the elimination priority level of the data blocks cached in the second cache can be adjusted by judging whether the data cached in the second cache is cached in the first cache, so as to control the second cache. The elimination order of cached data in the cache improves the response speed of IO requests.

可选地,所述第二监测单元所监测到的所述第二触发条件为:所述第二数据块在所述第二缓存中的缓存时间超过预定时间;Optionally, the second trigger condition monitored by the second monitoring unit is: the cache time of the second data block in the second cache exceeds a predetermined time;

在所述第二确定单元确定所述第二数据块存储在所述第一缓存中的情况下,所述第二调整单元将所述第二数据块从所述第二缓存中的淘汰优先级的级别提高。In the case that the second determination unit determines that the second data block is stored in the first cache, the second adjustment unit adjusts the priority of the second data block to be eliminated from the second cache level increased.

这样,在确定所述第一缓存中存在与所述第二缓存中的数据相同的数据块时,则提高所述第二缓存中数据块的淘汰优先级的级别,使其优先淘汰,从而减少第一缓存和第二缓存中重复存储的数据块,增加了第一缓存和第二缓存所缓存数据的总量,从而提高IO请求的响应速度。In this way, when it is determined that the same data block exists in the first cache as the data in the second cache, the level of the elimination priority of the data block in the second cache is increased to make it eliminated first, thereby reducing the The data blocks repeatedly stored in the first cache and the second cache increase the total amount of data cached in the first cache and the second cache, thereby improving the response speed of the IO request.

可选地,所述第二监测单元所监测到的所述第二触发条件为:删除所述第二缓存中的所述第二数据块,Optionally, the second trigger condition monitored by the second monitoring unit is: delete the second data block in the second cache,

当所述第二确定单元在确定所述第二数据未存储在所述第一缓存中的情况下,所述第二调整单元将所述第二数据在所述第二缓存中的淘汰优先级的级别降低。When the second determination unit determines that the second data is not stored in the first cache, the second adjustment unit adjusts the elimination priority of the second data in the second cache level is lowered.

这样,在删除第二缓存中的数据块时,若所删除的数据块没有存储在所述第一缓存中,则提高所删除的数据块的淘汰优先级,即不删除所述数据块,这样,当有IO请求访问所述数据块时,可在第二缓存中命中,则提高的IO请求的响应速度。In this way, when deleting a data block in the second cache, if the deleted data block is not stored in the first cache, the elimination priority of the deleted data block is increased, that is, the data block is not deleted, so that , when there is an IO request to access the data block, a hit can be made in the second cache, thereby improving the response speed of the IO request.

可选地,所述第二监测单元所监测到的所述第二触发条件为:将包含所述第二数据块的数据写入所述第二缓存;Optionally, the second trigger condition monitored by the second monitoring unit is: writing data including the second data block into the second cache;

在所述第二确定单元确定所述第二数据块存储在所述第一缓存中的情况下,所述第二调整单元将所述第二数据块在所述第二缓存中的淘汰优先级的级别提高。When the second determination unit determines that the second data block is stored in the first cache, the second adjustment unit adjusts the elimination priority of the second data block in the second cache level increased.

这样,如果新缓存至所述第二缓存的数据块,也存储在第一缓存中,则提高新缓存数据块的淘汰优先级的级别,从而尽快淘汰新缓存至所述第二缓存的数据块,减少第一缓存和第二缓存中的重复数据,增加缓存数据,节省缓存资源。In this way, if the data block newly cached to the second cache is also stored in the first cache, the level of the elimination priority of the newly cached data block is increased, so as to eliminate the data block newly cached to the second cache as soon as possible , reduce duplicate data in the first cache and the second cache, increase cache data, and save cache resources.

可选地,所述存储设备保存有所述第一缓存的索引记录,所述第一缓存的索引记录包括所述第一缓存中保存的数据块的数据特征标识,每个第一缓存中存储的数据块的大小等于与所述二数据块的大小,所述每个数据块的数据特征标识由所述每个数据块的数据内容决定;Optionally, the storage device stores an index record of the first cache, and the index record of the first cache includes the data feature identifiers of the data blocks stored in the first cache, and each first cache stores The size of the data block is equal to the size of the two data blocks, and the data feature identifier of each data block is determined by the data content of each data block;

所述第二确认单元根据所述每个第二数据块的数据特征标识查询所述第一缓存的索引记录,确定所述第二数据块是否存储在所述第一缓存中。The second confirmation unit queries the index record of the first cache according to the data characteristic identifier of each second data block, and determines whether the second data block is stored in the first cache.

这样,通过设置所述第一缓存索引记录,可以在所述第一缓存中快速的找到与所述第二缓存中的数据相同的数据。In this way, by setting the first cache index record, the same data as the data in the second cache can be quickly found in the first cache.

可选地,所述第一缓存索引记录只记录最近一段时间写入所述第一缓存的数据块的数据标识。这样可以减少第一缓存索引记录所占用的空间,减少查表的时间。Optionally, the first cache index record only records data identifiers of data blocks written into the first cache in a recent period of time. In this way, the space occupied by the first cache index record can be reduced, and the time for table lookup can be reduced.

本发明第五方面提供一种存储设备,所述存储设备包括处理器、内存、第一缓存、第二缓存和存储单元,所述第一缓存为应用服务器提供数据缓存,所述第二缓存用于为所述存储单元提供数据缓存,所述内存用于存储计算机执行指令,当所述存储设备运行时,所述处理器执行所述内存存储的所述计算机执行指令,以使所述存储设备执行第一方面所提供的数据缓存方法或者第二方面所提供的数据缓存方法。A fifth aspect of the present invention provides a storage device, the storage device includes a processor, a memory, a first cache, a second cache, and a storage unit, the first cache provides a data cache for an application server, and the second cache is used for To provide a data cache for the storage unit, the memory is used to store computer-executed instructions, and when the storage device is running, the processor executes the computer-executed instructions stored in the memory, so that the storage device Execute the data caching method provided by the first aspect or the data caching method provided by the second aspect.

本发明的实施例通过在存储服务器一侧设置第一缓存以缓存从所述应用服务器的应用缓存中的数据,然后判断第二缓存中是否存储有与第一缓存中相同的数据,并根据判断结果调整所述第二缓存中的数据淘汰优先级级别。如此,通过协调第一缓存及第二缓存中缓存的数据,减少第一缓存及第二缓存中的重复数据,节省缓存资源,还能暂缓淘汰第二缓存中不与第一缓存中的数据相同的数据,或者与第一缓存中的待删除数据相同的数据,从而增加IO请求的响应速度。In the embodiment of the present invention, a first cache is set on the storage server side to cache data from the application cache of the application server, and then it is determined whether the second cache stores the same data as the first cache, and according to the judgment As a result, the data elimination priority level in the second cache is adjusted. In this way, by coordinating the data cached in the first cache and the second cache, the duplicate data in the first cache and the second cache is reduced, the cache resources are saved, and the data in the second cache that is not the same as the first cache can be temporarily eliminated. , or the same data as the data to be deleted in the first cache, thereby increasing the response speed of the IO request.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention, and for those of ordinary skill in the art, other drawings can also be obtained from these drawings without any creative effort.

图1为现有技术中的存储服务器为应用服务器提供存储服务的数据处理系统的架构图。FIG. 1 is an architecture diagram of a data processing system in which a storage server provides storage services for an application server in the prior art.

图2为本发明实施例中存储服务器为应用服务器提供存储服务的数据处理系统的架构图。FIG. 2 is an architectural diagram of a data processing system in which a storage server provides a storage service for an application server according to an embodiment of the present invention.

图3为本发明一实施例中,在一种触发条件下,第一缓存与第二缓存之间进行数据块协调的方法的流程图。3 is a flowchart of a method for performing data block coordination between a first cache and a second cache under a trigger condition according to an embodiment of the present invention.

图4A及图4B为第二缓存的索引记录的示意图。4A and 4B are schematic diagrams of index records of the second cache.

图5为图3所示的实施例中,第一缓存与第二缓存之间进行数据块协调的示意图。FIG. 5 is a schematic diagram of data block coordination between the first cache and the second cache in the embodiment shown in FIG. 3 .

图6为本发明一实施例中,在另一种触发条件下,第一缓存与第二缓存之间进行数据块协调的方法的流程图。6 is a flowchart of a method for performing data block coordination between the first cache and the second cache under another trigger condition according to an embodiment of the present invention.

图7为图6所示的实施例中,第一缓存与第二缓存之间进行数据块协调的示意图。FIG. 7 is a schematic diagram of data block coordination between the first cache and the second cache in the embodiment shown in FIG. 6 .

图8为本发明一实施例中,在另一种触发条件下,第一缓存与第二缓存之间进行数据块协调的方法的流程图。FIG. 8 is a flowchart of a method for performing data block coordination between the first cache and the second cache under another trigger condition according to an embodiment of the present invention.

图9为图8所示的实施例中,第一缓存与第二缓存之间进行数据块协调的示意图。FIG. 9 is a schematic diagram of data block coordination between the first cache and the second cache in the embodiment shown in FIG. 8 .

图10为本发明一实施例中,在另一种触发条件下,第一缓存与第二缓存之间进行数据块协调的方法的流程图。10 is a flowchart of a method for performing data block coordination between the first cache and the second cache under another trigger condition according to an embodiment of the present invention.

图11为图10所示的实施例中,第一缓存与第二缓存之间进行数据块协调的示意图。FIG. 11 is a schematic diagram of data block coordination between the first cache and the second cache in the embodiment shown in FIG. 10 .

图12为本发明一实施例中,在另一种触发条件下,第一缓存与第二缓存之间进行数据块协调的方法的流程图。12 is a flowchart of a method for performing data block coordination between the first cache and the second cache under another trigger condition according to an embodiment of the present invention.

图13为图12所示的实施例中,第一缓存与第二缓存之间进行数据块协调的示意图。FIG. 13 is a schematic diagram of data block coordination between the first cache and the second cache in the embodiment shown in FIG. 12 .

图14为本发明一实施例中,在另一种触发条件下,第一缓存与第二缓存之间进行数据块协调的方法的流程图。FIG. 14 is a flowchart of a method for performing data block coordination between the first cache and the second cache under another trigger condition according to an embodiment of the present invention.

图15为图14所示的实施例中,第一缓存与第二缓存之间进行数据块协调的示意图。FIG. 15 is a schematic diagram of data block coordination between the first cache and the second cache in the embodiment shown in FIG. 14 .

图16为本发明实施例提供的一种存储控制装置的结构图。FIG. 16 is a structural diagram of a storage control apparatus according to an embodiment of the present invention.

图17为本发明实施例提供的另一种存储控制装置的结构图。FIG. 17 is a structural diagram of another storage control apparatus provided by an embodiment of the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。如图1所示,为现有技术中的存储服务器110为应用服务器120提供存储服务的数据处理系统100的架构图。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention. As shown in FIG. 1 , an architecture diagram of a data processing system 100 that provides storage services for an application server 120 for a storage server 110 in the prior art.

所述应用服务器120可以为供多个用户同时访问的共享服务器,例如数据库服务器、虚拟机管理服务器、桌面云服务器等。所述存储服务器110为所述应用服务器120提供数据存储服务。The application server 120 may be a shared server accessed by multiple users at the same time, such as a database server, a virtual machine management server, a desktop cloud server, and the like. The storage server 110 provides data storage services for the application server 120 .

所述应用服务器120包括应用处理器121、应用缓存122、扩展缓存123及其他元件。所述存储服务器110包括存储处理器111、存储缓存112、存储单元113及其他元件。所述应用缓存122为所述应用服务器120提供数据缓存,一般为高速缓存如动态随机存储器(DynamicRandom Access Memory,DRAM),但是由于DRAM的价格比较贵,所以一般容量较小。所述扩展缓存123一般为固态存储器(Solid State Disk,SSD),由于SSD存储器的价格相对DRAM比较便宜,但是速度比较低,所以一般用作应用缓存122的扩展缓存,即用于存储从所述应用缓存122淘汰的数据。由于应用缓存122的容量比较小,所以缓存至所述应用缓存122的数据可能很快被淘汰掉,所以通过扩展缓存123缓存应用缓存122淘汰的数据,可增加IO请求的响应速度。The application server 120 includes an application processor 121, an application cache 122, an extended cache 123 and other elements. The storage server 110 includes a storage processor 111, a storage cache 112, a storage unit 113 and other elements. The application cache 122 provides a data cache for the application server 120 , and is generally a cache such as a dynamic random access memory (Dynamic Random Access Memory, DRAM), but because DRAM is relatively expensive, its capacity is generally small. The extended cache 123 is generally a solid state memory (Solid State Disk, SSD). Since the price of the SSD memory is cheaper than that of the DRAM, but the speed is relatively low, it is generally used as the extended cache of the application cache 122, that is, it is used to store data from the The application caches 122 the retired data. Since the capacity of the application cache 122 is relatively small, the data cached in the application cache 122 may be quickly eliminated. Therefore, by extending the cache 123 to cache the eliminated data of the application cache 122, the response speed of the IO request can be increased.

所述存储缓存112为所述存储单元113如硬盘提供数据缓存,一般也为DRAM。可以缓存从存储单元113读取的数据,也可以缓存应用服务器100写入存储服务器110的数据。由于在缓存数据时,会在存储服务器110的存储缓存112与应用服务器120的应用缓存122中同时缓存相同的数据,而存储服务器110又无法感知应用服务器120的应用缓存122中所缓存的数据,这就会造成应用服务器120中的应用缓存122与扩展缓存123中缓存的数据与存储服务器110的存储缓存112缓存相同的数据。另外,在扩展缓存123中的数据被淘汰时,缓存在存储缓存112中的与所述淘汰数据块相同的数据可能也处于很快被淘汰的位置,这样,在扩展缓存123中淘汰的数据在存储缓存112中也很快被淘汰后,当有IO请求访问所述淘汰数据时,又需要从存储单元113中调用,从而影响IO请求的响应速度。The storage cache 112 provides data cache for the storage unit 113 such as a hard disk, and is generally also a DRAM. The data read from the storage unit 113 may be cached, and the data written to the storage server 110 by the application server 100 may also be cached. When caching data, the same data will be cached in the storage cache 112 of the storage server 110 and the application cache 122 of the application server 120 at the same time, and the storage server 110 cannot perceive the data cached in the application cache 122 of the application server 120. This will cause the data cached in the application cache 122 and the extended cache 123 of the application server 120 to cache the same data as the storage cache 112 of the storage server 110 . In addition, when the data in the extended cache 123 is eliminated, the same data cached in the storage cache 112 as the eliminated data block may also be in a position to be eliminated soon. In this way, the data eliminated in the extended cache 123 is After the storage cache 112 is also quickly eliminated, when there is an IO request to access the eliminated data, it needs to be called from the storage unit 113, thereby affecting the response speed of the IO request.

可见,由于现有技术中存储服务器110无法获知应用服务器120中的扩展缓存123中所缓存的数据,缺乏两个缓存的协同操作机制,所以影响IO请求的响应速度或者导致存储资源的浪费。It can be seen that in the prior art, the storage server 110 cannot know the data cached in the extended cache 123 of the application server 120, and lacks a cooperative operation mechanism of the two caches, so the response speed of IO requests is affected or the storage resources are wasted.

本发明实施例通过在将应用服务器的缓存设置在存储服务器一侧设置,例如存储服务器上的第一缓存,用以缓存所述应用服务器的应用缓存的数据,然后判断存储服务器的第二缓存中是否存储有与第一缓存中相同的数据,并根据不同的判断结果调整所述第二缓存中的数据的淘汰优先级级别,例如,如果确定第二缓存中缓存有与缓存在所述第一缓存的数据相同的数据,则将所述二级缓存中与所述缓存数据相同的数据优先淘汰,如果确定第二缓存中缓存有与从所述第一缓存删除的数据相同的数据,则将所述第二缓存中与所述删除数据相同数据优先存储,如果所述第一缓存中没有缓存与所述二级缓存中待删除的数据相同的数据,则不删除所述从所述第二缓存待删除数据。如此,通过协调第一缓存及第二缓存中缓存的数据,减少第一缓存及第二缓存中的重复数据,还能暂缓删除第二缓存中不与第一缓存中所缓存的数据相同的待删除数据,或者与第一缓存中的待删除数据相同的数据,即可增加IO请求的响应速度。In the embodiment of the present invention, the cache of the application server is set on the side of the storage server, for example, the first cache on the storage server is used to cache the data of the application cache of the application server, and then it is determined that the second cache of the storage server is in the second cache. Whether the same data as in the first cache is stored, and the elimination priority level of the data in the second cache is adjusted according to different judgment results. If the cached data is the same as the data in the cache, the data in the second cache that is the same as the cached data will be eliminated first. If it is determined that the second cache has the same data as the data deleted from the first cache, The data that is the same as the deleted data in the second cache is stored preferentially. If the first cache does not cache the same data as the data to be deleted in the second-level cache, the data from the second cache is not deleted. Cache data to be deleted. In this way, by coordinating the data cached in the first cache and the second cache, the duplicate data in the first cache and the second cache can be reduced, and the pending deletion of the data in the second cache that is not the same as the data cached in the first cache can be temporarily deleted. Deleting data, or the same data as the data to be deleted in the first cache, can increase the response speed of the IO request.

下面结合具体实施例对本发明的技术方案做详细描述。The technical solutions of the present invention will be described in detail below with reference to specific embodiments.

如图2所示,为本发明实施例中的存储服务器210为应用服务器220提供服务的数据处理系统200的架构图。As shown in FIG. 2 , it is an architectural diagram of a data processing system 200 in which the storage server 210 provides services for the application server 220 in the embodiment of the present invention.

本实施例中,所述应用服务器220包括应用处理器221、应用缓存222、及其他元件,如内存等,由于其他元件本发明实施例未涉及,在图中并未示出。In this embodiment, the application server 220 includes an application processor 221, an application cache 222, and other elements, such as a memory, etc., which are not shown in the figure because other elements are not involved in this embodiment of the present invention.

所述存储服务器210包括存储处理器211、第一缓存212、第二缓存213、存储单元214、内存215,及其他元件,其他元件本发明实施例未涉及,在图中并未示出。The storage server 210 includes a storage processor 211 , a first cache 212 , a second cache 213 , a storage unit 214 , a memory 215 , and other elements, which are not involved in this embodiment of the present invention and are not shown in the drawings.

与图1中的数据处理系统100相比,本实施例中去掉应用服务器120中的扩展缓存123,而是在所述存储服务器210中增加了第一缓存212。本发明实施例中应用服务器中还设置有该应用缓存222,存储服务器210中的第一缓存212仅用于替代图1中的扩展缓存123,但实际上在本发明的其他实施例中,应用服务器也可以不再包括应用缓存222,设置在存储服务器210的第一缓存212可以完全替代应用服务器的各种缓存,因本领域技术人员完全可以理解上述扩展实施例,具体实现方式在此不赘述。Compared with the data processing system 100 in FIG. 1 , in this embodiment, the extended cache 123 in the application server 120 is removed, but a first cache 212 is added in the storage server 210 . In this embodiment of the present invention, the application server is also provided with the application cache 222, and the first cache 212 in the storage server 210 is only used to replace the extended cache 123 in FIG. 1, but actually in other embodiments of the present invention, the application The server may no longer include the application cache 222, and the first cache 212 set in the storage server 210 can completely replace various caches of the application server, because those skilled in the art can fully understand the above-mentioned extended embodiments, and the specific implementation method is not repeated here. .

所述第一缓存212为所述存储服务器210提供给应用服务器220使用,用于缓存应用服务器220中的数据,例如,缓存从所述应用缓存222中删除的数据,当所述应用缓存222中的数据被删除时,所述应用服务器220的应用处理器221发送数据缓存请求至所述存储服务器210,使所述存储服务器210缓存从应用缓存222删除的数据至所述第一缓存212中,在所述删除数据缓存至所述第一缓存212后,所述存储处理器211将缓存至所述第一缓存212的数据的地址返回给所述应用服务器200的应用处理器221,则所述应用处理器221即可根据返回的数据地址对所述第一缓存中的数据进行控制,所述控制可以为对第一缓存212中的数据块进行读取、淘汰等。当所述应用处理器221要淘汰所述第一缓存212中的数据时,所述应用处理器221发送数据淘汰请求至所述存储服务器210,所述数据淘汰请求中包括要淘汰数据的地址,所述存储服务器210接收到所述淘汰请求后,根据所述淘汰请求中包含的淘汰数据的地址,在所述第一缓存中找到需要淘汰的数据后进行淘汰。The first cache 212 is provided by the storage server 210 to the application server 220 for caching data in the application server 220. For example, data deleted from the application cache 222 is cached. When the data of the application server 220 is deleted, the application processor 221 of the application server 220 sends a data cache request to the storage server 210, so that the storage server 210 caches the data deleted from the application cache 222 to the first cache 212, After the deleted data is cached in the first cache 212, the storage processor 211 returns the address of the data cached in the first cache 212 to the application processor 221 of the application server 200, then the The application processor 221 may control the data in the first cache according to the returned data address, and the control may be to read or eliminate the data blocks in the first cache 212 . When the application processor 221 wants to eliminate the data in the first cache 212, the application processor 221 sends a data elimination request to the storage server 210, where the data elimination request includes the address of the data to be eliminated, After receiving the elimination request, the storage server 210 finds the data to be eliminated in the first cache according to the address of the elimination data included in the elimination request, and performs elimination.

所述第二缓存213为所述存储单元214提供数据缓存。The second cache 213 provides data cache for the storage unit 214 .

这样,由于所述第一缓存212中所缓存的数据块为所述应用服务器的应用缓存222所淘汰的数据块,则所述存储服务器210可通过所述第一缓存212中缓存的数据获知之前缓存至所述应用缓存222的数据,这样,所述存储处理器211即可获知第一缓存212所缓存的数据,并协调所述第一缓存212与所述第二缓存213中所存储的数据块,以提高IO请求的响应速度,第一缓存212与第二缓存213中的数据的协调方法将在下文中做详细描述。In this way, since the data blocks cached in the first cache 212 are data blocks eliminated by the application cache 222 of the application server, the storage server 210 can know the previous data through the cached data in the first cache 212 cache the data in the application cache 222 , so that the storage processor 211 can know the data cached in the first cache 212 and coordinate the data stored in the first cache 212 and the second cache 213 In order to improve the response speed of the IO request, the method for coordinating the data in the first cache 212 and the second cache 213 will be described in detail below.

所述存储处理器211及应用处理器111可能为单核或多核中央处理单元,或者为特定集成电路,或者为被配置成实施本发明实施例的一个或多个集成电路。The storage processor 211 and the application processor 111 may be single-core or multi-core central processing units, or specific integrated circuits, or one or more integrated circuits configured to implement embodiments of the present invention.

所述内存215可以为高速RAM存储器,也可以为非易失性存储器(non-volatilememory),例如至少一个磁盘存储器,用于存储计算机执行指令2151。具体的,计算机执行指令2151中可以包括程序代码。The memory 215 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk memory, for storing the computer execution instructions 2151 . Specifically, the computer-executable instructions 2151 may include program codes.

当存储服务器210运行时,所述存储处理器211运行计算机执行指令2151,可以执行图3、图6、图8、图10、图12及图14所述的第一缓存212及第二缓存213中的数据协调方法的流程。When the storage server 210 is running, the storage processor 211 executes the computer execution instructions 2151 to execute the first cache 212 and the second cache 213 described in FIG. 3 , FIG. 6 , FIG. 8 , FIG. 10 , FIG. 12 and FIG. 14 . The flow of the data reconciliation method in .

图3、图6、图8、图10、图12及图14的协调方法将在下文做详细介绍。The coordination methods of FIGS. 3 , 6 , 8 , 10 , 12 and 14 will be described in detail below.

本实施例中,包括两种情况,第一种情况为侦测所述第一缓存212中的所缓存数据的情况触发所述第一缓存212与第二缓存213所缓存数据的协调,第二种情况为侦测所述第二缓存213中的所缓存数据的情况触发所述第一缓存212与第二缓存213所缓存数据的协调。在实际产品中,可以只实施第一种情况下的数据协调方法,也可以只实施第二种情况下的数据协调方法,也可以同时实施两种情况下的数据协调方法。In this embodiment, there are two cases. The first case is that the detection of the cached data in the first cache 212 triggers the coordination of the data cached by the first cache 212 and the second cache 213, and the second One case is that the detection of the cached data in the second cache 213 triggers the coordination of the cached data of the first cache 212 and the second cache 213 . In actual products, only the data reconciliation method in the first case can be implemented, or only the data reconciliation method in the second case can be implemented, or the data reconciliation method in both cases can be implemented simultaneously.

下面将首先描述第一种情况下进行所述第一缓存212与第二缓存213的数据协调方法,在第一种情况下,所述第一缓存212与第二缓存213的数据协调在第一触发条件下触发,所述第一触发条件可以为:所述存储处理器211接收到所述应用服务器220发送的数据缓存请求,并根据所述数据缓存请求将所述数据缓存请求中包含的数据缓存至所述第一缓存212;所述存储处理器211接收到所述应用服务器220发送的数据删除请求;所述存储处理器211侦测到缓存在所述第一缓存中的数据的时间超过一阈值。The following will first describe the method for data coordination between the first cache 212 and the second cache 213 in the first case. Triggered under a trigger condition, the first trigger condition may be: the storage processor 211 receives the data cache request sent by the application server 220, and stores the data included in the data cache request according to the data cache request cache to the first cache 212; the storage processor 211 receives the data deletion request sent by the application server 220; the storage processor 211 detects that the time of the data cached in the first cache exceeds a threshold.

如图3所示,为所述存储处理器211侦测到的第一触发条件为所述存储处理器211接收到所述应用服务器220发送的数据缓存请求,并根据所述数据缓存请求将所述数据缓存请求中包含的数据缓存至所述第一缓存212时,所述第一缓存212与第二缓存212之间进行数据块协调的方法的流程图。As shown in FIG. 3 , the first trigger condition detected by the storage processor 211 is that the storage processor 211 receives a data cache request sent by the application server 220, and stores the data cache request according to the data cache request. A flowchart of a method for performing data block coordination between the first cache 212 and the second cache 212 when the data included in the data cache request is cached in the first cache 212 .

步骤S301,所述存储处理器211接收到所述应用服务器220发送的数据缓存请求,并根据所述数据缓存请求将所述数据缓存请求中包含的数据缓存至所述第一缓存212,获取所述缓存请求对应的至少一个第一数据块的特征标识。Step S301, the storage processor 211 receives the data cache request sent by the application server 220, and caches the data contained in the data cache request to the first cache 212 according to the data cache request, and obtains the data cache. The feature identifier of at least one first data block corresponding to the cache request.

本实施例中,所述存储处理器211获取所述第一数据的特征标识包括:根据第一数据块包含的数据内容获得所述第一数据块的数据特征标识。In this embodiment, acquiring the feature identifier of the first data by the storage processor 211 includes: acquiring the data feature identifier of the first data block according to the data content included in the first data block.

所述第一数据块的特征标识为根据第一数据块包含的数据内容解析出的能够唯一标识所述第一数据块的代码。具体解析方法可以为对所述第一数据块本身做哈希运算,将计算的哈希值作为所述第一数据块的特征标识,也可以根据应用服务器220所运行应用所设定的数据块的特征识别出的能够唯一标识所述第一数据块数据特征标识,例如,在所述应用服务器所运行的为数据块库应用时,则可以通过所述第一数据块的第五到第八字节的相对数据块地址(relative data block address,RDBA)来唯一标识所述第一数据块。The feature identifier of the first data block is a code that can uniquely identify the first data block and is parsed according to the data content contained in the first data block. The specific analysis method may be to perform a hash operation on the first data block itself, and use the calculated hash value as the feature identifier of the first data block, or it may be based on the data block set by the application running by the application server 220. The feature identification can uniquely identify the first data block data feature identifier, for example, when the application server is running a data block library application, the fifth to eighth data blocks of the first data block can be used. A relative data block address (RDBA) of bytes is used to uniquely identify the first data block.

步骤S302,所述存储处理器211根据所述第一数据块的特征标识确定所述第一数据块是否存储在所述第二缓存213中。Step S302, the storage processor 211 determines whether the first data block is stored in the second cache 213 according to the characteristic identifier of the first data block.

所述内存215中还存储有所述第二缓存的索引记录2153,所述第二缓存的索引记录2153包括所述第二缓存中保存的至少一个第二数据块的特征标识,所述第二数据块的大小等于所述第一数据块的大小,且所述第二数据块的特征标识的获取方法也与所述第一数据块的特征标识的获取方法一致,在此不再赘述。The memory 215 also stores an index record 2153 of the second cache, and the index record 2153 of the second cache includes a feature identifier of at least one second data block stored in the second cache, and the second cache The size of the data block is equal to the size of the first data block, and the method for acquiring the feature identifier of the second data block is also the same as the method for acquiring the feature identifier of the first data block, which is not repeated here.

如此,则可根据所述每个第一数据块的特征标识查询所述第二缓存索引记录2153来确定所述每个第一数据块是否存储在所述第二缓存213中。In this way, the second cache index record 2153 can be queried according to the characteristic identifier of each first data block to determine whether each first data block is stored in the second cache 213 .

所述第二缓存索引记录2153中所存储的数据块标识可以是所述第二缓存213所缓存的所有第二数据块的特征标识,也可以为部分第二数据块的特征标识。由于所述第二缓存213中所缓存的第二数据块数量比较多,所以如果将第二缓存213中的所有第二数据块的数据特征标识都记录在所述第二缓存索引记录2153中,则会浪费存储空间,且会增加查表的时间,从而影响性能,所以本实施例中所述第二缓存的索引记录2153只维护预设时间段内的缓存至所述第二缓存213的数据块的数据块标识,比如10分钟之内,具体如图4A及4B所示,所述第二缓存的索引记录中所存储的第二数据块的特征标识(如An、An-1......An-6)以所述第二数据块缓存至所述第二缓存的时间为顺序排列,且每个第二数据块的特征标识都具有一个时间戳(如12:01、12:02......12:10),用于记录所述第二数据块的特征标识对应的第二数据块缓存至所述第二缓存213的时间,所述时间段可以是10分钟,如图4A所示,当有第二数据块a缓存至所述第二缓存213时,所述存储处理器211获取所述第二数据块的特征标识(An+1),并将所获取的数据标识添加至所述第二缓存索引记录2153中的表头位置,同时加入时间戳(12:00),并启动计时。如图4B所示,若当前的时间是12:10,所述第二数据块b的特征标识(An-6)在所述第二缓存索引记录2153中的时间达到预设时间段(10分钟),则从所述第二缓存索引记录2153中删除。The data block identifiers stored in the second cache index record 2153 may be the feature identifiers of all the second data blocks cached by the second cache 213, or may be the feature identifiers of some second data blocks. Since the number of second data blocks cached in the second cache 213 is relatively large, if the data feature identifiers of all the second data blocks in the second cache 213 are recorded in the second cache index record 2153, This will waste storage space and increase the time for table lookup, thereby affecting performance. Therefore, in this embodiment, the index record 2153 of the second cache only maintains the data cached to the second cache 213 within a preset time period. The data block identifier of the block, for example, within 10 minutes, as shown in FIGS. 4A and 4B, the feature identifier of the second data block stored in the index record of the second cache (such as An, An-1... ...An-6) are arranged in the order of the time when the second data block is cached to the second cache, and the feature identifier of each second data block has a timestamp (eg 12:01, 12: 02...12:10), used to record the time when the second data block corresponding to the feature identifier of the second data block is cached to the second cache 213, the time period may be 10 minutes, As shown in FIG. 4A, when a second data block a is cached in the second cache 213, the storage processor 211 acquires the feature identifier (An+1) of the second data block, and stores the acquired The data identifier is added to the header position in the second cache index record 2153, a timestamp (12:00) is added at the same time, and the timing is started. As shown in FIG. 4B , if the current time is 12:10, the time of the feature identifier (An-6) of the second data block b in the second cache index record 2153 reaches a preset time period (10 minutes). ), it is deleted from the second cache index record 2153.

在这种情况下,缓存在所述第二缓存中的数据才会记录在所述第二缓存索引记录中,则当所述第二缓存索引记录2153中记录有与所述第一数据块的特征标识相同的特征标识时,则确定所述第一数据块存储在所述第二缓存213中。In this case, the data cached in the second cache will be recorded in the second cache index record, then when the second cache index record 2153 records the data with the first data block When the feature identifiers are the same, it is determined that the first data block is stored in the second cache 213 .

第二缓存索引记录2153也可以是一个哈希(Hash)表,哈希表的key是所述第二数据块标识,Value是0或1,0表示数据特征标识对应的第二数据块不存在所述第二缓存213中,1表示所述数据特征标识对应的数据块存在所述索引记录内。当数据块标识添加至所述第二缓存213的索引记录时,将所述value值设为1,当所述特征标识对应的第二数据块从所述第二缓存中删除时,可将所述删除的数据块对应的特征标识的Value设置为0。The second cache index record 2153 can also be a hash table, the key of the hash table is the second data block identifier, the Value is 0 or 1, and 0 indicates that the second data block corresponding to the data feature identifier does not exist In the second cache 213, 1 indicates that the data block corresponding to the data feature identifier exists in the index record. When the data block identifier is added to the index record of the second cache 213, the value is set to 1, and when the second data block corresponding to the feature identifier is deleted from the second cache, all The Value of the feature identifier corresponding to the deleted data block is set to 0.

在这种情况下,在确定所述第一数据块是否存储在所述第二缓存213中时,首先查询所述第一数据块的特征标识是否记录在所述第二缓存索引记录2153中,当所述第一数据块的特征标识记录在所述第二缓存索引记录2153中时,确定对应的Value值,当Value值为1时,则确定所述第一数据块存储在所述第二缓存213中。In this case, when determining whether the first data block is stored in the second cache 213, first query whether the feature identifier of the first data block is recorded in the second cache index record 2153, When the feature identifier of the first data block is recorded in the second cache index record 2153, the corresponding Value value is determined, and when the Value value is 1, it is determined that the first data block is stored in the second cache index record 2153. Cache 213.

步骤S303,当确定所述第一数据块存储在所述第二缓存213中时,所述存储处理器211根据所述第一数据块的数据特征标识及地址表在所述第二缓存213中找到所述第一数据块,当确定所述第一数据块未存储在所述第二缓存213中时,返回步骤S301。Step S303, when it is determined that the first data block is stored in the second cache 213, the storage processor 211 stores the data in the second cache 213 according to the data feature identifier and address table of the first data block. The first data block is found, and when it is determined that the first data block is not stored in the second cache 213, return to step S301.

所述地址表中记录了缓存在所述第二缓存中的第二数据块的特征标识及存储地址。当有第二数据块缓存至所述第二缓存213时,所述存储处理器211获取所述第二数据块的数据特征标识,并建立所述第二数据块的数据特征标识与存储地址之间的映射关系,形成所述地址表。当所述第二缓存213中所缓存的第二数据块被淘汰时,所述存储处理器211获取所述第二数据块的数据块标识,然后将所述第二数据块标识对应的映射关系从所述地址表中删除,从而使所述地址表随着所述第二缓存213中所缓存数据块的变化而更新。The address table records the feature identifier and storage address of the second data block cached in the second cache. When a second data block is cached in the second cache 213, the storage processor 211 acquires the data feature identifier of the second data block, and establishes a relationship between the data feature identifier of the second data block and the storage address The mapping relationship between them forms the address table. When the second data block cached in the second cache 213 is eliminated, the storage processor 211 acquires the data block identifier of the second data block, and then assigns the mapping relationship corresponding to the second data block identifier It is deleted from the address table, so that the address table is updated with the change of the data blocks cached in the second cache 213 .

步骤S304,当所述存储处理器211在所述第二缓存213中找到所述第一数据块后,将所述第一数据块在所述第二缓存213中的淘汰优先级的级别提高,可以是提高到最高级,也可以为提高到预设设定的优先级级别,如果提高到最高级,则所述第一数据块即可被从所述第二缓存213中删除。Step S304, after the storage processor 211 finds the first data block in the second cache 213, it increases the level of the elimination priority of the first data block in the second cache 213, It can be raised to the highest level, or it can be raised to a preset priority level. If it is raised to the highest level, the first data block can be deleted from the second cache 213 .

本实施例中,通过淘汰队列的方式设定各个第二数据块的淘汰顺序,所述淘汰队列可以是近期最少使用算法(Least Recently Used,LRU)队列,也可以是近期经常使用算法(least frequently used,LFU)队列,或者其他对缓存中的数据进行淘汰的算法队列。In this embodiment, the elimination order of each second data block is set by means of an elimination queue. The elimination queue may be a Least Recently Used (LRU) queue, or a recently frequently used algorithm (least frequently used algorithm). used, LFU) queue, or other algorithm queues that eliminate data in the cache.

如图5所示,若第一数据块a缓存至所述第一缓存212后,所述存储处理器211确定所述第一数据块a的特征标识为An+1,然后在所述第二缓存索引记录2153中找到所述特征标识An+1,再在所述地址表2154中获取所述特征标识An+1对应的数据a的地址,最后调整所述数据a在LRU队列中的位置至优先被淘汰的位置,所述优先被淘汰的位置可以是LRU队列的队尾,也可以是靠近对尾的位置。As shown in FIG. 5 , if the first data block a is cached in the first cache 212, the storage processor 211 determines that the feature identifier of the first data block a is An+1, and then stores the second data block a as An+1. Find the feature identifier An+1 in the cache index record 2153, then obtain the address of the data a corresponding to the feature identifier An+1 in the address table 2154, and finally adjust the position of the data a in the LRU queue to The position to be eliminated preferentially, the position to be eliminated preferentially may be the tail of the LRU queue, or may be a position close to the opposite tail.

如图6所示,当所述第一触发条件为所述存储处理器211接收到所述应用服务器220发送的数据删除请求,所述第一缓存212与第二缓存212之间进行数据块协调的方法的流程图。As shown in FIG. 6 , when the first trigger condition is that the storage processor 211 receives a data deletion request sent by the application server 220 , data block coordination is performed between the first cache 212 and the second cache 212 The flow chart of the method.

步骤S601,所述存储处理器211接收到所述应用服务器220发送的第一数据块删除请求,根据所述删除请求中包含的第一数据块的地址,在所述第一缓存中找到所述第一数据块,并获取所述第一数据块的特征标识。Step S601, the storage processor 211 receives the first data block deletion request sent by the application server 220, and finds the first data block in the first cache according to the address of the first data block included in the deletion request. the first data block, and obtain the feature identifier of the first data block.

步骤S602,所述存储处理器211根据所述第一数据块的特征标识确定所述第一数据块是否存储在所述第二缓存213中。Step S602, the storage processor 211 determines whether the first data block is stored in the second cache 213 according to the characteristic identifier of the first data block.

步骤S603,当确定所述第一数据块存储存储在所述第二缓存213中时,所述存储处理器211根据所述第一数据块的特征标识及地址表2154在所述第二缓存213中找到所述第一数据块,当确定所述第一数据块未存储在所述第二缓存213中时,则不做任何操作,继续对所述第一缓存212中的数据情况进行侦测。Step S603, when it is determined that the first data block is stored in the second cache 213, the storage processor 211 stores the data in the second cache 213 according to the feature identifier of the first data block and the address table 2154. If the first data block is found in the second cache 213, when it is determined that the first data block is not stored in the second cache 213, do nothing, and continue to detect the data in the first cache 212. .

步骤S604,当所述存储处理器211在所述第二缓存213中找到所述第一数据块后,将所述第一数据块在所述第二缓存中的淘汰优先级的级别降低,可以是降低到最低级,也可以为降低到预设设定的优先级级别。Step S604, after the storage processor 211 finds the first data block in the second cache 213, lowers the elimination priority level of the first data block in the second cache, and can It can be lowered to the lowest level, or it can be lowered to the preset priority level.

如图7所示,若第一数据块f为根据数据删除请求确定从所述第一缓存212中删除的数据,所述存储处理器211确定组成所述第一数据的第一数据块(本实施例中所述第一数据只包括一个第一数据块)的数据特征标识An+1,然后在所述第二缓存索引记录2153中找到所述数据特征标识An+1,再在所述地址表2154中获取所述数据特征标识An+1对应的数据f的地址,最后调整所述数据f在LRU队列中的位置至优先被存储的位置,所述优先被存储的位置可以是LRU队列的队首,也可以是靠近对首的位置。As shown in FIG. 7 , if the first data block f is the data determined to be deleted from the first cache 212 according to the data deletion request, the storage processor 211 determines the first data block (this In the embodiment, the first data only includes the data feature identifier An+1 of a first data block), then find the data feature identifier An+1 in the second cache index record 2153, and then in the address Obtain the address of the data f corresponding to the data feature identifier An+1 in Table 2154, and finally adjust the position of the data f in the LRU queue to the position where it is preferentially stored, and the preferentially stored position may be in the LRU queue. The head of the team can also be close to the head of the team.

如图8所示,当所述第一触发条件为所述缓存在所述第一缓存212中的数据的时间超过一阈值时,所述第一缓存212与第二缓存212之间进行数据块协调的方法的流程图。As shown in FIG. 8 , when the first trigger condition is that the time of the data cached in the first cache 212 exceeds a threshold, data blocks are performed between the first cache 212 and the second cache 212 Flowchart of the coordinated approach.

步骤S801,所述存储处理器211在侦测到所述第一缓存中212所缓存的第一数据块超过阈值时,获取所述第一数据块的特征标识。Step S801, when the storage processor 211 detects that the first data block cached in the first cache 212 exceeds a threshold, acquire the feature identifier of the first data block.

步骤S802,所述存储处理器211根据所述第一数据块的特征标识确定所述第一数据块是否存储在所述第二缓存213中。Step S802, the storage processor 211 determines whether the first data block is stored in the second cache 213 according to the characteristic identifier of the first data block.

步骤S803,当确定所述第一数据块存储存储在所述第二缓存213中时,所述存储处理器211根据所述第一数据块的特征标识及地址表2154在所述第二缓存213中找到所述第一数据块,当确定所述第一数据块未存储在所述第二缓存213中时,返回步骤S301。Step S803, when it is determined that the first data block is stored in the second cache 213, the storage processor 211 stores the data in the second cache 213 according to the feature identifier of the first data block and the address table 2154. When the first data block is found in the second cache 213, the process returns to step S301 when it is determined that the first data block is not stored in the second cache 213.

步骤S804,当所述存储处理器211在所述第二缓存213中找到所述第一数据块后,将所述第一数据块在所述第二缓存中的淘汰优先级的级别提高,可以是提高到最高级,也可以为提高到预设设定的优先级级别。Step S804, after the storage processor 211 finds the first data block in the second cache 213, it increases the elimination priority level of the first data block in the second cache. It is raised to the highest level, or it can be raised to the preset priority level.

如图9所示,若第一数据块d在第一缓存212中的数据超过一阈值时,所述存储处理器211确定所述第一数据块d的数据特征标识An,然后在所述第二缓存索引记录中找到所述数据特征标识An,再在所述地址表中获取所述数据特征标识An对应的数据块d的地址,最后调整所述数据d在LRU队列中的位置至优先被淘汰的位置,所述优先被淘汰的位置可以是LRU队列的队尾,也可以是靠近对尾的位置。As shown in FIG. 9 , if the data of the first data block d in the first cache 212 exceeds a threshold, the storage processor 211 determines the data characteristic identifier An of the first data block d, and then stores the data in the first data block d in the first cache 212. Find the data feature identifier An in the second cache index record, then obtain the address of the data block d corresponding to the data feature identifier An in the address table, and finally adjust the position of the data d in the LRU queue to be prioritized The eliminated position, the preferentially eliminated position may be the tail of the LRU queue, or may be a position close to the opposite tail.

以上为第一种情况下,即侦测所述第一缓存212中的所缓存数据的情况触发所述第一缓存212与第二缓存213的数据协调,下面将介绍第二种情况,即侦测所述第二缓存213中的所缓存数据的情况触发所述第一缓存212与第二缓存213的数据协调的方法。The above is the first case, that is, the detection of the cached data in the first cache 212 triggers data coordination between the first cache 212 and the second cache 213. The second case will be described below, that is, the detection A method of triggering data coordination between the first cache 212 and the second cache 213 is triggered by measuring the condition of the cached data in the second cache 213 .

在第二种情况下,所述第一缓存212与第二缓存213的数据协调在第二触发条件下触发,所述第二触发条件可以为:往所述第二缓存中缓存数据时;删除所述第二缓存中的数据时;或者所述第二缓存中的数据块在第二缓存中存储的时间超过了一阈值。下面分别对这二触发条件下,所述第一缓存及第二缓存的数据的协调方法进行说明。In the second case, the coordination of data in the first cache 212 and the second cache 213 is triggered under a second trigger condition, and the second trigger condition may be: when data is cached in the second cache; delete When the data in the second cache is stored; or the time that the data blocks in the second cache are stored in the second cache exceeds a threshold. The methods for coordinating the data of the first cache and the second cache under these two triggering conditions are described below respectively.

如图10所示,为所述第二触发条件为所述第二缓存中缓存数据时,所述第一缓存及第二缓存的数据的协调方法的流程图。As shown in FIG. 10 , it is a flowchart of a method for coordinating data in the first cache and the second cache when the second trigger condition is that data is cached in the second cache.

步骤S1001,所述存储处理器211根据数据缓存请求,缓存数据至所述第二缓存,所缓存的数据被划分为预定大小的至少一个第二数据块,然后获取所述第二数据块的特征标识。Step S1001, the storage processor 211 caches data to the second cache according to the data cache request, the cached data is divided into at least one second data block of a predetermined size, and then acquires the characteristics of the second data block logo.

所述第二数据块的特征标识的获取方式与所述第一数据块的数据特征的获取方式相同,在此不再赘述。The manner of acquiring the feature identifier of the second data block is the same as the manner of acquiring the data feature of the first data block, and details are not described herein again.

步骤S1002,所述存储处理器211根据所述第二数据的特征标识确定所述第二数据是否存储在所述第一缓存中。Step S1002, the storage processor 211 determines whether the second data is stored in the first cache according to the feature identifier of the second data.

本实施例中,所述内存215中还存储有第一缓存的索引记录2152,所述第一缓存索引记录2152包括所述第一缓存212中保存的至少一个第一数据块的数据特征标识,所述第一数据块的大小等于所述第二数据块的大小。In this embodiment, the memory 215 further stores an index record 2152 of the first cache, and the first cache index record 2152 includes a data feature identifier of at least one first data block stored in the first cache 212, The size of the first data block is equal to the size of the second data block.

如此,则可根据所述每个第二数据块的特征标识查询所述第一缓存的索引记录2152来确定所述每个第二数据块是否存储在所述第一缓存212中。In this way, the index record 2152 of the first cache may be queried according to the characteristic identifier of each second data block to determine whether each second data block is stored in the first cache 212 .

所述第一缓存212的索引记录中所存储的数据块标识可以是所述第一缓存212所缓存的所有第一数据块的特征标识,也可以为部分第一数据块的特征标识。由于所述第一缓存212中所缓存的第一数据块数量比较多,所以如果将第一缓存212中的所有第一数据块的数据特征标识都存储在所述第一缓存索引记录中,则会浪费存储空间,且会增加查表的时间,从而影响性能,所以本实施例中所述第一缓存索引记录2153只维护预设时间段内的缓存至所述第一缓存212的第一数据块特征标识,比如10分钟之内。The data block identifiers stored in the index record of the first cache 212 may be the feature identifiers of all the first data blocks cached by the first cache 212, or may be the feature identifiers of some of the first data blocks. Since the number of first data blocks cached in the first cache 212 is relatively large, if the data feature identifiers of all the first data blocks in the first cache 212 are stored in the first cache index record, then This will waste storage space and increase the time for table lookup, thereby affecting performance. Therefore, in this embodiment, the first cache index record 2153 only maintains the first data cached to the first cache 212 within a preset time period. Block feature identification, such as within 10 minutes.

在这种情况下,缓存在所述第一缓存212中的数据才会记录在所述第一缓存索引记录2152中,则当所述第一缓存索引记录2152中记录有与所述第一数据块的特征标识相同的特征标识时,则确定所述第一数据块存储在所述第一缓存212中。In this case, the data cached in the first cache 212 will be recorded in the first cache index record 2152, then when the first cache index record 2152 is recorded with the first data When the feature identifiers of the blocks are the same, it is determined that the first data block is stored in the first cache 212 .

所述第一缓存索引记录2152也可以是一个哈希(Hash)表,哈希表的key是所述第一数据块标识,Value是0或1,0表示数据特征标识对应的第一数据块不存在所述第一缓存212中,1表示所述数据特征标识对应的数据块存在所述索引记录内。当第一数据块标识添加至所述第一缓存212的索引记录时,将所述value值设为1,当所述特征标识对应的第一数据块从所述第一缓存中删除时,可将所述删除的数据块对应的特征标识的Value设置为0。The first cache index record 2152 may also be a Hash table, the key of the hash table is the first data block identifier, and the Value is 0 or 1, and 0 represents the first data block corresponding to the data feature identifier. If it does not exist in the first cache 212, 1 indicates that the data block corresponding to the data feature identifier exists in the index record. When the first data block identifier is added to the index record of the first cache 212, the value is set to 1, and when the first data block corresponding to the feature identifier is deleted from the first cache, the value can be set to 1. The Value of the feature identifier corresponding to the deleted data block is set to 0.

在这种情况下,在确定所述第二数据块是否存储在所述第一缓存212中时,首先查询所述第一数据块的特征标识是否记录在所述第一缓存索引记录2152中,当所述第一数据块的特征标识记录在所述第一缓存索引记录2152中时,确定对应的Value值,当Value值为1时,则确定所述第一数据块存储在所述第一缓存212中。In this case, when determining whether the second data block is stored in the first cache 212, first query whether the feature identifier of the first data block is recorded in the first cache index record 2152, When the feature identifier of the first data block is recorded in the first cache index record 2152, the corresponding Value value is determined, and when the Value value is 1, it is determined that the first data block is stored in the first data block. in cache 212.

步骤S1003,当所述存储处理器211根据所述第二数据的特征标识确定所述第二数据存储在所述第一缓存212中时,将所述第二数据在所述第二缓存213中的淘汰优先级的级别提高,所述提高可以是提高到最高级,也可以为预先设定的优先级级别。当所述存储处理器211确定所述第二数据未存储在所述第一缓存212中时,则不调整所述第二数据的优先级级别。Step S1003, when the storage processor 211 determines that the second data is stored in the first cache 212 according to the feature identifier of the second data, the second data is stored in the second cache 213 The level of the elimination priority is increased, and the increase may be to the highest level, or it may be a preset priority level. When the storage processor 211 determines that the second data is not stored in the first cache 212, the priority level of the second data is not adjusted.

如图11所示,缓存至所述二缓存213的第二数据块a1的特征标识为Bn+1,查询所述第一缓存索引记录2152,在所述第一缓存索引记录2152中找到所述数据块a1的特征标识,则说明所述第二数据a1存储在所述第一缓存212中,则可将所述第二数据块a1调整到所述LRU队列的队尾位置,也可以调整到靠近对尾的位置。As shown in FIG. 11 , the feature identifier of the second data block a1 cached in the second cache 213 is Bn+1, the first cache index record 2152 is queried, and the first cache index record 2152 is found in the first cache index record 2152 The characteristic identifier of the data block a1 indicates that the second data a1 is stored in the first cache 212, then the second data block a1 can be adjusted to the tail position of the LRU queue, or can be adjusted to near the opposite end.

如图12所示,当所述存储处理器211从所述第二缓存213中删除数据时,所述第一缓存212及第二缓存213的数据的协调方法的流程图。As shown in FIG. 12 , when the storage processor 211 deletes data from the second cache 213 , a flowchart of a method for coordinating data in the first cache 212 and the second cache 213 is performed.

步骤S1201,所述存储处理器211确定从所述第二缓存213中待删除的第二数据块后,获取所述第二数据块的特征标识。Step S1201: After determining the second data block to be deleted from the second cache 213, the storage processor 211 acquires the feature identifier of the second data block.

步骤S1202,所述存储处理器211根据所述第二数据的特征标识确定所述第二数据块是否存储在所述第一缓存212中。Step S1202, the storage processor 211 determines whether the second data block is stored in the first cache 212 according to the characteristic identifier of the second data.

步骤S1203,当所述存储处理器211确定所述第二数据存储在所述第一缓存212中时,则删除所述第二数据块。Step S1203, when the storage processor 211 determines that the second data is stored in the first cache 212, delete the second data block.

步骤S1204,当所述存储处理器211确定所述第二数据没有存储在所述第一缓存212中时,则将所述第二数据在所述第二缓存213中的淘汰优先级的级别提高,所述提高可以是提高到最高级,也可以为预先设定的优先级级别。但是当所述待删除的数据块再次被选中为待删除的数据块时,则直接删除所述待删除的第二数据块。Step S1204, when the storage processor 211 determines that the second data is not stored in the first cache 212, it increases the level of the elimination priority of the second data in the second cache 213 , the improvement can be to the highest level, or it can be a preset priority level. However, when the data block to be deleted is selected as the data block to be deleted again, the second data block to be deleted is directly deleted.

如图13所示,第二数据块f1为所确定的从所述第二缓存中待删除的数据块,所获取的所述第二数据块f1的特征标识为Bn-3,所述特征标识Bn-3没有记录在所述第一缓存索引记录中,则说明所述第二数据块可能没有存储在所述第一缓存中,则将所述第二数据块f1调整至所述第二缓存213中的LRU队列的队首位置,或者靠近队首的位置。As shown in FIG. 13 , the second data block f1 is the determined data block to be deleted from the second cache, the acquired feature identifier of the second data block f1 is Bn-3, and the feature identifier If Bn-3 is not recorded in the first cache index record, it means that the second data block may not be stored in the first cache, and the second data block f1 is adjusted to the second cache The head position of the LRU queue in 213, or a position close to the head of the line.

如图14所示,当所述第二缓存中的第二数据块在第二缓存中存储的时间超过了一阈值时,所述第一缓存及第二缓存的数据的协调方法的流程图。As shown in FIG. 14 , when the time that the second data block in the second cache is stored in the second cache exceeds a threshold, a flowchart of a method for coordinating data in the first cache and the second cache.

步骤S1401,当确定所述第二缓存中的第二数据块在第二缓存中存储的时间超过了一阈值时,获取所述第二数据块的特征标识。Step S1401, when it is determined that the storage time of the second data block in the second cache in the second cache exceeds a threshold, acquire the feature identifier of the second data block.

步骤S1402,所述存储处理器211根据所述第二数据的特征标识确定所述第二数据是否存储在所述第一缓存中。Step S1402, the storage processor 211 determines whether the second data is stored in the first cache according to the feature identifier of the second data.

步骤S1403,当所述存储处理器211确定所述第二数据存储在所述第一缓存212中时,则将所述第二数据在所述第二缓存213中的淘汰优先级的级别提高。Step S1403 , when the storage processor 211 determines that the second data is stored in the first cache 212 , it increases the level of the elimination priority of the second data in the second cache 213 .

步骤S1404,当所述存储处理器211确定所述第二数据没有存储在所述第一缓存212中时,则将所述第二数据在所述第二缓存213中的淘汰优先级的级别降低。Step S1404, when the storage processor 211 determines that the second data is not stored in the first cache 212, it reduces the level of the elimination priority of the second data in the second cache 213 .

如图15所示,当所述第二数据块c1在所述第二缓存中所缓存的时间超过阈值时,则确定所述第二数据块c1的特征标识Bn是否记录在所述第一缓存索引记录中,当所述第二数据块c1的特征标识记录在所述第一缓存索引记录2152中时,将所述第二数据块c1调整至所述LRU队列的队尾,或者靠近队尾的位置。As shown in FIG. 15 , when the time that the second data block c1 is cached in the second cache exceeds a threshold, it is determined whether the feature identifier Bn of the second data block c1 is recorded in the first cache In the index record, when the feature identifier of the second data block c1 is recorded in the first cache index record 2152, the second data block c1 is adjusted to the end of the LRU queue, or close to the end of the queue s position.

当所述第二数据块d1在所述第二缓存213中所缓存的时间超过阈值时,则确定所述第二数据块d1的特征标识Bn-3是否记录在所述第一缓存索引记录中,当所述第二数据块d1的特征标识没有记录在所述第一索引记录中时,将所述第二数据块d1调整至所述LRU队列的队首,或者靠近队首的位置。When the time that the second data block d1 is cached in the second cache 213 exceeds a threshold, it is determined whether the feature identifier Bn-3 of the second data block d1 is recorded in the first cache index record , when the feature identifier of the second data block d1 is not recorded in the first index record, adjust the second data block d1 to the head of the LRU queue, or a position close to the head of the queue.

在本发明的其他实施例中,所述应用服务器可以为电子装置中的应用软件,所述应用缓存为所述应用软件提供数据缓存,所述存储服务器为电子装置的存储装置,为所述应用软件提供存储服务。In other embodiments of the present invention, the application server may be application software in an electronic device, the application cache provides a data cache for the application software, and the storage server is a storage device of the electronic device for the application The software provides storage services.

如图16所示,为本发明实施例提供存储控制装置的结构图。As shown in FIG. 16 , a structural diagram of a storage control apparatus is provided for an embodiment of the present invention.

所述存储控制装置包括第一监测单元1601、第一获取单元1602、第一确定单元1603及第一调整单元1604。The storage control device includes a first monitoring unit 1601 , a first acquiring unit 1602 , a first determining unit 1603 and a first adjusting unit 1604 .

所述第一监测单元1601用于侦测所述第一缓存212中的所缓存数据的情况,以触发所述第一缓存212与第二缓存213的数据协调。所述所述第一缓存212与第二缓存213的数据协调有三种触发条件,分别为:所述第一监测单元1601接收到所述应用服务器220发送的数据缓存请求,并根据所述数据缓存请求将所述数据缓存请求中包含的第一数据缓存至所述第一缓存212;所述第一监测单元1601接收到所述应用服务器220发送的数据删除请求;所述第一监测单元1601侦测缓存在所述第一缓存中的数据的时间超过预设阈值。The first monitoring unit 1601 is configured to detect the condition of the buffered data in the first buffer 212 to trigger data coordination between the first buffer 212 and the second buffer 213 . There are three trigger conditions for data coordination between the first cache 212 and the second cache 213, respectively: the first monitoring unit 1601 receives the data cache request sent by the application server 220, and according to the data cache Request to cache the first data contained in the data cache request to the first cache 212; the first monitoring unit 1601 receives the data deletion request sent by the application server 220; the first monitoring unit 1601 detects The time for measuring the data buffered in the first buffer exceeds a preset threshold.

当所述第一监测单元1601接收到所述应用服务器220发送的数据缓存请求,并根据所述数据缓存请求将所述数据缓存请求中包含的第一数据缓存至所述第一缓存212后,所述获取单元1602获取组成所述第一数据的第一数据块的特征标识,所述第一数据块的特征标识的获取方式前面已经介绍过,这里不再赘述。When the first monitoring unit 1601 receives the data cache request sent by the application server 220, and caches the first data included in the data cache request to the first cache 212 according to the data cache request, The acquiring unit 1602 acquires the feature identifier of the first data block that constitutes the first data. The acquisition method of the feature identifier of the first data block has been described above, and will not be repeated here.

所述确定单元1603根据所述第一数据的特征标识确定数所述第一据是否存储在所述第二缓存中。即所述确定单元1603根据所述每个第一数据块的数据特征标识查询所述第二缓存的索引记录来确定所述每个第一数据块是否存储在所述第二缓存213中。当所述第二缓存的索引记录中存在与所述第一数据块的数据特征标识相同的第二数据块索引记录时,则确定所述第一数据块存储在所述第二缓存213中。The determining unit 1603 determines whether the first data is stored in the second cache according to the characteristic identifier of the first data. That is, the determining unit 1603 queries the index record of the second cache according to the data feature identifier of each first data block to determine whether each first data block is stored in the second cache 213 . When a second data block index record with the same data feature identifier as the first data block exists in the index record of the second cache, it is determined that the first data block is stored in the second cache 213 .

当所述确定单元1603确定所述第一数据块存储在所述第二缓存213中时,所述调整单元1604根据所述第一数据块的特征标识及地址表在所述第二缓存213中找到所述第一数据块,然后将所述第一数据块在所述第二缓存中的淘汰优先级的级别降低,可以是降低到最低级,也可以为降低到预设设定的优先级级别。When the determining unit 1603 determines that the first data block is stored in the second cache 213, the adjusting unit 1604 stores the first data block in the second cache 213 according to the feature identifier and address table of the first data block Find the first data block, and then reduce the level of the elimination priority of the first data block in the second cache, which can be reduced to the lowest level, or can be reduced to a preset priority level level.

当所述第一监测单元1601在侦测到所述第一缓存中212所缓存的第一数据块的超过易阈值时,获取所述第一数据块的特征标识。When the first monitoring unit 1601 detects that the first data block buffered in the first cache 212 exceeds the easy threshold, it acquires the feature identifier of the first data block.

所述确定单元1603根据所述第一数据的特征标识确定数所述第一据是否存储在所述第二缓存中。The determining unit 1603 determines whether the first data is stored in the second cache according to the characteristic identifier of the first data.

所述调整单元1604根据所述第一数据块的特征标识及地址表在所述第二缓存213中找到所述第一数据块,将所述第一数据块在所述第二缓存中的淘汰优先级的级别提高,可以是提高到最高级,也可以为提高到预设设定的优先级级别。The adjustment unit 1604 finds the first data block in the second cache 213 according to the feature identifier and address table of the first data block, and eliminates the first data block in the second cache. The priority level can be increased to the highest level, or it can be increased to the preset priority level.

如图17所示,所述存储控制装置进一步还包括第二监测单元1605,第二获取单元1606、第二确定单元1607及第二调整单元1608。As shown in FIG. 17 , the storage control device further includes a second monitoring unit 1605 , a second acquiring unit 1606 , a second determining unit 1607 and a second adjusting unit 1608 .

所述第二监测单元1605用于侦测所述第二缓存的数据情况,以触发所述第一缓存及所述第二缓存所缓存数据的协调。所述第一缓存212与第二缓存213的数据协调有三种触发条件,分别为往所述第二缓存中缓存数据时;删除所述第二缓存中的数据时;或者所述第二缓存中的数据块在第二缓存中存储的时间超过了一阈值。The second monitoring unit 1605 is configured to detect the data condition of the second cache, so as to trigger the coordination of the data cached by the first cache and the second cache. There are three trigger conditions for data coordination between the first cache 212 and the second cache 213, namely, when data is cached in the second cache; when the data in the second cache is deleted; or when the data in the second cache is deleted. The time that the data blocks are stored in the second cache exceeds a threshold.

当所述第二监测单元1605侦测数据缓存至所述第二缓存,且所缓存的数据被划分为预定大小的至少一个第二数据块后,获取所述第二数据块的特征标识。After the second monitoring unit 1605 detects that the data is buffered into the second buffer, and the buffered data is divided into at least one second data block of a predetermined size, the characteristic identifier of the second data block is acquired.

所述第二确定单元1603用于据所述第二数据的特征标识确定所述第二数据是否存储在所述第一缓存中。所述确定单元1602根据所述第二数据块的特征标识查询所述第一缓存的索引记录来确定所述每个第二数据块是否存储在所述第一缓存212中。当所述第一缓存的索引记录中存在与所述第二数据块的特征标识相同的第二数据块索引记录时,则确定所述第二数据块存储在所述第一缓存213中。The second determining unit 1603 is configured to determine whether the second data is stored in the first cache according to the feature identifier of the second data. The determining unit 1602 queries the index record of the first cache according to the feature identifier of the second data block to determine whether each second data block is stored in the first cache 212 . When a second data block index record with the same feature identifier as the second data block exists in the index record of the first cache, it is determined that the second data block is stored in the first cache 213 .

当所述第二确定单元1603定所述第二数据存储在所述第一缓存212中时,所述调整单元1604用于将所述第二数据在所述第二缓存213中的淘汰优先级的级别提高,所述提高可以是提高到最高级,也可以为预先设定的优先级级别。当所述存储处理器211确定所述第二数据未存储在所述第一缓存212中时,则不调整所述第二数据的优先级级别。When the second determining unit 1603 determines that the second data is stored in the first cache 212 , the adjusting unit 1604 is configured to set the elimination priority of the second data in the second cache 213 The level of the upgrade can be raised to the highest level, or it can be a preset priority level. When the storage processor 211 determines that the second data is not stored in the first cache 212, the priority level of the second data is not adjusted.

当所述第二监测单元1605到从所述第二缓存213中待删除的第二数据块后,获取所述第二数据块的特征标识。After the second monitoring unit 1605 reaches the second data block to be deleted from the second cache 213, it acquires the feature identifier of the second data block.

所述第二确定单元1605根据所述第二数据的特征标识确定所述第二数据是否存储在所述第一缓存中。The second determining unit 1605 determines whether the second data is stored in the first cache according to the feature identifier of the second data.

当所述第二确定单元1605确定所述第二数据存储在所述第一缓存中时,所述第二调整单元删除所述第二数据块,当所述第二确定单元1605确定所述第二数据没有存储在所述第一缓存中时,所述第二调整单元将所述第二数据在所述第二缓存213中的淘汰优先级的级别提高。When the second determining unit 1605 determines that the second data is stored in the first cache, the second adjusting unit deletes the second data block, and when the second determining unit 1605 determines that the second data block is stored in the first cache When the second data is not stored in the first cache, the second adjustment unit increases the level of the elimination priority of the second data in the second cache 213 .

当所述第二监测单元1605侦测到从所述第二缓存213中待删除的第二数据块后,所述第二获取单元1606获取所述第二数据块的特征标识。After the second monitoring unit 1605 detects the second data block to be deleted from the second cache 213, the second obtaining unit 1606 obtains the feature identifier of the second data block.

所述第二确定单元1607根据所述第二数据的特征标识确定所述第二数据是否存储在所述第一缓存中。The second determining unit 1607 determines whether the second data is stored in the first cache according to the feature identifier of the second data.

当所述第二确定单元1605确定所述第二数据存储在所述第一缓存中时,所述调整单元1608删除所述第二数据块。当所述第二确定单元1605确定所述第二数据存储在所述第一缓存中时,则将所述调整单元将所述第二数据在所述第二缓存213中的淘汰优先级的级别提高。When the second determining unit 1605 determines that the second data is stored in the first cache, the adjusting unit 1608 deletes the second data block. When the second determining unit 1605 determines that the second data is stored in the first cache, the adjustment unit adjusts the level of the elimination priority of the second data in the second cache 213 improve.

当所述第二监测单元1605侦测到所述第二缓存中的第二数据块在第二缓存中存储的时间超过了一阈值时,所述第二获取单元1606获取所述第二数据块的特征标识。When the second monitoring unit 1605 detects that the time that the second data block in the second cache is stored in the second cache exceeds a threshold, the second obtaining unit 1606 obtains the second data block feature identification.

所述第二确定单元1606根据所述第二数据的特征标识确定所述第二数据是否存储在所述第一缓存中。The second determining unit 1606 determines whether the second data is stored in the first cache according to the feature identifier of the second data.

当所述第二确定单元1605确定所述第二数据存储在所述第一缓存中时,则所述调整单元1608将所述第二数据在所述第二缓存213中的淘汰优先级的级别提高。当所述第二确定单元1605确定所述第二数据没有存储在所述第一缓存中时,则所述调整单元1608将所述第二数据在所述第二缓存213中的淘汰优先级的级别降低。When the second determining unit 1605 determines that the second data is stored in the first cache, the adjusting unit 1608 adjusts the level of the elimination priority of the second data in the second cache 213 improve. When the second determining unit 1605 determines that the second data is not stored in the first cache, the adjusting unit 1608 adjusts the elimination priority of the second data in the second cache 213 Level down.

本发明实施例还提供一种计算机可读介质,包括计算机执行指令,当计算机的处理器执行所述计算机执行指令时,所述计算机执行图3、图6、图8、图10、图12、及图14所述的方法流程。An embodiment of the present invention further provides a computer-readable medium, including computer-executable instructions. When a processor of a computer executes the computer-executable instructions, the computer executes FIG. 3 , FIG. 6 , FIG. 8 , FIG. 10 , FIG. 12 , and the method flow described in FIG. 14 .

本发明实施例中的第一数据块,第二数据块中的第一、第二只是用于区别第一缓存和第二缓存中分别存储的数据块,第一、第二并没有包含级别不同、顺序不同的意思,也没有包含数量的涵义,第一数据块和第二数据块都可以是一个数据块,也都可以指代多个数据块。The first data block in the embodiment of the present invention, the first and the second in the second data block are only used to distinguish the data blocks stored in the first cache and the second cache respectively, and the first and the second do not contain different levels. 、 The meaning of the order is different, and it does not contain the meaning of quantity. Both the first data block and the second data block can be one data block, and can also refer to multiple data blocks.

本发明实施例中的第一触发条件和第二触发条件中的第一、第二只是用于区别侦测的是第一缓存中的数据还是第二缓存中的数据,第一、第二并没有包含级别不同、顺序不同的意思,也没有包含数量的涵义。The first and second of the first trigger condition and the second trigger condition in the embodiment of the present invention are only used to distinguish whether the data in the first cache or the data in the second cache is detected. It does not include the meaning of a different level, a different order, nor the meaning of a quantity.

本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:ROM、RAM、磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable storage medium, and the storage medium can include: ROM, RAM, magnetic disk or optical disk, etc.

以上对本发明实施例所提供的数据块写入装置及方法进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。The data block writing device and method provided by the embodiments of the present invention have been described in detail above. The principles and implementations of the present invention are described with specific examples in this paper. The descriptions of the above embodiments are only used to help understand the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation and application scope. In summary, the content of this specification should not be construed as Limitations of the present invention.

Claims (19)

1.一种数据的缓存方法,应用于存储设备,其特征在于,所述存储设备包括第一缓存、第二缓存和存储单元,所述第一缓存为应用服务器提供数据缓存,所述第二缓存用于为所述存储单元提供数据缓存,所述方法包括:1. A data caching method, applied to a storage device, wherein the storage device comprises a first cache, a second cache and a storage unit, the first cache provides a data cache for an application server, the second cache The cache is used to provide data cache for the storage unit, and the method includes: 在监测到第一触发条件的情况下,获取缓存在所述第一缓存中的第一数据块的特征信息;In the case of monitoring the first trigger condition, acquiring characteristic information of the first data block cached in the first cache; 根据所述第一数据块的特征信息确定所述第一数据块是否存储在所述第二缓存中;Determine whether the first data block is stored in the second cache according to the characteristic information of the first data block; 在确定所述第一数据块存储在所述第二缓存中的情况下,调整所述第一数据块在所述第二缓存中的淘汰优先级的级别;In the case that it is determined that the first data block is stored in the second cache, adjusting the level of the elimination priority of the first data block in the second cache; 其中,所述第一触发条件为:根据第一数据写请求将所述第一数据块写入所述第一缓存中,或者,所述第一数据块在所述第一缓存中的缓存时间超过预定时间;The first trigger condition is: the first data block is written into the first cache according to a first data write request, or the cache time of the first data block in the first cache exceeding the scheduled time; 所述在确定所述第一数据块存储在所述第二缓存中的情况下,调整所述第一数据块在所述第二缓存中的淘汰优先级的级别包括:When it is determined that the first data block is stored in the second cache, adjusting the level of the elimination priority of the first data block in the second cache includes: 在确定所述第一数据块存储在所述第二缓存中的情况下,将所述第一数据块在所述第二缓存中的淘汰优先级的级别提高;When it is determined that the first data block is stored in the second cache, the level of the elimination priority of the first data block in the second cache is increased; 或者,所述第一触发条件为:接收到在所述第一缓存中删除所述第一数据块的删除请求;Alternatively, the first trigger condition is: receiving a deletion request for deleting the first data block in the first cache; 所述在确定所述第一数据块存储在所述第二缓存中的情况下,调整所述第一数据块在所述第二缓存中的淘汰优先级的级别包括:When it is determined that the first data block is stored in the second cache, adjusting the level of the elimination priority of the first data block in the second cache includes: 在确定所述第一数据块存储在所述第二缓存中的情况下,将所述第一数据块在所述第二缓存中的淘汰优先级的级别降低。In the case that it is determined that the first data block is stored in the second cache, the level of the elimination priority of the first data block in the second cache is lowered. 2.如权利要求1所述的方法,其特征在于,所述存储设备保存有所述第二缓存的索引记录,所述第二缓存的索引记录包括所述第二缓存中保存的数据块的数据特征标识,所述第二缓存中保存的数据块的大小等于所述第一数据块的大小,每个所述第二缓存中保存的数据块的数据特征标识由每个所述第二缓存中保存的数据块的数据内容决定;2 . The method of claim 1 , wherein the storage device stores an index record of the second cache, and the index record of the second cache includes an index record of a data block stored in the second cache. 3 . Data feature identifier, the size of the data block saved in the second cache is equal to the size of the first data block, and the data feature identifier of each data block saved in the second cache is determined by each of the second caches. Determined by the data content of the data block stored in the; 所述获取第一数据块的特征信息包括:根据每个第一数据块的数据内容获得所述第一数据块的数据特征标识;The obtaining the feature information of the first data block includes: obtaining the data feature identifier of the first data block according to the data content of each first data block; 所述根据所述第一数据块的特征信息确定所述第一数据块是否存储在所述第二缓存中包括:根据所述第一数据块的数据特征标识查询所述第二缓存的索引记录,确定每个第一数据块是否存储在所述第二缓存中。The determining whether the first data block is stored in the second cache according to the feature information of the first data block includes: querying an index record of the second cache according to the data feature identifier of the first data block , and determine whether each first data block is stored in the second cache. 3.如权利要求1所述的方法,其特征在于,还包括:3. The method of claim 1, further comprising: 在监测到第二触发条件的情况下,获取缓存在所述第二缓存中的第二数据块的特征信息;In the case of monitoring the second trigger condition, acquiring the feature information of the second data block cached in the second cache; 根据所述第二数据块的特征信息确定所述第二数据块是否存储在所述第一缓存中;Determine whether the second data block is stored in the first cache according to the characteristic information of the second data block; 在确定所述第二数据块存储在所述第一缓存中的情况下,调整所述第二数据块在所述第二缓存中的淘汰优先级的级别。In the case that it is determined that the second data block is stored in the first cache, the level of the elimination priority of the second data block in the second cache is adjusted. 4.如权利要求3所述的方法,其特征在于,所述第二触发条件为:所述第二数据块在所述第二缓存中的缓存时间超过预定时间;4. The method according to claim 3, wherein the second trigger condition is: the cache time of the second data block in the second cache exceeds a predetermined time; 所述在确定所述第二数据块存储在所述第一缓存中的情况下,调整所述第二数据块在所述第二缓存中的淘汰优先级的级别包括:When it is determined that the second data block is stored in the first cache, adjusting the level of the elimination priority of the second data block in the second cache includes: 在确定所述第二数据块存储在所述第一缓存中的情况下,将所述第二数据块从所述第二缓存中的淘汰优先级的级别提高。In a case where it is determined that the second data block is stored in the first cache, the level of the elimination priority of the second data block is increased from the second cache. 5.如权利要求3所述的方法,其特征在于,若所述第二触发条件为:删除所述第二缓存中的所述第二数据块,5. The method of claim 3, wherein if the second trigger condition is: delete the second data block in the second cache, 所述方法还包括:The method also includes: 在确定所述第二数据未存储在所述第一缓存中的情况下,将所述第二数据在所述第二缓存中的淘汰优先级的级别降低。In a case where it is determined that the second data is not stored in the first cache, the level of the elimination priority of the second data in the second cache is lowered. 6.如权利要求3所述的方法,其特征在于,若所述第二触发条件为:将所述第二数据块写入所述第二缓存;6. The method of claim 3, wherein, if the second trigger condition is: writing the second data block into the second cache; 所述在确定所述第二数据块存储在所述第一缓存中的情况下,调整所述第二数据块在所述第二缓存中的淘汰优先级的级别包括:When it is determined that the second data block is stored in the first cache, adjusting the level of the elimination priority of the second data block in the second cache includes: 在确定所述第二数据块存储在所述第一缓存中的情况下,将所述第二数据块在所述第二缓存中的淘汰优先级的级别提高。When it is determined that the second data block is stored in the first cache, the level of the elimination priority of the second data block in the second cache is increased. 7.如权利要求3-6任意一项所述的方法,其特征在于,所述存储设备保存有所述第一缓存的索引记录,所述第一缓存的索引记录包括所述第一缓存中保存的数据块的数据特征标识,所述第一缓存中保存的数据块的大小等于所述第二数据块的大小,所述第一缓存中保存的数据块的数据特征标识由每个数据块包含的数据内容决定;7. The method according to any one of claims 3-6, wherein the storage device saves an index record of the first cache, and the index record of the first cache includes the index records in the first cache The data feature identifier of the stored data block, the size of the data block stored in the first cache is equal to the size of the second data block, and the data feature identifier of the data block stored in the first cache is determined by each data block. The content of the data included determines; 所述获取第二数据块的特征信息包括:根据每个第二数据块的数据内容获得每个第二数据块的数据特征标识;The obtaining the feature information of the second data block includes: obtaining the data feature identifier of each second data block according to the data content of each second data block; 所述根据所述第二数据块的特征信息确定所述第二数据块是否存储在所述第一缓存中包括:根据所述第二数据块的数据特征标识查询所述第一缓存的索引记录,确定所述第二数据块是否存储在所述第一缓存中。The determining whether the second data block is stored in the first cache according to the feature information of the second data block includes: querying an index record of the first cache according to the data feature identifier of the second data block , and determine whether the second data block is stored in the first cache. 8.一种数据的缓存方法,应用于存储设备,其特征在于,所述存储设备包括第一缓存、第二缓存和存储单元,所述第一缓存为应用服务器提供数据缓存,所述第二缓存用于为所述存储单元提供数据缓存,所述方法包括:8. A method for caching data, applied to a storage device, wherein the storage device comprises a first cache, a second cache and a storage unit, the first cache provides a data cache for an application server, the second cache The cache is used to provide data cache for the storage unit, and the method includes: 在监测到第二触发条件的情况下,获取缓存在所述第二缓存中的第二数据块的特征信息;In the case of monitoring the second trigger condition, acquiring the feature information of the second data block cached in the second cache; 根据所述第二数据的特征信息确定所述第二数据块是否存储在所述第一缓存中;Determine whether the second data block is stored in the first cache according to the feature information of the second data; 在确定所述第二数据块存储在所述第一缓存中的情况下,调整所述第二数据块在所述第二缓存中的淘汰优先级的级别;In the case of determining that the second data block is stored in the first cache, adjusting the level of the elimination priority of the second data block in the second cache; 其中,所述第二触发条件为:所述第二数据块在所述第二缓存中的缓存时间超过预定时间;Wherein, the second trigger condition is: the cache time of the second data block in the second cache exceeds a predetermined time; 所述在确定所述第二数据块存储在所述第一缓存中的情况下,调整所述第二数据在所述第二缓存中的淘汰优先级的级别包括:When it is determined that the second data block is stored in the first cache, adjusting the level of the elimination priority of the second data in the second cache includes: 在确定所述第二数据块存储在所述第一缓存中的情况下,将所述第二数据块在所述第二缓存中的淘汰优先级的级别提高;When it is determined that the second data block is stored in the first cache, the level of the elimination priority of the second data block in the second cache is increased; 或者,若所述第二触发条件为:删除所述第二缓存中的所述第二数据块,Or, if the second trigger condition is: delete the second data block in the second cache, 所述方法还包括:The method also includes: 在确定所述第二数据块未存储在所述第一缓存中的情况下,将所述第二数据块在所述第二缓存中的淘汰优先级的级别降低;In the case of determining that the second data block is not stored in the first cache, reducing the level of the elimination priority of the second data block in the second cache; 或者,若所述第二触发条件为:将包含所述第二数据块的数据写入所述第二缓存;Or, if the second trigger condition is: writing data including the second data block into the second cache; 所述在确定所述第二数据块存储在所述第一缓存中的情况下,调整所述第二数据块在所述第二缓存中的淘汰优先级的级别包括:When it is determined that the second data block is stored in the first cache, adjusting the level of the elimination priority of the second data block in the second cache includes: 在确定所述第二数据块存储在所述第一缓存中的情况下,将所述第二数据块在所述第二缓存中的淘汰优先级的级别提高。When it is determined that the second data block is stored in the first cache, the level of the elimination priority of the second data block in the second cache is increased. 9.如权利要求8所述的方法,其特征在于,所述存储设备保存有所述第一缓存的索引记录,所述第一缓存的索引记录包括所述第一缓存中保存的数据块的数据特征标识,所述第一缓存中保存的数据块的大小等于所述第二数据块的大小,每个所述第二缓存中保存的数据块的数据特征标识由每个所述第二缓存中保存的数据块的数据内容决定;9 . The method according to claim 8 , wherein the storage device stores an index record of the first cache, and the index record of the first cache includes the data block stored in the first cache. 10 . Data feature identifier, the size of the data block stored in the first cache is equal to the size of the second data block, and the data feature identifier of each data block stored in the second cache is determined by each of the second caches. Determined by the data content of the data block stored in the; 所述获取第二数据块的特征信息包括:根据每个第二数据块包含的数据内容获得每个第二数据块的数据特征标识;The obtaining the feature information of the second data block includes: obtaining the data feature identifier of each second data block according to the data content contained in each second data block; 所述根据所述第二数据块的特征信息确定所述第二数据块是否存储在所述第一缓存中包括:根据每个第二数据块的数据特征标识查询所述第一缓存的索引记录,确定所述第二数据块是否存储在所述第一缓存中。The determining whether the second data block is stored in the first cache according to the feature information of the second data block includes: querying the index record of the first cache according to the data feature identifier of each second data block , and determine whether the second data block is stored in the first cache. 10.一种存储控制装置,用于控制存储设备的数据存储,其特征在于,所述存储设备包括第一缓存、第二缓存和存储单元,所述第一缓存为应用服务器提供数据缓存,所述第二缓存用于为所述存储单元提供数据缓存,所述存储控制装置包括:10. A storage control device for controlling data storage of a storage device, wherein the storage device comprises a first cache, a second cache and a storage unit, the first cache provides a data cache for an application server, and the The second cache is used to provide a data cache for the storage unit, and the storage control device includes: 第一监测单元,用于监测第一触发条件;a first monitoring unit for monitoring the first trigger condition; 第一获取单元,用于在所述第一监测单元监测所述第一触发条件的情况下,获取缓存在所述第一缓存中的第一数据块的特征信息;a first obtaining unit, configured to obtain feature information of the first data block buffered in the first buffer when the first monitoring unit monitors the first trigger condition; 第一确定单元,用于根据所述第一数据块的特征信息确定所述第一数据块是否存储在所述第二缓存中;a first determining unit, configured to determine whether the first data block is stored in the second cache according to feature information of the first data block; 第一调整单元,用于在所述第一确定单元确定所述第一数据块存储在所述第二缓存中的情况下,调整所述第一数据块在所述第二缓存中的淘汰优先级的级别;a first adjustment unit, configured to adjust the elimination priority of the first data block in the second cache when the first determination unit determines that the first data block is stored in the second cache grade level; 其中,所述第一触发条件为:根据第一数据写请求将所述第一数据块写入所述第一缓存中,或者,所述第一数据在所述第一缓存中的缓存时间超过预定时间;The first trigger condition is: the first data block is written into the first cache according to a first data write request, or the first data is cached in the first cache for more than a period of time scheduled time; 所述第一调整单元具体用于:在所述第一确定单元确定所述第一数据块存储在所述第二缓存中的情况下,将所述第一数据块在所述第二缓存中的淘汰优先级的级别提高;The first adjustment unit is specifically configured to: in the case that the first determination unit determines that the first data block is stored in the second cache, store the first data block in the second cache The level of elimination priority is increased; 或者,所述第一触发条件为:接收到在所述第一缓存中删除所述第一数据块的删除请求;Alternatively, the first trigger condition is: receiving a deletion request for deleting the first data block in the first cache; 所述第一调整单元具体用于:在所述第一确定单元确定所述第一数据块存储在所述第二缓存中的情况下,将所述第一数据块在所述第二缓存中的淘汰优先级的级别降低。The first adjustment unit is specifically configured to: in the case that the first determination unit determines that the first data block is stored in the second cache, store the first data block in the second cache The level of elimination priority is lowered. 11.如权利要求10所述的存储控制装置,其特征在于,所述存储设备保存有所述第二缓存的索引记录,所述第二缓存的索引记录包括所述第二缓存中保存的数据块的数据特征标识,所述第二缓存中保存的数据块的大小等于所述第一数据块的大小,每个所述第二缓存中保存的数据块的数据特征标识由每个所述第二缓存中保存的数据块的数据内容决定;11 . The storage control device according to claim 10 , wherein the storage device stores an index record of the second cache, and the index record of the second cache includes data stored in the second cache. 12 . The data feature identifier of the block, the size of the data block saved in the second cache is equal to the size of the first data block, and the data feature identifier of each data block saved in the second cache is determined by each of the first data blocks. 2. The data content of the data block stored in the cache is determined; 所述第一获取单元具体用于:根据每个第一数据块的数据内容获得所述第一数据块的数据特征标识;The first obtaining unit is specifically configured to: obtain the data feature identifier of the first data block according to the data content of each first data block; 所述第一确定单元具体用于:根据所述第一数据块的数据特征标识查询所述第二缓存的索引记录,确定每个第一数据块是否存储在所述第二缓存中。The first determining unit is specifically configured to: query the index record of the second cache according to the data feature identifier of the first data block, and determine whether each first data block is stored in the second cache. 12.如权利要求10所述的存储控制装置,其特征在于,还包括:12. The storage control device of claim 10, further comprising: 第二监测单元,用于监测第二触发条件;a second monitoring unit for monitoring the second trigger condition; 第二获取单元,用于在所述第二监测单元监测到所述第二触发条件的情况下,获取缓存在所述第二缓存中的第二数据块的特征信息;a second acquiring unit, configured to acquire feature information of the second data block cached in the second cache when the second monitoring unit monitors the second trigger condition; 第二确定单元,用于根据所述第二数据块的特征信息确定所述第二数据块是否存储在所述第一缓存中;a second determining unit, configured to determine whether the second data block is stored in the first cache according to the characteristic information of the second data block; 第二调整单元,用于在所述第二确定单元确定所述第二数据块存储在所述第一缓存中的情况下,调整所述第二数据块在所述第二缓存中的淘汰优先级的级别。a second adjustment unit, configured to adjust the priority of elimination of the second data block in the second cache when the second determination unit determines that the second data block is stored in the first cache level level. 13.如权利要求12所述的存储控制装置,其特征在于,所述第二监测单元所监测到的所述第二触发条件为:所述第二数据块在所述第二缓存中的缓存时间超过预定时间;13 . The storage control device according to claim 12 , wherein the second trigger condition monitored by the second monitoring unit is: buffering of the second data block in the second buffer. 14 . time exceeds the predetermined time; 在所述第二确定单元确定所述第二数据块存储在所述第一缓存中的情况下,所述第二调整单元具体用于:When the second determination unit determines that the second data block is stored in the first cache, the second adjustment unit is specifically configured to: 将所述第二数据块从所述第二缓存中的淘汰优先级的级别提高。Raising the second data block from the second cache has a higher level of eviction priority. 14.如权利要求12所述的存储控制装置,其特征在于,所述第二监测单元所监测到的所述第二触发条件为:删除所述第二缓存中的所述第二数据块,14. The storage control device according to claim 12, wherein the second trigger condition monitored by the second monitoring unit is: deleting the second data block in the second cache, 当所述第二确定单元在确定所述第二数据未存储在所述第一缓存中的情况下,所述第二调整单元具体用于:将所述第二数据在所述第二缓存中的淘汰优先级的级别降低。When the second determination unit determines that the second data is not stored in the first cache, the second adjustment unit is specifically configured to: store the second data in the second cache The level of elimination priority is lowered. 15.如权利要求12所述的存储控制装置,其特征在于,所述第二监测单元所监测到的所述第二触发条件为:将包含所述第二数据块的数据写入所述第二缓存;15. The storage control device according to claim 12, wherein the second trigger condition monitored by the second monitoring unit is: writing data including the second data block into the first two cache; 在所述第二确定单元确定所述第二数据块存储在所述第一缓存中的情况下,所述第二调整单元具体用于:将所述第二数据块在所述第二缓存中的淘汰优先级的级别提高。When the second determination unit determines that the second data block is stored in the first cache, the second adjustment unit is specifically configured to: store the second data block in the second cache The level of elimination priority is increased. 16.如权利要求12-15任意一项所述的存储控制装置,其特征在于,所述存储设备保存有所述第一缓存的索引记录,所述第一缓存的索引记录包括所述第一缓存中保存的数据块的数据特征标识,所述第一缓存中保存的数据块的大小等于所述第二数据块的大小,所述第一缓存中保存的数据块的数据特征标识由每个数据块包含的数据内容决定;16 . The storage control apparatus according to claim 12 , wherein the storage device stores an index record of the first cache, and the index record of the first cache includes the first cache. 17 . The data feature identifier of the data block stored in the cache, the size of the data block stored in the first cache is equal to the size of the second data block, and the data feature identifier of the data block stored in the first cache is determined by each The data content contained in the data block is determined; 所述第二获取单元具体用于:根据每个第二数据块的数据内容获得每个第二数据块的数据特征标识;The second obtaining unit is specifically configured to: obtain the data feature identifier of each second data block according to the data content of each second data block; 所述第二确定单元具体用于:根据所述第二数据块的数据特征标识查询所述第一缓存的索引记录,确定所述第二数据块是否存储在所述第一缓存中。The second determining unit is specifically configured to: query the index record of the first cache according to the data feature identifier of the second data block, and determine whether the second data block is stored in the first cache. 17.一种存储控制装置,用于控制存储设备的数据存储,其特征在于,所述存储设备包括第一缓存、第二缓存和存储单元,所述第一缓存为应用服务器提供数据缓存,所述第二缓存用于为所述存储单元提供数据缓存,所述存储控制装置包括:17. A storage control device for controlling data storage of a storage device, wherein the storage device comprises a first cache, a second cache and a storage unit, the first cache provides a data cache for an application server, and the The second cache is used to provide a data cache for the storage unit, and the storage control device includes: 第二监测单元,用于监测第二触发条件;a second monitoring unit for monitoring the second trigger condition; 第二获取单元,用于在所述第二监测单元监测到所述第二触发条件的情况下,获取第二数据块的特征信息,所述第二数据块为缓存在所述第二缓存中的数据;a second acquiring unit, configured to acquire feature information of a second data block when the second monitoring unit monitors the second trigger condition, where the second data block is cached in the second cache The data; 第二确定单元,用于根据所述第二数据块的特征信息确定所述第二数据块是否存储在所述第一缓存中;a second determining unit, configured to determine whether the second data block is stored in the first cache according to the characteristic information of the second data block; 第二调整单元,用于在所述第二确定单元确定所述第二数据块存储在所述第一缓存中的情况下,调整所述第二数据块在所述第二缓存中的淘汰优先级的级别;a second adjustment unit, configured to adjust the priority of elimination of the second data block in the second cache when the second determination unit determines that the second data block is stored in the first cache grade level; 其中,所述第二监测单元所监测到的所述第二触发条件为:所述第二数据块在所述第二缓存中的缓存时间超过预定时间;Wherein, the second trigger condition monitored by the second monitoring unit is: the cache time of the second data block in the second cache exceeds a predetermined time; 所述第二调整单元具体用于:在所述第二确定单元确定所述第二数据块存储在所述第一缓存中的情况下,The second adjustment unit is specifically configured to: when the second determination unit determines that the second data block is stored in the first cache, 将所述第二数据块从所述第二缓存中的淘汰优先级的级别提高;increasing the level of elimination priority of the second data block from the second cache; 或者,所述第二监测单元所监测到的所述第二触发条件为:删除所述第二缓存中的所述第二数据块,Or, the second trigger condition monitored by the second monitoring unit is: delete the second data block in the second cache, 当所述第二确定单元在确定所述第二数据未存储在所述第一缓存中的情况下,所述第二调整单元还用于:将所述第二数据在所述第二缓存中的淘汰优先级的级别降低;When the second determination unit determines that the second data is not stored in the first cache, the second adjustment unit is further configured to: store the second data in the second cache The level of the elimination priority is reduced; 或者,所述第二监测单元所监测到的所述第二触发条件为:将包含所述第二数据块的数据写入所述第二缓存;Alternatively, the second trigger condition monitored by the second monitoring unit is: writing data including the second data block into the second cache; 在所述第二确定单元确定所述第二数据块存储在所述第一缓存中的情况下,所述第二调整单元具体用于:将所述第二数据块在所述第二缓存中的淘汰优先级的级别提高。When the second determination unit determines that the second data block is stored in the first cache, the second adjustment unit is specifically configured to: store the second data block in the second cache The level of elimination priority is increased. 18.如权利要求17所述的存储控制装置,其特征在于,所述存储设备保存有所述第一缓存的索引记录,所述第一缓存的索引记录包括所述第一缓存中保存的数据块的数据特征标识所述第一缓存中保存的数据块的大小等于所述第二数据块的大小,每个所述第二缓存中保存的数据块的数据特征标识由每个所述第二缓存中保存的数据块包含的数据内容决定;18 . The storage control device according to claim 17 , wherein the storage device stores an index record of the first cache, and the index record of the first cache includes data stored in the first cache. 19 . The size of the data block stored in the first cache is equal to the size of the second data block, and the data feature identifier of each data block stored in the second cache is determined by each of the second cache. The data content contained in the data block saved in the cache is determined; 所述第二获取单元具体用于:根据每个第二数据块包含的数据内容获得每个第二数据块的数据特征标识;The second obtaining unit is specifically configured to: obtain the data feature identifier of each second data block according to the data content contained in each second data block; 所述第二确定单元具体用于:根据每个第二数据块的数据特征标识查询所述第一缓存的索引记录,确定所述第二数据块是否存储在所述第一缓存中。The second determining unit is specifically configured to: query the index record of the first cache according to the data feature identifier of each second data block, and determine whether the second data block is stored in the first cache. 19.一种存储设备,所述存储设备包括处理器、内存、第一缓存、第二缓存和存储单元,所述第一缓存为应用服务器提供数据缓存,所述第二缓存用于为所述存储单元提供数据缓存,所述内存用于存储计算机执行指令,当所述存储设备运行时,所述处理器执行所述内存存储的所述计算机执行指令,以使所述存储设备执行权利要求1-7或者8-9所述的数据的缓存方法。19. A storage device, the storage device comprising a processor, a memory, a first cache, a second cache and a storage unit, the first cache provides a data cache for an application server, and the second cache is used for the The storage unit provides a data cache, the memory is used to store computer-executed instructions, and when the storage device operates, the processor executes the computer-executed instructions stored in the memory, so that the storage device executes claim 1 -7 or the data caching method described in 8-9.
CN201580054160.7A 2015-12-01 2015-12-01 Data caching method, storage control device and storage equipment Active CN107430551B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010981446.2A CN112214420B (en) 2015-12-01 2015-12-01 Data caching method, storage control device and storage equipment
CN202010983144.9A CN112231242B (en) 2015-12-01 2015-12-01 Data caching method, storage control device and storage equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2015/096176 WO2017091984A1 (en) 2015-12-01 2015-12-01 Data caching method, storage control apparatus and storage device

Related Child Applications (2)

Application Number Title Priority Date Filing Date
CN202010981446.2A Division CN112214420B (en) 2015-12-01 2015-12-01 Data caching method, storage control device and storage equipment
CN202010983144.9A Division CN112231242B (en) 2015-12-01 2015-12-01 Data caching method, storage control device and storage equipment

Publications (2)

Publication Number Publication Date
CN107430551A CN107430551A (en) 2017-12-01
CN107430551B true CN107430551B (en) 2020-10-23

Family

ID=58796064

Family Applications (3)

Application Number Title Priority Date Filing Date
CN202010981446.2A Active CN112214420B (en) 2015-12-01 2015-12-01 Data caching method, storage control device and storage equipment
CN202010983144.9A Active CN112231242B (en) 2015-12-01 2015-12-01 Data caching method, storage control device and storage equipment
CN201580054160.7A Active CN107430551B (en) 2015-12-01 2015-12-01 Data caching method, storage control device and storage equipment

Family Applications Before (2)

Application Number Title Priority Date Filing Date
CN202010981446.2A Active CN112214420B (en) 2015-12-01 2015-12-01 Data caching method, storage control device and storage equipment
CN202010983144.9A Active CN112231242B (en) 2015-12-01 2015-12-01 Data caching method, storage control device and storage equipment

Country Status (2)

Country Link
CN (3) CN112214420B (en)
WO (1) WO2017091984A1 (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109240946B (en) * 2018-09-06 2024-09-13 平安科技(深圳)有限公司 Multi-level caching method of data and terminal equipment
CN109144431B (en) * 2018-09-30 2021-11-02 华中科技大学 Data block caching method, device, device and storage medium
CN111400203A (en) * 2019-01-02 2020-07-10 钜泉光电科技(上海)股份有限公司 System architecture, memory mapping establishing method and releasing method, and chip design method
CN110971962B (en) * 2019-11-30 2022-03-22 咪咕视讯科技有限公司 Slice caching method and device and storage medium
CN113254893B (en) * 2020-02-13 2023-09-19 百度在线网络技术(北京)有限公司 Identity verification method and device, electronic equipment and storage medium
CN111339143B (en) * 2020-02-27 2023-04-25 郑州阿帕斯数云信息科技有限公司 Data caching method and device and cloud server
CN112035529B (en) * 2020-09-11 2024-07-02 北京字跳网络技术有限公司 Caching method, caching device, electronic equipment and computer readable storage medium
CN113098973B (en) * 2021-04-13 2022-05-20 鹏城实验室 Data transmission method, system, storage medium and terminal device in packet-level network
CN116467353B (en) * 2023-06-12 2023-10-10 天翼云科技有限公司 A cache method and system based on LRU differentiation adaptive adjustment
CN117149836B (en) * 2023-10-27 2024-02-27 联通在线信息科技有限公司 Cache processing method and device
CN118277435B (en) * 2024-06-03 2024-09-06 北京鼎泰智源科技有限公司 Query interface data processing system
CN118733490B (en) * 2024-06-05 2024-12-24 浙江睿兆芯半导体科技有限公司 A data storage system with multi-segment cache function

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5224217A (en) * 1988-12-30 1993-06-29 Saied Zangenehpour Computer system which uses a least-recently-used algorithm for manipulating data tags when performing cache replacement
CN1679004A (en) * 2002-07-04 2005-10-05 索尼株式会社 Cache device, cache data management method, and computer program
CN103019962A (en) * 2012-12-21 2013-04-03 华为技术有限公司 Data cache processing method, device and system
CN103491075A (en) * 2013-09-09 2014-01-01 中国科学院计算机网络信息中心 Method and system for dynamically adjusting cached resource records of DNS recursive server
CN104106061A (en) * 2012-02-08 2014-10-15 国际商业机器公司 Forward progress mechanism for stores in the presence of load contention in a system favoring loads
CN104572528A (en) * 2015-01-27 2015-04-29 东南大学 Method and system for processing access requests by second-level Cache
KR20150079413A (en) * 2013-12-31 2015-07-08 삼성전자주식회사 Cache replacement policy methods and systems
CN104994152A (en) * 2015-06-30 2015-10-21 中国科学院计算技术研究所 Web cooperative caching system and method

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003006003A (en) * 2001-06-18 2003-01-10 Mitsubishi Electric Corp Dma controller and semiconductor integrated circuit
US20140115260A1 (en) * 2012-10-18 2014-04-24 Oracle International Corporation System and method for prioritizing data in a cache
CN102945207A (en) * 2012-10-26 2013-02-27 浪潮(北京)电子信息产业有限公司 Cache management method and system for block-level data
CN103268292B (en) * 2013-06-13 2016-02-10 江苏大学 A kind of method and long-lived outer deposit system of high speed extending the non-volatile external memory life-span
JP6027504B2 (en) * 2013-08-02 2016-11-16 日本電信電話株式会社 Application server and cache control method
US9378151B2 (en) * 2013-08-05 2016-06-28 Avago Technologies General Ip (Singapore) Pte. Ltd. System and method of hinted cache data removal
KR102147356B1 (en) * 2013-09-30 2020-08-24 삼성전자 주식회사 Cache memory system and operating method for the same
CN104090852B (en) * 2014-07-03 2017-04-05 华为技术有限公司 The method and apparatus of management hybrid cache
CN104239233B (en) * 2014-09-19 2017-11-24 华为技术有限公司 Buffer memory management method, cache management device and caching management equipment
CN104572491B (en) * 2014-12-30 2017-10-17 华为技术有限公司 A kind of read buffer management method and device based on solid state hard disc

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5224217A (en) * 1988-12-30 1993-06-29 Saied Zangenehpour Computer system which uses a least-recently-used algorithm for manipulating data tags when performing cache replacement
CN1679004A (en) * 2002-07-04 2005-10-05 索尼株式会社 Cache device, cache data management method, and computer program
CN104106061A (en) * 2012-02-08 2014-10-15 国际商业机器公司 Forward progress mechanism for stores in the presence of load contention in a system favoring loads
CN103019962A (en) * 2012-12-21 2013-04-03 华为技术有限公司 Data cache processing method, device and system
CN103491075A (en) * 2013-09-09 2014-01-01 中国科学院计算机网络信息中心 Method and system for dynamically adjusting cached resource records of DNS recursive server
KR20150079413A (en) * 2013-12-31 2015-07-08 삼성전자주식회사 Cache replacement policy methods and systems
CN104572528A (en) * 2015-01-27 2015-04-29 东南大学 Method and system for processing access requests by second-level Cache
CN104994152A (en) * 2015-06-30 2015-10-21 中国科学院计算技术研究所 Web cooperative caching system and method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
PSC: a priority selected cache algorithm for streaming video over Internet;Shin-Hung Chang等;《The 11th IEEE International Conference on Networks, 2003. ICON2003.》;IEEE;20040226;第191-196页 *
实时数据库系统关键技术及实现;叶建位等;《计算机应用研究》;20050331(第3期);第45-47页 *

Also Published As

Publication number Publication date
CN112214420B (en) 2024-11-29
CN112231242B (en) 2024-11-29
CN112231242A (en) 2021-01-15
CN107430551A (en) 2017-12-01
WO2017091984A1 (en) 2017-06-08
CN112214420A (en) 2021-01-12

Similar Documents

Publication Publication Date Title
CN107430551B (en) Data caching method, storage control device and storage equipment
US10133679B2 (en) Read cache management method and apparatus based on solid state drive
US10380035B2 (en) Using an access increment number to control a duration during which tracks remain in cache
JP6613375B2 (en) Profiling cache replacement
US8463846B2 (en) File bundling for cache servers of content delivery networks
US9779027B2 (en) Apparatus, system and method for managing a level-two cache of a storage appliance
CN108920387B (en) Method and device for reducing read delay, computer equipment and storage medium
JP6106028B2 (en) Server and cache control method
US9727479B1 (en) Compressing portions of a buffer cache using an LRU queue
CN106527988A (en) SSD (Solid State Drive) data migration method and device
US11809330B2 (en) Information processing apparatus and method
CN102737068B (en) A kind of method and apparatus for being used to carry out retrieval data cache management
CN110147331A (en) Caching data processing method, system and readable storage medium storing program for executing
CN109002503A (en) A kind of metadata read method, device, equipment and readable storage medium storing program for executing
WO2020063355A1 (en) Method and device for buffering data blocks, computer device, and computer-readable storage medium
CN108959500A (en) A kind of object storage method, device, equipment and computer readable storage medium
CN109002400B (en) Content-aware computer cache management system and method
US9851925B2 (en) Data allocation control apparatus and data allocation control method
CN108664217A (en) A kind of caching method and system reducing the shake of solid-state disc storaging system write performance
CN101241501A (en) A File System Construction Method Applicable to Caching Proxy Server Architecture
US20210141738A1 (en) Method and Apparatus for Characterizing Workload Sequentiality for Cache Policy Optimization
CN110658999A (en) Information updating method, device, equipment and computer readable storage medium
CN112445794B (en) Caching method of big data system
CN108984432B (en) Method and device for processing IO (input/output) request
CN108287667A (en) A kind of method and its device accessing data

Legal Events

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