The present invention relates to computer systems, and more particularly to a method and system for improving performance of a RAID controller through adaptive write back/write through caching.
Redundant array of inexpensive disks (xe2x80x9cRAIDxe2x80x9d) technology is increasingly used in computer systems to provide increased capacity and performance. FIG. 1 depicts a conventional RAID subsystem 20 that is coupled to a computer system 10. The computer system 10 is typically a server which allows a large number of users to access the RAID subsystem 20. The RAID subsystem 20 includes a RAID controller 22 having a cache 24. The RAID subsystem 20 also includes disks 26, 28, 30 and 32. For clarity, only these portions of the RAID subsystem 20 are depicted.
The RAID controller 22 provides an interface between the RAID subsystem 20 and the computer system 10. Thus, the RAID controller 22 includes the hardware that interfaces between the computer system 10 and the disks 26, 28, 30 and 32 and allows the disks 26, 28, 30 and 32 to appear to the computer system 10 as a single disk. The RAID controller 22 also includes the cache 24. The cache is used to improve input to and output from the RAID subsystem 20 by reducing the latency and increasing throughput. This is possible because cache accesses are typically faster than accesses of a disk 26, 28, 30 or 32. When data is to be output from the RAID subsystem 20, data can be written from the disks 26, 28, 30 and 32 to the cache 24. The data can then be output from the cache 24, typically at a higher rate than data can be written from the disks 26, 28, 30 and 32. Performance is improved when data written to the cache by the disk is repeatedly accessed. When this happens disk I/O does not occur and performance is improved. When data is to be written to the RAID subsystem 20, data can be input to the cache 24. The data can then be asynchronously written to the disks 26, 28, 30 and 32, typically at a lower rate than data is written to the cache 24.
Typically, the cache 24 can be in one of two configurations. The cache 24 can be configured so that data stored in the cache is written to the RAID subsystem 20 at the same time it is written to the cache. This configuration is known as write through. In write through mode, data written to the RAID subsystem 20 is written to both the cache 24 and to the disks 26, 28, 30 and 32. This may improve performance because if data in the cache 24 is reused it can be retrieved from the cache 24 without the delay of a disk access. In the case of write through even though data is written to the cache 24 the operation does not complete until the data is actually written to a disk 26, 28, 30, or 32. Alternatively, the cache 24 can be placed in write back mode. In write back, data is written directly to the cache 24 without requiring data be immediately written to the disks 26, 28, 30 or 32. This allows a faster completion of the write operation because a write operation to the cache 24 is much faster than a write operation to the disks 26, 28, 30 or 32. Thus, the operation need not wait for the disk write to complete. At a later time, the modified data in the cache 24 is written from the cache 24 to the disks 26, 28, 30 and 32 of the RAID subsystem 20.
In general, the cache 24 is placed in write back mode. Thus, the cache 24 is used to store data that is written to the disks 26, 28, 30 and 32 without first writing the data to disk. In write back mode the cache is also used to store data that is read from the disk. In many instances, write back mode improves the performance of the RAID subsystem 20, as described above. However, one of ordinary skill in the art will readily recognize that the write back mode may not provide optimal performance in some instances. In particular, when the cache 24 starts to become full, an I/O operation may stall until a portion of the cache 24 is flushed. As a result, performance of the RAID subsystem 20 suffers because any outstanding disk write command must wait for a cache buffer management process in the RAID controller 22 to flush a modified buffer (not explicitly shown in FIG. 1) and make the cache 24 available for the new write operation. Write through operations also require a buffer of the cache 24 to store the write data, but the buffer management does not have to flush modified data to free a buffer of the cache 24 because all buffer data is already written to the disk 26, 28, 30 and 32. In this case buffer management can simply overwrite any existing buffer in the cache 24 to make space for an outstanding write command. In this case, the write through operation may complete without delay.
One solution to performance problems due to the cache 24 becoming full is to make the cache 24 larger. A larger cache 24 will become full less frequently. As a result, it was theorized that performance of the RAID subsystem 20 should improve. However, the increase in the size of the memory of the cache 24 often has the opposite result. An increase in the size of the memory of the cache 24 can actually degrade the performance of the RAID subsystem 20. This occurs because if a larger cache becomes full it will require more Raid Controller 22 buffer management-processing overhead to manage and free buffers. This buffer management overhead degrades performance. This condition occurs whenever the workload consists of a sustained I/O rate that is greater than the aggregate capabilities of the RAID subsystem 20.
Accordingly, what is needed is a system and method for improving the performance of a RAID subsystem 20 that includes a cache 24. The present invention addresses such a need.
The present invention provides a method and system for accessing data in a redundant array of inexpensive disks (RAID) subsystem. The RAID subsystem includes a RAID controller having a cache and a plurality of disks. The method and system comprise utilizing the cache in a write back mode if the RAID subsystem is lightly loaded. In write back mode, the data is written to the cache prior to storing the data on at least one disk of the plurality of disks or prior to outputting the data from the RAID subsystem. The method and system also comprise utilizing the cache in a write through mode if the RAID subsystem is heavily loaded. In the write through mode, the data is written directly to at least one disk of the plurality of disks.
According to the system and method disclosed herein, the present invention provides a faster, more efficient mechanism for accessing data in a RAID subsystem.