Add JVM_EXPERIMENTAL_PERFORMANCE configuration to enable compact object headers and transparent huge pages in the JVM.

This commit is contained in:
Overlord committed 2026-10-07 07:57:17 +02:00
1 parent 49af536786
commit be08756c36
3 files changed
+57 -38

No files matched your search

+14
View File
@@ -45,6 +45,12 @@
# JVM_UNCOMMIT_DELAY
# Seconds of disuse after which ZGC returns heap memory to the system
# (-XX:ZUncommitDelay). Default: 60 (JVM default: 300)
# JVM_EXPERIMENTAL_PERFORMANCE
# true/false: compact object headers (-XX:+UseCompactObjectHeaders) and
# transparent huge pages for the heap (-XX:+UseTransparentHugePages).
# Huge pages need the host's
# /sys/kernel/mm/transparent_hugepage/shmem_enabled at advise or always;
# otherwise the JVM logs a warning and runs without them. Default: false
#
# Maintenance
# SOFT_RESET true: start in Project Zomboid's soft reset mode (-Dsoftreset).
@@ -83,6 +89,7 @@ readonly RCON_PASSWORD="${RCON_PASSWORD:-}"
readonly JVM_MIN_HEAP="${JVM_MIN_HEAP:-}"
readonly JVM_MAX_HEAP="${JVM_MAX_HEAP:-}"
readonly JVM_UNCOMMIT_DELAY="${JVM_UNCOMMIT_DELAY:-60}"
readonly JVM_EXPERIMENTAL_PERFORMANCE="${JVM_EXPERIMENTAL_PERFORMANCE:-}"
readonly SOFT_RESET="${SOFT_RESET:-}"
readonly SERVER_INI="${DATA_DIR}/Server/${SERVER_NAME}.ini"
@@ -336,6 +343,13 @@ build_jvm_args() {
if [[ -n "${JVM_MIN_HEAP}" ]]; then
jvm_args+=("-Xms${JVM_MIN_HEAP}")
fi
if [[ -n "${JVM_EXPERIMENTAL_PERFORMANCE}" ]]; then
if is_true "${JVM_EXPERIMENTAL_PERFORMANCE}"; then
jvm_args+=("-XX:+UseCompactObjectHeaders" "-XX:+UseTransparentHugePages")
elif ! is_false "${JVM_EXPERIMENTAL_PERFORMANCE}"; then
fail "JVM_EXPERIMENTAL_PERFORMANCE must be true or false, got '${JVM_EXPERIMENTAL_PERFORMANCE}'."
fi
fi
if [[ -n "${SOFT_RESET}" ]] && is_true "${SOFT_RESET}"; then
log "SOFT_RESET is set: starting in soft reset mode. Unset it for the next start."
jvm_args+=("-Dsoftreset")