raid5 write performance
Hi all,
Currently zfs is a major news in the storage area. It is very interesting to read various details about it on varios blogs of Sun employees. Among the more interesting I found was this:
http://blogs.sun.com/roller/page/bonwick?entry=raid_z
The point the guy makes is that it is impossible to atomically both write data and update parity, which leaves a window of crash that would silently leave on-disk data+paritiy in an inconsistent state. Then he mentions that there are software only workarounds for that but that they are very very slow.
It's interesting that my expirience with veritas raid5 for example is just that: slow to the point of being unuseable. Now, I'm wondering what kind of magic does linux md raid5 does, since its write performance is quite good? Or, does it actually do something regarding this? :)
Niel?
Signature · 7 lines
Jure Pečar http://jure.pecar.org - To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Would it really be that much slower to have a journal of RAID 5 writes?
Quoted 4 lines · Jure Pečar
Hi all,
Currently zfs is a major news in the storage area. It is very interesting to read various details about it on varios blogs of Sun employees. Among the more interesting I found was this:
Quoted 8 lines
http://blogs.sun.com/roller/page/bonwick?entry=raid_z
The point the guy makes is that it is impossible to atomically both write data and update parity, which leaves a window of crash that would silently leave on-disk data+paritiy in an inconsistent state. Then he mentions that there are software only workarounds for that but that they are very very slow.
It's interesting that my expirience with veritas raid5 for example is just that: slow to the point of being unuseable. Now, I'm wondering what kind of magic does linux md raid5 does, since its write performance is quite good? Or, does it actually do something regarding this? :)
Niel?
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Moreover, and I'm sure Neil will chime in here, isn't the clean/unclean thing designed to prevent this exact scenario?
The array is marked unclean immediately prior to write, then the write and parity write happens, then the array is marked clean.
If you crash during the write but before parity is correct, the array is unclean and you resync (quickly now thanks to intent logging if you have that on)
The non-parity blocks that were partially written are then the responsibility of your journalling filesystem, which should make sure there is no corruption, silent or otherwise.
If I'm misunderstanding that, I'd love to be corrected. I was under the impression that the "silent corruption" issue was mythical at this point and if it's not I'd like to know.
-Mike
Quoted 14 lines · Dan Stromberg
Would it really be that much slower to have a journal of RAID 5 writes?
Quoted 10 lines · Jure Pečar
Hi all,
Currently zfs is a major news in the storage area. It is very interesting to read various details about it on varios blogs of Sun employees. Among the more interesting I found was this:
http://blogs.sun.com/roller/page/bonwick?entry=raid_z
The point the guy makes is that it is impossible to atomically both write data and update parity, which leaves a window of crash that would silently leave on-disk data+paritiy in an inconsistent state. Then he mentions that there are software only workarounds for that but that they are very very slow.
It's interesting that my expirience with veritas raid5 for example is just that: slow to the point of being unuseable. Now, I'm wondering what kind of magic does linux md raid5 does, since its write performance is quite good? Or, does it actually do something regarding this? :)
Quoted 8 lines
Quoted 2 lines
Niel?
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 23 lines
-----Original Message-----
From: [email protected] [mailto:linux-raid- [email protected]] On Behalf Of Mike Hardy
Sent: Friday, November 18, 2005 2:24 PM
To: Dan Stromberg
Cc: Jure Pečar; [email protected]
Subject: Re: raid5 write performanceMoreover, and I'm sure Neil will chime in here, isn't the clean/unclean thing designed to prevent this exact scenario?
The array is marked unclean immediately prior to write, then the write and parity write happens, then the array is marked clean.
If you crash during the write but before parity is correct, the array is unclean and you resync (quickly now thanks to intent logging if you have that on)
The non-parity blocks that were partially written are then the responsibility of your journalling filesystem, which should make sure there is no corruption, silent or otherwise.
Quoted 5 lines
If I'm misunderstanding that, I'd love to be corrected. I was under the impression that the "silent corruption" issue was mythical at this point and if it's not I'd like to know.
-Mike
It is not just a parity issue. If you have a 4 disk RAID 5, you can't be sure which if any have written the stripe. Maybe the parity was updated, but nothing else. Maybe the parity and 2 data disks, leaving 1 data disk with old data.
Beyond that, md does write caching. I don't think the file system can tell when a write is truly complete. I don't recall ever having a Linux system crash, so I am not worried. But power failures cause the same risk, or maybe more. I have seen power failures, even with a UPS!
Guy
Quoted 34 lines
Quoted 7 lines · Dan Stromberg
Would it really be that much slower to have a journal of RAID 5 writes?
Quoted 3 lines · Jure Pečar
Hi all,
Currently zfs is a major news in the storage area. It is very
interesting to read various details about it on varios blogs of Sun employees. Among the more interesting I found was this:
Quoted 4 lines
Quoted 4 lines
http://blogs.sun.com/roller/page/bonwick?entry=raid_z
The point the guy makes is that it is impossible to atomically both
write data and update parity, which leaves a window of crash that would silently leave on-disk data+paritiy in an inconsistent state. Then he mentions that there are software only workarounds for that but that they are very very slow.
Quoted 2 lines
Quoted 2 lines
It's interesting that my expirience with veritas raid5 for example is
just that: slow to the point of being unuseable. Now, I'm wondering what kind of magic does linux md raid5 does, since its write performance is quite good? Or, does it actually do something regarding this? :)
Quoted 9 lines
Quoted 3 lines
Niel?
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 4 lines
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Guy
It is not just a parity issue. If you have a 4 disk RAID 5, you can't be sure which if any have written the stripe. Maybe the parity was updated, but nothing else. Maybe the parity and 2 data disks, leaving 1 data disk with old data.
Beyond that, md does write caching. I don't think the file system can tell when a write is truly complete. I don't recall ever having a Linux system crash, so I am not worried. But power failures cause the same risk, or maybe more. I have seen power failures, even with a UPS!
Good points there Guy - I do like your example. I'll go further with crashing too and say that I actually crash outright occasionally. Usually when building out new machines where I don't know the proper driver tweaks, or failing hardware, but it happens without power loss. Its important to get this correct and well understood.
That said, unless I hear otherwise from someone that works in the code, I think md won't report the write as complete to upper layers until it actually is. I don't believe it does write-caching, and regardless, if it does it must not do it until some durable representation of the data is committed to hardware and the parity stays dirty until redundancy is committed.
Building on that, barring hardware write-caching, I think with a journalling FS like ext3 and md only reporting the write complete when it really is, things won't be trusted at the FS level unless they're durably written to hardware.
I think that's sufficient to prove consistency across crashes.
For example, even if you crash during an update to a file smaller than a stripe, the stripe will be dirty so the bad parity will be discarded and the filesystem won't trust the blocks that didn't get reported back as written by md. So that file update is lost, but the FS is consistent and all the data it can reach is consistent with what it thinks is there.
So, I continue to believe silent corruption is mythical. I'm still open to good explanation it's not though.
-Mike
Quoted 4 lines · On Friday November 18, [email protected] wrote:
So, I continue to believe silent corruption is mythical. I'm still open to good explanation it's not though.
Silent corruption is not mythical, though it is probably talked about more than it actually happens (but then as it is silent, I cannot be certain :-).
Silent corruption can happen only if an unclean degraded array is started.
md will not start an unclean degraded (raid 4/5/6) array (though I'm going to add a module parameter to allow it) and mdadm will only start such an array if given --force (in which case it modifies to appear clean so md will start it).
If your array is not degraded, or you always shut down cleanly, there is no opportunity for raid5-level corruption (of course, the drives may choose to corrupt things silently themselves...).
Note that an unclean degraded start doesn't imply corruption - you could be in this situation and not have any corruption at all. But it does allow it. It must as 'unclean' means you cannot trust the parity, and 'degraded' means that you have to.
There are two solutions to this silent corruption problem (other than 'ignore it and hope it doesn't bite' which is a fair widely used solution, and I haven't seen any bite marks myself).
One is journalling, as has been mentioned. This could be done to a mirrored pair, or to a ECC NVRAM card (the latter being probably the best, though also most expensive). You would write each data block as it becomes available, and each parity block just before commencing a write to the raid5. Obviously you also keep track of what you have written.
I have toyed with the idea of implementing this, but I think demand is sufficiently low that it isn't worth it.
The other is to use a filesystem that allows the problem to be avoided by making sure that the only blocks that can be corrupted are dead blocks.
This could be done with a copy-on-write filesystem that knows about the raid5 geometry, and only ever writes to a stripe when no other blocks on the stripe contain live data.
I've been working on a filesystem which does just this, and hope to have it available in a year or two (it is a back-ground 'hobby' project).
I know that ZFS is a copy-on-write filesystem. It is entirely possible that it can do the right thing for raid5.
And as an addendum, md/raid5 never reports a block as complete to the filesystem until the device drives have reported the data block and the parity block as being safe. i.e. It has a write-through cache, not a write-behind cache.
NeilBrown
Quoted 9 lines · Neil Brown
The other is to use a filesystem that allows the problem to be avoided by making sure that the only blocks that can be corrupted are dead blocks.
This could be done with a copy-on-write filesystem that knows about the raid5 geometry, and only ever writes to a stripe when no other blocks on the stripe contain live data.
I've been working on a filesystem which does just this, and hope to have it available in a year or two (it is a back-ground 'hobby' project).
why are you waiting so long? why not just release the project plan, and any pre-pre-alpha code? that's the point of the cathedral and the bazaar. may be others can help, find bugs, write code, etc..
Signature · 1 line
Levente "Si vis pacem para bellum!"
Quoted 12 lines · On Saturday November 19, [email protected] wrote:
Quoted 9 lines · Neil Brown
The other is to use a filesystem that allows the problem to be avoided by making sure that the only blocks that can be corrupted are dead blocks.
This could be done with a copy-on-write filesystem that knows about the raid5 geometry, and only ever writes to a stripe when no other blocks on the stripe contain live data.
I've been working on a filesystem which does just this, and hope to have it available in a year or two (it is a back-ground 'hobby' project).
Quoted 3 lines
why are you waiting so long? why not just release the project plan, and any pre-pre-alpha code? that's the point of the cathedral and the bazaar. may be others can help, find bugs, write code, etc..
Uhmm... maybe I'm just selfish and want to have all the fun to myself (it is as much a learning exercise as anything else)... or maybe I want to be a coder rather than a project manager...
Despite the 'release early / release often' mantra, I think it is possible to release something too early. People look, find nothing there, lose interest and never come back.
However I'm possibly at the stage were it might be worth making the project more visible... I'll think about it and let you know....
Thanks for your interest
NeilBrown
Neil Brown ([email protected]) wrote on 19 November 2005 16:54:
Quoted 3 lines
There are two solutions to this silent corruption problem (other than 'ignore it and hope it doesn't bite' which is a fair widely used solution, and I haven't seen any bite marks myself).
It happened to me several years ago when two disks failed almost simultaneously due to scsi bus problems. I had to re-assemble the array anyway and some files got corrupted :-( That's why I ended up having each disk on an independent bus and cable...
Quoted 9 lines
One is journalling, as has been mentioned. This could be done to a mirrored pair, or to a ECC NVRAM card (the latter being probably the best, though also most expensive). You would write each data block as it becomes available, and each parity block just before commencing a write to the raid5. Obviously you also keep track of what you have written.
I have toyed with the idea of implementing this, but I think demand is sufficiently low that it isn't worth it.
Quoted 9 lines
The other is to use a filesystem that allows the problem to be avoided by making sure that the only blocks that can be corrupted are dead blocks.
This could be done with a copy-on-write filesystem that knows about the raid5 geometry, and only ever writes to a stripe when no other blocks on the stripe contain live data.
I've been working on a filesystem which does just this, and hope to have it available in a year or two (it is a back-ground 'hobby' project).
I think the demand for any solution to the unclean array is indeed low because of the small probability of a double failure. Those that want more reliability can use a spare drive that resyncs automatically or raid6 (or both).
Quoted 4 lines · Carlos Carvalho
I think the demand for any solution to the unclean array is indeed low because of the small probability of a double failure. Those that want more reliability can use a spare drive that resyncs automatically or raid6 (or both).
A spare disk would help, but note that raid6 does not decrease the probability of the silent corruption problem. Losing one disk in a raid6 still means that you are degraded (i.e., you rely on parity to recalculate data, so an incomplete stripe write means corruption).
--
Paul
Quoted 54 lines
-----Original Message-----
From: Mike Hardy [mailto:[email protected]]
Sent: Friday, November 18, 2005 11:57 PM
To: Guy
Cc: 'Dan Stromberg'; 'Jure Pečar'; [email protected]
Subject: Re: raid5 write performanceQuoted 1 line · Guy
It is not just a parity issue. If you have a 4 disk RAID 5, you can't
be
Quoted 1 line
sure which if any have written the stripe. Maybe the parity was
updated,
Quoted 1 line
but nothing else. Maybe the parity and 2 data disks, leaving 1 data
disk
Quoted 3 lines
with old data.
Beyond that, md does write caching. I don't think the file system can
tell
Quoted 1 line
when a write is truly complete. I don't recall ever having a Linux
system
Quoted 2 lines
crash, so I am not worried. But power failures cause the same risk, or maybe more. I have seen power failures, even with a UPS!
Good points there Guy - I do like your example. I'll go further with crashing too and say that I actually crash outright occasionally. Usually when building out new machines where I don't know the proper driver tweaks, or failing hardware, but it happens without power loss. Its important to get this correct and well understood.
That said, unless I hear otherwise from someone that works in the code, I think md won't report the write as complete to upper layers until it actually is. I don't believe it does write-caching, and regardless, if it does it must not do it until some durable representation of the data is committed to hardware and the parity stays dirty until redundancy is committed.
Building on that, barring hardware write-caching, I think with a journalling FS like ext3 and md only reporting the write complete when it really is, things won't be trusted at the FS level unless they're durably written to hardware.
I think that's sufficient to prove consistency across crashes.
For example, even if you crash during an update to a file smaller than a stripe, the stripe will be dirty so the bad parity will be discarded and the filesystem won't trust the blocks that didn't get reported back as written by md. So that file update is lost, but the FS is consistent and all the data it can reach is consistent with what it thinks is there.
Quoted 4 lines
So, I continue to believe silent corruption is mythical. I'm still open to good explanation it's not though.
-Mike
I will take a stab at an explanation.
Assume a single stripe has data for 2 different files (A and B). A disk has failed. The file system writes a 4K chunk of data to file A. The parity gets updated, but not the data. Or the data gets updated but not the parity. The system crashes or power fails. The system recovers, but can't do anything about the parity with a failed disk. But the filesystem does its thing. The disk is replaced and added, the data block is reconstructed using a good block and a bad block. The parity now matches the data. But the reconstructed block (file B) is wrong and the file using that block has not been changed for years. So, silent corruption. But you could argue it was a double failure.
Also, after a power failure, I have seen the system come back with a single disk failed. I guess that 1 disk had an expired superblock. When you add that disk back, any stripes that were not up to date will be re-constructed with invalid data. I don't know if the intent logging will help here or not. Most likely, more than 1 disk will have an expired superblock. If you force md to assemble the array it resyncs, but I don't know if it does the parity or picks a disk to pretend was just added. It show a single disk as rebuilding, if that is correct, silent corruption could occur.
Guy
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
raid5 reliability (was raid5 write performance)
Guy ([email protected]) wrote on 19 November 2005 00:56:
Quoted 5 lines
Assume a single stripe has data for 2 different files (A and B). A disk has failed. The file system writes a 4K chunk of data to file A. The parity gets updated, but not the data. Or the data gets updated but not the parity. The system crashes or power fails. The system recovers, but can't do anything about the parity with a failed disk.
But this is just the case Neil mentioned: an unclean degraded array. This is the only case where data corruption can appear.
Quoted 2 lines
Also, after a power failure, I have seen the system come back with a single disk failed. I guess that 1 disk had an expired superblock.
You mean the disk was fine and operating in the array before the power failure? If so the superblocks were all in sync. If one of the superblocks was different the array was already degraded and after the power failure it'll also be dirty, and we're back at the case above.
Quoted 2 lines
When you add that disk back, any stripes that were not up to date will be re-constructed with invalid data.
If the array was not degraded the reconstruction data will not be invalid. Only the parity will be rebuilt and no data corruption will happen.
Quoted 1 line
I don't know if the intent logging will help here or not.
It won't change anything, it only helps to accelerate the resync by not re-writing stripes that were up to date.
RE: raid5 reliability (was raid5 write performance)
Quoted 11 lines
-----Original Message-----
From: [email protected] [mailto:linux-raid- [email protected]] On Behalf Of Carlos Carvalho
Sent: Saturday, November 19, 2005 2:30 PM
To: [email protected]
Subject: raid5 reliability (was raid5 write performance)Guy ([email protected]) wrote on 19 November 2005 00:56:
Quoted 1 line
Assume a single stripe has data for 2 different files (A and B). A disk
has
Quoted 1 line
failed. The file system writes a 4K chunk of data to file A. The
Quoted 8 lines
parity
Quoted 2 lines
gets updated, but not the data. Or the data gets updated but not the parity. The system crashes or power fails. The system recovers, but
can't
Quoted 1 line
do anything about the parity with a failed disk.
But this is just the case Neil mentioned: an unclean degraded array. This is the only case where data corruption can appear.
Ok, so Neil hit send 1 minute before me, sorry. :)
Quoted 9 lines
Quoted 2 lines
Also, after a power failure, I have seen the system come back with a
single
Quoted 1 line
disk failed. I guess that 1 disk had an expired superblock.
You mean the disk was fine and operating in the array before the power failure? If so the superblocks were all in sync. If one of the superblocks was different the array was already degraded and after the power failure it'll also be dirty, and we're back at the case above.
Yes, everything was fine, but while the superblocks were being updated, BANG! Now 1 is out of date. I think on reboot that 1 disk will be failed. But I am not sure of this. I do know I had 1 disk dropped from my array after a loss of power. I did not have any emails telling me a disk had failed. So, I think the power failure led to the disk being dropped from the array. I did not pursue how or why, I just added the disk back. I don't really know if this can lead to data corruption. I guess the stripes would be updated before the superblock updates start. But not sure. But if so, then I don't see how this case can corrupt data.
Quoted 7 lines
Quoted 3 lines
When you add that disk back, any stripes that were not up to date will be re-constructed with invalid data.
If the array was not degraded the reconstruction data will not be invalid. Only the parity will be rebuilt and no data corruption will happen.
No, if you add a disk, it is re-built 100%. At least with my version. The intent log may resolve this, but I am not sure.
Quoted 9 lines
Quoted 2 lines
I don't know if the intent logging will help here or not.
It won't change anything, it only helps to accelerate the resync by not re-writing stripes that were up to date.
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
To the best of my knowledge, I have never had corrupt data.
Guy