Server freeze after reached full memory

Discussion in 'Performance Tweaking' started by Anderson66, Sep 28, 2019.

  1. Hi, I have a big problem with 1.14.4. I have a VPS with 16GB RAM and six cores of CPU.
    The server works fine with 20 - 30 players. I have 19-20TPS. But problem is when the server is turned on too long. After 6 - 8h since start the memory is almost full. I have 14GB Memory for java (with Xmx and Xms) and when server reached 13600 - 13800MB then just freeze and I have a error that server is not responding for 30 - 40 secs. And the most important is that i have to restart the server manually becouse this error isnt one-time. After few minutes the memory again reached limit... And over and over its the same. After full restart the server again works fine 6 - 8h. And the amount of players is doesnt matter, becouse the full memory is reached even at night when on server is one player!

    Here is my startup flags:

    Code (Text):
    java -Xms14G -Xmx14G -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:MaxGCPauseMillis=100 -XX:+DisableExplicitGC -XX:TargetSurvivorRatio=90 -XX:G1NewSizePercent=50 -XX:G1MaxNewSizePercent=80 -XX:G1MixedGCLiveThresholdPercent=35 -XX:+AlwaysPreTouch -XX:+ParallelRefProcEnabled -Dusing.aikars.flags=mcflags.emc.gs
    What can i do? I dont want to restart the server manually every 6 hours..
     
  2. Well first of all, If you are using 14 GB of ram for 30 players, You have a plugin that is leaking resources. Secondly, You don't want your XMS to Equal your XMX. Your XMS should be set around 2-4GB.
     
    • Agree Agree x 1
  3. I read this tutorial many many times, and I do everything and even more that is there written. I limited mobs, activation ranges, everything. I also have plugins like this: ClearLag (very helpful), EntityTracker, VillagerOptimiser. I think that 14GB RAM for 30 players is OK (in 1.14.4) becouse i heard that many people have problems with 1.14.4 so I'm happy that I can handle 30 players. I will check your tip, I decrease xms to 4GB.
     
  4. One or more of your plugins probably have memory leaks, get a heap dump and analyze it or try removing some of the plugins to see if the servers lasts longer without a restart.
     
  5. What is a heap dump?
     
  6. I'd advise using less memory perhaps which may work.
     
  7. I'm using these plugins:
    [​IMG]

    Which one should be suspected?
     
  8. Try removing PlayerListPlus
     
  9. OK, I've upgrade my VPS to 32GB RAM and 8 cores of CPU. I was observating the server memory with command /lagg check
    I decided to drawn my own diagram. The diagram isnt generated by software but I've drawed it by myself.

    [​IMG]

    Look, server dont want to fully release the memory. It's still increase and increase. I so angry becouse I think 30GB is a lot but I can handle server for only about 6/8 hours...
     
  10. Try installing the plugin spark. You can use /spark heapsummary to get an easy-to-read summary of what is taking up your memory. If it doesn't tell you enough you'll have to take a heap dump, which you can also do with spark using /spark heapdump. This will create a very large file, so make sure you have enough disk space. You'll need an external tool to analyse this: Eclipse Memory Analyzer is a nice free one.
     
  11. You said that it freezes and give errors, maybe you can send the errors?

    It is probably an memory leak, you can try to test every plugin one by one or use an analyzing plugin.
     
  12. Jeeze, I wish that peeps would just look at their server logs.

    I could almost guarantee that there are plugin 'ERROR's and 'WARN's in there.
     
    • Agree Agree x 1
  13. OK, now I've changed xms to 7GB (xmx is 27GB) and I've deleted stats plugin (becouse it was generating some errors when the server was shutting down) and now I have 15 - 20 players and the memory is still below 5GB.
     
  14. ... lower xms to 4Gb and xmx to no more than 12-16Gb, because that causes server Garbage collecting issues. Also if that doesn't work, remove plugins until you can find the crash.

    Edit: Spelling.
     
    #16 MaGiiK_PartyBoy, Oct 1, 2019
    Last edited: Oct 2, 2019
    • Agree Agree x 1
  15. Can you explain what is Garbage collecting? Now my server works fine but I still have XMX at 27GB (xms 4GB). I have 20 - 30 players average and the RAM usage is 10 - 20 GB (it's growing from 10GB to 20GB and again RAM usage is 10GB and again is growing to 20GB). What would happen if I changed XMX to 16GB? Would it still work? And what would happen if I upgraded my VPS to 64GB RAM? Could I then set XMX to for example 50GB?
     
  16. Anything over 16GB of ram is un-necessary for Minecraft servers. If you are using more than 10GB of ram, you have a memory leak. As for Garbage Collection, that's a process where Minecraft Servers go through the process of freeing up Ram from chunks that are unloaded, entities that have been on the ground for too long, and more. You NEVER want to set XMS = XMX as it will cause garbage collecting issues. As for if you should upgrade your VPS to 64Gb, I strongly don't recommend unless you are running multiple servers & actually need the extra ram.
     
  17. OK, Thanks. Now I did /spark heapdump. It created a 12GB .hprof file. I downloaded it to my PC and I want to analyze it by Eclipse Memory Analyzer but I have an error "Java heap space". I know why - becouse I dont have 12GB RAM in my PC. What can I do now? How can I analyze this file? Maybe I can analyze it at my VPS (Ubuntu) ?
     
  18. For a 20 to 30 player server on 1.14.4, Xms=2GB Xmx=4GB Xms=4GB Xmx=4GB should be plenty enough.
    When / if plugins start complaining - check them out, they (or, their configuration) are probably to blame.

    I used to back Aikar's recommendations, until these later postings suggested using Xms = Xmx values.
    What would be the point of having an Xms versus Xmx situation where only one flag would be required?
    It is like saying, set an Xmx value and don't bother to include an Xms value! Resulting in the server only abiding by the Xmx value.
     
    #20 Goldentoenail, Oct 7, 2019
    Last edited: Oct 11, 2019