Mirrored data is not 'sent twice'. it is sent to two drives at the same time.
It's using a software RAID though, so the software on the Mac needs to send the data twice for mirroring to work. Are you saying there is a SATA command that can send a single block of data to multiple drives?
I guess the way to test this is to compare a non-RAID with a software RAID-1 to see if they are the same speed. I suspect the RAID 1 will be half the speed. But wait, let's think about that a second:
To be clear, we are talking about multiple drives connected to the same data line.
The slow part is waiting for the drives to write the data - not actually sending the data.
So let's say it takes 1 second to send a block of data and 4 seconds to write the data.
Take 1 second to send one block to diskA. diskA will take 4 seconds to write the block.
After the 1st second, you can send the same block to diskB. diskB will take 4 seconds to write the data.
The total time will be something like 6 seconds.
Code:
Writing 1 mirrored block:
0 1 2 3 4 5 6
diskA | send | write |
diskB | send | write |
take the ideal time to write the data and divide by the actual time to get the efficiency:
4/6 = 66% efficient
So it's better than half the speed. And if you increase the number of blocks to infinity, then the time can approach the same speed as a single drive (getting closer to 100% efficient).
This depends on the ability to send data to a drive while it's writing previously sent data. The drive should have a cache to allow this.
Code:
Writing 2 mirrored blocks:
0 1 2 3 4 5 6 7 8 9 10
diskA | send | write |
diskB | send | write |
diskA | send | write |
diskB | send | write |
8/10 = 80% efficient.
You see in this case that we can send a block to diskA while it's still writing the previous block. Same for the mirror, diskB.
So mirroring data doesn't need to be much slower than non-mirrored data for two drives connected to the same data line as long as the drives are half the speed of the data line or slower.
In the four drive case, when RAID 1 and RAID 0 are mixed:
Code:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
--- 2 blocks:
stripe0 | s | w |
mirror0 | s | w |
stripe1 | s | w |
mirror1 | s | w |
--- +2 = 4 blocks:
stripe0 | s | w |
mirror0 | s | w |
stripe1 | s | w |
mirror1 | s | w |
--- +2 = 6 blocks:
stripe0 | s | w |
mirror0 | s | w |
stripe1 | s | w |
mirror1 | s | w |
--- +2 = 8 blocks:
stripe0 | s | w |
mirror0 | s | w |
stripe1 | s | w |
mirror1 | s | w |
--- +2 = 10 blocks:
stripe0 | s | w |
mirror0 | s | w |
stripe1 | s | w |
mirror1 | s | w |
s = send (there's only one data line so we can send to only one disk at a time - none of these overlap)
w = write (a disk can only write one piece of data at a time - no write to the same disk can overlap)
efficiency = expected write time for a non-RAID divided by actual write time
2 blocks = 8/8 = 100%
4 blocks = 16/12 = 133%
6 blocks = 24/16 = 150%
8 blocks = 32/20 = 160%
10 blocks = 40/24 = 166%
w = 4 seconds per block
s = 1 second per send
m = 2 times the same block (mirroring)
r = 2 raid count (2 disks to raid with)
n = number of blocks (a multiple of r for simplicity)
expected write time = n*w
actual time = s*m*r + n*w/r
efficiency for n blocks = n*w / (s*m*r + n*w/r)
But this only works if w ≥ s*m*r
In the case of a SATA 6g, we can only send 6Gbps which is ≈ 540 MB/s. I guess we need to know the maximum speed for a single drive to figure out what the ideal speed is.
Per drive, we get 135 MB/s so the max RAID 0 speed for a pair is 270 MB/s if the drives are fast enough.