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
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

andyalderSaggar maker's framemakerCommented:
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.

Experts Exchange Solution brought to you by

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?
andyalderSaggar maker's framemakerCommented:
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.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook 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?
andyalderSaggar maker's framemakerCommented:
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.
LockDown32OwnerAuthor Commented:
Thanks Andy. Much appreciated.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.