Lower default heap to 10G

13G left roughly 1G for the OS once the ZFS ARC cap is accounted for. 10G plus
a 2G ARC leaves comfortable headroom on a 16G host.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
main
Amir Alexander Abdelbaki 2026-08-05 22:38:50 +02:00
parent c9da65d7ce
commit 87b280cc91
3 changed files with 10 additions and 10 deletions

View File

@ -41,20 +41,20 @@ server address already filled in.
## Memory ## Memory
The heap defaults to 13 GB (`-X`/`-x` to change it). `-XX:+AlwaysPreTouch` means The heap defaults to 10 GB (`-X`/`-x` to change it). `-XX:+AlwaysPreTouch` means
the JVM commits the whole heap at startup rather than growing into it. the JVM commits the whole heap at startup rather than growing into it, so the
number you set is the number actually taken.
On a ZFS host, cap the ARC before running a heap this large — ZFS defaults to On a ZFS host, cap the ARC to go with it — ZFS defaults to using up to half of
using up to half of RAM for cache, which will fight the JVM for the same pages: RAM for cache, and will otherwise contend with the JVM for the same pages:
```bash ```bash
echo "options zfs zfs_arc_max=2147483648" | sudo tee /etc/modprobe.d/zfs.conf echo "options zfs zfs_arc_max=2147483648" | sudo tee /etc/modprobe.d/zfs.conf
sudo dracut --force && sudo reboot sudo dracut --force && sudo reboot
``` ```
That pins the ARC to 2 GB. On a 16 GB box, 13 GB heap + 2 GB ARC leaves ~1 GB That pins the ARC to 2 GB. On a 16 GB box that leaves roughly 4 GB for the OS
for everything else, which is tight — drop the heap to 1011 GB if the host and anything else the host runs, which is comfortable.
does anything besides run the server.
## Requirements ## Requirements

View File

@ -14,7 +14,7 @@
set -euo pipefail set -euo pipefail
NAME=""; AUTHOR=""; BASEURL=""; NFVER="latest"; MCVER="1.21.1" NAME=""; AUTHOR=""; BASEURL=""; NFVER="latest"; MCVER="1.21.1"
SHARE="/minecraft"; XMX="13G"; XMS="13G"; ACCEPT_EULA="" SHARE="/minecraft"; XMX="10G"; XMS="10G"; ACCEPT_EULA=""
HERE="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" HERE="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
die() { echo "error: $*" >&2; exit 1; } die() { echo "error: $*" >&2; exit 1; }

View File

@ -18,8 +18,8 @@ set -euo pipefail
SHARE="/minecraft" SHARE="/minecraft"
MCUSER="minecraft" MCUSER="minecraft"
XMS="13G" XMS="10G"
XMX="13G" XMX="10G"
NFVER="" # version, or "latest" to resolve one; empty = don't install NFVER="" # version, or "latest" to resolve one; empty = don't install
MCVER="1.21.1" # only used to pick the matching NeoForge series MCVER="1.21.1" # only used to pick the matching NeoForge series
ADMIN="" # human user who authors the pack on the share ADMIN="" # human user who authors the pack on the share