Data caching method, storage control device, and storage device
By setting up a multi-level cache collaborative operation mechanism in the storage server, the problem of lack of collaborative operation between the application server and the storage server is solved, duplicate data storage is reduced, hot data caching time is extended, and IO request response speed is improved.
Patent Information
- Application Number
- CN202010981446.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2015-12-01
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2035-12-01
AI Technical Summary
In the prior art, there is a lack of a mechanism for collaborative operation between the application server and the storage server, resulting in the same data being repeatedly stored in both caches, or the hot data being not cached in both caches, resulting in delayed data reading speed.
Set up a multi-level cache collaborative operation mechanism in the storage server. By monitoring specific trigger conditions, obtaining data block characteristics information in the first-level cache, determining whether it is stored in the second-level cache, and adjusting the elimination priority in the second-level cache. To reduce duplicate data and extend the cache time of hot data.
By coordinating the data in the first-level cache and the second-level cache, we reduce the data blocks of repeated storage, extend the cache time of hot data, improve the response speed of IO requests, and save storage resources.
Smart Images

Figure CN112214420B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data storage technology, and in particular to data cache technology. Background Art
[0002] 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 greatly increased, which requires accelerating the processing capabilities of I / O requests to access storage servers in order to quickly respond to user access needs.
[0003] The prior art generally adopts a cache method to speed up the processing capability of I / O requests, that is, cache is 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.
[0004] When the application server receives an I / O request, it first accesses the data block in the cache of the application server. If there is no hit, the I / O request is transmitted to the storage server. If there is no hit in the storage server either, the data needs to be read from the hard disk.
[0005] Since the storage space of the application server's cache is smaller than that of the storage server's cache, the data cached in the upper-level cache may be eliminated soon. In this way, after the data block requested by the I / O request is eliminated by the application server's cache, it can be hit in the storage server's cache, thereby quickly responding to the I / O request.
[0006] However, there is a lack of a mechanism for coordinated operation between the cache in the application server and the cache in the storage server. As a result, the same data may often be cached in both caches, causing a waste of storage resources. It is also possible that some hot data is not cached in both caches and needs to be read from the hard disk, causing a delay in data reading speed. Summary of the invention
[0007] The present application provides a data caching method, a storage device, and a data processing system to provide a collaborative operation mechanism of a multi-level cache.
[0008] A first aspect of the present invention provides a data caching method, which is applied to a storage server, wherein the storage device includes a first cache, a second cache and a storage unit, wherein the first cache provides data caching for an application server, and the second cache is used to provide data caching for the storage unit. When the storage server detects a first trigger condition, characteristic information of a first data block cached in the first cache is obtained, and then it is determined whether the first data block is stored in the second cache based on the characteristic information of the first data block; when it is determined that the first data block is stored in the second cache, the level of elimination priority of the first data block in the second cache is adjusted. The characteristic information of the first data block is determined by the data content of the first data block.
[0009] According to the data cached in the first-level cache and the second-level cache, the elimination priority level of the data blocks cached in the second cache is adjusted, thereby controlling the elimination order of the data cached in the second cache, reducing the duplicate data cached in the first cache and the second cache, or extending the cache time of hot data in the second-level cache, and improving the response speed of IO requests.
[0010] 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 cache time of the first 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 elimination priority level of the first data block in the second cache can be increased.
[0011] In this way, when it is determined that there is a data block in the second cache that is identical to the data block newly written into the first cache, or there is a data block that is identical to the hot data in the first cache, the elimination priority level of the same data block in the second cache is increased so that it is eliminated first, thereby reducing the data blocks that are repeatedly stored in the first cache and the second cache, increasing the total amount of data cached in the first cache and the second cache, and saving storage resources.
[0012] 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, when it is determined that the first data block is stored in the second cache, the elimination priority level of the first data block in the second cache is reduced.
[0013] In this way, when a data block is deleted 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 will be lowered. In this way, the data deleted from the first cache can be stored in the second cache longer. When there is an IO request to access the data block next time, it can hit the second cache without being obtained from the hard disk, thereby improving the response speed of the IO request.
[0014] Optionally, the storage device stores an index record of the second cache, the index record of the second cache includes data feature identifiers of data blocks stored in the second cache, the size of the data blocks stored in the second cache is equal to the size of the first data blocks, the data feature identifier of each data block stored in the second cache is determined by the data content of each data block stored in the second cache; the feature information of the first data block is obtained according to the data content of each first data block; and the index record of the second cache is queried according to the data feature identifier of the first data block to determine whether each first data block is stored in the second cache.
[0015] By establishing an index table, it is possible to quickly determine whether the first data block is stored in the second cache.
[0016] Optionally, the storage device stores an address table, which records the characteristic identifier and storage address of the second data block cached in the second cache. After determining 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 elimination level of the first data block in the second cache is adjusted. By establishing the address table, the position of the first data block in the second cache can be quickly found, so that the elimination priority level of the first data block in the second cache can be adjusted.
[0017] Optionally, the second cache index record only records the data identifiers of the data blocks written into the second cache in the most recent period of time, which can reduce the space occupied by the second cache index record and the time for table lookup.
[0018] Optionally, when the storage server detects a second trigger condition, characteristic information of a second data block cached in the second cache is obtained, and then whether the second data block is stored in the first cache is determined based on the characteristic information of the second data block; when it is determined that the second data block is stored in the first cache, the level of elimination priority of the second data block in the second cache is adjusted.
[0019] In this way, the data status 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 determining whether the data cached in the second cache is cached in the first cache, thereby controlling the elimination order of the data cached in the second cache, thereby reducing the duplicate data cached in the first cache and the second cache.
[0020] 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, when it is determined that the second data block is stored in the first cache, the elimination priority level of the second data block from the second cache is increased.
[0021] In this way, when it is determined that there is a data block in the first cache that is identical to the data in the second cache, the elimination priority level of the data block in the second cache is increased so that it is eliminated first, thereby reducing the data blocks that are 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, thereby improving the response speed of IO requests.
[0022] Optionally, the second trigger condition is: deleting the second data block in the second cache, and the method further includes:
[0023] When 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 reduced.
[0024] 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. In this way, when an IO request accesses the data block, it can hit in the second cache, thereby improving the response speed of the IO request.
[0025] Optionally, the second trigger condition is: writing data containing the second data block into the second cache; under this condition, when it is determined that the second data block is stored in the first cache, increasing the elimination priority level of the second data block in the second cache.
[0026] In this way, if the data block newly cached to the second cache is also stored in the first cache, the elimination priority level of the newly cached data block is increased, so that the data block newly cached to the second cache is eliminated as soon as possible, reducing the duplicate data in the first cache and the second cache, increasing the cached data, and improving the IO request hit rate.
[0027] Optionally, the storage device stores an index record of the first cache, the index record of the first cache including a data feature identifier of at least one data block stored in the first cache, the size of each data block being a predetermined size, and the data feature identifier of each data block being determined by the data content contained in each data block; the feature identifier of the second data block is obtained based on the data content contained in the second data block; and when determining whether the second data block is stored in the first cache, the index record of the first cache is queried based on the data feature identifier of each second data block.
[0028] In this way, by setting the first cache index record, data identical to the data in the second cache can be quickly found in the first cache.
[0029] Optionally, the first cache index record only records the data identifiers of the data blocks written into the first cache in the most recent period of time, which can reduce the space occupied by the first cache index record and reduce the time for table lookup.
[0030] A second aspect of the present invention provides a data caching method, which is applied to a storage device, wherein the storage device includes a first cache, a second cache and a storage unit, wherein the first cache provides data caching for an application server, and the second cache is used to provide data caching for the storage unit. When the storage server detects a second trigger condition, characteristic information of a second data block cached in the second cache is obtained; based on the characteristic information of the second data, it is determined whether the second data block is stored in the first cache; and when it is determined that the second data block is stored in the first cache, the level of elimination priority of the second data block in the second cache is adjusted.
[0031] In this way, the data status 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 determining whether the data cached in the second cache is cached in the first cache, thereby controlling the elimination order of the data cached in the second cache, thereby reducing the duplicate data cached in the first cache and the second cache or delaying the elimination of data in the second cache that is not stored in the first cache, thereby increasing the response speed of IO requests.
[0032] 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, the elimination priority level of the second data block in the second cache is increased.
[0033] In this way, when it is determined that there is a data block in the first cache that is identical to the data in the second cache, the elimination priority level of the data block in the second cache is increased so that it is eliminated first, thereby reducing the data blocks that are repeatedly stored in the first cache and the second cache, increasing the total amount of data cached in the first cache and the second cache, and saving storage resources.
[0034] Optionally, the second trigger condition is: deleting the second data block in the second cache, and when the storage server determines that the second data is not stored in the first cache, the storage server reduces the elimination priority level of the second data in the second cache.
[0035] 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. In this way, when an IO request accesses the data block, it can hit in the second cache, thereby improving the response speed of the IO request.
[0036] Optionally, if the second trigger condition is: writing data including the second data block into the second cache;
[0037] When it is determined that the second data block is stored in the first cache, the elimination priority level of the second data block in the second cache is increased.
[0038] In this way, if the data block newly cached to the second cache is also stored in the first cache, the elimination priority level of the newly cached data block in the second cache is increased, so that the data block newly cached to the second cache is eliminated as soon as possible, reducing the duplicate data in the first cache and the second cache, increasing the cached data, and saving storage resources.
[0039] Optionally, the storage device stores an index record of the first cache, the index record of the first cache includes data feature identifiers of data blocks stored in the first cache, the size of the data blocks stored in the first cache is equal to the size of the second data blocks, and the data feature identifier of each data block stored in the second cache is determined by the data content of each data block stored in the second cache; the index record of the first cache is queried according to the data feature identifier of each second data block to determine whether the second data block is stored in the first cache.
[0040] In this way, by setting the first cache index record, data identical to the data in the second cache can be quickly found in the first cache.
[0041] Optionally, the first cache index record only records the data identifiers of the data blocks written into the first cache in the most recent period of time, which can reduce the space occupied by the first cache index record and reduce the time for table lookup.
[0042] 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 providing data cache for an application server, the second cache providing data cache for the storage unit, a first monitoring unit, a first acquisition unit, a first determination unit and a first adjustment unit. When the first monitoring unit monitors the first trigger condition, the first acquisition unit acquires characteristic information of a first data block cached in the first cache; the first determination unit determines whether the first data block is stored in the second cache based on the characteristic information of the first data block, and when the first determination unit determines that the first data block is stored in the second cache, the elimination priority level of the first data block in the second cache is adjusted.
[0043] In this way, according to the data cached in the first-level cache and the second-level cache, the elimination priority level of the data blocks cached in the second cache is adjusted, thereby controlling the elimination order of the data cached in the second cache and improving the response speed of IO requests.
[0044] In a first implementation manner of the third aspect, the first trigger condition is: according to a first data write request, the data to be written including at least one of the first data blocks is written into the first cache, or the cache 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 increases the level of the elimination priority of the first data block in the second cache.
[0045] In this way, when it is determined that there is a data block in the second cache that is identical to the data block newly written into the first cache, or there is a data block that is identical to the hot data in the first cache, the elimination priority level of the identical data block in the second cache is increased so that it is eliminated first, thereby reducing the data blocks that are repeatedly stored in the first cache and the second cache, increasing the total amount of data cached in the first cache and the second cache, and thus improving the response speed of IO requests.
[0046] Optionally, the first trigger condition is: receiving a deletion request to delete the first data block in the first cache;
[0047] In a case where the first determining unit determines that the first data block is stored in the second cache, the first adjusting unit reduces a level of elimination priority of the first data block in the second cache.
[0048] In this way, when a data block is deleted 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 will be lowered. In this way, the data deleted from the first cache can be stored in the second cache longer. When there is an IO request to access the data block next time, it can hit the second cache without being obtained from the hard disk, thereby improving the response speed of the IO request.
[0049] Optionally, the storage device stores an index record of the second cache, the index record of the second cache includes a data feature identifier of at least one second data block stored in the second cache, the size of the second data block is equal to the size of the first data block, and the data feature identifier of each second data block is determined by data content contained in each second data block;
[0050] The first determination unit queries the index record of the second cache according to the data feature identifier of the first data block to determine whether each first data block is stored in the second cache. By establishing an index table, it is possible to quickly determine whether the first data block is stored in the second cache.
[0051] In a fourth implementation of the third aspect, the storage device stores an address table, the address table records the characteristic identifier and storage address of the second data block cached in the second cache, after determining 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 elimination level of the first data block in the second cache is adjusted. By establishing the address table, the position of the first data block in the second cache can be quickly found, so that the elimination priority level of the first data block in the second cache can be adjusted.
[0052] Optionally, the second cache index record only records the data identifiers of the data blocks written into the second cache in the most recent period of time, which can reduce the space occupied by the second cache index record and the time for table lookup.
[0053] Optionally, the storage control device further includes a second monitoring unit, a second acquiring unit, a second determining unit and a second adjusting unit.
[0054] When the second monitoring unit detects the second trigger condition, the second acquisition unit acquires characteristic information of the second data block cached in the second cache; the second determination unit determines whether the second data block is stored in the first cache based on the characteristic information of the second data block. When the second determination unit determines that the second data block is stored in the first cache, the second adjustment unit adjusts the level of elimination priority of the second data block in the second cache.
[0055] In this way, the elimination priority level of the data blocks cached in the second cache can be adjusted by monitoring the data status in the second cache and judging whether the data cached in the second cache is cached in the first cache, thereby controlling the elimination order of the cached data in the second cache and improving the response speed of IO requests.
[0056] 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 determining unit determines that the second data block is stored in the first cache, the second adjusting unit
[0057] The level of the elimination priority of the second data block from the second cache is increased.
[0058] In this way, when it is determined that there is a data block in the first cache that is identical to the data in the second cache, the elimination priority level of the data block in the second cache is increased so that it is eliminated first, thereby reducing the data blocks that are 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, thereby improving the response speed of IO requests.
[0059] Optionally, 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 reduces the elimination priority level of the second data in the second cache.
[0060] 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. In this way, when an IO request accesses the data block, it can hit in the second cache, thereby improving the response speed of the IO request.
[0061] Optionally, the second trigger condition monitored by the second monitoring unit is: writing data containing 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 increases the level of elimination priority of the second data block in the second cache.
[0062] In this way, if the data block newly cached to the second cache is also stored in the first cache, the elimination priority level of the newly cached data block is increased, so that the data block newly cached to the second cache is eliminated as soon as possible, reducing the duplicate data in the first cache and the second cache, increasing the cached data, and improving the IO request hit rate.
[0063] Optionally, the storage device stores an index record of the first cache, the index record of the first cache includes data feature identifiers of data blocks stored in the first cache, the size of each 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 is determined by data content of each data block;
[0064] The second confirmation unit queries the index record of the first cache according to the data feature identifier of each second data block to determine whether the second data block is stored in the first cache.
[0065] In this way, by setting the first cache index record, data identical to the data in the second cache can be quickly found in the first cache.
[0066] Optionally, the first cache index record only records the data identifiers of the data blocks written into the first cache in the most recent period of time, which can reduce the space occupied by the first cache index record and reduce the time for table lookup.
[0067] 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, wherein the first cache provides data cache for an application server, and the second cache provides data cache for the storage unit, and the storage control device includes: a second monitoring unit, a second acquisition unit, a second determination unit and a second adjustment unit. When the second monitoring unit detects the second trigger condition, the second acquisition unit acquires characteristic information of a second data block cached in the second cache; the second determination unit determines whether the second data block is stored in the first cache according to the characteristic information of the second data block;
[0068] The second adjusting unit adjusts the level of the elimination priority of the second data block in the second cache when the second determining unit determines that the second data block is stored in the first cache.
[0069] In this way, the data status 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, thereby controlling the elimination order of the cached data in the second cache and improving the response speed of IO requests.
[0070] Optionally, the second trigger condition monitored by the second monitoring unit is: a cache time of the second data block in the second cache exceeds a predetermined time;
[0071] In a case where the second determining unit determines that the second data block is stored in the first cache, the second adjusting unit increases a level of elimination priority of the second data block from the second cache.
[0072] In this way, when it is determined that there is a data block in the first cache that is identical to the data in the second cache, the elimination priority level of the data block in the second cache is increased so that it is eliminated first, thereby reducing the data blocks that are 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, thereby improving the response speed of IO requests.
[0073] Optionally, the second trigger condition monitored by the second monitoring unit is: deleting the second data block in the second cache,
[0074] When the second determining unit determines that the second data is not stored in the first cache, the second adjusting unit reduces the level of the elimination priority of the second data in the second cache.
[0075] 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. In this way, when an IO request accesses the data block, it can hit in the second cache, thereby improving the response speed of the IO request.
[0076] Optionally, the second trigger condition monitored by the second monitoring unit is: writing data including the second data block into the second cache;
[0077] In a case where the second determining unit determines that the second data block is stored in the first cache, the second adjusting unit increases the level of the elimination priority of the second data block in the second cache.
[0078] In this way, if the data block newly cached to the second cache is also stored in the first cache, the elimination priority level of the newly cached data block is increased, so that the data block newly cached to the second cache is eliminated as soon as possible, reducing the duplicate data in the first cache and the second cache, increasing the cached data, and saving cache resources.
[0079] Optionally, the storage device stores an index record of the first cache, the index record of the first cache includes data feature identifiers of data blocks stored in the first cache, the size of each 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 is determined by the data content of each data block;
[0080] The second confirmation unit queries the index record of the first cache according to the data feature identifier of each second data block to determine whether the second data block is stored in the first cache.
[0081] In this way, by setting the first cache index record, data identical to the data in the second cache can be quickly found in the first cache.
[0082] Optionally, the first cache index record only records the data identifiers of the data blocks written into the first cache in the most recent period of time, which can reduce the space occupied by the first cache index record and reduce the time for table lookup.
[0083] A fifth aspect of the present invention provides a storage device, comprising a processor, a memory, a first cache, a second cache and a storage unit, wherein the first cache provides data cache for an application server, the second cache is used to provide data cache for the storage unit, the memory is used to store computer execution instructions, and when the storage device is running, the processor executes the computer execution instructions stored in the memory so that the storage device executes the data caching method provided in the first aspect or the data caching method provided in the second aspect.
[0084] The embodiment of the present invention sets a first cache on the storage server side to cache data from the application cache of the application server, then determines whether the second cache stores the same data as the first cache, and adjusts the data elimination priority level in the second cache according to the determination result. 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, cache resources are saved, and the elimination of data in the second cache that is not the same as the data in the first cache, or the same as the data to be deleted in the first cache, can be temporarily postponed, thereby increasing the response speed of IO requests. BRIEF DESCRIPTION OF THE DRAWINGS
[0085] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0086] Figure 1 An architectural diagram of a data processing system in which a storage server in the prior art provides storage services to an application server.
[0087] Figure 2 This is an architecture diagram of a data processing system in which a storage server provides storage services to an application server in an embodiment of the present invention.
[0088] Figure 3 The present invention is a flowchart of a method for coordinating data blocks between a first cache and a second cache under a trigger condition in an embodiment of the present invention.
[0089] Figure 4A and Figure 4B A schematic diagram of the index record of the second cache.
[0090] Figure 5 for Figure 3 In the illustrated embodiment, a schematic diagram of data block coordination between a first cache and a second cache is shown.
[0091] Figure 6 The present invention is a flowchart of a method for coordinating data blocks between a first cache and a second cache under another trigger condition in an embodiment of the present invention.
[0092] Figure 7 for Figure 6 In the illustrated embodiment, a schematic diagram of data block coordination between a first cache and a second cache is shown.
[0093] Figure 8 The present invention is a flowchart of a method for coordinating data blocks between a first cache and a second cache under another trigger condition in an embodiment of the present invention.
[0094] Fig. 9 for Figure 8 In the illustrated embodiment, a schematic diagram of data block coordination between a first cache and a second cache is shown.
[0095] Fig.10 The present invention is a flowchart of a method for coordinating data blocks between a first cache and a second cache under another trigger condition in an embodiment of the present invention.
[0096] Fig.11 for Fig.10In the illustrated embodiment, a schematic diagram of data block coordination between a first cache and a second cache is shown.
[0097] Fig.12 The present invention is a flowchart of a method for coordinating data blocks between a first cache and a second cache under another trigger condition in an embodiment of the present invention.
[0098] Fig.13 for Fig.12 In the illustrated embodiment, a schematic diagram of data block coordination between a first cache and a second cache is shown.
[0099] Fig.14 The present invention is a flowchart of a method for coordinating data blocks between a first cache and a second cache under another trigger condition in an embodiment of the present invention.
[0100] Fig.15 for Fig.14 In the illustrated embodiment, a schematic diagram of data block coordination between a first cache and a second cache is shown.
[0101] Fig.16 A structural diagram of a storage control device provided in an embodiment of the present invention.
[0102] Fig.17 A structural diagram of another storage control device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0103] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. Figure 1 As shown, it is an architecture diagram of a data processing system 100 in the prior art in which a storage server 110 provides storage services for an application server 120 .
[0104] The application server 120 may be a shared server for simultaneous access by multiple users, such as a database server, a virtual machine management server, a desktop cloud server, etc. The storage server 110 provides data storage services for the application server 120 .
[0105] The application server 120 includes an application processor 121, an application cache 122, an extended cache 123 and other components. The storage server 110 includes a storage processor 111, a storage cache 112, a storage unit 113 and other components. The application cache 122 provides data cache for the application server 120, which is generally a high-speed cache such as a dynamic random access memory (DRAM). However, since the price of DRAM is relatively expensive, the capacity is generally small. The extended cache 123 is generally a solid-state disk (SSD). Since the price of SSD memory is relatively cheap compared to DRAM, but the speed is relatively low, it is generally used as an extended cache of the application cache 122, that is, for storing data eliminated from the application cache 122. Since the capacity of the application cache 122 is relatively small, the data cached in the application cache 122 may be eliminated quickly, so by caching the data eliminated by the application cache 122 through the extended cache 123, the response speed of the IO request can be increased.
[0106] The storage cache 112 provides data cache for the storage unit 113, such as a hard disk, and is generally a DRAM. The data read from the storage unit 113 can be cached, and the data written by the application server 100 to the storage server 110 can also be cached. Since 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 when caching data, 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 in the application server 120 to be the same as the data cached in the storage cache 112 of the storage server 110. In addition, when the data in the extended cache 123 is eliminated, the data cached in the storage cache 112 that is the same as the eliminated data block may also be in a position to be eliminated soon. In this way, after the data eliminated in the extended cache 123 is also eliminated soon in the storage cache 112, 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.
[0107] It can be seen that, in the prior art, since the storage server 110 cannot obtain the data cached in the extended cache 123 in the application server 120 and lacks a collaborative operation mechanism between the two caches, the response speed of the IO request is affected or storage resources are wasted.
[0108] The embodiment of the present invention sets the cache of the application server on the side of the storage server, for example, the first cache on the storage server, to cache the data of the application cache of the application server, and then judges whether the second cache of the storage server stores the same data as the first cache, and adjusts the elimination priority level of the data in the second cache according to different judgment results. For example, if it is determined that the second cache caches the same data as the data cached in the first 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 caches the same data as the data deleted from the first cache, the data in the second cache that is the same as the deleted data will be stored first, if the first cache does not cache the same data as the data to be deleted in the second cache, the data to be deleted from the second cache will not 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 is reduced, and the deletion of the data to be deleted in the second cache that is not the same as the data cached in the first cache, or the data that is the same as the data to be deleted in the first cache can be temporarily postponed, so as to increase the response speed of the IO request.
[0109] The technical solution of the present invention is described in detail below in conjunction with specific embodiments.
[0110] like Figure 2 , which is an architecture diagram of a data processing system 200 in which a storage server 210 provides services to an application server 220 in an embodiment of the present invention.
[0111] In this embodiment, the application server 220 includes an application processor 221, an application cache 222, and other components, such as memory, etc. Since other components are not involved in this embodiment of the present invention, they are not shown in the figure.
[0112] 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 components. The other components are not involved in the embodiment of the present invention and are not shown in the figure.
[0113] and Figure 1 Compared with the data processing system 100 in the embodiment, the extended cache 123 in the application server 120 is removed in this embodiment, and a first cache 212 is added to the storage server 210. In the 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 Figure 1However, in fact, in other embodiments of the present invention, the application server may no longer include the application cache 222, and the first cache 212 set in the storage server 210 can completely replace the various caches of the application server. Since those skilled in the art can fully understand the above-mentioned extended embodiment, the specific implementation method is not repeated here.
[0114] The first cache 212 is provided by the storage server 210 to the application server 220 for use, and is used to cache data in the application server 220, for example, cache data deleted from the application cache 222. When the data in the application cache 222 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 into 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, and the application processor 221 can control the data in the first cache according to the returned data address. The control can be to read and eliminate the data blocks in the first cache 212. When the application processor 221 wants to eliminate data in the first cache 212, the application processor 221 sends a data elimination request to the storage server 210, and 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 eliminated data contained in the elimination request, and then eliminates it.
[0115] The second cache 213 provides data cache for the storage unit 214 .
[0116] 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 obtain the data previously cached in the application cache 222 through the data cached in the first cache 212. In this way, the storage processor 211 can obtain the data cached in the first cache 212 and coordinate the data blocks stored in the first cache 212 and the second cache 213 to improve the response speed of IO requests. The coordination method of the data in the first cache 212 and the second cache 213 will be described in detail below.
[0117] 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 the embodiments of the present invention.
[0118] The memory 215 may be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory, for storing computer-executable instructions 2151. Specifically, the computer-executable instructions 2151 may include program codes.
[0119] When the storage server 210 is running, the storage processor 211 runs the computer execution instruction 2151, which can execute Figure 3 , Figure 6 , Figure 8 , Fig.10 , Fig.12 and Fig.14 The process of the data coordination method in the first cache 212 and the second cache 213.
[0120] Figure 3 , Figure 6 , Figure 8 , Fig.10 , Fig.12 and Fig.14 The coordination method will be described in detail below.
[0121] In this embodiment, two cases are included. The first case is that the data cached in the first cache 212 is detected to trigger the coordination of the data cached in the first cache 212 and the second cache 213. The second case is that the data cached in the second cache 213 is detected to trigger the coordination of the data cached in the first cache 212 and the second cache 213. In actual products, only the data coordination method in the first case may be implemented, only the data coordination method in the second case may be implemented, or both data coordination methods may be implemented simultaneously.
[0122] The following will first describe a method for data coordination between the first cache 212 and the second cache 213 in a first case. In the first case, the data coordination between the first cache 212 and the second cache 213 is triggered under a first trigger condition, and the first trigger condition may be: the storage processor 211 receives a 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; the storage processor 211 receives a 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.
[0123] like Figure 3As shown, it is a flowchart of a method for coordinating data blocks between the first cache 212 and the second cache 212 when 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 caches the data contained in the data cache request to the first cache 212 according to the data cache request.
[0124] Step S301, the storage processor 211 receives a data cache request sent by the application server 220, and caches the data included in the data cache request to the first cache 212 according to the data cache request, and obtains a feature identifier of at least one first data block corresponding to the cache request.
[0125] In this embodiment, the storage processor 211 acquires the feature identifier of the first data, including: obtaining the data feature identifier of the first data block according to the data content included in the first data block.
[0126] The characteristic identifier of the first data block is a code that can uniquely identify the first data block, which is parsed based on the data content contained in the first data block. The specific parsing method can be to perform a hash operation on the first data block itself and use the calculated hash value as the characteristic identifier of the first data block, or it can be a data characteristic identifier that can uniquely identify the first data block based on the characteristics of the data block set by the application running on the application server 220. For example, when the application server runs a data block library application, the first data block can be uniquely identified by the relative data block address (RDBA) of the fifth to eighth bytes of the first data block.
[0127] Step S302: The storage processor 211 determines whether the first data block is stored in the second cache 213 according to the feature identifier of the first data block.
[0128] 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. The size of the second data block is equal to the size of the first data block, and the method for obtaining the feature identifier of the second data block is also consistent with the method for obtaining the feature identifier of the first data block, which will not be repeated here.
[0129] In this way, the second cache index record 2153 may be queried according to the feature identifier of each first data block to determine whether each first data block is stored in the second cache 213 .
[0130] The data block identifiers stored in the second cache index record 2153 may be feature identifiers of all second data blocks cached in the second cache 213, or 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 second data blocks in the second cache 213 are recorded in the second cache index record 2153, storage space will be wasted and the table lookup time will increase, thereby affecting performance. Therefore, in this embodiment, the second cache index record 2153 only maintains the data block identifiers of the data blocks cached in the second cache 213 within a preset time period, such as within 10 minutes. Specifically, Figure 4A and 4B As shown, the characteristic identifiers of the second data blocks 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 blocks are cached to the second cache, and each characteristic identifier of the second data block has a timestamp (such as 12:01, 12:02...12:10) for recording the time when the second data block corresponding to the characteristic identifier of the second data block is cached to the second cache 213. The time period can be 10 minutes, such as Figure 4A As shown, when a second data block a is cached in the second cache 213, the storage processor 211 obtains the characteristic identifier (An+1) of the second data block, and adds the obtained data identifier to the header position in the second cache index record 2153, adds a timestamp (12:00), and starts timing. Figure 4B As shown, if the current time is 12:10, and the time when the characteristic identifier (An-6) of the second data block b in the second cache index record 2153 reaches the preset time period (10 minutes), it will be deleted from the second cache index record 2153.
[0131] In this case, only the data cached in the second cache will be recorded in the second cache index record. When the second cache index record 2153 records a feature identifier that is the same as the feature identifier of the first data block, it is determined that the first data block is stored in the second cache 213.
[0132] The second cache index record 2153 may also be a hash table, the key of the hash table is the second data block identifier, and the value is 0 or 1, 0 indicates that the second data block corresponding to the data feature identifier does not exist in the second cache 213, and 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, the value of the feature identifier corresponding to the deleted data block may be set to 0.
[0133] In this case, when determining whether the first data block is stored in the second cache 213, first query whether the characteristic identifier of the first data block is recorded in the second cache index record 2153. When the characteristic identifier of the first data block is recorded in the second cache index record 2153, determine the corresponding Value value. When the Value value is 1, it is determined that the first data block is stored in the second cache 213.
[0134] Step S303, when it is determined that the first data block is stored in the second cache 213, the storage processor 211 finds the first data block in the second cache 213 according to the data feature identifier and address table of the first data block, and when it is determined that the first data block is not stored in the second cache 213, returns to step S301.
[0135] The address table records the characteristic 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 obtains the data characteristic identifier of the second data block, and establishes a mapping relationship between the data characteristic identifier of the second data block and the storage address to form the address table. When the second data block cached in the second cache 213 is eliminated, the storage processor 211 obtains the data block identifier of the second data block, and then deletes the mapping relationship corresponding to the second data block identifier from the address table, so that the address table is updated with the change of the data block cached in the second cache 213.
[0136] Step S304, after the storage processor 211 finds the first data block in the second cache 213, the elimination priority level of the first data block in the second cache 213 is increased, which may be increased to the highest level or to a preset priority level. If increased to the highest level, the first data block can be deleted from the second cache 213.
[0137] In this embodiment, the elimination order of each second data block is set by means of an elimination queue. The elimination queue can be a least recently used algorithm (Least Recently Used, LRU) queue, or a least frequently used algorithm (LFU) queue, or other algorithm queues for eliminating data in the cache.
[0138] like Figure 5 As shown, if the first data block a is cached to the first cache 212, the storage processor 211 determines that the characteristic identifier of the first data block a is An+1, and then finds the characteristic identifier An+1 in the second cache index record 2153, and then obtains the address of the data a corresponding to the characteristic identifier An+1 in the address table 2154, and finally adjusts the position of the data a in the LRU queue to a position to be eliminated first. The position to be eliminated first can be the end of the LRU queue or a position close to the end.
[0139] like Figure 6 As shown, it is a flowchart of a method for coordinating data blocks between the first cache 212 and the second cache 212 when the first trigger condition is that the storage processor 211 receives a data deletion request sent by the application server 220 .
[0140] Step S601: the storage processor 211 receives a first data block deletion request sent by the application server 220, finds the first data block in the first cache according to the address of the first data block included in the deletion request, and obtains a feature identifier of the first data block.
[0141] Step S602: The storage processor 211 determines whether the first data block is stored in the second cache 213 according to the feature identifier of the first data block.
[0142] Step S603, when it is determined that the first data block is stored in the second cache 213, the storage processor 211 finds the first data block in the second cache 213 according to the characteristic identifier and address table 2154 of the first data block. When it is determined that the first data block is not stored in the second cache 213, no operation is performed and the data status in the first cache 212 continues to be detected.
[0143] Step S604, after the storage processor 211 finds the first data block in the second cache 213, it reduces the elimination priority level of the first data block in the second cache, which may be reduced to the lowest level or to a preset priority level.
[0144] like Figure 7 As shown, if the first data block f is data to be deleted from the first cache 212 according to a data deletion request, the storage processor 211 determines the data feature identifier An+1 of the first data block constituting the first data (in this embodiment, the first data only includes one first data block), and then finds the data feature identifier An+1 in the second cache index record 2153, and then obtains the address of the data f corresponding to the data feature identifier An+1 in the address table 2154, and finally adjusts the position of the data f in the LRU queue to a position to be stored preferentially, which can be the head of the LRU queue or a position close to the head.
[0145] like Figure 8 As shown, it is a flowchart of a method for coordinating data blocks between the first cache 212 and the second cache 212 when the first trigger condition is that the time of the data cached in the first cache 212 exceeds a threshold.
[0146] Step S801: When the storage processor 211 detects that the first data block cached in the first cache 212 exceeds a threshold, the storage processor 211 obtains a feature identifier of the first data block.
[0147] Step S802: The storage processor 211 determines whether the first data block is stored in the second cache 213 according to the feature identifier of the first data block.
[0148] Step S803, when it is determined that the first data block is stored in the second cache 213, the storage processor 211 finds the first data block in the second cache 213 according to the feature identifier and address table 2154 of the first data block, and when it is determined that the first data block is not stored in the second cache 213, returns to step S301.
[0149] Step S804, after the storage processor 211 finds the first data block in the second cache 213, the elimination priority level of the first data block in the second cache is increased, which may be increased to the highest level or to a preset priority level.
[0150] like Fig. 9As shown, if the data of the first data block d in the first cache 212 exceeds a threshold, the storage processor 211 determines the data feature identifier An of the first data block d, and then finds the data feature identifier An in the second cache index record, and then obtains the address of the data block d corresponding to the data feature identifier An in the address table, and finally adjusts the position of the data d in the LRU queue to a position to be eliminated first. The position to be eliminated first can be the end of the LRU queue or a position close to the end.
[0151] The above is the first case, that is, detecting the situation of 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 introduced below, that is, detecting the situation of cached data in the second cache 213 triggers the method of data coordination between the first cache 212 and the second cache 213.
[0152] In the second case, the data coordination between 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; when data in the second cache is deleted; or the storage time of the data block in the second cache in the second cache exceeds a threshold. The following describes the coordination method of the data of the first cache and the second cache under these two trigger conditions.
[0153] like Fig.10 , which is a flowchart of a method for coordinating data in the first cache and the second cache when the second trigger condition is data cached in the second cache.
[0154] Step S1001: the storage processor 211 caches data into the second cache according to a data cache request, the cached data is divided into at least one second data block of a predetermined size, and then a feature identifier of the second data block is obtained.
[0155] The method for acquiring the feature identifier of the second data block is the same as the method for acquiring the data feature of the first data block, which will not be repeated here.
[0156] Step S1002: The storage processor 211 determines whether the second data is stored in the first cache according to a feature identifier of the second data.
[0157] In this embodiment, the memory 215 also 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, and the size of the first data block is equal to the size of the second data block.
[0158] In this way, the index record 2152 of the first cache may be queried according to the feature identifier of each second data block to determine whether each second data block is stored in the first cache 212 .
[0159] The data block identifiers stored in the index record of the first cache 212 may be feature identifiers of all first data blocks cached in the first cache 212, or feature identifiers of some 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 first data blocks in the first cache 212 are stored in the first cache index record, storage space will be wasted and table lookup time will be increased, thereby affecting performance. Therefore, in this embodiment, the first cache index record 2153 only maintains the first data block feature identifiers cached in the first cache 212 within a preset time period, such as within 10 minutes.
[0160] In this case, only the data cached in the first cache 212 will be recorded in the first cache index record 2152. When the first cache index record 2152 records a feature identifier that is the same as the feature identifier of the first data block, it is determined that the first data block is stored in the first cache 212.
[0161] 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, 0 indicates that the first data block corresponding to the data feature identifier does not exist in the first cache 212, and 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 of the feature identifier corresponding to the deleted data block may be set to 0.
[0162] In this case, when determining whether the second data block is stored in the first cache 212, first query whether the characteristic identifier of the first data block is recorded in the first cache index record 2152. When the characteristic identifier of the first data block is recorded in the first cache index record 2152, determine the corresponding Value value. When the Value value is 1, it is determined that the first data block is stored in the first cache 212.
[0163] 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 elimination priority level of the second data in the second cache 213 is increased, and the increase may be to the highest level or to 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.
[0164] like Fig.11 As shown, the characteristic 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 characteristic identifier of the data block a1 is found in the first cache index record 2152, which means that the second data a1 is stored in the first cache 212. The second data block a1 can be adjusted to the tail position of the LRU queue, or it can be adjusted to a position close to the tail.
[0165] like Fig.12 As shown, when the storage processor 211 deletes data from the second cache 213, a flowchart of the method for coordinating data in the first cache 212 and the second cache 213 is shown.
[0166] Step S1201: After determining a second data block to be deleted from the second cache 213, the storage processor 211 obtains a feature identifier of the second data block.
[0167] Step S1202: The storage processor 211 determines whether the second data block is stored in the first cache 212 according to a feature identifier of the second data.
[0168] Step S1203: when the storage processor 211 determines that the second data is stored in the first cache 212, the second data block is deleted.
[0169] Step S1204, when the storage processor 211 determines that the second data is not stored in the first cache 212, the elimination priority level of the second data in the second cache 213 is increased, and the increase may be increased to the highest level or 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.
[0170] like Fig.13As shown, the second data block f1 is the data block determined to be deleted from the second cache, and the characteristic identifier of the second data block f1 obtained is Bn-3. The characteristic identifier Bn-3 is not recorded in the first cache index record, which means that the second data block may not be stored in the first cache, so the second data block f1 is adjusted to the head position of the LRU queue in the second cache 213, or a position close to the head of the queue.
[0171] like Fig.14 As shown, it is a flow chart of a method for coordinating data of the first cache and the second cache when the storage time of the second data block in the second cache in the second cache exceeds a threshold.
[0172] Step S1401: when it is determined that the storage time of the second data block in the second cache exceeds a threshold, a feature identifier of the second data block is obtained.
[0173] Step S1402: The storage processor 211 determines whether the second data is stored in the first cache according to a feature identifier of the second data.
[0174] Step S1403 : when the storage processor 211 determines that the second data is stored in the first cache 212 , the elimination priority level of the second data in the second cache 213 is increased.
[0175] Step S1404: when the storage processor 211 determines that the second data is not stored in the first cache 212, the elimination priority level of the second data in the second cache 213 is reduced.
[0176] like Fig.15 As shown, when the cache time of the second data block c1 in the second cache exceeds a threshold, it is determined whether the characteristic identifier Bn of the second data block c1 is recorded in the first cache index record. When the characteristic 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 a position close to the end of the queue.
[0177] When the cache time of the second data block d1 in the second cache 213 exceeds a threshold, it is determined whether the characteristic identifier Bn-3 of the second data block d1 is recorded in the first cache index record. When the characteristic identifier of the second data block d1 is not recorded in the first index record, the second data block d1 is adjusted to the head of the LRU queue, or a position close to the head.
[0178] In other embodiments of the present invention, the application server may be application software in an electronic device, the application cache provides data cache for the application software, and the storage server is a storage device of the electronic device, providing storage services for the application software.
[0179] like Fig.16 As shown, a structural diagram of a storage control device is provided in an embodiment of the present invention.
[0180] 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 .
[0181] The first monitoring unit 1601 is used to detect the cached data in the first cache 212 to trigger data coordination between the first cache 212 and the second cache 213. There are three triggering conditions for data coordination between the first cache 212 and the second cache 213, which are: the first monitoring unit 1601 receives a 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 first monitoring unit 1601 receives a data deletion request sent by the application server 220; the first monitoring unit 1601 detects that the time of the data cached in the first cache exceeds a preset threshold.
[0182] When the first monitoring unit 1601 receives the data cache request sent by the application server 220, and caches the first data contained in the data cache request to the first cache 212 according to the data cache request, the acquisition unit 1602 acquires the characteristic identifier of the first data block constituting the first data. The method for acquiring the characteristic identifier of the first data block has been introduced before and will not be repeated here.
[0183] The determining unit 1603 determines whether the first data is stored in the second cache according to the feature 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 there is a second data block index record having the same data feature identifier as the first data block in the index record of the second cache, it is determined that the first data block is stored in the second cache 213.
[0184] When the determination unit 1603 determines that the first data block is stored in the second cache 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 then reduces the level of elimination priority of the first data block in the second cache, which can be reduced to the lowest level or to a preset priority level.
[0185] When the first monitoring unit 1601 detects that the first data block cached in the first cache 212 exceeds the threshold, the feature identifier of the first data block is obtained.
[0186] The determining unit 1603 determines whether the first data is stored in the second cache according to a feature identifier of the first data.
[0187] 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 increases the elimination priority level of the first data block in the second cache, which may be increased to the highest level or to a preset priority level.
[0188] like Fig.17 As shown, 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 .
[0189] The second monitoring unit 1605 is used to detect the data status of the second cache to trigger the coordination of the data cached in the first cache and the second cache. The data coordination between the first cache 212 and the second cache 213 has three triggering conditions, namely, when caching data in the second cache; when deleting data in the second cache; or when the data block in the second cache is stored in the second cache for a time exceeding a threshold.
[0190] When the second monitoring unit 1605 detects that data is cached in the second cache and the cached data is divided into at least one second data block of a predetermined size, a feature identifier of the second data block is obtained.
[0191] The second determination unit 1603 is used to determine whether the second data is stored in the first cache according to the feature identifier of the second data. The determination 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 there is a second data block index record having the same feature identifier as the second data block in the index record of the first cache, it is determined that the second data block is stored in the first cache 213.
[0192] When the second determination unit 1603 determines that the second data is stored in the first cache 212, the adjustment unit 1604 is used to increase the level of the elimination priority of the second data in the second cache 213, and the increase may be increased to the highest level or 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.
[0193] When the second monitoring unit 1605 receives the second data block to be deleted from the second cache 213 , it obtains a feature identifier of the second data block.
[0194] The second determination unit 1605 determines whether the second data is stored in the first cache according to a feature identifier of the second data.
[0195] When the second determination unit 1605 determines that the second data is stored in the first cache, the second adjustment unit deletes the second data block; when the second determination unit 1605 determines that the second data is not stored in the first cache, the second adjustment unit increases the level of elimination priority of the second data in the second cache 213.
[0196] When the second monitoring unit 1605 detects the second data block to be deleted from the second cache 213 , the second acquiring unit 1606 acquires the feature identifier of the second data block.
[0197] The second determination unit 1607 determines whether the second data is stored in the first cache according to a feature identifier of the second data.
[0198] 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 adjusting unit increases the elimination priority level of the second data in the second cache 213.
[0199] When the second monitoring unit 1605 detects that the storage time of the second data block in the second cache exceeds a threshold, the second acquiring unit 1606 acquires the feature identifier of the second data block.
[0200] The second determination unit 1606 determines whether the second data is stored in the first cache according to a feature identifier of the second data.
[0201] When the second determining unit 1605 determines that the second data is stored in the first cache, the adjusting unit 1608 increases the level of the elimination priority of the second data in the second cache 213. When the second determining unit 1605 determines that the second data is not stored in the first cache, the adjusting unit 1608 decreases the level of the elimination priority of the second data in the second cache 213.
[0202] The 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-executable Figure 3 , Figure 6 , Figure 8 , Fig.10 , Fig.12 ,and Fig.14 The method flow is described.
[0203] In the embodiment of the present invention, the first data block and the first and second in the second data block are only used to distinguish the data blocks stored in the first cache and the second cache respectively. The first and second do not mean different levels or different orders, nor do they mean quantity. The first data block and the second data block can both be one data block, and can also refer to multiple data blocks.
[0204] In the embodiment of the present invention, the first and second in the first trigger condition and the second trigger condition are only used to distinguish whether the data detected is in the first cache or the second cache. The first and second do not mean different levels, different orders, or quantity.
[0205] A person skilled 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 the relevant hardware through a program, and the program can be stored in a computer-readable storage medium, which can include: ROM, RAM, disk or CD, etc.
[0206] The data block writing device and method provided in the embodiments of the present invention are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. 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 method and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A data caching method, applied to a storage device, wherein the storage device is used to persist data of an application server, characterized in that: The storage device includes a first cache, the first cache provides data cache for the application server, the storage device also includes a second cache, and the method includes: Receiving a data cache request sent by the application server; storing the data in the data cache request into the first cache; Returning the address where the data is stored to the application server; The second cache is used to provide data cache for a storage unit of the storage device.
2. The method according to claim 1, characterized in that The data in the data cache request is data eliminated from the cache of the application server.
3. The method according to claim 1 or 2, characterized in that The method further comprises: It is detected that the data in the first cache meets the first condition; The elimination priority of the data in the second cache is adjusted based on the first condition.
4. The method according to claim 3, characterized in that The first condition is: writing the first data into the first cache, or the cache time of the first data in the first cache exceeds a predetermined time; The adjusting the elimination priority of the first data in the second cache based on the first condition includes: The elimination priority level of the first data in the second cache is increased.
5. The method according to claim 3, characterized in that The first condition is: receiving a deletion request to delete the first data in the first cache; The adjusting the elimination priority of the first data in the second cache based on the first condition includes: The elimination priority level of the first data in the second cache is reduced.
6. The method according to any one of claims 1 to 5, characterized in that: Also includes: It is monitored that the second data in the second cache meets a second condition, and the second data is stored in the first cache; The level of elimination priority of the second data in the second cache is adjusted based on the second condition.
7. The method according to claim 6, characterized in that The second condition is: the cache time of the second data in the second cache exceeds a predetermined time or the second data is written into the second cache; The step of adjusting the level of elimination priority of the second data in the second cache based on the second condition 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 from the second cache is increased.
8. The method according to claim 6, characterized in that The second condition is: deleting the second data in the second cache, The method further comprises: The elimination priority level of the second data in the second cache is reduced.
9. A storage device, characterized in that: The method comprises a processor and a memory, wherein the memory stores program instructions, and the processor runs the program instructions to execute the method according to any one of claims 1 to 8.
10. A storage device, characterized in that: The storage device is used to persist data of the application server, and is characterized in that the storage device includes a first cache, which provides data cache for the application server, and the storage device also includes a second cache, which is used to provide data cache for the storage device.
Citation Information
Patent Citations
Cache management method and system for block-level data
CN102945207A
Method for prolonging life of non-volatile external memory and high-speed long-life external memory system
CN103268292A
Method and equipment for managing hybrid cache
CN104090852A
Read cache management method and device based on solid-state drive (SSD)
CN104572491A
System and method for prioritizing data in a cache
US20140115260A1
