-
Notifications
You must be signed in to change notification settings - Fork 555
perf: investigate rent-or-buy compaction heuristics #48
Description
Pebble currently implements compaction heuristics that match the RocksDB kOldestSmallestSeqFirst setting combined with level_compaction_dynamic_level_bytes. The kOldestSmallestSeqFirst setting has this comment:
// First compact files whose range hasn't been compacted to the next level
// for the longest. If your updates are random across the key space,
// write amplification is slightly better with this option.
CRDB currently uses a different compaction heuristic, kMinOverlappingRatio:
// First compact files whose ratio between overlapping size in next level
// and its size is the smallest. It in many cases can optimize write
// amplification.
The KOldestSmallestSeqFirst heuristic has the advantage of being simpler, and it avoids starving an sstable from being compacted. kMinOverlappingRatio is the default heuristic in RocksDB. My understanding is that it can propagate deletion tombstones to lower levels quicker.
It is unclear to me if kMinOverlappingRatio is significantly better for CRDBs use case. Note that CRDB also know marks any sstable containing a range deletion tombstone as requiring compaction, which will tend to result in range deletion tombstones quickly compacting down to the bottom of the LSM and thus freeing up space. Incorporating better heuristics around range deletion tombstones into compaction is worth investigating.
Cc @ajkr
Jira issue: PEBBLE-187