diff --git a/minecraft-java/README.md b/minecraft-java/README.md index ee69963..818c474 100644 --- a/minecraft-java/README.md +++ b/minecraft-java/README.md @@ -38,13 +38,21 @@ chosen file downloads through the same allowlist (Modrinth's CDN is listed). ## Memory / JVM heap -The wizard's **JVM max heap** / **JVM initial heap** fields (configSchema -`MAX_MEMORY` / `INIT_MEMORY`, defaults `2G` / `1G`) size the Java heap via -the itzg image's `-Xmx`/`-Xms` plumbing. Keep the max heap roughly **25% -below the container memory limit**: the limit only caps the cgroup — it -does not size the heap — so a heap at or above the limit gets the server -OOM-killed, and a limit far above the heap wastes RAM the JVM will never -touch. +Left empty (the default), the wizard's **JVM max heap** / **JVM initial +heap** fields (configSchema `MAX_MEMORY` / `INIT_MEMORY`) are sized +automatically to **75% of the container memory limit** — pick 8Gi of +memory and the heap becomes 6144M, and it re-tracks the limit whenever +you resize the server. The remaining 25% is headroom for non-heap JVM +memory: the limit only caps the cgroup — it does not size the heap — so +a heap at or above the limit gets the server OOM-killed, and a limit far +above the heap wastes RAM the JVM will never touch. Automatic sizing +needs gameplane ≥ 0.2.0-beta.6 (`gameplaneMinVersion` gates this bundle +accordingly). + +Setting either field explicitly (e.g. `2G`, `3072M`) turns the automatic +sizing off for that field and feeds the value straight to the itzg +image's `-Xmx`/`-Xms` plumbing; keep an explicit max heap roughly 25% +below the container limit for the same reason. ## Logs (including install) diff --git a/minecraft-java/module.yaml b/minecraft-java/module.yaml index 6105d24..bd95e58 100644 --- a/minecraft-java/module.yaml +++ b/minecraft-java/module.yaml @@ -1,9 +1,9 @@ apiVersion: gameplane.local/module/v1 name: minecraft-java displayName: Minecraft (Java Edition) -version: 2.6.0 +version: 2.7.0 game: minecraft-java summary: Vanilla / Paper / Spigot / Bukkit / Purpur / Forge / NeoForge / Fabric / Quilt servers (itzg/minecraft-server) with a version+loader picker spanning 1.16.5–latest, per-loader mod volumes, and in-app Modrinth browse. homepage: https://www.minecraft.net/ license: MIT -gameplaneMinVersion: 0.2.0 +gameplaneMinVersion: 0.2.0-beta.6 diff --git a/minecraft-java/template.yaml b/minecraft-java/template.yaml index 9d4c9a1..47a7855 100644 --- a/minecraft-java/template.yaml +++ b/minecraft-java/template.yaml @@ -519,22 +519,31 @@ spec: type: int default: "10" - # The itzg image passes these to the JVM as -Xms/-Xmx. They must track - # the container memory limit: the limit only caps the cgroup, it does - # NOT size the heap, so a 3Gi limit with the old hardcoded 2G heap - # wasted a gigabyte — and a limit *below* heap + JVM overhead got the - # container OOM-killed. + # The itzg image passes these to the JVM as -Xms/-Xmx. Left empty, + # the operator sizes both to 75% of the container memory limit + # (autoFromMemoryLimit — needs gameplane ≥ 0.2.0-beta.6; the + # remaining 25% is headroom for non-heap JVM memory, which is what + # keeps the cgroup from OOM-killing the server). Equal -Xms/-Xmx + # gives a fixed heap, which game servers prefer over GC-driven + # resizes. - name: MAX_MEMORY displayName: JVM max heap description: >- - Java heap ceiling (e.g. 2G, 3072M). Keep roughly 25% below the - container memory limit — the JVM needs headroom for non-heap - memory, and exceeding the limit gets the server OOM-killed. + Java heap ceiling (-Xmx, e.g. 2G, 3072M). Leave empty to size it + automatically to 75% of the container memory limit — it then + tracks the limit whenever you resize the server. If you set it + yourself, keep roughly 25% below the limit: the JVM needs + headroom for non-heap memory, and exceeding the limit gets the + server OOM-killed. type: string - default: "2G" + autoFromMemoryLimit: + percent: 75 - name: INIT_MEMORY displayName: JVM initial heap - description: Starting heap size (-Xms). At most JVM max heap. + description: >- + Starting heap size (-Xms), at most JVM max heap. Leave empty to + match the automatic max heap (a fixed heap avoids GC resizes). type: string - default: "1G" + autoFromMemoryLimit: + percent: 75