Useful Java arguments to increase server performance

Discussion in 'Performance Tweaking' started by LeeTheENTP, Oct 20, 2015.

  1. My server has gone from running on a Pentium E2200 with an old hard drive, to a dual-socket Xeon 5160 server with a pretty standard hard drive, to a Xeon E3-1276 v3 server with an 850 EVO SSD, yet the startup time (as well as speeds loading chunks after teleporting, etc.) has remained fairly constant. Since the server's hardware has essentially gone from rags to riches, the only cause for the so-so performance I can think of is a limitation of the Java virtual machine.

    I'm running my server on Java 8 and my startup command is just
    Code (Text):
    java -Xmx8192M -jar spigot.jar
    It's fairly simple, so I was wondering if there were any launch arguments I could include in order to boost performance and have the server actually take advantage of the hardware it's running on.

    Thanks!
     
    • Creative Creative x 1
  2. Gaurav1234

    Benefactor

    I would highly recommend reading Aikar's post here, but if you're too lazy then a compilation of the "major" ones would be

    -XX:+AlwaysPreTouch -XX:+DisableExplicitGC -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=4M -XX:TargetSurvivorRatio=90 -XX:G1NewSizePercent=50 -XX:G1MaxNewSizePercent=80 -XX:InitiatingHeapOccupancyPercent=10 -XX:G1MixedGCLiveThresholdPercent=50 -XX:+AggressiveOpts
     
    • Agree Agree x 3
    • Winner Winner x 1
    • Friendly Friendly x 1
  3. I'm not too familiar with Java runtime arguments, but 4MB seems a little low for a heap size.
    Code (Text):
    -XX:G1HeapRegionSize=4M
    What is this for, and would 4MB be enough for a fairly large server?
     
  4. Cldfire

    Cldfire Retired Moderator
    Retired

    I'll just quote @Aikar's explanation from his post:
     
  5. Gaurav1234

    Benefactor

    Was trying to find that specific part - thanks
     
  6. Thanks.

    Unfortunately, adding these arguments did not increase my server's performance. Startup is still fairly sluggish and chunk loading after teleport is still slow.
     
  7. That's because most start up flags are a placebo.
     
    • Agree Agree x 4
  8. What can I do to help increase performance?
     
  9. Tux

    Tux

    Sluggish startup and chunk loading can probably be explained through other causes. Have you recently updated Spigot?
     
  10. I usually keep it up to date.
     
  11. Gaurav1234

    Benefactor

    Also (may seem kind of like common sense but I'll say it anyways) chunk loading could be slow because of a super large world (more chunks = more time needed to load them). If you have a large world consider resetting it at some point in the future and adding a world border to prevent it from getting too large
     
  12. I reset the world a few months ago and it's still fairly small.

    I have a custom world generator plugin installed, but I wouldn't think that would cause issues with chunks that have already been generated.
     
  13. startup flags arent going to improve your performance out of the box.

    the point of them is to improve and provide consistent performance and be able to tolerate changes in load.

    if your servers lagging out of the box at X player count, flags arent going to fix that.

    if your doing fine and then all of a sudden you start lagging, flags MIGHT fix that.
     
  14. It's not lagging because it's starved for resources. It just takes longer than it should to boot and there is a delay for a client when it teleports for the server to load chunks. These things shouldn't be happening with a quad-core CPU and an SSD.
     
  15. What is the server render distance set to? If its 10 then try 6 and see if that helps.
     
  16. I'll give it a shot and report back.

    A 100Mbps internal connection should be fast enough for 10 chunks, though.

    EDIT: The server's render distance didn't seem to affect the situation.
     
    #16 LeeTheENTP, Oct 23, 2015
    Last edited: Oct 23, 2015
  17. I am going to ask the questions no one has asked.
    1. How long does it take for your server to load at start up? is it 15 seconds or 100?
    2. How many plugins are you running?
    3. have you done a 5-15 minute timings report to see what things are using your excellent resources?
    4. what is your expectation of delay in a teleport? are you expecting a teleport to just be there by the time a tick has past which is 1/20 of a second?
    5. What are you really saying when you say it just takes longer than it should are you comparing it to other servers you have been on and it just seems like it takes for ever where some other server is likety split?

    These terms you are using to define your issue are all extremely subjective, what may seem like a long time to you might be exactly normal for all the rest of us.
     
  18. Not exactly. Startup flags are unlikely to change performance unless you have performance issues caused by bad memory management, which is inevitable if you're running large servers without setting any flags, as the default garbage collector is horrible for Minecraft.
     
  19. 1. The server takes 40 seconds to boot.
    2. I am running 30 plugins.
    3. Here is the timings report: http://hastebin.com/ujimagosoj.vhdl
    4. I expect there to be no delay between when a player arrives at a teleport location/logs in and when he can interact and move around. Currently if a player teleports/logs in and immediately tries to move/interact, interactions will not do anything and any movements will be reset once the server catches up.
    5. I am comparing it to other servers I've been on. When I log in, I can immediately move around and do things.