Hi,
I have two 320 GB SATA disks (/dev/sda, /dev/sdb) in a server running CentOS release 5.
They both have three partitions setup as RAID1 using md (boot, swap, and an LVM data partition).
# cat /proc/mdstat Personalities : [raid1] md0 : active raid1 sdb1[1] sda1[0] 104320 blocks [2/2] [UU]
md1 : active raid1 sdb2[1] sda2[0] 4192896 blocks [2/2] [UU]
md2 : active raid1 sdb3[1] sda3[0] 308271168 blocks [2/2] [UU]
When I do tests though, I find that the md raid1 read performance is no better than either of the two disks on their own
# hdparm -tT /dev/sda3 /dev/sdb3 /dev/md2
/dev/sda3: Timing cached reads: 4160 MB in 2.00 seconds = 2080.92 MB/sec Timing buffered disk reads: 234 MB in 3.02 seconds = 77.37 MB/sec
/dev/sdb3: Timing cached reads: 4148 MB in 2.00 seconds = 2074.01 MB/sec Timing buffered disk reads: 236 MB in 3.01 seconds = 78.46 MB/sec
/dev/md2: Timing cached reads: 4128 MB in 2.00 seconds = 2064.04 MB/sec Timing buffered disk reads: 230 MB in 3.02 seconds = 76.17 MB/sec
If I fail and remove one of the disks in /dev/md2: # mdadm /dev/md2 -f /dev/sda3 # mdadm /dev/md2 -r /dev/sda3 # cat /proc/mdstat ... md2 : active raid1 sdb3[1] 308271168 blocks [2/1] [_U]
# hdparm -tT /dev/md2
/dev/md2: Timing cached reads: 4184 MB in 2.00 seconds = 2092.65 MB/sec Timing buffered disk reads: 240 MB in 3.01 seconds = 79.70 MB/sec
So with only one disk in the array the performance is pretty much the same.
At first I thought maybe the bottleneck is the SATA controller, but if I do simultaneous reads from both disks: # mkfifo /tmp/sync # cat /tmp/sync; hdparm -tT /dev/sda3 (and in another terminal, to make sure they start simultaneously) # > /tmp/sync; hdparm -tT /dev/sdb3
/dev/sda3: Timing cached reads: 2248 MB in 2.00 seconds = 1123.83 MB/sec Timing buffered disk reads: 234 MB in 3.00 seconds = 77.91 MB/sec
/dev/sdb3: Timing cached reads: 2248 MB in 2.00 seconds = 1123.74 MB/sec Timing buffered disk reads: 236 MB in 3.01 seconds = 78.30 MB/sec
So the total cached read bandwidth seems limited to about 2250 MB/s, which is slightly higher than the cache read bandwidth for /dev/md2, but I'm not too worried about that. More concerning is that I am still getting ~80MB/s from each disk simultaneously on the buffered reads. Given this I would expect /dev/md2 to give buffered read speeds of at least 120MB/s (if not 150MB/s).
What can I do to track down this issue? Any help would be really appreciated.
Thanks, Kieran Clancy.
Kieran Clancy wrote:
When I do tests though, I find that the md raid1 read performance is no better than either of the two disks on their own
Why should RAID1 be faster than writing to/reading from a single disc? You are *mirroring* each write to another disk, so I'd even expect it to be slower.
Ralph
On Sun, 23 Mar 2008, Ralph Angenendt wrote:
Kieran Clancy wrote:
When I do tests though, I find that the md raid1 read performance is no better than either of the two disks on their own
Why should RAID1 be faster than writing to/reading from a single disc? You are *mirroring* each write to another disk, so I'd even expect it to be slower.
Read performance would be better if there are multiple accessors, but not for just a single stream. The hdparm test is not good in this case; Kieran sees exactly what is suspected. Try running it twice (at the same time).
Steve ---------------------------------------------------------------------------- Steve Thompson E-mail: smt AT vgersoft DOT com Voyager Software LLC Web: http://www DOT vgersoft DOT com 39 Smugglers Path VSW Support: support AT vgersoft DOT com Ithaca, NY 14850 "186,300 miles per second: it's not just a good idea, it's the law" ----------------------------------------------------------------------------
On Sunday 23 March 2008 7:11:41 am Kieran Clancy wrote: [snip]
So the total cached read bandwidth seems limited to about 2250 MB/s, which is slightly higher than the cache read bandwidth for /dev/md2, but I'm not too worried about that. More concerning is that I am still getting ~80MB/s from each disk simultaneously on the buffered reads. Given this I would expect /dev/md2 to give buffered read speeds of at least 120MB/s (if not 150MB/s).
The value of RAID 1 isn't speed. it's fault tolerance. I would expect what you're seeing, a slight performance *loss* (relative to a single disk) due to the additional overhead of the RAID management.
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch26_:_Linux...
Steve Snyder wrote:
On Sunday 23 March 2008 7:11:41 am Kieran Clancy wrote: [snip]
So the total cached read bandwidth seems limited to about 2250 MB/s, which is slightly higher than the cache read bandwidth for /dev/md2, but I'm not too worried about that. More concerning is that I am still getting ~80MB/s from each disk simultaneously on the buffered reads. Given this I would expect /dev/md2 to give buffered read speeds of at least 120MB/s (if not 150MB/s).
The value of RAID 1 isn't speed. it's fault tolerance. I would expect what you're seeing, a slight performance *loss* (relative to a single disk) due to the additional overhead of the RAID management.
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch26_:_Linux...
Raid1 is supposed to let the disks read independently but I'm not sure if it works that way when there is only a single read happening. I'd expect a bigger difference when reading many small files simultaneously and the drive with the head nearest to the right place is used for each access.
On Sun, Mar 23, 2008 at 8:11 AM, Kieran Clancy clancy.kieran+centos@gmail.com wrote:
Hi,
I have two 320 GB SATA disks (/dev/sda, /dev/sdb) in a server running CentOS release 5.
They both have three partitions setup as RAID1 using md (boot, swap, and an LVM data partition).
<snip>
When I do tests though, I find that the md raid1 read performance is no better than either of the two disks on their own
<snip>
Thanks, Kieran Clancy.
As a few already pointed out, RAID 1 is mirroring. So whatever gets written to the first drive also gets written to the second drive as well. It provides redundancy, not performance. I've used RAID 5 in the past to achieve performance with redundancy. But of course it has to be stripped across drives and not partitions. I saw a case where someone implemented RAID 1 by partitioning the drive into two and setting up the two partitions as RAID 1. So drive performance took a drastic nose dive and redundancy was practically worthless as the mirror resided on the same drive.
With only two drives, your options are RAID 0 or RAID 1 (see http://en.wikipedia.org/wiki/RAID#Standard_levels). RAID 0 will cause the two drives to be treated as one big drive (or each combination of partitions to be treated as larger partitions). The data would be stripped across the two drives (for each respective partition) which would give you a performance increase. However there would be no fault tolerance. If something crashed, your data is gone. And data recovery on a RAID where the data is stripped across drives is no easy task vs a standalone drive. So if redundancy is an important factor you will want a good backup system in lieu of another RAID level which offers fault tolerance.
Jacques B.