RAID Controllers and Caches

My understand in write-through is that the controller puts the data directly to/from memory where as write-back lets the CPU do it. Is that correct?

   So neither method has anything to do with lost data due to a power outage? Only a cache backup (or a UPS) can save you there?

   So if you spend the bucks on a cache battery backup don't you still have the possibility of losing data that is in the cache of the hard drives?
LVL 15
LockDown32OwnerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
andyalderCommented:
You are getting CPU cache mixed up with RAID controller cache.

For RAID controllers write-through is when the controller does not send a write operation complete signal to the server until the data is written to the hard disk. Write-back is when the controller sends a write operation complete while the data is still in its cache and not yet committed to the disk.

Enabling write-back without a cache battery will likely lead to corrupt data in the event of power loss, the process such as SQL has been told the data is on the disk so after it is powered on again it may not re-process that transaction from its log.

Cache backup used to only last a day or so, nowadays it's generally flushed to a flash chip so can last for an indefinite powercut.

Controller cache also protects you from the RAID write hole, consider you write a block to a pair of mirrored disks, the controller manages to update disk 1 but the power goes down before disk 2 is updated. If you have write backed cache it will update disk 2 after power comes back, if not it won't update it and the mirrors will be out of sync. With RAID 5 and 6 your parity can be out of sync for weeks and you won't know it as the controller does not often check parity is correct, then a disk fails and rebuild from parity leaves a load of gobbledygook on the storage.
0

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
 
LockDown32OwnerAuthor Commented:
OK. So write-through doesn't utilize the cache on the controller? and hence is slower?

So..... where does the drive cache come in to play? Even using write-through on the controller don't you stand a chance of the data being in the drive cache when the power goes out?
0
 
andyalderCommented:
Write-through mode (write cache disabled mode) utilizes the cache as read cache normally.

The drive's cache is separate, it should always be disabled if you value your data. Some controllers won't even allow you to enable it.

Actually the drive cache and controller cache are enabled for write partially even when they are said to be disabled, if you send 10 write commands to a disk which has its write cache disabled it will still cache them and may write the blocks out of sync but it will not return "write operation complete" until the data is on the platters.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
LockDown32OwnerAuthor Commented:
Yes the only cache that is really of concern is the write cache. Users don't have control of the cache on the drives do they? I have never seen anything to that effect. You think it is an option in the RAID controller firmware?
0
 
andyalderCommented:
You can enable drive write cache on HPE Smart Array controllers via the CLI globally... "hpssacli ctrl slot=0 modify dwc=enable". I've used it occasionally when doing a restore, just have to remember to turn it off again once the data's live.
0
 
LockDown32OwnerAuthor Commented:
Thanks Andy. Much appreciated.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.