Skip to content

Commit 146e6e1

Browse files
authored
chore: add badger constraints on index and block cache (#3209)
* add sustainable badger configs * remove blockcache size * changelog
1 parent a4484f5 commit 146e6e1

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818
### Fixed
1919

2020
- Avoid evicting yet to be processed heights [#3204](https://github.com/evstack/ev-node/pull/3204)
21+
- Bound Badger index cache memory to prevent growth with chain length [3209](https://github.com/evstack/ev-node/pull/3209)
2122
- Refetch latest da height instead of da height +1 when P2P is offline [#3201](https://github.com/evstack/ev-node/pull/3201)
2223
- Fix race on startup sync. [#3162](https://github.com/evstack/ev-node/pull/3162)
2324
- Strict raft state. [#3167](https://github.com/evstack/ev-node/pull/3167)

pkg/store/badger_options.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,20 @@ import (
66
badger4 "github.com/ipfs/go-ds-badger4"
77
)
88

9+
const (
10+
// DefaultBadgerIndexCacheSize bounds Badger's table index and bloom filter
11+
// cache to avoid growth with chain length.
12+
DefaultBadgerIndexCacheSize int64 = 256 << 20 // 256 MiB
13+
)
14+
915
// BadgerOptions returns ev-node tuned Badger options for the node workload.
1016
// These defaults favor write throughput for append-heavy usage.
1117
func BadgerOptions() *badger4.Options {
1218
opts := badger4.DefaultOptions
1319

20+
// Bound Badger-owned caches explicitly instead of inheriting a large block
21+
// cache and an unbounded index cache from the upstream defaults.
22+
opts.Options = opts.WithIndexCacheSize(DefaultBadgerIndexCacheSize)
1423
// Disable conflict detection to reduce write overhead; ev-node does not rely
1524
// on Badger's multi-writer conflict checks for correctness.
1625
opts.Options = opts.WithDetectConflicts(false)

0 commit comments

Comments
 (0)