-
Notifications
You must be signed in to change notification settings - Fork 886
move pebble checkpoints off of the execution goroutine #4039
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,7 +74,7 @@ func DefaultViewManagerConfig(name string, reservedPrefix string) *ViewManagerCo | |
| Name: name, | ||
| MetricsEnabled: true, | ||
| MetricsScrapeIntervalSeconds: 10, | ||
| MaxUnflushedVersions: 4, | ||
| MaxUnflushedVersions: 1024, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [suggestion] Raising the default from 4 to 1024 applies to all four FlatKV view managers, and this is the only bound on that backlog: The increase is required by the design (with 4, Worth recording the reasoning here (why 1024 rather than something just above
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. any OOM risk here to MaxUnflushedVersions to 1024? |
||
| TargetBytesPerFlush: unit.MB * 4, | ||
| ReservedPrefix: reservedPrefix, | ||
| FlushSync: false, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,11 +8,6 @@ import ( | |
| "github.com/sei-protocol/sei-chain/sei-db/db_engine/view" | ||
| ) | ||
|
|
||
| const ( | ||
| DefaultSnapshotInterval uint32 = 10000 | ||
| DefaultSnapshotKeepRecent uint32 = 1 | ||
| ) | ||
|
|
||
| // Config defines configuration for the FlatKV (EVM) commit store. | ||
| type Config struct { | ||
| // DataDir is the root directory for the FlatKV data files. | ||
|
|
@@ -22,27 +17,32 @@ type Config struct { | |
| // Fsync controls whether every view manager's flush is fsync'd. It overwrites each store | ||
| // config's FlushSync, so the four databases are always synced alike. The state WAL is | ||
| // unaffected and always writes NoSync. | ||
| // Default: false | ||
| Fsync bool `mapstructure:"fsync"` | ||
|
|
||
| // AsyncWriteBuffer defines the size of the async write buffer for data DBs. | ||
| // Set <= 0 for synchronous writes. | ||
| // Default: 0 (synchronous) | ||
| AsyncWriteBuffer int `mapstructure:"async-write-buffer"` | ||
|
|
||
| // SnapshotInterval defines how often (in blocks) a PebbleDB checkpoint | ||
| // snapshot is taken. 0 disables auto-snapshots. | ||
| // Without periodic snapshots the WAL grows unbounded and every restart | ||
| // replays the entire history from snapshot-0. | ||
| // Default: 10000 | ||
| SnapshotInterval uint32 `mapstructure:"snapshot-interval"` | ||
|
|
||
| // SnapshotKeepRecent defines how many old snapshots to keep besides the | ||
| // latest one. 0 means keep only the current snapshot (no old snapshots). | ||
| // Ignored entirely when ExternalPruning is set. | ||
| // Default: 1 | ||
| SnapshotKeepRecent uint32 `mapstructure:"snapshot-keep-recent"` | ||
|
|
||
| // MaxSnapshotLagBlocks is how many committed blocks may queue up behind a snapshot that is still | ||
| // being written before Commit blocks. A value below 1 is treated as 1. | ||
| // | ||
| // A snapshot being written holds every database pinned at its own height, so no later block can | ||
| // reach disk until it completes, and each one is retained in memory meanwhile. This bounds how far | ||
| // that can run, trading a pause in block production for the memory the backlog would otherwise | ||
| // consume. It bounds blocks rather than bytes, so it mitigates exhaustion rather than preventing it. | ||
| MaxSnapshotLagBlocks uint32 `mapstructure:"max-snapshot-lag-blocks"` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [suggestion] The This knob is the whole of the writer's backpressure and the one lever an operator has when a checkpoint outruns block production, so it is the flatkv field most worth wiring rather than least. Suggest adding the guarded read alongside the other four in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 |
||
|
|
||
| // ExternalPruning hands retention to the StorageGarbageCollector: the store stops pruning its | ||
| // own snapshots (SnapshotKeepRecent) and stops truncating the state WAL. | ||
| // | ||
|
|
@@ -51,16 +51,12 @@ type Config struct { | |
| // | ||
| // With it on, snapshots are retained by height rather than by count, so the number kept becomes | ||
| // RollbackWindow / SnapshotInterval instead of SnapshotKeepRecent + 1. | ||
| // | ||
| // Default: false | ||
| ExternalPruning bool `mapstructure:"-"` | ||
|
|
||
| // EnablePebbleMetrics defines if the Pebble metrics should be enabled. | ||
| // Default: true | ||
| EnablePebbleMetrics bool `mapstructure:"enable-pebble-metrics"` | ||
|
|
||
| // EnableReadWriteMetrics emits simple estimated read/write counters for FlatKV's Pebble DBs. | ||
| // Default: false | ||
| EnableReadWriteMetrics bool `mapstructure:"enable-read-write-metrics"` | ||
|
|
||
| // AccountDBConfig defines the PebbleDB configuration for the account database. | ||
|
|
@@ -133,8 +129,9 @@ func DefaultConfig() *Config { | |
| cfg := &Config{ | ||
| Fsync: false, | ||
| AsyncWriteBuffer: 0, | ||
| SnapshotInterval: DefaultSnapshotInterval, | ||
| SnapshotKeepRecent: DefaultSnapshotKeepRecent, | ||
| SnapshotInterval: 10000, | ||
| SnapshotKeepRecent: 1, | ||
| MaxSnapshotLagBlocks: 512, | ||
| EnablePebbleMetrics: true, | ||
| AccountDBConfig: pebbledb.DefaultConfig(), | ||
| AccountStoreConfig: defaultStoreConfig("account"), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be a pretty big jump? Why do we need that big of backlog?