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

    Massimo1993

    tnks a lot, i test and say if they work
     
  2. Offline

    nala3

    even though i may be necro-posting , i must say this did help me :)
     
  3. Offline

    Perling

    Hum so much command lines from everyone but which works now good?

    I have a 4x3Ghz 8gb Ram Server windows 7 64bit , which command line should i use?

    this?

    Code:
    java -server -Xmn2G -Xms6G -Xmx6G -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:ParallelGCThreads=4 -XX:+CMSParallelRemarkEnabled -XX:+DisableExplicitGC -XX:MaxGCPauseMillis=500 -XX:SurvivorRatio=16 -XX:TargetSurvivorRatio=90 -jar craftbukkit.jar
    or
    Code:
    -Xmx6G -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:MaxGCPauseMillis=50 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:+UseBiasedLocking -Xnoclassgc -XX:UseSSE=3
    or
    Code:
    -Xms6G -Xmx6G -XX:+UseParNewGC -XX:MaxGCPauseMillis=200
     
  4. Offline

    Phaedrus

    Your best bet is to read through this post:

    http://forums.bukkit.org/threads/ho...24gb-dedicated-server.3967/page-2#post-184208

    This is what I use.
    Code:
    java -server -Xms6G -Xmx12G -XX:PermSize=128m -XX:MaxPermSize=256m -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:ParallelGCThreads=3 -XX:MaxGCPauseMillis=50 -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
    
    At the very least, you should try this:
    Code:
    java -server -Xms2G -Xmx4G -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:MaxGCPauseMillis=50 -Xnoclassgc -XX:UseSSE=3 -XX:+UseBiasedLocking -jar craftbukkit.jar nogui
    
    Don't forget to adjust xms and xmx to match how much ram you have.
     
  5. Offline

    Perling

    Thank you phaedrus

     
  6. Offline

    Phaedrus

    Let us know if you notice a difference.
     
  7. Offline

    Perling

    Can you tell me how can i fix this problem ?
    -XX:+UseLargePages this make the problem on the screen.
    [​IMG]
     
  8. Offline

    Lolmewn

    1. Remove -XX:+UseLargePages
    2. Somehow give it the perms.
     
  9. Offline

    Perling

    ok now i will test it :) thanks
     
  10. Offline

    Phaedrus

    You probably aren't running as administrator.
     
  11. Offline

    Perling

    When i try with right click -> start with administrator than comes the same :/
     
  12. Offline

    Phaedrus

    You'll have to login as a user with full admin privs. If that isn't an option, you'll just have to remove the largepages argument and run without it.
     
  13. Offline

    Perling

    Yes iam running the server :D i will give later a feedback
     
  14. Offline

    Massimo1993

    @Phaedrus

    i've a dedicate server with 2 core 2.60 ghz 4gb ram
    i've 3 questions:
    1) best centos 5.2 or debian 6 for bukkit server
    2) best openjdk 6/7 or oracle jdk 6/7
    3) with the best configuration java/OS what im need to put on my sh?
     
  15. Offline

    Phaedrus

    I don't use Linux, so I'm not sure which distro to choose. I say use whichever one you are most familiar with.

    I also can't say which is better since I've never used openJD, but using 7 seems to be a good option now since it's been fully released.

    I suggest you see this post for what arguments to try: http://forums.bukkit.org/threads/ho...24gb-dedicated-server.3967/page-2#post-184208
     
  16. Offline

    Medniy

    need help with arguments to launch a server (server have a freezes):
    - Core i5, 4Gb DDR3
    - Windows 7 x64;
    - Java 7;
    p.s. Sorry for my english =)
    p.s.2. thnx
     
  17. Offline

    Phaedrus

    Need more information.
     
  18. Offline

    Perling

    She playes client and server on the same pc... i have read the other post from it.
     
  19. Offline

    Medniy

    i sayd - sometimes..

    intel core i5 650 3.20 Ghz, installed java6 upd.29, java7 x64, jSDK x64 don't use RAMdisk


    Code:
    @ECHO OFF
    SET BINDIR=%~dp0
    CD /D "%BINDIR%"
    "%ProgramFiles%\java\jdk1.7.0\bin\java.exe" -Xincgc -Xmx2G -server -XX:+DisableExplicitGC -XX:+UseAdaptiveGCBoundary -XX:MaxGCPauseMillis=500 -XX:-UseGCOverheadLimit -XX:SurvivorRatio=16 -Xnoclassgc -XX:UseSSE=3 -XX:ParallelGCThreads=3 -XX:+AggressiveOpts -jar craftbukkit.jar nogui
    PAUSE
    with these parameters I run a server, but I do not understand them ...
    and with 14 players, have friezes .. all actions committed, did not immediately take effect .. for example, destroying blocks, they disappear after a couple of seconds..
    plugins:
    Code:
    AuthDB
    AutoSave
    AutoMessage
    ChestShop
    CommandBook
    iChat
    iConomy
    Jobs
    LWC
    Permissions
    SpawnX
    WorldEdit
    AutoMessage
    iZone
     
  20. Offline

    Phaedrus

    Try this instead:

    Code:
    @ECHO OFF
    SET BINDIR=%~dp0
    CD /D "%BINDIR%"
    "%ProgramFiles%\java\jdk1.7.0\bin\java.exe" -server -Xmx3G -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:ParallelGCThreads=3 -XX:MaxGCPauseMillis=50 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:+UseBiasedLocking -Xnoclassgc -XX:UseSSE=3 -jar craftbukkit.jar nogui
    
    That will increase the max amount of ram to 3 gigs instead of 2, and will use a different garbage collector that won't freeze the game while it collects garbage.

    Also 4 gigs of ram for a server hosting 14 people isn't enough. Minecraft server is a ram hog.
     
    Medniy likes this.
  21. Offline

    Medniy

    and if I upgraded the memory to 8 GB, it will correct the situation?
     
  22. Offline

    Phaedrus

    It would help a lot. The better your hardware is, the better performance is likely to be.

    Did that command line I recommend make a difference?
     
  23. Offline

    Medniy

    I have not tried yet, but thnx =))
    how to check - just accomplish your goal

    Frizes has become much less, though I have not figured out why, either restart the server, or after running through that command line =)) But anyway thank you very much =))

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

    Phaedrus

    You are welcome.
     
  25. Offline

    7Tys7

  26. Offline

    Phaedrus

    That link is describing how developers can make use of it.

    All you need to do is run as administrator.
     
  27. Offline

    7Tys7

    Well, that explains a lot. xD
     
  28. Offline

    adamjon858

    I'm getting 120% CPU spikes with 60ish players online. I've ran JMX profiling and it looks like it's not caused by any plugins so I won't bother to list them. It's mostly just chunk loading. My memory and disk I/O performance does not appear to be affecting this at all.

    I'm currently using Java 7 on Ubuntu 10.10 on a i7 2600K with 8GB of ram.

    I'm throwing flags for 4GB starting and 6GB max heap sizes on the command line and nothing else at the moment.

    I've tried a few flags to test it out but nothing seems to make a difference. I'm fine for now but whenever I top 70 players I start getting lag and as the server grows I'm sure I'll start seeing major lag pretty soon.

    What flags are going to have the best results for me?
     
  29. Offline

    Phaedrus

  30. Offline

    mrciku

    This parameters for my server seems to run fine (Ram drops down to 50% left and GC makes it back up to 75% instantly without much CPU usage)

    Code:
    java -Djline.terminal:jline.UnsupportedTerminal -server -Xss208k -Xmx3G -XX:-DisableExplicitGC -XX:+UseParallelGC -XX:ParallelGCThreads:4 -XX:+AggressiveOpts -XX:+OptimizeStringConcat -XX:+UseFastAccessorMethods -XX:+UseThreadPriorities -XX:+MaxFDLimit -jar bukkit.jar
    Can I improve it more?

    Also, my server machine is dual core, and I am using "-XX:parallelGCThreads:4" is it a bad idea? Doesn't seem to cause any problems and the machine is going to upgrade to an quad core this monday.
     
Thread Status:
Not open for further replies.

Share This Page