Created
July 26, 2022 18:47
-
-
Save kaspergrubbe/01a3b15481527f43e4685badf558aee2 to your computer and use it in GitHub Desktop.
Tuning Jemalloc 5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inspiration: https://twitter.com/wgjordan/status/1440574986264006659 | |
jemalloc_conf = { | |
# Maximum number of arenas to use for automatic multiplexing of threads and arenas. | |
# The default is four times the number of CPUs, or one if there is a single CPU. | |
narenas: 2, | |
# Enabling jemalloc background threads generally improves the tail latency for application threads, | |
# since unused memory purging is shifted to the dedicated background threads. | |
# In addition, unintended purging delay caused by application inactivity is avoided with background threads. | |
# | |
# Suggested: background_thread:true when jemalloc managed threads can be allowed. | |
background_thread: true, # default false | |
# Transparent hugepage (THP) mode. | |
# Settings "always", "never" and "default" are available if THP is supported by the operating system. | |
# The "always" setting enables transparent hugepage for all user memory mappings with MADV_HUGEPAGE; | |
# "never" ensures no transparent hugepage with MADV_NOHUGEPAGE; the default setting "default" makes no changes. | |
thp: 'never', | |
# Decay time determines how fast jemalloc returns unused pages back to the operating system, | |
# and therefore provides a fairly straightforward trade-off between CPU and memory usage. | |
# Shorter decay time purges unused pages faster to reduces memory usage | |
# (usually at the cost of more CPU cycles spent on purging), and vice versa. | |
# | |
# Suggested: tune the values based on the desired trade-offs. | |
dirty_decay_ms: 1_000, # Default 10_000 | |
muzzy_decay_ms: 0 # Default 10_000 | |
}.map {|x| x.join(':')}.join(',') | |
# MALLOC_CONF="narenas:2,background_thread:true,thp:never,dirty_decay_ms:1000,muzzy_decay_ms:0" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment