Skip to content

Commit b92bd59

Browse files
authored
Merge pull request #2382 from CortexFoundation/dev
adjust memory table size
2 parents ab86fbf + 30a87ad commit b92bd59

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

ctxcdb/pebble/pebble.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,12 @@ func New(file string, cache int, handles int, namespace string, readonly bool) (
164164
// Taken from https://github.com/cockroachdb/pebble/blob/master/internal/constants/constants.go
165165
maxMemTableSize := (1<<31)<<(^uint(0)>>63) - 1
166166

167-
// Two memory tables is configured which is identical to leveldb,
168-
// including a frozen memory table and another live one.
169-
memTableLimit := 2
167+
// Four memory tables are configured, each with a default size of 256 MB.
168+
// Having multiple smaller memory tables while keeping the total memory
169+
// limit unchanged allows writes to be flushed more smoothly. This helps
170+
// avoid compaction spikes and mitigates write stalls caused by heavy
171+
// compaction workloads.
172+
memTableLimit := 4
170173
memTableSize := cache * 1024 * 1024 / 2 / memTableLimit
171174
if memTableSize > maxMemTableSize {
172175
memTableSize = maxMemTableSize - 1

0 commit comments

Comments
 (0)