Skip to content

Commit

Permalink
Merge pull request #2800 from OffchainLabs/pebble-no-sync-and-levels
Browse files Browse the repository at this point in the history
[config change] pebble: no-sync mode and increasing level sizes
  • Loading branch information
joshuacolvin0 authored Dec 20, 2024
2 parents ffa2388 + b528421 commit 56ff5ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion cmd/conf/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,19 @@ func (c *PersistentConfig) Validate() error {
}

type PebbleConfig struct {
SyncMode bool `koanf:"sync-mode"`
MaxConcurrentCompactions int `koanf:"max-concurrent-compactions"`
Experimental PebbleExperimentalConfig `koanf:"experimental"`
}

var PebbleConfigDefault = PebbleConfig{
SyncMode: false, // use NO-SYNC mode, see: https://github.com/ethereum/go-ethereum/issues/29819
MaxConcurrentCompactions: runtime.NumCPU(),
Experimental: PebbleExperimentalConfigDefault,
}

func PebbleConfigAddOptions(prefix string, f *flag.FlagSet, defaultConfig *PebbleConfig) {
f.Bool(prefix+".sync-mode", defaultConfig.SyncMode, "if true sync mode is used (data needs to be written to WAL before the write is marked as completed)")
f.Int(prefix+".max-concurrent-compactions", defaultConfig.MaxConcurrentCompactions, "maximum number of concurrent compactions")
PebbleExperimentalConfigAddOptions(prefix+".experimental", f, &defaultConfig.Experimental)
}
Expand Down Expand Up @@ -180,7 +183,7 @@ var PebbleExperimentalConfigDefault = PebbleExperimentalConfig{
BlockSize: 4 << 10, // 4 KB
IndexBlockSize: 4 << 10, // 4 KB
TargetFileSize: 2 << 20, // 2 MB
TargetFileSizeEqualLevels: true,
TargetFileSizeEqualLevels: false,

L0CompactionConcurrency: 10,
CompactionDebtConcurrency: 1 << 30, // 1GB
Expand Down Expand Up @@ -251,6 +254,7 @@ func (c *PebbleConfig) ExtraOptions(namespace string) *pebble.ExtraOptions {
walDir = path.Join(walDir, namespace)
}
return &pebble.ExtraOptions{
SyncMode: c.SyncMode,
BytesPerSync: c.Experimental.BytesPerSync,
L0CompactionFileThreshold: c.Experimental.L0CompactionFileThreshold,
L0CompactionThreshold: c.Experimental.L0CompactionThreshold,
Expand Down
2 changes: 1 addition & 1 deletion go-ethereum

0 comments on commit 56ff5ec

Please sign in to comment.