# Trident environment configuration
# This file is sourced by the trident systemd service.
# Edit this file to override default settings.

# Path to the Trident configuration file
# Both JSON and TOML are supported (detected by file extension)
TRIDENT_CONFIG=/etc/trident/config.toml

# Uncomment to set the number of worker threads (0 = auto-detect CPU cores)
# TRIDENT_WORKERS=0

# Uncomment to set the log level (trace, debug, info, warn, error)
# TRIDENT_LOG_LEVEL=info

# Uncomment to override the listen address
# TRIDENT_LISTEN=0.0.0.0:8120

# jemalloc tuning (BP-59 1.3.2 — Sub-project G) — single-arena strategy to
# minimize per-thread memory retention. Only effective when binary was built
# with --features jemalloc-default. Ignored by mimalloc builds.
#   narenas:1               all threads share one arena (vs default 4×CPUs)
#   tcache:false            disable per-thread cache (eliminates per-thread retained state)
#   dirty_decay_ms:0        return dirty pages to OS immediately
#   muzzy_decay_ms:0        return muzzy (recently-freed) pages immediately
#   abort_conf:true         fail loudly if config has typos
#
# IMPORTANT — env var name: tikv-jemallocator ships jemalloc with the `_rjem_`
# symbol prefix (to avoid conflicts with system jemalloc), which means the
# embedded allocator reads `_RJEM_MALLOC_CONF` — NOT the plain `MALLOC_CONF`.
# Setting only `MALLOC_CONF` is silently ignored and the binary runs with
# jemalloc defaults (4×CPU arenas, tcache on, slow decay) — exactly what
# Sub-project G is trying to avoid. We export BOTH names for safety + forward
# compatibility with any future non-prefixed jemalloc build.
_RJEM_MALLOC_CONF="narenas:1,tcache:false,dirty_decay_ms:0,muzzy_decay_ms:0,abort_conf:true"
MALLOC_CONF="narenas:1,tcache:false,dirty_decay_ms:0,muzzy_decay_ms:0,abort_conf:true"
