Need help optimizing tickrate/fixing lagspikes

Discussion in 'Performance Tweaking' started by TowelieDOH, Apr 2, 2013.

  1. TowelieDOH


    Hey guys,
    Ever since i updated from 1.4.7 my server has been suffering intermitent lagspikes, at random intervals.
    However, since i updated from 1.5 to 1.5.1 the tickrate has also gone way down (before it was at 19-20 now it's at 6-10 with ~100 players).

    Spigot #751
    Slots: 110 (timings were taken with 100 players online)
    Plugins: 60
    Hardware: Core i7 3930k @ 4.2 ghz, 32GB ram, Cent OS 6.3 x64

    Startup script:
    Code (Text):
    /usr/java/jre1.7.0/bin/java -server -Xmn4M -Xms8048M -Xmx24576M -XX\:NewRatio\=24 -XX\:MaxInlineSize\=1000 -XX\:MaxGCPauseMillis\=300 -XX\:+OptimizeStringConcat -XX\:ParallelGCThreads\=4 -XX\:+UseCompressedOops -Djline.terminal\=jline.UnsupportedTerminal -XX\:+UnlockExperimentalVMOptions -XX\:+UseG1GC -XX\:+UseBiasedLocking -XX\:+AggressiveOpts -XX\:UseSSE\=4 -jar craftbukkit.jar nogui
    Other mentions: using RemoteToolkit
  2. vemacs


    No. Remove some flags. Java knows best.
  3. TowelieDOH


    The CPU i'm using has 6 physical cores and 12 threads. Could you please point me to which args i should remove and why?
    • Disagree Disagree x 1
  4. Minecraft is single-threaded, it doesn't matter how many cores or threads you have. As far as flags go, I don't have one single flag on any of my servers and I have zero issues.

    During a peak time, do you mind doing a:
    /timings reset
    wait 10-20 seconds...
    /timings merged

    It will help us to diagnose the issue with a more specific timings file.
  5. TowelieDOH


    I am aware s4ndal , i was reffering to the -XX\: ParallelGCThreads\=4 arg.
    • Disagree Disagree x 1
  6. My startup looks like this: "java -Xmx20G -jar craftbukkit.jar nogui." I threw out all my flag once Java 7 came around and I have had very good results with absolutely no issues. The only time when Garbage Collection becomes an issue is if a plugin has a memory leak or something like that.

    This in my opinion is a good read to have if you are worried about Java flags:
  7. About that one flag, set it to 12, because you have 12 threads on your CPU, might cut down the load a bit, it also seems like World2 is consuming a LOT of CPU time compared to the others.
  8. vemacs



    you're obviously ignoring network, chunkloading, and chat threads
  9. Nonetheless, whether it is quadcore or hexacore isn't going to make much of a difference for this specific issue.
    #9 s4ndal, Apr 4, 2013
    Last edited: Apr 4, 2013
  10. vemacs


  11. TowelieDOH


    I have modified my launch params into this (thank you vemacs for the link) and will come back later with some results (when the server is full).

    Code (Text):
    /usr/java/jre1.7.0/bin/java -server -d64 -Xmx16G -XX\:+AggressiveOpts -XX\:+UseConcMarkSweepGC -XX\:+UseParNewGC -XX\:+DisableExplicitGC -Djline.terminal\=jline.UnsupportedTerminal -jar craftbukkit.jar nogui
    • Disagree Disagree x 1
  12. The lag spikes are probably being created by multiple plugins running tasks, plugins such as Lottery, ClearLagg, AreaChat, NoCheatPlus, CommandBook, SFTMMO, Plugin 18, Strang Weapons, Plugin 60, are all performing very large extensive tasks and should be optimized or deleted.
  13. TowelieDOH


    Can anyone suggest a reliable NoCheatPlus alternative that's a bit mre lightweight ?
    • Disagree Disagree x 1
  14. There aren't any, which are as good, just disable useless checks like : Inventory move to fast or ones which don't seem useful ( There are some really stupid ones like selfhit? )

    Also try PTweaks or NoLagg :)
  15. I have been using AntiCheat instead of NoCheatPlus with good results. It's cleared up my lagspike issue for the most part. YMMV though.
    • Disagree Disagree x 2
  16. I don't think that NoCheatPlus needs so much performance or causes issues there. AntiCheat is really easy to bypass...
  17. What Toseb said is probably correct ^^

    But really, with some effort you can make NoCheatPlus abit lighter, just disable those silly checks- like selfhit.
  18. CustomForms

    CustomForms Retired Moderator
    Retired Supporter

    Disable checks you don't need and disable logging of you have it on.
  19. AnitCheat might be a little bit more lightweight but you can't really test that because the performance of NC+/AC is depended on so many factors.
    More cheaters = More load for the server
    Bad connection or other kind of lag = false positives = More load
    False positives = More load

    So you basically want to keep the false positives and cheat attempts as low as possible, less alerts means more chill time for the server.

    Here some tricks and tweaks for NC+:
    - InGame notifications can cause some lag if you for example get 20 notifications at the same time. So you should set ingamechat to false or edit the actions of each check to fit your needs.
    - You can set a scheduler to tell NC+ when it should delete the recorded data of all players too free up some memory: HERE
    - Disable checks that you don't need on your server. For example if you run a build or creative server there is no need to have the fight checks running in the background or NoSwing can generally be disabled (it simple forces the players to do swing animations if they hit something, interact with blocks or break/place a block. If you want your players to be able to interact through walls then disable the Visible check and so on...
    - Keep NC+ and Spigot up to date!
  20. I haven't done much beyond "removing NoCheatPlus fixed my constant minor lagspikes". AntiCheat has been doing its job pretty well as far as I can tell, I've had a couple of players intentionally try to crack it so I'm pretty confident.

    If you have anything more than FUD against AC, I'd love to hear it though.