How To Improve Minecraft Server Performance

Discussion in 'Bukkit Help' started by TnT, Jan 15, 2011.

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

    Xon

    -XX:+UseConcMarkSweepGC is identical to -Xincgc

    Switching to a concurrent mark & sweep garbage collector over a pause-the-world garbage collector can make a big difference.

    If you have the GUI server you really want to have the option "-XX:-DisableExplicitGC" Because both the GUI server and the Minecraft client make a bunch of explicit GC calls which really hurt performance.
    --- merged: Feb 15, 2011 10:09 AM ---
    It's enables a bunch of self-tuning on the concurrent mark & sweep garbage collector when running in an incremental mode. You might actually need -XX:+CMSIncrementalMode to do anything, but the documentation is somewhat unclear about it.

    http://www.oracle.com/technetwork/java/gc-tuning-5-138395.html
     
  2. Offline

    fffizzz

    Xeon processors of 64bit. least the ones in my dell poweredge 2850 are..
     
  3. Offline

    TnT

    Check this post. He listed all the flags for his processor.

    I didn't see any instruction set for 64 bit. Easy enough to boot to an Ubuntu 10.10 x64 disc and find out though.
     
  4. Offline

    Nate204

    Just a quick question,

    If I use your script provided in the OP, what should I do if I DO lose power, or my server freezes like it does A LOT during the /stop command -.-; It always freezes on me at the saving chunks section. It did this before I used a Ramdisc though.

    I guess I was just wondering what you do? Even if you say~ I "I just re-run my script", I'll be happy. I'm just worried I might be doing something wrong. I stopped the server today to check my BIOS settings, and I have a member now wondering if I did a rollback. It could be from the ramdisc, or possibly the freeze durring the shutdown =/

    Thanks!
     
  5. Offline

    Plague

    After a hard crash I would run the server, check for problems and if needed use a backup world save.
     
  6. Offline

    TnT

    This isn't normal operation of the server. That should be possible to fix.

    When your system freezes, does it hard freeze? As in, you have to power it off via the power switch, and boot it back up? If it isn't frozen solid - aka, you can still run terminal commands, just re-run the script that saves your world to its HD location. At least then your world is saved, as of the last time the server did a save-all.

    If it freezes during the stopping server, my guess is that the server hasn't had a chance to save the world chunks properly first, hence the user rollback question. Before doing a stop command next time, try doing a save-all first. That should ensure your world is saved properly. Then once you run your script to copy it back to the HD, you should be free to reboot and check bios or whatever.
     
  7. Offline

    Nate204

    I'll start doing just that. I appreciate the info!

    So these tips are good for increasing the world load time? This post got me googling like crazy... lol
    --- merged: Feb 15, 2011 8:00 PM ---
    It hard crashes. I'll then CTRL+C to drop the process. If I try and restart the server right after that, it will tell me the port is already in use.... So then I'll do a hard restart. Sometimes I can't even CTRL + C, but that's only happened a couple times total.

    I know It should be fixable. I'm thinking it might be my bukkit build. I'm on 312 I believe.

    I've gotten into the habbit of doing a /save-all before I do anything. It's saved me SO many times..... So what your saying is I should start up my server. I should then find my way to my server files and run your script. It will then launch and we're golden. If I want to stop, I should /save-all and then /stop. After the stop, I should run the script again? I may need to re-read your comment.
     
  8. Offline

    TnT

    I actually split my commands into a few different files. I have a run.sh which launches all of them (my run.sh contains the line stop.sh, which is a script I'll post below).

    My stop.sh script only does this:
    Code:
    #!/bin/bash
    rm -r backup/
    mkdir backup/
    cp -r world/ backup/
    echo "World copied to HD."
    
    It removes my backup directory and all the contents, makes a new one, and copies the world to the backup (HD) location.

    You can leave your scripts setup exactly as you have them, and make a new one like this if you want. You would then just run this script before rebooting the OS.

    Edit:
    My run.sh file:
    Code:
    #!/bin/bash
    ./start.sh
    ./server_bukkit.sh
    ./stop.sh
    
    start.sh just copies the backup/world to the world folder (and does various wget commands, etc, to update the server and plugins).
     
  9. Offline

    Nate204

    Now I feel like a total idiot....

    I understand your start.sh, that's from the first page.
    Now I get your ./stop.sh from this post.....
    What is your ./server_bukkit.sh script?

    I feel like you might tell me~ and I'm going to say "oh....duh."
    lol, sorry about that. I just want to make sure I've got this all right.

    Again, I appreciate all your help and insight.
    You've really helped me out with this. Anything I can do to get my server running better.
     
  10. Offline

    TnT

    Want me to give you a hint? What is the one line every admin needs to be able to run the server?
    Code:
    #!/bin/sh
    java -d64 -verbose:gc -Xloggc:gc.log -Xincgc -Xmx3G -jar craftbukkit.jar nogui
    
    I have a couple extra flags in there you don't need and can't use, so don't copy mine.
     
  11. Offline

    Nate204

    Oh doh...

    Yeah, I figured as much... I guess I asked because I "figured as much" that my server was 64 bit... lol
    Ty again
    --- merged: Feb 15, 2011 9:56 PM ---
    When I run the script, I get this right away:

    sudo chown -R <root>:<root> /home/onlineself/midworld
    cp -r backup/midworld ./
    Here are the lines:
     
  12. Offline

    TnT

    Don't forget the # in front of the !/bin/sh line.

    Are you running it as the root user, or a different user name? You should be running it as a different user than root.
     
  13. Offline

    Mercury

    What does "-d64" do?
     
  14. Offline

    TnT

    Forces Java to use the 64 bit binaries if possible. I've only seen this flag available on Linux.
     
  15. Offline

    Mercury

    Isnt -server same?
     
  16. Offline

    TnT

    Not as far as I am aware.
     
  17. Offline

    zumbach242

    Do I type in this?, or do I have to edit it?
    !/bin/sh

    sudo chown -R <user for minecraft>:<group for user> /opt/craftbukkit/world
    cp -r backup/world ./
    java -Xincgc -Xmx3072M -jar craftbukkit.jar nogui
    rm -r backup/
    mkdir backup/
    cp -r world/ backup/


    Craftbukkit is so not user friendly to me...

     
  18. Offline

    Plague

    #!/bin/sh
     
  19. Offline

    TnT

    Sorry, fixed that typo. Plague is correct - #!/bin/sh

    You can put that script in a file to run it automatically upon launch. Usually people have this as their run.sh or start.sh. Whatever you name the file is fine, as long as you make the file executable (chmod 755 <filename>.sh)
     
  20. is there a minecraft tag we can use to clear the memory from a user after they leave, because if you log out and log back in you waist memory each time
     
  21. Offline

    Brettflan

    Essentials has that feature, freeing up player memory on disconnect.
     
  22. Offline

    rct2guy

    The people on my server are complaining that it's really slow. I don't really want to go out and buy new components (since doing so would require a new motherboard), so I figured some of this might help. But I'm really confused.

    First of all, how do I allocate memory for the server? Is it the same as running it on the RAM, like you described later on? How much of it should I let it use?

    Second, if I want to run it on the RAM, how much memory do I let it use? I have 4Gb running on a Pentium 4 3.0GHz processor.
     
  23. Offline

    TnT

    You allocate more RAM by increasing the amount you use in the command line to launch the server - for example, java -Xincgc -Xmx2G -jar craftbukkit.jar nogui is better than allocating 1G.

    A ramdisk is different than allocating more RAM to the java process. A ramdisk allows whatever you put in it to be accessed at the speed of your RAM (which is many times faster than your hard disk). The size of your ramdisk is going to need to be larger than the size of your world. So if you have a 120 MB world, a 256 MB ramdisk should suffice for a while, depending on how fast your world grows (and whether you let it grow or not).

    Garbage collection should take care of that. I suggest running -Xincgc for that, as I haven't noticed any wasted memory usage when users log in/out.

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

    rct2guy

    So, with my 4GB of RAM, how much would you suggest I allocate?
     
  25. Offline

    Pierate

    What OS are you running? If it's windows I could help.
    EDIT: It also depends on many other factors. Not just the amount of RAM.
     
  26. Offline

    rct2guy

    I'm running Windows XP 32-bit with a Pentium 4 processor that runs at 3.0 GHz. Need anything else?
     
  27. Offline

    Pierate

    Ahh, 32-bit I expected that. There's a thing with 32-bit Windows. Java will only let you run up to 1.5GB (1500M) using the command line. I've experienced this when I was trying to run a server using Vista 32-bit.
    You can try running it using this
    and see if that helps. Otherwise, there's nothing else you can do with a 32-bit OS.
     
  28. Offline

    rct2guy

    Ok, sweet, thanks a lot. Does this mean I can't have it run directly off the RAM, either?
     
  29. Offline

    Pierate

    If it's a dedicated server, then it can run directly off the RAM.
    The system needs a certain amount of RAM to keep applications/services running.
    Using the command line I gave you, you should be able to run your server without any errors.
     
  30. Offline

    DierWolf

    depending on your comp, just for an extr 1GB of RAM was 78$ not including installtion :/
     
Thread Status:
Not open for further replies.

Share This Page