pub struct Leveled {
pub l0_threshold: u8,
pub target_size: u32,
pub level_ratio: u8,
}
Expand description
Levelled compaction strategy (LCS)
If a level reaches some threshold size, parts of it are merged into overlapping segments in the next level.
Each level Ln for n >= 1 can have up to ratio^n segments.
LCS suffers from comparatively high write amplification, but has decent read & space amplification.
LCS is the recommended compaction strategy to use.
More info here: https://fjall-rs.github.io/post/lsm-leveling/
Fields§
§l0_threshold: u8
When the number of segments in L0 reaches this threshold, they are merged into L1
Default = 4
Same as level0_file_num_compaction_trigger
in RocksDB
target_size: u32
Target segment size (compressed)
Default = 64 MiB
Same as target_file_size_base
in RocksDB
level_ratio: u8
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
A level target size is: max_memtable_size * level_ratio.pow(#level + 1)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Strategy
impl RefUnwindSafe for Strategy
impl Send for Strategy
impl Sync for Strategy
impl Unpin for Strategy
impl UnwindSafe for Strategy
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)