feat: 减少 badger 的内存占用 (#1216)

This commit is contained in:
zhengkunwang223 2023-06-01 14:45:18 +08:00 committed by GitHub
parent 6abd313bd2
commit d40b2734a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,29 +14,29 @@ func Init() {
options := badger.Options{ options := badger.Options{
Dir: c, Dir: c,
ValueDir: c, ValueDir: c,
ValueLogFileSize: 102400000, ValueLogFileSize: 64 << 20,
ValueLogMaxEntries: 100000, ValueLogMaxEntries: 10 << 20,
VLogPercentile: 0.1, VLogPercentile: 0.1,
MemTableSize: 64 << 20, MemTableSize: 32 << 20,
BaseTableSize: 2 << 20, BaseTableSize: 2 << 20,
BaseLevelSize: 10 << 20, BaseLevelSize: 10 << 20,
TableSizeMultiplier: 2, TableSizeMultiplier: 2,
LevelSizeMultiplier: 10, LevelSizeMultiplier: 10,
MaxLevels: 7, MaxLevels: 7,
NumGoroutines: 8, NumGoroutines: 4,
MetricsEnabled: true, MetricsEnabled: true,
NumCompactors: 4, NumCompactors: 2,
NumLevelZeroTables: 5, NumLevelZeroTables: 5,
NumLevelZeroTablesStall: 15, NumLevelZeroTablesStall: 15,
NumMemtables: 5, NumMemtables: 1,
BloomFalsePositive: 0.01, BloomFalsePositive: 0.01,
BlockSize: 4 * 1024, BlockSize: 2 * 1024,
SyncWrites: false, SyncWrites: false,
NumVersionsToKeep: 1, NumVersionsToKeep: 1,
CompactL0OnClose: false, CompactL0OnClose: false,
VerifyValueChecksum: false, VerifyValueChecksum: false,
BlockCacheSize: 256 << 20, BlockCacheSize: 32 << 20,
IndexCacheSize: 0, IndexCacheSize: 0,
ZSTDCompressionLevel: 1, ZSTDCompressionLevel: 1,
EncryptionKey: []byte{}, EncryptionKey: []byte{},