Easy Way to Garabage Collect?

Discussion in 'Spigot Help' started by BlackDemonZ, May 1, 2017.

  1. During one day, a lot of ram is used in my servers, can someone tell me a easy and optimized way to make that All the Unnecesary ram gets removed because some GB of ram Stays used there when nothing is using them so i need a garabage collecting for my ram optimitzed :3

    Operative System: Linux, Ubuntu
     
  2. You can get a clear lag plugin which might help, but with regards to garbage collection; Java's GC runs by itself and while you can call it via System.gc(), it does not force the GC to run, simply asks it to run and then it may or may not run.
     
    • Agree Agree x 1
  3. I heart that calling garabage callecting its high cpu consuming, and garabage collection task too, is that true?
     
  4. electronicboy

    IRC Staff

    Calling for a gc asks the JVM to try a full GC, which pauses the full JVM in order to scan the entire heap. Quite simply, unless you're a professional who knows exactly how the JVM and memory works, you should never be calling System.gc. if you don't want your server to use x amount of memory, don't allocate x amount of memory
     
    • Agree Agree x 1
  5. The problem is that In total i put to all my modalities like 8GB per each but its still using a lot more ram than the specified. Can you take a look at my Start script and look if the limit is wrote bad? Because its literally ignoring the Ram limit :/

    #!/bin/bash
    while true; do
    /usr/bin/java -Xmx12G -jar /censored/censored/censored/SERVERNAME/spigot-1.8.8.jar
    sleep 2
    done

    It's ignoring the 12 G limit and its using more than it :(
     
  6. Gaxan

    Supporter

    you should have read the thread I linked you. It tells you exactly how to set your start up args.
    Here's another
    https://aquifermc.org/threads/optim...kes-fix-tps-improve-performance.101/#post-822
     
  7. Help me please
     
  8. Gaxan

    Supporter

    how many players do you have on your server?
     
  9. 150/200 in the nights
     
  10. Gaxan

    Supporter

    Code (Text):

    java -Xms12G -Xmx12G -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:MaxGCPauseMillis=100 -XX:+DisableExplicitGC -XX:TargetSurvivorRatio=90 -XX:G1NewSizePercent=35 -XX:G1MaxNewSizePercent=60 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=50 -XX:+AggressiveOpts -XX:+AlwaysPreTouch -jar
     
    Try that

    Just a note, using Xmx without Xms will continue using memory from the system as explained in the guide I linked.
     
  11. electronicboy

    IRC Staff

    Worth noting, that Xms/x only affect the memory of the heap itself, the JVM needs memory for various other operations that are not part of the heap, running a GC on a server JVM will also not release the memory back to the OS (and even the desktop JVM sucks at releasing memory back to the OS in 99% of cases).
     
  12. Is it okay if i set a mxs of 1024? as default?
     
  13. Gaxan

    Supporter

    Do you mean Xms?
    Xms should be the same as Xmx. if you use the flags I gave you, you should be good.
     
  14. Lol but if the xms are 12G it will use fully 12G intially :/
     
  15. Gaxan

    Supporter

    Do what you want, I gave you the flags to optomize your server. If Xms does not match Xmx you are going to have the same problem.
    This is why I hate helping lazy people. Too lazy to help themselves, and they think the help is wrong.

    Read the links I gave you if you need more help.
     
  16. If you dont want to use the proven working standard config, why are you asking for help?
     
  17. electronicboy

    IRC Staff

    That's just how java works. If you don't want to allocate 12G to the server, don't allocate 12G to the server. It's really as simple as that.
     
    • Agree Agree x 3
  18. Can i just put 2GB to Xms and put 12GB to Xmx?