Why is it better to use RAID 1 for the operating system, SQL Server binaries, and the swap file? What advantages does RAID 1 have over RAID 5?
Both hardware RAID 1 (mirroring or duplexing) or RAID 5 (striping with parity) offer good data redundancy should a single hard disk in a RAID array fail. And as you might expect, there is some differences in performance between the two.
The major difference in performance between RAID 1 and RAID 5 is that RAID 5 experiences heavy write overhead because additional parity data has to be created and written to the array. This is overhead that RAID 1 does not experience. Because of this, write performance on RAID 1 is generally much faster than RAID 5.
Read performance, on the other hand, is generally better for RAID 5 than RAID 1. This is especially true if the RAID 5 arrays have more than three disk drives in them. RAID 5 read performance increases as more disks are added to the array because the more disks there are, the more read/write heads there are, and RAID 5 arrays have the ability to read simultaneously from all the drives, speeding read access. Since RAID 1 only has two disk drives, and RAID 5 has three or more disk drives, RAID 5 has the read performance advantage.
Log files, by their nature, are mostly written to, which means that often RAID 1 is your best choice for performance. Ideally, each log file should be on its own RAID 1 array for performance. This is because if you locate log files on the same array as other files, then the array will have to shift between random reads/writes and sequential reads/writes as needed, which is not good for performance. Since log files are mostly writes, and this is done sequentially on the array, isolating a log file on its own array allows the array to mostly use sequential writes, which offer overall better performance. In addition, it is a good idea to locate log files on an array that does not have data files because you don’t want to risk losing both your data files and your log files should an entire array fail.
The Windows OS swap file should be rarely used by SQL Server on a dedicated SQL Server, so its location on RAID 1 or RAID 5 is not especially critical in regards to performance.
The SQL Server binaries are always read, so they should be located on an array that offers good read performance, which could be either RAID 1 or RAID 5, depending on the configuration. But again, in the real world, reading binaries doesn’t really put much overhead on the server, and shouldn’t be a big concern.
So what does this all mean? First, there are no easy answers. Here’s what we do, and why?
We locate the SQL Server binaries and swap file on its own RAID 1 array. We then locate the transaction log files on its own RAID 1 array. And then we locate the data files on its own RAID 5 or RAID 10 array. This is an expensive way to allocate arrays, but we find that it offers both convenience and performance, along with a high degree of redundancy.