Many hardware RAID controllers let you configure how cache is used and when the controller signals completion to the program that requested the I/O. Your choice of configuration options has a direct effect on RAID subsystem performance and the potential for lost data in the event of a system crash. The read-ahead, write policy, cache policy, and stripe size options that you choose will affect performance. Although these controller options are specific to Gateway's ADAC RAID controller, other RAID controller's have similar configuration options.
During a read operation, the read-ahead policy determines when the controller will read additional data records into cache. If an application program reads data sequentially (as the disk stores data) then read-ahead will improve performance. The following are the read-ahead policy options:
- Normal—provides no read-ahead for a logical hard disk
- Read-ahead—lets the controller read additional records into cache
- Adaptive—turns on read-ahead when the two most recent disk accesses are for sequential sectors and turns off read-ahead (i.e., set to normal) when the disk accesses revert to random sectors
Write policy determines whether I/O completion is signaled when data is transferred to the cache or when data is written to disk. The following are the write policy options:
- Write-back—I/O completion is signaled when the data is transferred to cache
- Write-through—I/O completion is signaled after data is written to disk
When using the write-back option, the data will be lost if a system failure occurs before the data in cache is written to disk. Databases using write-back can become corrupt, which might require you to take manual recovery measures. RAID controllers with a battery-backed cache will retain the data in cache memory during a system failure and complete the write operation when the system restarts. Using the write-through option reduces the potential for lost data because the data is stored on disk upon operation completion.
Cache policy determines whether reads for a logical hard disk will use cache memory. The cache policy options, which affect performance, are the following:
- Cached I/O—all reads are buffered into cache memory
- Direct I/O—data is transferred directly to the host application
Cached I/O is often best for small databases or files; Direct I/O is often best for large databases.
Stripe size specifies the segment's size when written to each disk in a RAID array. The options are 2KB, 4KB, 8KB, 16KB, 32KB, and 64KB. When the disk accesses are mostly for sequential sectors, a larger stripe size provides the best read performance. When the disk accesses are mostly for random sectors, a smaller stripe size is best for performance.
Although the standard caveats apply (i.e., run performance tests on your applications to find out what configurations work best for you), I can make some general comments regarding performance and configurations. Adaptive read-ahead is a good choice because it speeds sequential read operations. Write-back generally yields higher throughput than write-through, but write-back is safe to use only with a RAID controller with battery-backed cache. Finally, you need to select cache policy and stripe size options based on your performance testing.