Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
125793: storage: use jemalloc size classes when intializing pebble r=RaduBerinde a=aadityasondhi

This patch makes use of the pebble size class aware flush heuristics introduced in cockroachdb/pebble#3508. The experimentation there showed improvements in internal fragmentation.

Fixes cockroachdb#123090.

Release note: None

Co-authored-by: Aaditya Sondhi <20070511+aadityasondhi@users.noreply.github.com>
  • Loading branch information
craig[bot] and aadityasondhi committed Jun 17, 2024
2 parents 81d5418 + 2bdff39 commit 38165df
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/storage/pebble.go
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,21 @@ func DefaultPebbleOptions() *pebble.Options {
l.EnsureDefaults()
}

// These size classes are a subset of available size classes in jemalloc[1].
// The size classes are used by Pebble for determining target block sizes for
// flushes, with the goal of reducing internal fragmentation. There are many
// more size classes that could be included, however, sstable blocks have a
// target block size of 32KiB, a minimum size threshold of ~19.6KiB and are
// unlikely to exceed 128KiB.
//
// [1] https://jemalloc.net/jemalloc.3.html#size_classes
opts.AllocatorSizeClasses = []int{
16384,
20480, 24576, 28672, 32768,
40960, 49152, 57344, 65536,
81920, 98304, 114688, 131072,
}

return opts
}

Expand Down

0 comments on commit 38165df

Please sign in to comment.