The present invention relates to the field of data storage. More particularly, the present invention relates to the field of data storage where write and read caches are used to facilitate data transfer to and from the data storage.
Many storage systems employ separate read and write caches to improve access to the storage systems. Data that is read from the storage system is often found in the read cache. When data is written to a storage device, the data may be temporarily held in the write cache and marked as “dirty” (i.e., to be flushed to storage). Eventually, the data that is temporarily held in the write cache is flushed to storage.
One method of improving a hit ratio for the read cache places a copy of write data in the read cache as well as the write cache. Such a technique often fails to improve the hit ratio because it is only in some instances that a significant amount of write data is read from a storage system within a time period for read caching. In other instances, little write data is read from the storage system within the time frame for the read caching.
Another method of improving a hit ratio for the read cache copies a write-cache line into the read cache upon a read of the write-cache line from the write cache. Such a technique makes inefficient use of the write and read caches because two copies of data are cached for a period of time.
The present invention comprises a method of caching data. According to an embodiment, the method writes units of data into a write cache for eventual flushing to storage. The method sets a copy-to-read-cache flag for each particular unit of data that is read from the write cache. Upon flushing each unit of data to the storage, the method copies the unit of data to a read cache if the copy-to-read-cache flag for the unit of data is set.
According to another embodiment, the method writes units of data into a write cache for eventual flushing to storage. The method simulates a transfer policy for copying the units of data from the write cache to a read cache upon flushing the units of data to the storage to determine a performance indicator for the transfer policy. Upon flushing each unit of data, the method copies the unit of data to the read cache if the performance indicator exceeds a threshold and the transfer policy includes copying the unit of data into the read cache.
These and other aspects of the present invention are described in more detail herein.
The present invention is described with respect to particular exemplary embodiments thereof and reference is accordingly made to the drawings in which:
An embodiment of a method of caching data of the present invention is illustrated as a flow chart in
An embodiment of a storage unit that employs methods of caching data of the present invention is illustrated schematically in
In a second step 104 (
An embodiment of the write cache 204 is schematically illustrated in
Upon flushing each unit of data to the storage 202 (
In an alternative embodiment, the method 100 further comprises a fourth step of saving a timestamp for each unit of data that has the copy-to-read-cache flag set that indicates a time when the copy-to-read-cache flag was set or a time of a most recent read of the unit of data. In this alternative embodiment, the method 100 employs the timestamp to determine an insertion point for an identifier for the unit of data in a queue for a caching policy for the read cache 206. The caching policy may be a least recently used caching policy, an adaptive replacement caching policy, a first-in-first-out caching policy, or some other caching policy that employs time to arrange the queue for eviction from the read cache 206.
Another embodiment of a method of caching data of the present invention is illustrated as a flow chart in
Upon flushing each unit of data to the storage 202, the method 400 (
In an embodiment, if the performance indicator does not exceed the threshold, the method 400 further comprises a step of copying the unit of data to the read cache 206 if a default transfer policy includes copying the unit of data into the read cache 206.
In an alternative embodiment, the method 400 further comprises a step of setting a copy-to-read-cache flag for each particular unit of data read from the write cache 204. In this alternative embodiment, if the performance indicator does not exceed the threshold, the method 400 further comprises a step of copying the unit of data to the read cache 206 upon flushing the unit of data to the storage 202 if the copy-to-read cache flag for the unit of data is set.
In an alternative embodiment, the hypothetical transfer policy, the performance indicator, and the threshold are a first hypothetical transfer policy, a first performance indicator, and a first threshold, respectively. In this alternative embodiment, the method 400 further comprises a step of simulating a second hypothetical transfer policy for copying the units of data from the write cache 204 to the read cache 206 upon flushing the units of data to the storage 202 to provide a second performance indicator for the second hypothetical transfer policy. In this alternative embodiment, if the first performance indicator does not exceed the first threshold but the second performance indicator exceeds a second threshold, upon flushing each unit of data to the storage 202, the method 400 further comprises a step of copying the unit of data from the write cache 204 to the read cache 206 if the second hypothetical transfer policy includes copying the unit of data from the write cache 204 to the read cache 206 upon flushing the units of data to the storage 202.
Another embodiment of a method of caching data of the present invention is illustrated as a flow chart in
In a third step 506, the method 500 simulates an always transfer policy over a time window. If employed, the always transfer policy copies all units of data from the write cache 204 to the read cache 206 upon flushing the units of data to the storage 202 over the time window. The simulation of the always transfer policy determines a fraction of write-cache data that would have been read from the read cache 206 before eviction from the read cache 206. The time window may be a recent time window (e.g., 1 min. or 5 mins.) or a longer time window (e.g., a time window for eviction from the read cache). Further, the fraction may be weighted (e.g., using exponential averaging) so that the fraction reflects more recently accessed data rather than assigning equal weight to recently accessed data and previously accessed data.
Upon flushing each unit of data to the storage 202, the method 500 employs a fourth step 508 of copying each unit of data into the read cache 206 under one of three conditions. The first condition is that the fraction of the write-cache data that would have been read from the read cache 206 before eviction for the always transfer policy exceeds an upper threshold. The second condition is that a lower threshold for the fraction exists, the fraction exceeds the lower threshold, and the copy to read cache flag for the unit of data is set. The third condition is that a lower threshold for the fraction does not exist and the copy to read cache flag for the unit of data is set.
The foregoing detailed description of the present invention is provided for the purposes of illustration and is not intended to be exhaustive or to limit the invention to the embodiments disclosed. Accordingly, the scope of the present invention is defined by the appended claims.