Search code examples
javaminecraftg1gc

Application freezing on g1 old run


we currently run DonutSMP.net, a minecraft server that handles concurrently more than 4000 players online every day and it runs a survival gamemode, chunk-intensive, currently we have been experiencing some G1 OLD issues, every time the g1 old runs the server freezes, and mainly we would avoid the G1 old running since its not a cheap process at all. Is there anything I can do to investigate what would be causing it to run, not only once but its consitent.

Here is the startup flags of all the applications, we run about 30 mc boxes & all of them seem to be having the same issue.

-Xms16G -Xmx16G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=40 -XX:G1MaxNewSizePercent=50 -XX:G1HeapRegionSize=16M -XX:G1ReservePercent=15 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=20 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 --add-modules=jdk.incubator.vector -Dusing.aikars.flags=https://mcflags.emc.gs/ -Daikars.new.flags=true

I have heap dumps of the most intensive memory usage moments, I just dont know exactly what to be looking for.

I already tried analyzing the heapdump but there doesnt seem to be a memory leak that's visible fast, the instances arent really crashing for now. Ive already tried reducing memory usage by lowering the view distance etc, so far some things havent worked. I have also tried to change hte startup flag parameters, but if they are the cause, i havent achieved the good values one yet. I am expecting the G1 old not to run because every time it does the server freezes, these instances run about 90 players survival and everything is really tunnned tweaked, it shouldnt be happening.


Solution

  • If it was me, I would get rid of all of these options:

    -XX:G1NewSizePercent=40 -XX:G1MaxNewSizePercent=50 
    -XX:G1HeapRegionSize=16M -XX:G1ReservePercent=15 
    -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 
    -XX:InitiatingHeapOccupancyPercent=20
    -XX:G1MixedGCLiveThresholdPercent=90
    -XX:G1RSetUpdatingPauseTimePercent=5 
    -XX:SurvivorRatio=32 -XX:MaxTenuringThreshold=1
    

    Then tell the G1GC what pause time to aim for, and let it work things out for itself.

    In particular, the options that set sizes or ratios for the new space will override G1GC's self-tuning that is intended to meet your specified pause time goals. The new space collection is stop-the-world, so a collection of a large new space is going to inevitably lead to long pauses.

    For more advice, read: