Storage Fundamentals Series

🔋 Understanding a RAID Controller's Write-Back and Write-Through From a Top 1% Perspective — When the Battery Weakens, the Controller Quietly Slows Itself Down to Protect Your Data

Introduction

This article is part of the Top 1% Series Complete Article Guide, and article 6.3 in the Storage Series.

Prerequisite Knowledge

Getting the Big Picture

Write-through never returns a “write complete” response to the host until the write actually finishes on disk — safe, but slow. Write-back responds “write complete” the instant data lands in the RAID controller’s own fast cache (DRAM) — fast, but it carries the risk of losing that data if power drops while it’s still sitting in cache, not yet flushed to disk. And worse, this data loss happens with the host application never noticing at all — because the host already received that “complete” response.

graph TB
    Write["Write request"] --> Mode{"Cache mode"}
    Mode -->|"Write-through"| Disk["Waits for the real disk write to finish before responding"]
    Mode -->|"Write-back"| Cache["Responds instantly once written to the fast cache"]
    Cache --> BBU{"Is the BBU healthy?"}
    BBU -->|"Healthy"| Fast["Fast, but risks losing cached data on a power loss"]
    BBU -->|"Degraded/failed"| AutoFallback["Controller automatically falls back to write-through"]

Deep Dive Into the Fundamentals

The BBU (Battery Backup Unit): Protects the Cache, but Its Charge Has a Limit

To address write-back’s risk, many RAID controllers include a battery called a BBU (Battery Backup Unit), keeping the cache’s DRAM powered during an outage, so its contents can get flushed to disk once power returns. But a BBU’s charge has a limit — typically protecting the cache for only about 24 to 48 hours — and if power isn’t restored within that window, the data gets lost anyway.

The Controller’s Automatic Fallback: Detecting a Weakening Battery Quietly Switches It to Write-Through

Many RAID controllers, on detecting a degraded or failed BBU, automatically switch from write-back to write-through, with no action from an administrator at all. This is a typical cause behind the seemingly unexplainable symptom of “write performance suddenly dropped one day.” It’s the controller itself prioritizing data safety, once it can no longer trust its own battery.

Something You Must Never Do: Manually Forcing Write-Back Back On With a Degraded Battery

If an administrator manually forces write-back back on despite the battery showing as degraded or failed, an event that would otherwise have been nothing more than an ordinary power outage turns into a genuine data-loss incident. This automatic fallback needs to be understood as the last safety mechanism the controller is giving you.

What a Pro Sees Here (Top 1% Understanding)

Behind “Performance Dropped,” a Deliberate, Safety-First Decision Can Be Hiding

Seeing “performance dropped” tends to make you suspect a hardware failure or a misconfiguration — but in reality, the system itself may have deliberately sacrificed performance to prioritize a more important value: data safety. The habit of digging one layer deeper, when hitting a performance-degradation symptom, to check “is this a genuine failure, or the deliberate result of some safety mechanism kicking in” is the perspective a top-1% engineer carries.

Common Misconceptions and Pitfalls

Troubleshooting Perspective

  1. Write performance suddenly dropped one day: Check the BBU’s state and the current cache mode (write-back or write-through) using the RAID controller’s management tool.
  2. The BBU shows as degraded or failed: Rather than manually switching back to write-back, consider replacing the BBU itself first.
  3. You want to verify data integrity after recovering from a power outage: Check whether the BBU’s charge actually covered the duration of the outage.

Summary

Takeaways to Apply Today

  1. When you hit an unexplained performance drop, check the BBU’s state and cache mode first.
  2. When a degraded BBU gets detected, prioritize replacing the battery itself, rather than manually switching back to write-back.

References

Comments

Feel free to leave thoughts, questions, or corrections below (sign in with a GitHub account to comment or react).