Support in-memory compaction in rocksdb and use it for lock CF #8140
Labels
component/rocksdb
Component: RocksDB engine
difficulty/hard
Difficulty: Hard.
sig/engine
SIG: Engine
Projects
Feature Request
Is your feature request related to a problem? Please describe:
For rocksdb (or any LSM tree implementation) in use cases when data get deleted soon after they being inserted, when memtable flush to disk, the end result could be significant smaller than the memtable size. This will result in inefficient compaction since L0 file sizes become too small. One way to work it around is compacting memtables: instead of flushing memtable when they are full, we can run compaction on them to reduce their size in memory. The technique reduces IO and also keep hot data in memory as much as possible.
One challenge to implement in-memory compaction is handling WAL. Normally when memtable get flushed, corresponding WAL file can be deleted since data is persisted to SSTs. However, after in-memory compaction such WAL files cannot be deleted. They will grow indefinitely. A workaround is to force memtable flush when WAL size reach certain threshold. RocksDB already provide such functionality. The WAL wouldn't be a problem if we remove the use of WAL from KvDB.
We can use in-memory compaction on lock CF to reduce its IO cost and keep its content in memory for query.
This is a common optimization for LSM implementations. We can probably sync with rocksdb team to know their views and plan.
The text was updated successfully, but these errors were encountered: