HyperAIHyperAI

Command Palette

Search for a command to run...

Wie schreibt man auf SSDs?

Bohyun Lee Tobias Ziegler Viktor Leis

Zusammenfassung

Dieses Paper zeigt, dass die Übernahme von Out-of-Place-Schreibzugriffen für Datenbanksysteme entscheidend ist, um die Leistung von SSDs vollständig auszuschöpfen und deren Lebensdauer zu verlängern. Wir schlagen eine Reihe von Out-of-Place-Optimierungen vor, die gemeinsam die Schreibverstärkung sowohl auf der DBMSals auch auf der SSD-Ebene reduzieren. Wir überarbeiten den In-Place-basierten, B-Baum-basierten LeanStore dahingehend, dass er Out-of-Place schreibt und diese Optimierungen unterstützt, und evaluieren ihn auf verschiedenen OLTP-Benchmarks, Datenmengen und SSDs. Das finale Design verbessert den Durchsatz um das 1,65bis 2,24-Fache und reduziert die Flash-Schreibvorgänge pro Operation um das 6,2bis 9,8-Fache auf YCSB-A. Bei TPC-C mit 15.000 Warehouses verbessert sich der Durchsatz um das 2,45-Fache, während die Flash-Schreibvorgänge um das 7,2-Fache sinken. Schließlich zeigen wir, dass die Architektur nahtlos neuartige SSD-Schnittstellen wie ZNS und FDP unterstützen kann.

One-sentence Summary

Technische Universität München and TigerBeetle demonstrate that out-of-place writes are essential for databases to fully exploit SSD performance and lifespan, and propose a suite of write-amplification-reducing optimizations across both DBMS and SSD layers that, when integrated into the redesigned B-tree-based LeanStore, achieve up to 2.24×2.24 \times2.24× throughput improvement and 9.8×9.8 \times9.8× fewer flash writes while supporting novel SSD interfaces such as ZNS and FDP.

Key Contributions

  • The paper introduces an out-of-place write architecture that redesigns the in-place, B-tree-based LeanStore with page-level optimizations to reduce write amplification while preserving B-tree-based indexing.
  • It adds database-level garbage collection that predicts individual page deathtimes using DBMS-specific semantics and integrates optional ZNS and FDP support, making zoned or placement-aware optimizations flexible rather than mandatory.
  • Evaluations on YCSB-A show throughput improvements of 1.65 to 2.24 times and flash-write reductions per operation of 6.2 to 9.8 times; TPC-C with 15,000 warehouses shows 2.45 times higher throughput and 7.2 times fewer flash writes.

Introduction

Modern databases increasingly rely on SSDs as the primary storage medium, but most systems are still optimized primarily for SSD reads rather than writes. This matters because SSDs wear out with repeated writes and amplify writes internally through garbage collection, so an inefficient write path can hurt performance, raise power use, and shorten SSD lifespan.

The key challenge is that write amplification occurs across layers. A database may issue extra writes for mechanisms such as doublewrite buffering, and the SSD may then amplify those writes again when it relocates pages during garbage collection. Prior work often treats these effects separately, focusing on either database-level write amplification, such as through index or compression optimizations, or on specialized hardware such as ZNS or FDP. As a result, optimizing one layer can sometimes increase total writes if the interaction with the other layer is ignored.

The authors address this gap by arguing that the DBMS itself should coordinate writes to minimize end-to-end write amplification. They move from in-place to out-of-place writes and introduce complementary techniques, including page packing for compressed pages, grouping pages by expected invalidation time, aligning database garbage collection with SSD internals, and patterns that achieve SSD write amplification of 1 on both ZNS and commodity SSDs. In their LeanStore implementation, these approaches reduce flash writes substantially and nearly double throughput while extending device lifetime.

Method

The authors leverage an out-of-place write pipeline to reduce database-level and device-level write amplification. Instead of overwriting pages in place, the system appends new page versions to append-managed regions called zones, maintains mappings from logical page identifiers to physical offsets and compressed sizes, and controls invalidation, compression, placement, and garbage collection as a coordinated workflow. The core components are a buffer manager that tracks page revision history, an I/O interface that performs compression and page packing, a space manager that places grouped pages into zones, and a garbage collector that reclaims stale pages while preserving workload-aware alignment.

A key early module is page-wise compression. Database pages are typically managed at a fixed logical granularity, such as 4 KiB, and are compressed independently before being flushed. Compressing each page before persistence lowers the logical number of bytes written and reduces the on-disk dataset footprint. With out-of-place writes, variable-length compressed pages can be written sequentially and recorded in a PID-to-offset table, so later reads can locate the current version without overwriting the original physical slot. This avoids the main limitations of in-place compression, where full aligned overwrite would erase physical savings or variable offset maintenance would require costly cascading relocations. In an out-of-place design, compressed pages are grouped into larger batches and issued as sequential writes, making compression much easier to integrate into the storage layer.

Because compressed pages are smaller than the original 4 KiB page, placement must preserve the efficient read unit of the underlying SSD. The system therefore applies page packing: compressed pages are placed into 4 KiB-aligned slots so that a compressed page never crosses a 4 KiB boundary. A best-fit packing strategy can be used to reduce internal slack while keeping each logical page readable with one aligned 4 KiB access. This design prevents a single logical read from becoming multiple physical reads, which would otherwise introduce read amplification and negate compression benefits.

Database-level garbage collection is the next major module. In an out-of-place system, updates append new page versions and mark old versions invalid. Storage is partitioned into zones, and each zone serves as the basic reclaim unit. During GC, the system selects a victim zone, reads valid pages that are not already in memory, compacts them into a denser region, writes them back, and then frees the reclaimed space. This copyback process creates write amplification because valid pages are rewritten even though they were not modified by user transactions. If a victim zone has a valid-page ratio vvv, the space saved corresponds to invalid data 1−v1-v1−v, and a simplified database write amplification can be expressed as:

WAF=11−v.WAF = \frac{1}{1-v}.WAF=1−v1​.

A higher valid ratio in a victim zone means more data must be moved per unit of reclaimed space. As shown in the figure below:

The garbage collector selects a victim zone containing a mixture of valid and invalid pages, loads valid pages into memory, recompacts them, writes the compacted result back to the device, and then makes the freed space available for future writes. Greedy victim selection, which chooses the zone with the fewest valid pages, can be effective under uniform workloads. However, real workloads are often skewed, causing hot and cold pages to be co-located in the same zone and raising the valid ratio of victim zones.

To address skew, the authors introduce Grouping by Death Time, or GDT. The idea is to estimate when each page is likely to become invalid, or to be overwritten, and then place pages with similar expected invalidation times into the same zone. This makes pages in the same zone die together, lowering the valid ratio at GC time. The system maintains recent write timestamps for each page and estimates the expected death time, or EDT, by extrapolating from the recent write interval:

EDT=current LSN+WHn−WH1n−1.EDT = current\ LSN + \frac{WH_n - WH_1}{n-1}.EDT=current LSN+n−1WHn​−WH1​​.

Here, WHnWH_nWHn​ and WH1WH_1WH1​ denote the newest and oldest write timestamps in a small write history, and nnn is the number of recent timestamps retained. For initial writes, the system can use index identifiers or other structural metadata to infer similar access patterns. During placement, pages are grouped by EDT, page-packed, and assigned to zones whose existing pages have the closest average EDT. If no suitable active zone exists, the space manager opens a new zone.

GDT placement is paired with GDT-aware GC. During reclamation, valid pages from victim zones are loaded, sorted by descending EDT, grouped, and packed so that colder pages are rewritten into colder zones. Read-only pages can be assigned a maximum EDT, treating them as the coldest data. After a GC cycle, the system reassigns EDT ranges to zones so that empty and partially full zones can attract short-lived or warm pages, while full zones retain the coldest pages. This keeps invalidation behavior aligned across GC cycles. As shown in the figure below:

When pages with very different expected death times are randomly interleaved across zones, a GC trigger can encounter a zone with many still-valid pages. When pages are grouped by death time, the victim zone can contain almost no valid pages at the moment of reclamation, substantially reducing GC-induced database write amplification.

The method then extends control from database-level GC to SSD-level GC. Modern SSDs also use out-of-place writes internally, with a controller that maps logical block addresses to physical block addresses and appends writes to erase-block-aligned regions, often called superblocks. When device capacity approaches exhaustion, the SSD performs internal GC at a vendor-specific granularity. The system attempts to align its zone size with the SSD’s internal GC unit so that pages written together also become invalid together in the physical layout. As shown in the figure below:

When the database zone size matches the SSD superblock or GC unit, all writes from one zone are placed in one superblock. Later database GC rewrites that zone, invalidating all pages in the corresponding superblock and producing a fully empty physical region. If the zone is smaller than the superblock, writes from different database zones can be interleaved, mixing short-lived and long-lived data within the same superblock. When only one logical zone is rewritten, the superblock becomes only partially invalid, forcing the SSD to perform more complex internal reclamation.

This alignment principle supports Zoned Namespace SSDs cleanly. A ZNS device enforces sequential writes within host-managed zones and eliminates internal GC, so device write amplification can approach 1. The database design already uses out-of-place appends, a translation layer, and its own GC, so it maps naturally onto ZNS zones. The system sets the database zone size to the ZNS zone size, issues zone-append operations, tracks zone state, and resets zones after GC copyback. ZNS also returns overprovisioning space to the host, which gives the database-level GC more room to wait for more pages to become invalid, thereby reducing database-level write amplification.

For commodity SSDs, where internal GC remains invisible, the system uses two techniques: GC-unit inference and the NoWA write pattern. For FDP-enabled devices, the Reclaim Unit size directly exposes the smallest GC granularity, allowing the database zone size to be set to that unit. For standard SSDs, the system can infer an upper bound on the SSD GC unit by observing a ZNS-like write pattern: as zone size increases, SSD write amplification can drop to 1 once the zone is large enough to match the internal append and reclaim granularity. A practical upper bound can be selected from this transition, and a conservative large zone size can be used when no stronger device information is available.

The NoWA pattern handles the more complicated case of multiple active zones under multithreaded execution. When the database writes to several zones concurrently, an SSD that cannot distinguish zone boundaries may multiplex their writes into the same superblocks. Multiplexing itself is not fatal, but it causes write amplification when zones in the same active group are invalidated at different rates. Some zones may produce fully invalidated superblocks, while others produce partially invalidated superblocks that still contain valid pages. As shown in the figure below:

NoWA prevents this outcome by ensuring that at least one fully invalidated superblock is available before the SSD reaches its internal free-space threshold. It defers opening new zones until currently open zones are completely written and detects frequency imbalance among concurrently appended zones. If one underrepresented zone needs more physical placement opportunities, the system issues a compensation write for that zone. The compensation write recompacts scattered pages into a single superblock, invalidates their older versions, and increases the number of fully empty superblocks. As shown in the figure below:

Compensation writes slightly increase database-level GC work, but the overhead is controlled by database victim selection and is generally much smaller than the SSD-level write amplification that can be avoided. NoWA also allows flexible zone sizing: as long as the product of the maximum number of concurrently open zones and the zone size matches or divides the inferred SSD GC unit, the balanced-invalidation property can be preserved.

For FDP SSDs, the same imbalance problem can be addressed through placement hints rather than compensation. FDP exposes Reclaim Unit Handles, each representing an independent write stream. The database assigns each zone a placement ID derived from the number of RUHs and uses that placement ID for all writes belonging to the zone. Different zones then map to different RUHs, preventing internal multiplexing across logical zones with different death times. SSD write amplification of 1 is achievable when zone size equals the Reclaim Unit size and the number of concurrently open zones does not exceed the available RUH count.

The implementation combines these components into a single write path. On eviction, dirty PIDs are passed to the I/O interface together with their contents and estimated death times. The I/O interface compresses each page, groups PIDs with similar EDTs, packs them into aligned 4 KiB slots, and asks the space manager for a target zone. The space manager maintains PID-to-offset mappings, reverse offset-to-PID mappings, fill factors, invalidation counts, average EDTs, zone state, and active-group history. It selects an active zone with the closest average EDT or opens a new zone when necessary. If active-zone capacity is exhausted, the GC runs before the requested write proceeds. GC reads valid pages into the shared buffer pool, sorts them by EDT, compacts them, and rewrites them through the same compression, grouping, packing, and placement path. Recovery persists checkpoints of the PID-to-offset table and active-group history, replays subsequent WAL entries, and rebuilds the storage-space layout from the final mapping state.

Experiment

The evaluation uses multiple enterprise SSDs, including ZNS and FDP devices, with write-intensive YCSB-A and TPC-C workloads under small buffer pools. The experiments validate that aligning database GC granularity with SSD GC granularity, using out-of-place placement, dead-time-aware GC, and non-write-amplifying patterns substantially lowers total write amplification and improves throughput. Compression amplifies these benefits, while ZNS and FDP further reduce amplification by exposing additional capacity and placement control. Overall, the approach is robust across devices, dataset sizes, and workload variations.

Both LZ4 and ZSTD compress every evaluated OLTP workload enough to reduce stored data size, supporting compression as a practical way to lower write volume and storage footprint. ZSTD consistently achieves smaller compressed sizes than LZ4 across TPC-C, YCSB, Email, URL, and Wiki datasets. URL and Wiki data compress most strongly, while TPC-C and YCSB show more modest but still meaningful reductions. Compression reduces data size for all evaluated workloads ZSTD gives better compression than LZ4 on every workload URL and Wiki datasets show the strongest reduction

Applying the proposed optimizations improves throughput and reduces total write amplification compared with in-place writes. Out-of-place writes remove database write overhead but can raise write amplification under high fill factor, while compression, skew-aware placement, and aligned garbage collection lower both database and SSD amplification. All optimizations raise throughput substantially over in-place writes. Compression and page packing reduce database write amplification and write traffic per operation. NoWA and GC-unit alignment reduce SSD write amplification to the ideal level. Removing compression increases database write amplification even when SSD write amplification remains low.

Out-of-place writes substantially increase throughput on conventional CNS SSDs compared with in-place writes. ZNS also improves performance when the dataset fits on both drives, and it gains more when the larger usable ZNS capacity allows a bigger dataset than CNS. At the same fill factor, the ZNS advantage narrows, showing that usable capacity is the dominant source of the benefit. Out-of-place writes yield roughly double the throughput of in-place writes on CNS at the same dataset size. ZNS provides a modest throughput gain over out-of-place CNS when both use the same dataset size. ZNS shows a larger throughput advantage over CNS with the larger dataset, mostly due to its greater usable capacity. Matching fill factors reduces the ZNS performance edge, indicating most of the benefit comes from capacity rather than reduced NoWA overhead.

FDP placement hints allow the storage system to maintain SSD-level write amplification of 1 without using NoWA compensation writes. Out-of-place writes with all optimizations produce much lower total write amplification and higher throughput than in-place writes. Enabling FDP instead of NoWA further reduces database write amplification slightly and improves throughput the most. FDP prevents SSD multiplexing and achieves SSD write amplification of 1 Out-of-place optimized writes greatly reduce total write amplification compared to in-place writes FDP-enabled out-of-place writes provide the best throughput in the compared configurations

Experiments across OLTP workloads and datasets evaluate compression, write-placement optimizations, and storage-device behavior. ZSTD consistently compresses better than LZ4, with URL and Wiki data compressing most strongly, while the proposed out-of-place optimizations substantially improve throughput and reduce total write amplification compared with in-place writes. Comparisons between conventional CNS and ZNS show that out-of-place writes yield major gains over in-place writes, whereas ZNS advantages largely reflect usable capacity, and FDP placement hints achieve ideal SSD write amplification and the best overall throughput.


KI mit KI entwickeln

Von der Idee bis zum Launch – beschleunigen Sie Ihre KI-Entwicklung mit kostenlosem KI-Co-Coding, sofort einsatzbereiter Umgebung und bestem GPU-Preis.

KI-gestütztes kollaboratives Programmieren
Sofort einsatzbereite GPUs
Die besten Preise

HyperAI Newsletters

Abonnieren Sie unsere neuesten Updates
Wir werden die neuesten Updates der Woche in Ihren Posteingang liefern um neun Uhr jeden Montagmorgen
Unterstützt von MailChimp