#Server Lag and Memory Leak

8 messages · Page 1 of 1 (latest)

hoary wyvern
#

Subject: Performance Issues – GTNH Server Lag and Memory Leak

Hello,

I am experiencing major issues with my Minecraft server running the GregTech: New Horizons (GTNH) modpack.

Server Specs:

4 CPU cores

~20 GB RAM available

Java flags: -Xms8G -Xmx14G

Problems:

  1. The console is constantly spamming the message:
    "Can't keep up! Did the system time change, or is the server overloaded?"
    This happens even with only a few players online.

  2. There appears to be a RAM leak:

The server starts around 9 GB RAM usage

Then slowly climbs up to ~18 GB

After ~5 hours it crashes due to running out of memory

Could you please Help meand advise me on how to stabilize the server?

Thank you in advance

nocturne stirrupBOT
#

Please explain the issue you're experiencing in as much detail as possible. Preferably with error messages in a text format or paste link to logs. Nobody can assist you without information that helps to understand the issue. Help us help you. Messages such as "doesn't work" or "i need help" will most likely be ignored.

fresh meteor
# hoary wyvern Subject: Performance Issues – GTNH Server Lag and Memory Leak Hello, I am expe...

For the first problem, you would either need a better cpu or tune the server.properties with lower render distance or other properties, there are server optimization guides on the internet for mc especially

For 2, either you haven't given it enough ram or there is indeed a memory leak, in which case, you'd need to perform a heapdump before the server crashes (depending on if the OS or the JVM kills it, the java argument for HeapDump on OOM may not always work) when it is near full and look at it under a heapdump analyzer like Eclipse MAT, then see what objects are taking the most amount of ram, and find the code where it is occuring, figure out why it is leaking, fix the leak, compile the new mod/code, and done, memory leak fixed

hoary wyvern
#

for the java start i use this

java -Xms12G -Xmx12G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:+UnlockExperimentalVMOptions -XX:MaxGCPauseMillis=200 -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=20 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=15 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=20 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:MaxTenuringThreshold=1 -XX:+PerfDisableSharedMem -XX:+UseStringDeduplication -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./oom.hprof -Dfml.readTimeout=180 @java9args.txt -jar lwjgl3ify-forgePatches.jar nogui

nocturne stirrupBOT
#

Do not use the AlwaysPreTouch Aikar flag as it will preallocate all the memory and starve the container causing it to freeze or crash. Aikar's website warns of this.

Remove the flag or lower the Xmx to have overhead for the container, for example, with -Xmx$(({{SERVER_MEMORY}}-512))M

hoary wyvern
#

I have no changed it like the bot wanted

java -Xms8G -Xmx$(({{SERVER_MEMORY}}-512))M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:+UnlockExperimentalVMOptions -XX:MaxGCPauseMillis=200 -XX:+DisableExplicitGC -XX:G1NewSizePercent=20 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=20 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:MaxTenuringThreshold=1 -XX:+PerfDisableSharedMem -XX:+UseStringDeduplication -XX:MaxDirectMemorySize=1024m -Dio.netty.noPreferDirect=true -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./oom.hprof -XX:+ExitOnOutOfMemoryError -XX:ErrorFile=./hs_err_pid%p.log -Dfml.readTimeout=180 @java9args.txt -jar lwjgl3ify-forgePatches.jar nogui

hoary wyvern
#

java -Xms8G -Xmx15G
-XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:+UnlockExperimentalVMOptions
-XX:MaxGCPauseMillis=200 -XX:+DisableExplicitGC
-XX:G1NewSizePercent=20 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M
-XX:G1ReservePercent=25 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4
-XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90
-XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:MaxTenuringThreshold=1
-XX:+PerfDisableSharedMem -XX:+UseStringDeduplication
-XX:MaxDirectMemorySize=1024m -Dio.netty.noPreferDirect=true
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./oom.hprof
-XX:+ExitOnOutOfMemoryError -XX:ErrorFile=./hs_err_pid%p.log
-Dfml.readTimeout=180 @java9args.txt -jar lwjgl3ify-forgePatches.jar nogui

severe vale
#

try the default startup command given by the egg. Someone had the same issue before (the memory leak) and it was caused by their overly complicated startup command if i remember correctly.