Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Raid1 - why not read speed improved
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
boospy
Guru
Guru


Joined: 07 Feb 2010
Posts: 310
Location: Austria

PostPosted: Sun Dec 18, 2011 10:48 pm    Post subject: Raid1 - why not read speed improved Reply with quote

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
Back to top
View user's profile Send private message
jormartr
Apprentice
Apprentice


Joined: 02 Jan 2008
Posts: 174

PostPosted: Mon Dec 19, 2011 10:41 am    Post subject: Reply with quote

That is how raid1 works at the moment, there is no option to change it as it is not implemented.
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2977
Location: Germany

PostPosted: Mon Dec 19, 2011 1:05 pm    Post subject: Reply with quote

There is a read speed improvement, but only for concurrent disk access. Try running two reading processes at the same time.
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3526

PostPosted: Mon Dec 19, 2011 1:32 pm    Post subject: Reply with quote

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.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Mon Dec 19, 2011 3:56 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3526

PostPosted: Mon Dec 19, 2011 4:16 pm    Post subject: Reply with quote

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.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54838
Location: 56N 3W

PostPosted: Mon Dec 19, 2011 9:41 pm    Post subject: Reply with quote

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.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
mbar
Veteran
Veteran


Joined: 19 Jan 2005
Posts: 1991
Location: Poland

PostPosted: Tue Dec 20, 2011 7:20 am    Post subject: Reply with quote

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:

2 drives 3 drives 4 drives
-------- ---------- --------------
A1 A1 A1 A1 A2 A1 A1 A2 A2
A2 A2 A2 A3 A3 A3 A3 A4 A4
A3 A3 A4 A4 A5 A5 A5 A6 A6
A4 A4 A5 A6 A6 A7 A7 A8 A8
.. .. .. .. .. .. .. .. ..

The 4-drive example is identical to a standard RAID-1+0 array, while the 3-drive example is a software implementation of RAID-1E. The 2-drive example is equivalent to RAID 1.

The driver also supports a "far" layout where all the drives are divided into f sections. All the chunks are repeated in each section but offset by one device. For example, f2 layouts on 2-, 3-, and 4-drive arrays would look like:

2 drives 3 drives 4 drives
-------- -------------- --------------------
A1 A2 A1 A2 A3 A1 A2 A3 A4
A3 A4 A4 A5 A6 A5 A6 A7 A8
A5 A6 A7 A8 A9 A9 A10 A11 A12
.. .. .. .. .. .. .. .. ..
A2 A1 A3 A1 A2 A4 A1 A2 A3
A4 A3 A6 A4 A5 A8 A5 A6 A7
A6 A5 A9 A7 A8 A12 A9 A10 A11
.. .. .. .. .. .. .. .. ..

This is designed for striping performance of a mirrored array; sequential reads can be striped, as in RAID-0, random reads are somewhat faster (maybe 10-20 % due to using the faster outer disk sectors, and smaller average seek times), and sequential and random writes offer about equal performance to other mirrored raids. The layout performs well for systems where reads are more frequent than writes, which is common. The first 1/f of each drive is a standard RAID-0 array. This offers striping performance on a mirrored set of only 2 drives.

The near and far options can be used together. The chunks in each section are offset by n device(s). For example n2 f2 layout stores 2×2 = 4 copies of each sector, so requires at least 4 drives:

A1 A1 A2 A2 A1 A1 A2 A2 A3
A3 A3 A4 A4 A3 A4 A4 A5 A5
A5 A5 A6 A6 A6 A6 A7 A7 A8
A7 A7 A8 A8 A8 A9 A9 A10 A10
.. .. .. .. .. .. .. .. ..
A2 A2 A1 A1 A2 A3 A1 A1 A2
A4 A4 A3 A3 A5 A5 A3 A4 A4
A6 A6 A5 A5 A7 A8 A6 A6 A7
A8 A8 A7 A7 A10 A10 A8 A9 A9
.. .. .. .. .. .. .. .. ..

The driver also supports an offset layout where each stripe is repeated o times. For example, o2 layouts on 2-, 3-, and 4-drive arrays are laid out as:

2 drives 3 drives 4 drives
-------- ------------ -----------------
A1 A2 A1 A2 A3 A1 A2 A3 A4
A2 A1 A3 A1 A2 A4 A1 A2 A3
A3 A4 A4 A5 A6 A5 A6 A7 A8
A4 A3 A6 A4 A5 A8 A5 A6 A7
A5 A6 A7 A8 A9 A9 A10 A11 A12
A6 A5 A9 A7 A8 A12 A9 A10 A11
.. .. .. .. .. .. .. .. ..

Note: k is the number of drives, n#, f# and o# are parameters in the mdadm --layout option.


https://en.wikipedia.org/wiki/Non-standard_RAID_levels
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2977
Location: Germany

PostPosted: Tue Dec 20, 2011 2:03 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum