Skip to download

Computed examples / not database measurements

Key-value separation: cleaning-cost sensitivity

Thirty deterministic byte-accounting cases compare inline records with separated values, including relocation-driven index writes. Invented inputs, not engine measurements.

Download CSV30 cases / 16 columns

JSON and provenance / Evaluator code / Research explanation

Method

For equal-sized records, K=16 key bytes, P=16 reference bytes, H=8 log-header bytes; V in {16,128,1024} bytes; C in {4,10} tree output/input-byte factors; selected-region live fraction u in {0,0.25,0.5,0.75,0.9}. Inline=C(K+V); separated=[C(K+P)+K+V+H]/(1-u). Every relocated record induces an index update charged at C. Each ratio uses K+V new logical bytes as denominator. Original steady-state accounting example, not a fit to a paper.

Cleaning S bytes moves uS live bytes but makes only (1-u)S net space. The append-plus-relocation multiplier is 1/(1-u). We apply it to both log records and their index updates. A separate index and value log are the modeled layout, not a claim that every implementation has this exact cost.

All 30 constructed cases. K=16 B, P=16 B, H=8 B. Written bytes per new logical insertion; display rounding only.
Tree factor CValue, BLive fraction, %Inline, BSeparated, BSeparated / inline
41601281681.313
416251282241.750
416501283362.625
416751286725.250
41690128168013.125
412805762800.486
4128255763730.648
4128505765600.972
41287557611201.944
41289057628004.861
410240416011760.283
4102425416015680.377
4102450416023520.565
4102475416047041.131
41024904160117602.827
101603203601.125
1016253204801.500
1016503207202.250
10167532014404.500
101690320360011.250
10128014404720.328
101282514406290.437
101285014409440.656
1012875144018881.311
1012890144047203.278
10102401040013680.132
101024251040018240.175
101024501040027360.263
101024751040054720.526
1010249010400136801.315

Interpretation

Below 1 in the final column means fewer modeled writes, not higher throughput. Above 1 means the separated layout loses this byte comparison. The break-even live fraction in JSON is specific to selected cleaning regions; it is not a drive-capacity threshold. Null, serialized as an empty CSV cell, means no crossover for nonnegative live fractions.

Batch accounting: choose the denominator

These six additional examples use a separate log-only boundary. Add selected sizes S and live bytes L, copy L once, then refill D=S-L once. Writes=S; total transfers=readBytes+S. Both ratios use D, not bytes scanned. The original 30-row model above also charges index updates and remains unchanged.

Invented 100 MiB batches; 1 MiB = 1,048,576 bytes. A dash means undefined because no space is reclaimed. All other values are computed.
CaseRead policyLive, MiBReclaimed, MiBRead, MiBWrites / reclaimedTransfers / reclaimed
Equal-size regionsscan-all50501002.004.00
Larger region mostly livescan-all74261003.857.69
Larger region mostly obsoletescan-all26741001.352.70
Empty region scannedscan-all01001001.002.00
Known-empty region skippedskip-known-empty010001.001.00
All bytes still livescan-all1000100--

The first three batches all have an unweighted 50% live fraction, but their byte-weighted live fractions are 50%, 74% and 26%. Summing byte counters avoids both percentage-weighting errors and unweighted averaging of per-region ratios. The all-live example still copies bytes but produces no new capacity.

The scan-all policy reads each chosen region in full. The skip-known-empty policy omits only regions already known to have no survivors. Neither models liveness-discovery cost, index updates, WAL, compression, concurrent invalidations or time. These are finite arithmetic examples, not a simulation of LFS or a database collector.

Batch JSON: input regions, field definitions, assumptions and hashes / Dependency-free batch evaluator / Derivation and source context.

Reproduce

The standalone JavaScript module requires Node.js and no packages. It rejects non-finite values, byte sizes outside 1-1,000,000,000 (headers may be zero), C outside 1-1,000,000, and live fractions outside [0,1). The JSON includes full-precision rows, runtime and SHA-256 hashes of code and CSV.

node --input-type=module -e 'import { toCsv } from "./kv-cleaning.mjs"; process.stdout.write(toCsv())'

Limits

Column definitions

keyBytes
Assumed key size, bytes.
valueBytes
Assumed value size, bytes.
pointerBytes
Assumed reference size in the separated tree, bytes.
logHeaderBytes
Assumed extra log header size, bytes.
treeWriteFactor
Tree output bytes per inserted tree-record byte, including initial table writes and rewrites; same for both layouts.
liveFraction
Live-byte fraction of the selected cleaning regions, not whole-database utilization.
logicalBytes
New logical input bytes per key-value insertion: keyBytes + valueBytes.
relocationFactor
Total append-plus-relocation multiplier: 1/(1-liveFraction).
inlineBytes
Modeled tree bytes written per new logical insertion in the inline layout.
separatedTreeBytes
Modeled tree bytes per new insertion including pointer updates for relocated records.
valueLogBytes
Modeled log bytes per new insertion including all repeated copies and headers.
separatedBytes
Separated tree plus log bytes per new insertion; excludes WAL and lower-layer writes.
inlineWriteRatio
inlineBytes / logicalBytes, modeled byte ratio.
separatedWriteRatio
separatedBytes / logicalBytes, modeled byte ratio.
separatedToInline
separatedBytes / inlineBytes; below 1 means fewer modeled writes.
breakEvenLiveFraction
Selected-region live fraction at equal cost; null/empty CSV means no nonnegative crossover (separation loses even at zero live bytes).

Sources and license

CC0-1.0 for Hesela's original code and computed rows. Source papers and documentation retain their own rights.

  1. Lanyue Lu, Thanumalayan Sankaranarayana Pillai, Andrea C. Arpaci-Dusseau and Remzi H. Arpaci-Dusseau. WiscKey: Separating Keys from Values in SSD-conscious Storage. USENIX FAST 2016, pp. 133-148, sections 3.2-3.3 and 4.
  2. Helen H. W. Chan, Yongkun Li, Patrick P. C. Lee and Yinlong Xu. HashKV: Enabling Efficient Updates in KV Storage via Hashing. USENIX ATC 2018, pp. 1007-1019, sections 3-4.
  3. RocksDB project. BlobDB: integrated implementation, garbage collection and configuration. Documentation reviewed 12 October 2026; page displays revision date 22 September 2022.
  4. Mendel Rosenblum and John K. Ousterhout. The Design and Implementation of a Log-Structured File System. ACM TOCS 10(1), February 1992, pp. 26-52, sections 3.4-3.5.

Related concepts: key-value separation, value log and database write amplification.

Published by Hesela team

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Key-value separation: cleaning-cost sensitivity. Hesela. https://hesela.dev/datasets/kv-separation-cleaning/