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

    Kainzo

    -XX:+UseLargePages -- I don't have large pages enabled in Linux (or at least I didnt configure it) will that be an issue?

    -XX:MaxTenuringThreshold=15
    -Xnoclassgc
    Also not familiar with these either ... care to explain them a bit?

    Also - why
    -server - since it should auto know that its using a 64bit binary - right?
     
  2. Offline

    Phaedrus

    Possibly. If your distro doesn't support it out of the box then it will likely fail to start. If so, simply remove with argument and try again. It may be trivial to enable large page support depending on the distro, either way, it's something you should really consider doing, as it can really increase efficiency.
     
  3. Offline

    Geracl

    ubuntu 10.10 server x32
    does not run when-xmx 5g
     
  4. Offline

    Kainzo

    I'll look at enabling larger pages - unsure if it does out of box or not.

    Code:
    #!/bin/sh
    /usr/jdk1.7.0/bin/java \
         -Xmx16G \
            -XX:SurvivorRatio=8 \
            -XX:TargetSurvivorRatio=90 \
            -XX:+AggressiveOpts \
            -XX:MaxGCPauseMillis=50 \
         -Djline.terminal=jline.UnsupportedTerminal \
            -XX:+UseAdaptiveGCBoundary \
         -XX:PermSize=128m \
         -XX:MaxPermSize=256m \
         -XX:+DisableExplicitGC \
         -XX:+UseConcMarkSweepGC \
         -XX:+UseParNewGC \
         -XX:+CMSParallelRemarkEnabled\
         -XX:ParallelGCThreads=6 \
         -XX:UseSSE=3 \
            -XX:+UseBiasedLocking \
            -XX:+UseFastAccessorMethods \
            -XX:+UseLargePages \
            -XX:+OptimizeStringConcat \
         -XX:+UseCompressedStrings \
         -XX:+UseStringCache \
         -XX:+PrintGCDetails \
         -XX:+PrintGCTimeStamps \
         -XX:+PrintHeapAtGC \
            -verbose:gc \
            -Xloggc:gc.log \
            -jar bmod.jar
    New launch - anything need some changing before I try it out?

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

    Phaedrus

    I assume that x32 means x86, and therefore only 32-bit. You need a 64-bit os and 64-bit java to use more than 2 gigs of ram. You'll have to change your OS.

    Looks fine.

    as for these...
    -XX:MaxTenuringThreshold=15
    -Xnoclassgc

    Max tenuring threshold works along with the survivor ratio settings to allow more time for the young generation objects to die before promoting them.

    No Class GC disables garbage collection for loaded classes.

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

    Geracl

    can advise the server startup script
    and auto restart?
     
  7. Offline

    Kainzo

    At this point - I'm having a hard time believing its the java flags causing these issues. I think it may be caused by the NIC (onboard) pushing the CPU to halt or die with the amount of connections going through. Any thoughts about that?
     
  8. Offline

    Phaedrus

    Can you post some detailed hardware specs?
    What kind of NIC is it?

    Garbage Collection is a very small part of server performance. Bugs and inefficient code are probably the dominant performance determinants.
     
  9. Offline

    Kainzo



    Intel Ethernet 82567V

    Max LAN Speed
    10/100/1000Mbps

    Board = http://www.newegg.com/Product/Product.aspx?Item=N82E16813131666
     
  10. Offline

    Phaedrus

    Have you investigated particular driver settings for the nic?

    Have you considered overclocking? I'm sucessfully running my i7 at 4.8 ghz with a high end air cooler. Without good multicore support, clockspeed is really the only means of boosting performance.
     
  11. Offline

    Kainzo

    I've overclocked to 4.2Ghz (on air) and saw no real performance increases... I have not looked at tweaking the stock settings on the NIC - using Debian ...
     
  12. Offline

    Phaedrus

    Things you can experiment with:
    - increasing or decreasing the send/receive buffers
    - side scaling queue depth
    - cpu offloading

    Intel NICs are on top of the pack and the defaults are usually the best bet, but with the amount of data that minecraft can send and receive from users you might be able to get something out of it.

    I have nearly the same NIC and I've increased the send and receive buffers to their maximum and have all flow control and CPU offloading enabled. Unsure if it's made much of a difference, bug I don't typically get complaints of lag. Performance with the Intel NIC is noticeably better than it was when using the onboard nic.

    Can I assume you're using MySQL? How bout a RAM disk?

    I tried to look at your plugin list, but nothing loaded on the pastebin page. Can you post it here again?
     
  13. Offline

    Kainzo

    Plugin list - http://pastebin.com/n7px2QD
    @Phaedrus

    Ramdisk / Mysql...

    rx-checksumming: on
    tx-checksumming: on
    scatter-gather: on
    tcp segmentation offload: off
    udp fragmentation offload: off
    generic segmentation offload: on
    large receive offload: off
     
  14. Offline

    Phaedrus

    try turning the offloading on to allow the nic to handle it rather than the cpu.

    Once again, all I get from that pastebin link is "Unknown Paste ID"
     
  15. Offline

    Kainzo

    http://pastebin.com/qnEPnh2H - try that hah.
     
  16. Offline

    Phaedrus

    Do you have all plugins that support it using mysql?
    Can you limit LogBlock to only log block placement and breaks? I use BigBrother and noticed a decent improvement when I limited what it logged to the bare essentials.

    One thing you might consider, which may or may not make a big difference, is formating your ram disk with a 32kb or 64kb block size. It is more efficient, (fewer blocks are written and less fragmentation as files expand), but wastes available space (The minimum size of a file is 64kb, and grows in 64kb increments).

    You might also want to look at the Performance Tweaks plugin to limit mobs and disk activity, though I would be careful with the chunk persistance option. I experienced world corruption when using it.
     
  17. Offline

    Kainzo

    Logblock is already doing the bare necessity - the only thing that its logging that may be a bit harsh is chest access. For the ramdisk we are using.

    Limiting or removing mobs really didnt show an increase in performance, I've tried Performance Tweaks, i didnt see much improve on that either.

    It's frustrating dealing with code thats been restricted to only use 1 core.
     
  18. Offline

    Phaedrus

    1.6.6 is probably pretty buggy still too. Who knows what 1.7 will bring.

    I have my doubts about the code ever becoming very multithreaded. Even if it did I don't think performance would suddenly skyrocket.

    How bout the new view distance variable introduced in 1.6? What do you have it set to in the server.properties?

    What about using that proxy cache plugin to cut down on data transfers?

    You also kind of trailed off about the ram disk.
     
  19. Offline

    Kainzo

    view distance is set to 7 .... (we tried 5 without much performance gain) ... the Proxy cache plugin wont work on the latest ... players are getting a pack disconnect when attempting to use it. (185 from bukkitcontrib)

    We're using ramdisk 4GB - not sure on the specifics of it tbh.
    SUPERLATEREPLY!
     
  20. Offline

    Rabus

    Hey there!

    I'm running 7 servers on my 24GB dedicated I7, what flags should I set?

    Each one got 3GB ram assigned, and the main one 4.

    HT is OFF of course by disabling 1,3,5,7 proc
     
  21. Offline

    Phaedrus

    What is your reasoning on turning off hyper threading? You're probably doing more harm than good.
     
  22. Offline

    Rabus

    Oh well, heard that HT kills minecraft server...

    Good to know btw.

    Any other tips?
     
  23. Offline

    Phaedrus

  24. Offline

    Rabus

    Used same configuration, just not 4/6g, but 2/3
     
  25. Offline

    Phaedrus

    Is your total usage exceeding what you have available? Try 1 gig for each to start and raise from there.
     
  26. Offline

    j0rd0n420

    I'm using Ubuntu 10.04 with java:
    java version "1.6.0_24"
    Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
    Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
    I'm trying to run this line:
    Code:
    java -server -Xms1536 -Xmx3072M -XX:PermSize=128m -XX:MaxPermSize=256m -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:ParallelGCThreads=2 -XX:MaxGCPauseMillis=5 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:+UseBiasedLocking -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=15 -Xnoclassgc -XX:UseSSE=3 -XX:+UseLargePages -XX:+UseFastAccessorMethods -XX:+UseStringCache -XX:+UseCompressedStrings -XX:+OptimizeStringConcat -XX:+AggressiveOpts -jar craftbukkit.jar nogui
    But it will not let me (says: command not found) until I take out these two commands:
    Code:
    -XX:TargetSurvivorRatio=90 -XX:+OptimizeStringConcat
    Anyone know how I can make them work? My googlefu sucks apparently.
     
  27. Offline

    Rabus

    But I'll try your suggestion with 1gig and post results
     
  28. Offline

    ShaDooM

    Herro, using an i7 950 with 8gigs of ram.
    Any recommendations on garbagecollectors and other java starting paramters ?

    I'm using java 7 and all the gcs and settings ive tried failed so far.

    Would be really glad if someone has an idea whats the best :D
     
  29. Offline

    Kainzo

  30. Offline

    Phaedrus

    The only time I've noticed chunk corruption was with PerformanceTweaks and chunk persistence turned on.

    I've been running virtually the same launch line for months now 24/7 and haven't had any issues.

    Perhaps try using java 6?

    Your version of Ubuntu and Java looks like it doesn't like those parameters. You can safely leave them out any problems.

    I don't recommend using Java 7. It's not very well publicly documented yet and it's still under heavy development.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 8, 2016
Thread Status:
Not open for further replies.

Share This Page