100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

What is Write Amplification and Why Does it Matter?

Learn what write amplification is, why it hurts SSD lifespan and throughput, and how storage engines minimize it.

mediumQ208 of 228 in Database Est. time: 6 minsLast updated:
Open Code Lab

Expected Interview Answer

Write amplification is the ratio between the amount of data actually written to physical storage and the amount of data the application logically intended to write, and it matters because higher amplification wastes disk bandwidth, wears out SSDs faster, and directly limits a database’s sustainable write throughput.

A single logical write, such as updating one row, can trigger far more physical writes than the row itself: a B-tree may rewrite a whole page for a small change, an LSM-tree rewrites the same key multiple times across compaction levels as it merges SSTables, and the underlying SSD firmware adds its own amplification when it must erase and rewrite whole blocks for small updates. Each layer compounds, so a database designer measures write amplification end-to-end — application to storage engine to disk — to understand true write cost. Reducing it usually means trading something else: larger write batches reduce per-write overhead, tuned compaction strategies (leveled versus size-tiered) trade read or space amplification for less write amplification, and choosing a write-optimized structure like an LSM-tree or Bε-tree over a plain B-tree can lower it for write-heavy workloads.

  • Quantifies true storage write cost beyond the logical write size
  • Directly impacts SSD lifespan and sustained write throughput
  • Guides compaction strategy and storage engine choice
  • Helps predict and tune database performance under write-heavy load

AI Mentor Explanation

Think of a groundskeeper who, to fix one small divot on the pitch, ends up having to re-roll and re-mark the entire strip because the marking equipment cannot target just that spot. The effort spent (re-rolling the whole strip) is far larger than the actual damage (one divot), which is exactly what write amplification measures: the ratio of total physical effort to the small logical change requested. A storage engine with poor amplification is like a groundskeeper who re-rolls the whole pitch for every tiny fix.

Step-by-Step Explanation

  1. Step 1

    Identify the logical write size

    Determine how many bytes the application actually intended to write, such as one updated row.

  2. Step 2

    Trace physical writes through each layer

    Follow the write through the storage engine (page rewrites, compaction) and down to the disk or SSD firmware.

  3. Step 3

    Compute the amplification ratio

    Divide total physical bytes written by the logical bytes intended, giving the write amplification factor.

  4. Step 4

    Tune to reduce amplification

    Adjust batching, compaction strategy, or storage engine choice to lower the ratio for the target workload.

What Interviewer Expects

  • Clear definition as a ratio of physical to logical writes
  • Awareness that amplification compounds across engine and hardware layers
  • Understanding of the trade-off between write, read, and space amplification
  • Ability to name mitigation strategies like batching and compaction tuning

Common Mistakes

  • Describing write amplification as only an SSD hardware concept
  • Ignoring that storage engine design (B-tree vs LSM-tree) affects it directly
  • Not mentioning the trade-off with read or space amplification
  • Forgetting that batching writes is a practical mitigation

Best Answer (HR Friendly)

Write amplification is the extra physical writing a database does beyond the actual change you asked for, like rewriting a whole page or file just to update a small piece of data. It matters because it wastes disk bandwidth and wears out SSDs faster, so database and storage engine designs actively try to minimize it.

Code Example

Conceptual write amplification calculation
-- Pseudocode illustrating write amplification across layers
function updateRow(rowId, newValue) {
  const logicalBytes = sizeOf(newValue); -- e.g. 50 bytes

  -- Storage engine may rewrite a full 8KB page for this small change
  const enginePhysicalBytes = pageSize; -- e.g. 8192 bytes

  -- SSD firmware may need to erase/rewrite a larger flash block
  const ssdPhysicalBytes = flashBlockSize; -- e.g. 256KB

  const engineAmplification = enginePhysicalBytes / logicalBytes;
  const totalAmplification = ssdPhysicalBytes / logicalBytes;

  return { engineAmplification, totalAmplification };
}

-- The logical write the application issued:
UPDATE Orders SET status = 'SHIPPED' WHERE order_id = 42;

Follow-up Questions

  • How does compaction strategy affect write amplification in an LSM-tree?
  • What is the relationship between write amplification and SSD wear leveling?
  • How does write amplification trade off against read amplification?
  • Why might a Bε-tree exhibit lower write amplification than a plain B-tree?

MCQ Practice

1. Write amplification measures the ratio of:

Write amplification is defined as total physical bytes actually written divided by the logical bytes the application intended to write.

2. Which of these commonly contributes to write amplification?

Compaction repeatedly rewrites keys as it merges SSTables across levels, adding physical writes beyond the original logical write.

3. Why does high write amplification matter for SSD-backed databases?

Excess physical writes consume more bandwidth and wear out flash storage faster, shortening SSD lifespan and limiting throughput.

Flash Cards

What is write amplification?The ratio of physical bytes written to storage versus the logical bytes the application intended to write.

Why does it matter for SSDs?Higher amplification wastes bandwidth and accelerates flash wear, shortening SSD lifespan.

What commonly causes it in LSM-trees?Compaction rewrites the same keys multiple times as it merges SSTables across levels.

How can it be reduced?Batching writes, tuning compaction strategy, or choosing a write-optimized storage engine.

1 / 4

Continue Learning