Adjust BadgerDB memory settings to prevent OOM issues and update version to v0.8.8.
This commit is contained in:
@@ -52,8 +52,12 @@ func New(
|
|||||||
}
|
}
|
||||||
|
|
||||||
opts := badger.DefaultOptions(d.dataDir)
|
opts := badger.DefaultOptions(d.dataDir)
|
||||||
opts.BlockCacheSize = int64(units.Gb)
|
// Use sane defaults to avoid excessive memory usage during startup.
|
||||||
opts.BlockSize = units.Gb
|
// Badger's default BlockSize is small (e.g., 4KB). Overriding it to very large values
|
||||||
|
// can cause massive allocations and OOM panics during deployments.
|
||||||
|
// Set BlockCacheSize to a moderate value and keep BlockSize small.
|
||||||
|
opts.BlockCacheSize = int64(256 * units.Mb) // 256 MB cache
|
||||||
|
opts.BlockSize = 4 * units.Kb // 4 KB block size
|
||||||
opts.CompactL0OnClose = true
|
opts.CompactL0OnClose = true
|
||||||
opts.LmaxCompaction = true
|
opts.LmaxCompaction = true
|
||||||
opts.Compression = options.None
|
opts.Compression = options.None
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v0.8.7
|
v0.8.8
|
||||||
Reference in New Issue
Block a user