performance tweaks (zgc, sysctl, jvmopts, etc)
All checks were successful
Activate Homelab Configuration / rebuild (push) Successful in 59s
All checks were successful
Activate Homelab Configuration / rebuild (push) Successful in 59s
This commit is contained in:
parent
6b13eb3323
commit
37867492a9
1 changed files with 27 additions and 42 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
{ inputs, lib, pkgs, ... }: let
|
{ inputs, lib, pkgs, ... }: let
|
||||||
ram-allocation = "10240M";
|
ram-allocation-mb = 12288;
|
||||||
# auth-server = "https://mc.satr14.my.id"; # TODO: self hosted drasl server
|
|
||||||
modpack = let
|
modpack = let
|
||||||
commit = "667aadf36aac9b0689289f4988a76b924bbb9cbc";
|
commit = "667aadf36aac9b0689289f4988a76b924bbb9cbc";
|
||||||
in pkgs.fetchPackwizModpack {
|
in pkgs.fetchPackwizModpack {
|
||||||
|
|
@ -11,6 +10,12 @@ in {
|
||||||
imports = [ inputs.mc.nixosModules.minecraft-servers ];
|
imports = [ inputs.mc.nixosModules.minecraft-servers ];
|
||||||
nixpkgs.overlays = [ inputs.mc.overlay ];
|
nixpkgs.overlays = [ inputs.mc.overlay ];
|
||||||
|
|
||||||
|
powerManagement.cpuFreqGovernor = "schedutil";
|
||||||
|
boot.kernel.sysctl = {
|
||||||
|
"vm.nr_hugepages" = 6656;
|
||||||
|
"vm.swappiness" = 10;
|
||||||
|
};
|
||||||
|
|
||||||
services.minecraft-servers = {
|
services.minecraft-servers = {
|
||||||
enable = true;
|
enable = true;
|
||||||
eula = true;
|
eula = true;
|
||||||
|
|
@ -21,54 +26,34 @@ in {
|
||||||
enable = true;
|
enable = true;
|
||||||
autoStart = true;
|
autoStart = true;
|
||||||
restart = "always";
|
restart = "always";
|
||||||
enableReload = false; # NOTE: development phase, disable in production
|
enableReload = true; # NOTE: development phase, disable in production
|
||||||
|
|
||||||
package = pkgs.fabricServers.fabric-1_21_11.override {
|
package = pkgs.fabricServers.fabric-1_21_11.override {
|
||||||
jre_headless = pkgs.javaPackages.compiler.temurin-bin.jre-25;
|
jre_headless = pkgs.javaPackages.compiler.temurin-bin.jdk-25;
|
||||||
loaderVersion = "0.19.2";
|
loaderVersion = "0.19.2";
|
||||||
};
|
};
|
||||||
|
|
||||||
jvmOpts = let
|
jvmOpts = let flags = [
|
||||||
flags = [
|
"-Xms${toString ram-allocation-mb}M"
|
||||||
"-Xms${ram-allocation}"
|
"-Xmx${toString ram-allocation-mb}M"
|
||||||
"-Xmx${ram-allocation}"
|
|
||||||
"--add-modules=jdk.incubator.vector"
|
|
||||||
|
|
||||||
# Custom auth server
|
|
||||||
# "-Dminecraft.api.env=custom"
|
|
||||||
# "-Dminecraft.api.auth.host=${auth-server}/auth"
|
|
||||||
# "-Dminecraft.api.account.host=${auth-server}/account"
|
|
||||||
# "-Dminecraft.api.profiles.host=${auth-server}/account"
|
|
||||||
# "-Dminecraft.api.session.host=${auth-server}/session"
|
|
||||||
# "-Dminecraft.api.services.host=${auth-server}/services"
|
|
||||||
|
|
||||||
# Aikar's GC flags (tuned for 10GB)
|
# Exposes SIMD instructions (requires full JDK, useful with performance mods)
|
||||||
"-XX:+UseG1GC"
|
"--add-modules=jdk.incubator.vector"
|
||||||
"-XX:+ParallelRefProcEnabled"
|
|
||||||
"-XX:MaxGCPauseMillis=200"
|
# ZGC flags (requires Java v25+, 8+ CPU cores, 10GB+ RAM)
|
||||||
"-XX:+UnlockExperimentalVMOptions"
|
"-XX:+UseZGC"
|
||||||
"-XX:+DisableExplicitGC"
|
"-XX:+UseLargePages"
|
||||||
"-XX:+AlwaysPreTouch"
|
"-XX:+AlwaysPreTouch"
|
||||||
"-XX:G1HeapWastePercent=5"
|
"-XX:+DisableExplicitGC"
|
||||||
"-XX:G1MixedGCCountTarget=4"
|
"-XX:+PerfDisableSharedMem"
|
||||||
"-XX:InitiatingHeapOccupancyPercent=15"
|
"-XX:+UseCompactObjectHeaders"
|
||||||
"-XX:G1MixedGCLiveThresholdPercent=90"
|
"-XX:ZAllocationSpikeTolerance=5"
|
||||||
"-XX:G1RSetUpdatingPauseTimePercent=5"
|
"-XX:SoftMaxHeapSize=${toString (ram-allocation-mb - 2048)}M"
|
||||||
"-XX:SurvivorRatio=32"
|
]; in lib.concatStringsSep " " flags;
|
||||||
"-XX:+PerfDisableSharedMem"
|
|
||||||
"-XX:MaxTenuringThreshold=1"
|
|
||||||
"-Dusing.aikars.flags=https://mcflags.emc.gs"
|
|
||||||
"-Daikars.new.flags=true"
|
|
||||||
"-XX:G1NewSizePercent=30"
|
|
||||||
"-XX:G1MaxNewSizePercent=40"
|
|
||||||
"-XX:G1HeapRegionSize=8M"
|
|
||||||
"-XX:G1ReservePercent=20"
|
|
||||||
];
|
|
||||||
in lib.concatStringsSep " " flags;
|
|
||||||
|
|
||||||
serverProperties = {
|
serverProperties = {
|
||||||
server-port = 25565;
|
server-port = 25565;
|
||||||
server-name = "Digit Association";
|
server-name = "Minecraft Server";
|
||||||
motd = "§lSeason 3 TESTING§r - §dExplorers Creativity 🔥";
|
motd = "§lSeason 3 TESTING§r - §dExplorers Creativity 🔥";
|
||||||
|
|
||||||
difficulty = "normal";
|
difficulty = "normal";
|
||||||
|
|
@ -88,7 +73,7 @@ in {
|
||||||
# resource-pack-sha1 = "e0958dcef5755286f390c22280700c471ec34a65";
|
# resource-pack-sha1 = "e0958dcef5755286f390c22280700c471ec34a65";
|
||||||
# resource-pack-enforce = false;
|
# resource-pack-enforce = false;
|
||||||
|
|
||||||
simulation-distance = 16;
|
simulation-distance = 12;
|
||||||
view-distance = 4;
|
view-distance = 4;
|
||||||
|
|
||||||
enable-rcon = true;
|
enable-rcon = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue