pub struct Leveled {
pub l0_threshold: u8,
pub target_size: u64,
pub level_ratio_policy: Vec<f32>,
}Expand description
Levelled compaction strategy (LCS)
When a level reaches some threshold size, parts of it are merged into overlapping tables in the next level.
Each level Ln for n >= 2 can have up to level_base_size * ratio^(n - 1) tables.
LCS suffers from comparatively high write amplification, but has decent read amplification and great space amplification (~1.1x).
LCS is the recommended compaction strategy to use.
More info here: https://fjall-rs.github.io/post/lsm-leveling/
Fields§
§l0_threshold: u8When the number of tables in L0 reaches this threshold, they are merged into L1.
Default = 4
Same as level0_file_num_compaction_trigger in RocksDB.
target_size: u64The target table size as disk (possibly compressed).
Default = 64 MiB
Same as target_file_size_base in RocksDB.
level_ratio_policy: Vec<f32>Size ratio between levels of the LSM tree (a.k.a fanout, growth rate)
This is the exponential growth of the from one. level to the next.
Default = 10