diff --git a/lib/db/backend/leveldb_backend.go b/lib/db/backend/leveldb_backend.go index c45cf9dd7..959b6558a 100644 --- a/lib/db/backend/leveldb_backend.go +++ b/lib/db/backend/leveldb_backend.go @@ -13,10 +13,17 @@ import ( ) const ( - // Never flush transactions smaller than this, even on Checkpoint() - dbFlushBatchMin = 1 << MiB - // Once a transaction reaches this size, flush it unconditionally. - dbFlushBatchMax = 128 << MiB + // Never flush transactions smaller than this, even on Checkpoint(). + // This just needs to be just large enough to avoid flushing + // transactions when they are super tiny, thus creating millions of tiny + // transactions unnecessarily. + dbFlushBatchMin = 64 << KiB + // Once a transaction reaches this size, flush it unconditionally. This + // should be large enough to avoid forcing a flush between Checkpoint() + // calls in loops where we do those, so in principle just large enough + // to hold a FileInfo plus corresponding version list and metadata + // updates or two. + dbFlushBatchMax = 1 << MiB ) // leveldbBackend implements Backend on top of a leveldb