Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ CONF_String(mem_limit, "90%");
// Enable the jemalloc tracker, which is responsible for reserving memory
CONF_Bool(enable_jemalloc_memory_tracker, "true");

// The jemalloc runtime options applied via the JEMALLOC_CONF environment variable when the
// process is started in the normal mode (i.e. neither --jemalloc_debug nor --check_mem_leak) and JEMALLOC_CONF is not already set.
// jemalloc reads JEMALLOC_CONF at process init before BE config parsing, so this config does not
// reconfigure jemalloc at runtime; it is exported by bin/start_backend.sh and surfaced here purely
// for observability via information_schema.be_configs. It is ignored under the jemalloc_debug and
// check_mem_leak modes, which force their own JEMALLOC_CONF.
// NOTE: keep this default in sync with the normal-mode default in bin/start_backend.sh.
CONF_String(jemalloc_conf,
Comment thread
trueeyu marked this conversation as resolved.
"percpu_arena:percpu,oversize_threshold:0,muzzy_decay_ms:5000,dirty_decay_ms:5000,metadata_thp:auto,"
"background_thread:true,prof:true,prof_active:false");
Comment thread
trueeyu marked this conversation as resolved.

// Whether abort the process if a large memory allocation is detected which the requested
// size is larger than the available physical memory without wrapping with TRY_CATCH_BAD_ALLOC
CONF_mBool(abort_on_large_memory_allocation, "false");
Expand Down
11 changes: 10 additions & 1 deletion bin/start_backend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,16 @@ if [[ -z "$JEMALLOC_CONF" ]]; then
elif [ ${RUN_CHECK_MEM_LEAK} -eq 1 ] ; then
export JEMALLOC_CONF="percpu_arena:percpu,oversize_threshold:0,muzzy_decay_ms:5000,dirty_decay_ms:5000,metadata_thp:auto,background_thread:true,prof:true,prof_active:true,prof_leak:true,lg_prof_sample:0,prof_final:true"
else
export JEMALLOC_CONF="percpu_arena:percpu,oversize_threshold:0,muzzy_decay_ms:5000,dirty_decay_ms:5000,metadata_thp:auto,background_thread:true,prof:true,prof_active:false"
# Normal mode: take the value from the `jemalloc_conf` config in be.conf/cn.conf so it is
# observable via information_schema.be_configs. Fall back to the built-in default when unset.
# NOTE: keep this default in sync with CONF_String(jemalloc_conf, ...) in be/src/common/config.h.
jemalloc_conf="percpu_arena:percpu,oversize_threshold:0,muzzy_decay_ms:5000,dirty_decay_ms:5000,metadata_thp:auto,background_thread:true,prof:true,prof_active:false"
if [ ${RUN_BE} -eq 1 ]; then
read_var_from_conf jemalloc_conf $STARROCKS_HOME/conf/be.conf
elif [ ${RUN_CN} -eq 1 ]; then
read_var_from_conf jemalloc_conf $STARROCKS_HOME/conf/cn.conf
Comment thread
trueeyu marked this conversation as resolved.
fi
export JEMALLOC_CONF="$jemalloc_conf"
fi
fi

Expand Down
Loading