Guide Optimizing Paper - Remove lag spikes, Fix tps & Improve performance!

Discussion in 'Paper Discussion' started by frash23, Mar 28, 2016.

  1. electronicboy

    electronicboy New Member

    What are you hosting that on, it's generally not a good idea to not run servers on toasters;

    Looks like the server just isn't able to keep up, only 121 ticks have actually had major lag, however overall it looks like GC is having issues keeping up with what is going on on the server... (21 old gen collections is generally a sign that GC isn't able to keep on top of the heap, this can be for various reasons, in this case it more specifically looks as if it's not able to keep up, however could also be that you just have a lot of persistent objects in the heap from plugins and stuff.
  2. mel_instagibson

    mel_instagibson New Member

    Its a dedicated i7 6700k with 32GB, SSD with 3 servers running on it with a total of around 30 people when taking the timings. This server was the one with only like 2 people on it and has 7GB RAM dedicated to it, they all use the same configurations even. All i can see in those timings is that i should turn autosaving off but that didnt help either, would you have an idea how i can narrow down the cause of it without being a java developer? because alot of the things you told me dont mean anything to me. how would i find those persistent objects?

    And how do you see there are only a few ticks having issues and that there are 21 old gens?
    Last edited: May 19, 2017
  3. mel_instagibson

    mel_instagibson New Member

    So i went from those flags:

    java -Xms7G -Xmx7G -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:MaxGCPauseMillis=100 -XX:+DisableExplicitGC -XX:TargetSurvivorRatio=90 -XX:G1NewSizePercent=50 -XX:G1MaxNewSizePercent=80 -XX:InitiatingHeapOccupancyPercent=10 -XX:G1MixedGCLiveThresholdPercent=50 -XX:+AggressiveOpts -XX:+AlwaysPreTouch -XX:LargePageSizeInBytes=2M -XX:+UseLargePages -XX:+UseLargePagesInMetaspace -jar paperclip.jar

    to those flags:

    java -Xms7G -Xmx7G -XX:+UseG1GC -jar paperclip.jar

    And that actually fixed my problems... you might want to see this @Aikar ? any idea which flag couldve caused this? And yes, largepages are setup correctly and my overall ram allocation is good too. The other 2 servers have the same settings and use all the flags above and dont have issues :S
  4. Sweepyoface

    Sweepyoface The crazed Moderator

    You should lower your memory allocation. Less is more.
    • Optimistic Optimistic x 1
  5. mel_instagibson

    mel_instagibson New Member

    Is this a serious advise? because i dont see how there can be too much RAM... Oo
  6. Sweepyoface

    Sweepyoface The crazed Moderator

    Yes. The JVM can use resources more efficiently when it isn't allocated much more than it needs.
    • Optimistic Optimistic x 1
  7. mel_instagibson

    mel_instagibson New Member

    Ok thank you ill see if that improves things. Would it be a good idea to remove the Xms in that case?
  8. RoboMWM

    RoboMWM Moderator Moderator

  9. sandor

    sandor New Member

  10. ssamjh

    ssamjh New Member

    I posted this on Spigot but felt it should also be posted here.

    Important Message

    It should be made aware that the author of this thread is no longer with us. This means that there will be no reply if you ask a question. He was an amazing person to this community and I'm sure his work benefited hundreds if not thousands of people.
    • Friendly Friendly x 3
  11. arturek1666

    arturek1666 New Member

    I would love to see this updated to 2017 mc version 1.12 there is some stuff that really change for example tacospigot changed quite a bit
  12. Aikar

    Aikar git am FixMinecraft.patch Administrator Paper Core Developer

    Nothing really needs updating as far as Paper is concerned. and Tech hasn't done as much with Taco lately. So this guide is likely still up to date.
  13. hilaolu

    hilaolu New Member

    Some people may use this:
    Does the flag really work?
  14. electronicboy

    electronicboy New Member

    that flag is enabled by default in any modern version of Java
    • Like Like x 1
  15. PirateCraft

    PirateCraft New Member

    how updated are these start up flags?
  16. electronicboy

    electronicboy New Member

    They won't need to be changed anytime soon
  17. Neppo

    Neppo New Member

    @Aikar Are your start-up arguments still viable and worth using? I was laughed at when reporting I use the following flags.
    java -server -Xmx10G -Xms10G -Dfile.encoding=UTF-8 -XX:MaxGCPauseMillis=100 -XX:+UseG1GC -DIReallyKnowWhatIAmDoingISwear=1 -XX:TargetSurvivorRatio=90 -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=50 -XX:G1MaxNewSizePercent=80 -XX:InitiatingHeapOccupancyPercent=10 -XX:G1MixedGCLiveThresholdPercent=50 -XX:+AggressiveOpts -XX:+AlwaysPreTouch -XX:+DisableExplicitGC -Djline.terminal=jline.UnsupportedTerminal -jar spigot.jar
    I was told the following and to just use this. :(
    java -Xmx10g -Xms1m -XX:+UseG1GC -jar jar.jar
  18. Aikar

    Aikar git am FixMinecraft.patch Administrator Paper Core Developer

    Yes, just ignore them, they are inexperienced.

    Feel free to link them to

    though, thats why my suggested list includes that as a -D param :p

    They are welcome to do a month worth of research to counter my research with results instead of interpretation and opinion.
  19. Neppo

    Neppo New Member

    I did link them to your write-up, but I don't think they really cared. Couldn't say one way or another if they are inexperienced, but they are doing experimental things with minecraft portal reprojection. In any case, I appreciate the reassurance. I'll continue to use your optimized flags. :)
  20. Zeffy

    Zeffy New Member


    I'm currently using a service to host our MC Server and just recently got Paper to replace Spigot in order to use Timings v2 - while using the timings I learned I could check what JVM Flags were being used; and so I found out what our Host Company placed.

    I'm not experienced in this stuff so I was wondering if any in sight could be given towards their choice in the following JVM flags:

    flags: -Xms256M -Xmx3072M -XX:+UseParNewGC -XX:+CMSIncrementalPacing -XX:+CMSClassUnloadingEnabled -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -Djline.terminal=jline.UnsupportedTerminal -Dfml.queryResult=confirm -Dfml.queryResult=confirm

    Atop that, would requesting a change from this to the JVM flags mentioned in make a significant difference?

Share This Page