# Raid1 - why not read speed improved

## boospy

I have an Softwareraid Raid1 with 2 Drives. Theoretically the readspeed must be twice as fast. But it is not. Are there any special kernel options? 

Greetings

boospy

----------

## jormartr

That is how raid1 works at the moment, there is no option to change it as it is not implemented.

----------

## frostschutz

There is a read speed improvement, but only for concurrent disk access. Try running two reading processes at the same time.

----------

## depontius

To expand on that last statement just a little bit...

RAID1 doesn't have any code for striping, so in a simple situation it doesn't have any mechanism for reading from both disks and combining the data.  However under normal circumstances, RAID1 only needs to read from one disk, needing to consult the second disk only if the first says it failed.  In other words, there's no need to do any sort of "dynamic compare" between the two disks.  That means that in single-threaded situations, the second disk sits idle.  However in multi-threaded situations the second disk can be scheduled to read for another thread.

Both disks must be scheduled together for any write.

----------

## krinn

technically you can get read improvments, as both disks are perfect mirror, you can find the same datas on both disks.

so instead of reading them from only 1 disk, reading them from the both disks would get you twice the throuput.

if it's not done, it's just for software programming reason ; or hardware limitation, using two controllers that handle 1 disk each would be more easier to handle from the software side.

OP: you should dig mdadm help for multi-controllers support, it might be just (lol) you need two controllers to perform that.

----------

## depontius

I'm running RAID-1 mirrors on my servers, and use separate controllers.  I simply knew I wanted the separate write paths, at the very least.

----------

## NeddySeagoon

boospy,

How do you measure read speed?

Random reads or sequential reads.

The read speed is determined by two elements.

1. The time to position the read head onto the right track and the time for the right sector to come under the head, so your data can be read.  This is called latency.

2. The time it takes to get your data (once its been located) onto or off of the platter. Its limited by the head/platter data rate.  For small amounts of data cache and read ahead don't help much. For large amounts of data that don't fit in the drive cache it doesn't help either.

In many real world situations, the latency is much larger than the time spent actually moving data.  The kernel tries to minimise latency by positioning the heads over different parts of the drives in a mirror set and using the drive that can get your data with lowest latency.

Native Command Queuing is another trick aimed at reducing latency by reordering commands for minimum head movements. Drives do that with no help from the kernel, other than turning the feature on.

The answer you get depends on how you define 'data rate' in your question.

----------

## mbar

I'm quite sure there *is* a raid1 alignment that gives you double raw data read speed. I can't find some source about it now...

EDIT: found it on Wikipedia:

 *Quote:*   

> Linux MD RAID 10
> 
> The Linux kernel software RAID driver (called md, for "multiple device") can be used to build a classic RAID 1+0 array, but also as a single level[8] with some interesting extensions.[9]
> 
> The standard "near" layout, where each chunk is repeated n times in a k-way stripe array, is equivalent to the standard RAID 10 arrangement, but it does not require that n evenly divide k. For example an n2 layout on 2, 3 and 4 drives would look like:
> ...

 

https://en.wikipedia.org/wiki/Non-standard_RAID_levels

----------

## frostschutz

In a server scenario there are usually multiple processes working anyway; so in overall performance it makes no difference whether you do the striping thing or not. For me the speed improvement is noticable even on a desktop. It's only if you benchmark using a single process, for example dd, that there does not seem to be any difference.

You could do a RAID 5 with 2 disks if you want striping. The two disk raid 5 mode is a bit odd though, and usually only used as an intermediate step when converting RAID 1 to RAID 5.

----------

