How can I optimize Java on my server?

Discussion in 'Bukkit Help' started by odielag, Feb 10, 2011.

Thread Status:
Not open for further replies.
  1. Offline


  2. Offline


    Sometimes I get slight block lag on my server.
    Ticks are always at 20.0 (Checked with Lagmeter)
    Ram is >1GB for most of the time.

    Plugins: PermissionsEx, WorldEdit, iConomy (SQL), SquidLimiter, Modifyworld, MotherNature, PlugMan, Spout, RemoteToolkitPlugin, StealthLogin, FalseBookCart, DragonSlayer, milkAdmin, AutoAnnouncer, LyTreeHelper, MCSL, SignRank, LagMeter, PaintingSwitch, LightVote, FalseBookCore, Essentials, NoCheat, HeroicDeath, Multiverse-Core, WorldGuard, BookWorm, MCDocs, BlockHat, WorldSaver, MobDisguise, Money4Exp, FalseBookBlock, Minequery, Vault, Multiverse-Portals, FalseBookChat, ChatManager, Lottery, MultiInv, Herobrine, antiSpam, MinecraftViewer, Votifier, SimpleSignEdit, TrippyTerrain, OnJoin, mcbans, Permissions, AutoRank, MobRider, LaunchMe, HomeSpawnPlus, MyWarp, WorldBorder, ChestShop, BaseBukkitPlugin, HawkEye (SQL), VanishNoPacket, dynmap (2 maps, top down - simple rendering), Honeypot, LWC, NoLagg

    A few more may be SQL, but I cant remember.

    Running Ubuntu x64 10.10
    Java7 64bit
    2GB on host, 1.7GB allocated to the server.

    Launching Server through Remote Toolkit with parameters:
    -Djline.terminal\=jline.UnsupportedTerminal, -server, -XX\:permSize\=128m, -XX\:MaxPermSize\=256m, -XX\:+DisableExplicitGC, -XX\:+UseConcMarkSweepGC, -XX\:+UseParNewGC, -XX\:+UseNUMA, -XX\:+CMSParallelRemarkEnabl$

    Are there any plugins I should remove, or parameters I should add
  3. Aren't NoLagg's limits useful for limiting squids (SquidLimiter)? The less plugins the faster it should be.

    I'm reading about GC maybe rarely GC's is the problem. Just a thinking.
  4. Offline


    What should I use with these specs?

    • 16 GB REG ECC DDR3
    • Quad Core Xeon X3430 2.40GHz
    • 500 GB Enterprise Grade SATA II
    • 3200 GB Transfer (1 Gbps Uplink)
    Going to be running Linux, Bukkit, McMyAdmin
  5. Offline


    java -server -Xmx12G -XX:PermSize=128m -XX:MaxPermSize=256m -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseNUMA -XX:+CMSParallelRemarkEnabled -XX:MaxGCPauseMillis=50 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:+UseBiasedLocking -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=15 -XX:UseSSE=3 -XX:+UseLargePages -XX:+UseFastAccessorMethods -XX:+UseStringCache -XX:+UseCompressedStrings -XX:+UseCompressedOops -XX:+OptimizeStringConcat -XX:+AggressiveOpts -jar craftbukkit.jar nogui
  6. Offline


    Looking to optimize and remove some unneeded plugins.

    Which ones wouldn't I need, or are there replacements for a few without lowering functionality?

    EDIT: Ive already removed CompassEx, Votifier, FalseBookChat and MinecraftViewer
  7. Offline


    If you are using a plugin for backups you might want to look into an external application to manage that.
  8. Offline


    Which application would you suggest that has automatic backups and supports ubuntu server?
  9. Offline


    For automatic backups I wrote a simple script (ran via a cron):

    NOW=`date +'%y%m%d_%H%M%S'`
    zip -r /path/to/backups/bk_${NOW}.zip /path/to/world/
    (might not be perfectly accurate, I can't find the original one I'm currently using)
  10. Offline


  11. Offline


    Still love this thread :)
    Got it bookmarked, some great information here, worth the read for server owners. +1 to you @Phaedrus
  12. Offline


    After using
    java -server -Xmx10G -XX:PermSize=128m -XX:MaxPermSize=256m -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseNUMA -XX:+CMSParallelRemarkEnabled -XX:MaxGCPauseMillis=500 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:+UseBiasedLocking -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=15 -XX:UseSSE=3 -XX:+UseLargePages -XX:+UseFastAccessorMethods -XX:+UseStringCache -XX:+UseCompressedOops -XX:+OptimizeStringConcat -XX:+AggressiveOpts -jar craftbukkit.jar nogui
    LogBlock and Dynmap seem to have stopped working. LogBlock seems to operate for about 30 minutes or so before it stops making MySQL entries/lookups and Dynmap stops rendering. A simple restart fixes this; but it's annoying. I've reverted back to my old JVM startup script, which was simple and LogBlock and Dynmap are back to working; but the horrid lag is back, too. Is there something with the JVM that's altering the way the two plugins operate?

    Thanks in advance.
  13. Offline


    My line is now the following on Java 7.0
    Any input?
    -server -Xmx12G -XX:PermSize=128m -XX:MaxPermSize=256m -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseNUMA -XX:+CMSParallelRemarkEnabled -XX:MaxGCPauseMillis=50 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:+UseBiasedLocking -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=15 -XX:UseSSE=3 -XX:+UseLargePages -XX:+UseFastAccessorMethods -XX:+UseStringCache -XX:+UseCompressedOops -XX:+OptimizeStringConcat -XX:+AggressiveOpts -jar
    Just updated to java 7.0 update 2 and giving off message that this "-XX:+UseCompressedStrings" is not supported anymore. Just for reference to anyone :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 8, 2016
  14. Offline


    Hello! Help to adjust please parameters of start JAVA for the game server. Our parameters:

    CPU: 2x Xeon E5620 2.4Ghz
    RAM: 16 GB DDR3-RAM
    HDD: 300GB SAS
    LAN: 1.000 MBit
    System: CentOs

    Thankful in advance.
    Also tell please, what maximum online will support our server?
    Forgive for my bad English.
  15. Offline


  16. Offline


    Might as well see if anyone has some ideas for me.

    CPU: 2x Dual Core AMD Opteron 280 (total of 4 cores at 2.4GHz/each)
    RAM: 8GB
    Linux: (CentOS)
    Linux 2.6.18-274.12.1.el5 #1 SMP Tue Nov 29 13:37:46 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
    java version "1.6.0_20"
    OpenJDK Runtime Environment (IcedTea6 1.9.10) (rhel-
    OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)
    Startup line: (ran via rkit)
    java -server -d64 -Xincgc -XX\:+DisableExplicitGC -Xmx5G -Djline.terminal\=jline.UnsupportedTerminal -jar craftbukkit.jar nogui
    The server runs fine, but CPU usage is a little high with just one player online.
  17. Offline


    Had a look through this thread to improve dedicated server performance.


    • AMD Athlon™ II X4 Quad-Core,
      4x 2.3 GHz
    • 12 GB DDR3-RAM
    • 2x 1,500 GB SATA II-HDD
    • 100Mbit network connectivity (data centre)
    • Ubuntu 10.04LTS 64bit
    • Java 1.6 64bit
    I used the following start script as described in this therad:-

    java -server -Xmx8G -XX:PermSize=128m -XX:MaxPermSize=256m -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseNUMA -XX:+CMSParallelRemarkEnabled -XX:MaxGCPauseMillis=50 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:+UseBiasedLocking -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=15 -XX:UseSSE=3 -XX:+UseLargePages -XX:+UseFastAccessorMethods -XX:+UseStringCache -XX:+UseCompressedStrings -XX:+UseCompressedOops -XX:+OptimizeStringConcat -XX:+AggressiveOpts -jar craftbukkit-1.0.1-R1.jar nogui
    I receive this error on startup

    Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 22).

    Performance with 20 Players online
    I ran free -m with the server running and

        total       used       free     shared    buffers     cached
    Mem:11789       5626       6162          0        164       3503


    And still getting the following spam

    [WARNING] can't keep up is the server overloaded spam with above 15 players online
    Any ideas?
  18. Offline



    Server4You dedi?

    That's a Athlon X4 605e, it's slower than my dual Opteron 280s, and those are already slow as shit.
  19. Offline


    Pah, thats a shame.

    Any idea if the Xeon 3440 would be much of an improvement?
  20. Offline


    Yes, it scored much higher, almost double what the 605e scores. It's a great CPU, Intel is miles ahead of AMD, especially when you're comparing the X3440 and the 605e.
  21. Offline


    Had a look into this and it appears the Xeon can handle multi-threaded applications much better. So doesn't look like it'l be much use for Minecraft as the performance for single threaded is almost the same as the Athlon.
  22. Offline


    Which plugin did you use to get your ticks? I use LagMeter but yours look interesting too :)
  23. Offline


    Commandbook 1.7

    /debug info
    /debug clock

    Resolved issue by moving to Xeon + SSD drives by the way.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 8, 2016
  24. Offline


    Nice, what write speeds are you getting on that SSD?
  25. Offline

    Nathan C

    Remove the following from your startup flags: -XX:+UseLargePages
  26. Offline


    My CPU usage is still messed up, I'm now suspecting that the garbage collector is at fault. Time to try some new startup lines, it's a good thing that I haven't went public yet.

    Edit: Adjusted the recommended line on page 2 to fit my needs, and I'm seeing vastly reduced CPU usage. Seems that -Xingc doesn't play nice with my dual Opterons.
  27. Offline


    That was the problem with my server a while back (months), I used a pretttyyyy long startup line and it works perfect. Though I use Remote Toolkit now with that startup line.
  28. Offline


    Hello @Phaedrus

    I was wondering if you would take the time to help me optimize my Dedicated server for running minecraft.

    I only run minecraft on this server, apart from apache, mysql, webmin.

    The server specs are:
    8GB Ram - Using ramdisk for map
    AMD x2 250 (Not a great CPU but it works)
    Java 7
    Debian x64
    100Mbit up/down

    Any ideas on the best optimized flags for this system?
  29. Offline


    See here my good man!
  30. Offline


    One word: CraftBukkit++

    Can't provide a link, it's against the forum rules, but it's an optimized CraftBukkit build.
Thread Status:
Not open for further replies.

Share This Page