Adjust BadgerDB memory settings to prevent OOM issues and update version to v0.8.8.

This commit is contained in:
2025-10-01 12:40:34 +01:00
parent f8a321eaee
commit 7d5ebd5ccd
2 changed files with 7 additions and 3 deletions

View File

@@ -52,8 +52,12 @@ func New(
}
opts := badger.DefaultOptions(d.dataDir)
opts.BlockCacheSize = int64(units.Gb)
opts.BlockSize = units.Gb
// Use sane defaults to avoid excessive memory usage during startup.
// 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.LmaxCompaction = true
opts.Compression = options.None