Skip to content

Commit 1f27d04

Browse files
committed
ethdb/pebble: lower the compaction debt (ethereum#31988)
This pull request reduces the threshold for triggering compaction at level0, leading to less compaction debt. This change is helpful in the case of heavy write-load, mitigating the case of heavy write stalls caused by compaction. closes ethereum#31830
1 parent 4ee5878 commit 1f27d04

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ethdb/pebble/pebble.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,17 @@ func New(file string, cache int, handles int, namespace string, readonly bool) (
280280
// By setting the WALBytesPerSync, the cached WAL writes will be periodically
281281
// flushed at the background if the accumulated size exceeds this threshold.
282282
WALBytesPerSync: 5 * ethdb.IdealBatchSize,
283+
284+
// L0CompactionThreshold specifies the number of L0 read-amplification
285+
// necessary to trigger an L0 compaction. It essentially refers to the
286+
// number of sub-levels at the L0. For each sub-level, it contains several
287+
// L0 files which are non-overlapping with each other, typically produced
288+
// by a single memory-table flush.
289+
//
290+
// The default value in Pebble is 4, which is a bit too large to have
291+
// the compaction debt as around 10GB. By reducing it to 2, the compaction
292+
// debt will be less than 1GB, but with more frequent compactions scheduled.
293+
L0CompactionThreshold: 2,
283294
}
284295
// Disable seek compaction explicitly. Check https://github.com/ethereum/go-ethereum/pull/20130
285296
// for more details.

0 commit comments

Comments
 (0)