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

    Phaedrus

    The first column is the running time. As in the time the collection entry occurred.
     
  2. Offline

    SVoyager

    Hi, for the sake of optimizing my server, I wanted to toy a bit with these settings too. I run a core I7 920, HT disabled and the server is only 6gb for now. It is serving about 10 ppl max so relativly small. Still, I wanted to try these settings. I have modified the -xms to 1g and -xmx to 3g so to fit my ram values here and leaving lots to the system for now.

    When I did that, the server's first line is:
    Java HotSpot(TM) 64-Bit Server VM warning: JVM cannot use large page memory because it does not have enough privilege to lock pages in memory.

    I have the evil UAC disabled in win7 so evrything should be running with admin rights. Not quite experienced in how to troubleshoot java tho. Any tips? Is there something else I should have changed considering my system specs vs your own.

    Thanks in advance, and great thread, lots of good info!!
    SV
     
  3. Offline

    txtsd

    This thread is epic! I propose all the useful info be compiled into a new thread and the thread be stickied.

    Here's what I'm using in my .bat on my private server.
    Code:
    @ECHO OFF
    TITLE MINECRAFT-CRAFTBUKKIT
    START "MINECRAFT-CRAFTBUKKIT" /ABOVENORMAL /B java -d64 -server -Xincgc -Xmx2048M -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:ParallelGCThreads=5 -XX:+CMSParallelRemarkEnabled -XX:MaxGCPauseMillis=250 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:SurvivorRatio=16 -XX:TargetSurvivorRatio=90 -Xnoclassgc -XX:UseSSE=3 -XX:+UseLargePages -XX:+OptimizeStringConcat -XX:+UseFastAccessorMethods -XX:+AggressiveOpts -verbose:gc -Xloggc:gc.log -jar craftbukkit-0.0.1-SNAPSHOT.jar nogui
    
    PAUSE
    Vanilla .bat used to make my 6GB of RAM max out. Now it doesn't even go over 1GB of usage.
     
  4. Offline

    Phaedrus

    you should take -xincgc out of your line if you are going to use the rest of it. xincgc and concmarksweep are two different garbage collectors. It's either or. I have no idea which java is choosing to use for you with both set. im surprised it even loads.

    You probably aren't running as admin. UAC may be disabled, but that doesn't mean you are admin. Check the user control panel to see if you are an administrator or not. You can also try running the batch file as admin. Create a short cut to the batch file, then right click it and go to properties, then look in the compatibility tab.

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

    txtsd

    It never threw and error or a warning so I couldn't tell I was doing something wrong.

    New .bat looks like this
    Code:
    @ECHO OFF
    TITLE MINECRAFT-CRAFTBUKKIT
    START "MINECRAFT-CRAFTBUKKIT" /ABOVENORMAL /B java -d64 -server -Xmn512M -Xms1024M -Xmx2048M -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:ParallelGCThreads=5 -XX:+CMSParallelRemarkEnabled -XX:MaxGCPauseMillis=250 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:SurvivorRatio=16 -XX:TargetSurvivorRatio=90 -Xnoclassgc -XX:UseSSE=3 -XX:+UseLargePages -XX:+OptimizeStringConcat -XX:+UseFastAccessorMethods -XX:+AggressiveOpts -verbose:gc -Xloggc:gc.log -jar craftbukkit-0.0.1-SNAPSHOT.jar nogui
    Wow uh, there was absolutely no garbage collection after I removed -Xincgc. RAM usage went higher and higher the more I explored. I guess I'm putting it back in. Should I remove -XX:+UseConcMarkSweepGC then?
     
  6. Offline

    Phaedrus

    take out -d64 -xmn512 and -xms1024 and try again
     
  7. Offline

    txtsd

    Seems better now. Thanks!
     
  8. Offline

    tony.t

    Hello
    I'm now running with this:
    Code:
    @ECHO OFF
    TITLE MINECRAFT-CRAFTBUKKIT
    START "MINECRAFT-CRAFTBUKKIT" /ABOVENORMAL /B java -server -Xmx20480M -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:ParallelGCThreads=15 -XX:+CMSParallelRemarkEnabled -XX:MaxGCPauseMillis=250 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:SurvivorRatio=16 -XX:TargetSurvivorRatio=90 -Xnoclassgc -XX:UseSSE=3 -XX:+UseLargePages -XX:+OptimizeStringConcat -XX:+UseFastAccessorMethods -XX:+AggressiveOpts -verbose:gc -Xloggc:gc.log -jar craftbukkit.jar nogui
    But I get this error when starting the server:
    Code:
    Java HotSpot(TM) 64-Bit Server VM warning: JVM cannot use large page memory beca
    use it does not have enough privilege to lock pages in memory.
    Even though everything seems to be working I'd like to know where this come from!
    thanks
     
  9. Offline

    Birdie

    How do i install Java 1.7 on my CentOS 5.5 x64 machine?
     
  10. Offline

    Orcworm

  11. Offline

    Birdie

  12. Offline

    Phaedrus

    You probably aren't running as admin. UAC may be disabled, but that doesn't mean you are admin. Check the user control panel to see if you are an administrator or not. You can also try running the batch file as admin. Create a short cut to the batch file, then right click it and go to properties, then look in the compatibility tab.
     
  13. Offline

    SVoyager

    Hi, thanks for the reply. I had already tried running the file with right-click run as admin with the same result.

    In compatibility window, since UAC is disabled, the option to run the file as admin is disabled. In the java console, I tried looking at just about evry option in there, I didn't saw anything about giving it admin rights. Can you point to the location in java that would give it the proper rights??

    Thanks in advance.
     
  14. Offline

    tony.t

    jasonznack
    thank you for your answer.
    But I checked and I am an admin, and running as admin didn't changed anything :(
     
  15. Offline

    Phaedrus

    Which version of windows are you running?
     
  16. Offline

    tony.t

    It's Windows Server Web Edition x64.
     
  17. Offline

    DevRW

  18. Offline

    Phaedrus

    @TnT I was hoping to get some impressions from you on the settings I've posted. Have you tried them?
     
  19. Offline

    phondeux

    I've noticed these settings have improved my servers memory and cpu use but I still get this random lag. I've seen it on other servers, too; you can go an hour or so and then suddenly broken blocks restore and chat takes five or ten seconds to appear globally.
     
  20. Offline

    Phaedrus

    Do you have mobs and animals enabled? That seems to be the biggest contributor to lag.
     
  21. Offline

    phondeux

    I have both enabled and I've suspected that as well; it seems like there are more of them since 1.3.
     
  22. Offline

    Phaedrus

    I think squid cause a big problem especially. They seem to spawn in incredibly large numbers in very small areas. Add in wolves as well.
     
  23. Offline

    Plague

    I do see pretty good results, and his point was that you should first try to solve it yourself.
    Anyway, no personal insults, or there will be infractions given.
     
  24. Offline

    parker_digg

    You could do all that stuff, OR get the remotetoolkit plugin that has automatic restarts. Set it at every 2 hours or so.
     
  25. Offline

    Phaedrus

    I already restart the server automatically every night. But that isn't really a solution to lag while it's up.
     
  26. Offline

    jeffreylec

    Code:
    #! /bin/sh
    BINDIR="$(dirname "$(readlink -fn "$0")")"
    cd "$BINDIR"
    screen java -server -Xmx1G -Xms3G -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=2 -XX:+AggressiveOpts -jar craftbukkit-0.0.1-SNAPSHOT.jar
    This is what I have right now and I am using MySQL and 1.7 SunJava. Anyway, we are getting these weird pauses and weird day/night time hours. Any suggestions?

    3gb ram
    3 CPU Cores
    123systems.net <- is what I use as a VPS provider

    edit: I don't know if it's a plugin making backups with MySQL or just the VPS being stupid. I am always getting these console reports
    Code:
    Can't keep up! Server time spam spam message etc
     
  27. Offline

    Phaedrus

    sounds like you might have a crappy vps provider.

    I'm not as familiar with tuning java 7 yet. you might want to do some googling. java 7 has a new garbage collector that should be better than that in java 6, but it's still in development. if you can't find anything, just try the arguments i show in post #67 or something like that.
     
  28. Offline

    Orcworm

    You're renting a 3GB VPS and you're allocating a maximum of 3GB to Java?
     
  29. Offline

    Phaedrus

    -Xmx1G -Xms3G

    That's assbackwards

    xmx is the max, so that should be less than 3gb, and xms is the starting, so that should be 1gb
     
  30. Offline

    Toni

Thread Status:
Not open for further replies.

Share This Page