Flash Foundations companion · Simulator

FTL & GC Sandbox

NAND cannot overwrite a page. It can only write a fresh one and, later, erase a whole block. Watch one small drive pay for that rule. Write amplification (WAF) is how much more the drive writes to flash than the host sent it, and it moves with the workload, the spare area, TRIM and data placement.

The walkthrough

Six setups, one drive

Pick a setup, then a variant of it. The drive below restarts with those settings and WAF settles as it runs. Color the map by page state, data temperature or erase count to see why.

01 Sequential or random

Sequential overwrites arrive in the order the data was written, so the oldest block is entirely stale and nothing is copied. Random overwrites scatter live pages through every block, and WAF settles near 2.7 instead of 1.00.

0 host writes · 0.0 drive-fulls16 × 16 blocks · 3 × 3 pages
Color the map by

Every page is valid, invalid or free.

    • Open: host stream
    • Open: hot stream
    • Open: GC stream
    • Last GC victim

    Live readouts

    WAF is the data written to the flash divided by the data the host wrote. At 1.00 the drive writes nothing extra, and at 2.00 garbage collection copies one page for every page the host sends.

    WAF, since the drive was filled1.00
    WAF, recent window1.00
    Host writes
    0
    NAND writes
    0
    GC-relocated pages
    0
    Block erases
    0
    Free blocks
    0
    Valid pages
    0
    Wear evenness
    100%

    The recent window covers the last four drive-fulls of host writes, so it shows where WAF is heading before the cumulative figure catches up. Wear evenness is the mean erase count divided by the highest one.

    Small enough to follow one page at a time. It needs a lot of spare area, or garbage collection would have no room to work.The drive the experiments below are written for.Closer to a real erase block, at the price of a slower simulation.

    Settings tagged restarts the drive rebuild it from a fresh, full state after a short pause. Settings tagged applies live change the running drive at once and keep its history. Every setting is kept in this page’s link, so a drive can be shared.

    DriveSize and spare area
    256
    restarts the drive

    Erase blocks on the drive. Fewer are easier to follow; real drives have vastly more.

    64
    restarts the drive

    Pages in each block. A bigger block means more valid pages to copy before it can be erased.

    7%
    restarts the drive

    User capacity: 15,312 of 16,384 pages.

    85%
    restarts the drive

    13,015 of 15,312 user pages hold host data.

    WorkloadWhat the host writes
    Workloadrestarts the drive

    Sequential rewrites the drive in order, uniform picks any page at random, and hot-cold aims most writes at a small hot set.

    20%
    restarts the drive

    Only the hot-cold workload has a hot set, so this has no effect with this workload.

    80%
    restarts the drive

    Only the hot-cold workload has a hot set, so this has no effect with this workload.

    1 page
    applies live

    Consecutive logical pages written per host write. Longer bursts fill a block with data that ages together.

    100% (incompressible)
    restarts the drive

    Incompressible data: every host page fills a whole flash page.

    Garbage collectionHow blocks are chosen and how much room is kept
    Victim policyapplies live

    Greedy always collects the block with the fewest valid pages.

    none
    applies live

    Free blocks garbage collection keeps beyond its built-in reserve. In a real drive this absorbs bursts. Here it only takes spare area away from data, so WAF rises. At most 9 on this drive.

    0%
    applies live

    Zero ignores wear. Higher values steer garbage collection away from heavily erased blocks, spreading erases across blocks. In this model WAF barely changes.

    applies live

    Off: only garbage collection erases blocks, so blocks that hold cold data are rarely erased and the wear spread widens. Turn it on to recycle them.

    T = 3
    applies live

    Static wear leveling is off, so this has no effect.

    HostDeletes, TRIM and data placement
    applies live

    Deleted files are reported to the drive, so their pages become invalid once the TRIM is issued.

    3.1
    applies live

    About 3.1 delete events per 100 host writes. Each deletes 8 pages of host data and creates as many new ones.

    8 pages
    applies live

    Each delete event removes 8 live pages and creates as many elsewhere.

    immediate
    applies live

    TRIMs reach the drive as soon as the host deletes a file.

    restarts the drive

    Only the hot-cold workload has a hot or cold label to hand to the drive; this workload behaves the same either way. A real drive learns this from the host, through Flexible Data Placement (FDP) or Zoned Namespaces (ZNS).

    restarts the drive

    The same settings and seed always replay the same run.

    The bench

    What if the setting were different?

    Each point is a small drive of its own, simulated from scratch with your current settings and measured in steady state, once it has settled into its routine. Choose one setting to sweep and press Run sweep. The result joins the chart as a line, and up to five lines can sit side by side.

    To compare two policies, run the sweep, change the policy in the settings above, and run it again. Pin live drive drops a diamond at the drive you are watching. Click a point to load that exact drive into the map.

    The dashed line is the textbook estimate, drawn only for overprovisioning. It assumes a full drive, uniform random writes and greedy collection, so treat it as a reference. This simulator holds a few blocks in reserve, and a drive that is less than full does better than the line.

    With uniform random writes, 25% overprovisioning and a full drive, the block size sweep climbs from about 2 at 8 pages to about 6 at 512.

    Sweep this setting

    Sweeps overprovisioning from 5% to 50%. A small drive cannot run at the low end, so its run starts higher.

    Every other setting is copied from the live drive when you press Run sweep.

    No runs yet.

    Vertical scale

    No runs yet. Press Run sweep to measure a line, or Pin live drive to mark the drive you are watching.

    Write amplification against the swept settingLine chart of steady-state write amplification against overprovisioning. No runs shown.

    Keyboard: Tab to the chart, then Left and Right move along a run, Up and Down switch runs, Home and End jump to the ends, and Enter loads the drive. The vertical range grows to fit the runs on show.

    Textbook (1 + OP) / (2 × OP): greedy garbage collection, uniform random writes, full drive.Live drive now
    Steady-state write amplification for every visible run
    RunSettingWAFUser pages
    No visible runs.

    The setups, written out

    All six setups

    Exact values move a little with the seed, and the direction does not. Each setup starts from the default drive and changes only what is listed.

    1. 01

      Sequential or random

      Sequential overwrites arrive in the order the data was written, so the oldest block is entirely stale and nothing is copied. Random overwrites scatter live pages through every block, and WAF settles near 2.7 instead of 1.00.

      Overprovisioning 7%, fullness 85%, Greedy. Compare: Uniform random, Sequential.

    2. 02

      Spare area

      Extra spare area gives garbage collection emptier blocks to pick. On a full drive with random writes, WAF falls from about 9 at 7% to about 2.5 at 28% and about 1.7 at 50%.

      Uniform random, fullness 100%, Greedy. Compare: 7% spare, 28% spare, 50% spare.

    3. 03

      TRIM

      TRIM only matters when the drive is not full. At 70% full it keeps WAF near 1.7, and without it deleted files stay valid, so WAF climbs toward the full-drive figure.

      Uniform random, overprovisioning 7%, fullness 70%, Greedy. Compare: TRIM off, TRIM on.

    4. 04

      Hot and cold data

      When the drive is told which data is hot, it keeps hot and cold pages in separate blocks. Here that lowers WAF from about 2.4 to about 2.2.

      80-20 hot-cold, Cost-benefit, overprovisioning 28%, fullness 100%. Compare: Mixed together, Separated.

    5. 05

      Choosing a victim

      Greedy chases the emptiest block and keeps rewriting hot data. Cost-benefit also weighs how long a block has been quiet, and here it gets about 3.9 against about 4.5.

      80-20 hot-cold, overprovisioning 15%, fullness 100%, hot and cold data not separated. Compare: Greedy, Cost-benefit.

    6. 06

      Even wear

      A drive is worn out when its worst block is, not its average one. After about 12 drive-fulls, raising the wear weight from 0% to 100% lifts wear evenness from about 68% to about 88%.

      80-20 hot-cold, overprovisioning 15%, fullness 100%, Greedy. Raise the speed to get there sooner. Compare: Wear weight 0%, Wear weight 100%.

    How it works

    The drive keeps a page-level mapping table: every logical page maps to any physical page. Pages go free, then valid, then invalid, and only a whole block can be erased. The table takes 59.8 KiB on the default drive, at 4 bytes a page. A real drive that maps in 4 KiB units needs about 1 GB of table for every 1 TB, which is why it usually keeps the table in DRAM.

    Garbage collection starts when free blocks fall below a small reserve and runs until it is restored. Greedy picks the block with the fewest valid pages. Cost-benefit maximizes (1 − u) / 2u × age, where u is the valid fraction and age is the time since the block closed.

    With placement off, every host write shares one stream and garbage-collection relocations use a second. With placement on and the 80-20 workload, hot and cold host data get their own streams and relocations a third, an oracle standing in for FDP or ZNS placement hints. Sequential and uniform workloads carry no hot or cold label, so placement changes nothing for them.

    Preconditioning writes every live logical page once, then zeroes the counters, so WAF is measured from a full drive. TRIM matters only below 100% fullness. Random workloads occasionally delete eight live pages and create eight others. With TRIM the drive invalidates the deleted pages immediately, and without it they stay valid until rewritten.

    Compressed size is a setting too. At 50% on a full drive with random writes and 7% overprovisioning, the data fills half the user area, so garbage collection finds nearly empty blocks and WAF falls from near 9 to about 1.2.

    Static wear leveling follows Chang, Hsieh and Kuo (DAC 2007). In the paper’s worst case, 256 hot blocks and 3,840 blocks of static data with T = 100, it adds under 1% to the erases and about 7.6% to the live-page copies, at 128 pages a block and 16 pages copied per hot-block clean. This sandbox has no fixed hot and static split, so it reports what it measures.

    Every run is seeded, so the same settings always give the same numbers, and the trends hold up as you change a setting.

    What it leaves out

    • ECC, read retry and read disturb.
    • Wear leveling beyond an optional erase-count penalty when garbage collection picks a victim and the optional static pass (a block erasing table, after Chang, Hsieh and Kuo, DAC 2007). Free blocks are reused in first-in, first-out order, which already evens out erases.
    • Die and plane parallelism, multi-plane programs and channel scheduling.
    • Mapping-table caching and DRAM-less designs.
    • Write speed, SLC caches and lifetime estimates. The page counts write amplification only.
    • Anything but page-level mapping: no hybrid, block-level or zoned mapping.