Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[config change] pebble: no-sync mode and increasing level sizes #2800

Merged
merged 8 commits into from
Dec 20, 2024
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
Loading