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

    zaq_hack

    I love rdiff-backup. ;-)

    I will check out MineOS. Is there performance optimization to be had using Apache/MySQL for things? Seems like overhead, to me. I don't think this server is going to get to 100+ users or anything ... and if so, I'll spring for new hardware. Right now, I'm having an issue with my Debian kernel, I think, not allowing a java process to consume over 3GB. It seems like I might be better off limiting Bukkit to 1.5G and using the other 2G as a RAMdisk ... the server has 3.5G total and is an older machine that I am unlikely to upgrade unless absolutely necessary.

    Thanks for the tips!
     
  2. Offline

    Milkywayz

    Its funny you should say, i just ordered a computer with 16gb of ram :p
     
  3. Offline

    4am

    If you run 32-bit Java, the process cannot address over ~3GB of RAM (it can only use address numbers up to 32 bits long; only enough for aroudn 3GB). Run 64-bit Java. Always.

    EDIT: And, you want more RAM. always. Get enough RAM to dedicate at least 1GB to the OS, 2+ to the Bukkit server, and then have space for your RAM Disk (then double that). I run 12GB (8GB for the VM) myself.
     
  4. Offline

    zaq_hack

    To close the loop on my server, I implemented a very small installation of Debian. The in-use memory when idle is around 36 meg. If your O/S is taking up a Gig, then you shouldn't be using that box as a Minecraft server, most likely. Even in the Microsoft world, you can turn off services to get that number down to something reasonable.

    My server is a 32-bit Pentium 4 with Hyperthreading at 2.8 GHz. Yeah, old, right? It has 3.5 G of RAM (which is okay since it could only really use 4.0 G, anyway). Making these changes allows me to support a couple handfuls of players without lag and without the server freaking out. The world is still pretty small (<200M) and easily fits in a RAMdisk. I have a 1G RAMdisk and give the process 2G (2048M) and it all seems pretty happy. I went from a CPU load over 90% @ 3 logins to 40% @ 5 logins after the RAMdisk.

    TANGENT: In the middle of this, the hard drive crashed. The mounted root went read-only, but the server played on. I did not realize for nearly 24 hours that the hard drive was dying. It scrambled nearly all of my Linux tools!!! I could not get tar, ftp, sftp, samba, nfs, scp, etc., etc. to work! I could not rescue my world using any normal means, including the attachment of USB drives. I also knew that the last time the world was copied from RAMdisk to hard drive was nearly 24 hours prior, so we would "lose a day" if I just shut it off and went back to the hard drive copy. Fortunately, after a lot of Googling, I was able to piece together a way to retrieve the files using the tools I had: ssh, gzip, and cat. (Python also worked, but not perl - so I flirted with some Python scripts for awhile before figuring I could do it all in bash with gzip and cat.) Turns out this was smart - the hard drive refused to spin back up after I shut down the computer! So for all of you who have lost things in a RAMdisk, turns out I was able to actually save things because of one ...

    At this stage, I have a cron job to backup every 2 hours from RAMdisk to hard disk and from hard disk over the network to another backup share. (FWIW - you can FTP to a Box.net account ... and then have that snapshot available anywhere ... and I have a 50G Box account.)
     
  5. Offline

    PierreLouis

    Could a mod remove the spam right above me? :)
     
  6. Offline

    BoneHunter9

    RAM is cheap when you get 25 for 100$.Just buy at a big root server host.Not at a minecraft Server host !
     
  7. Offline

    TnT Retired Staff

    Changelog
    August 8, 2012
    • Replaced -Xincgc flag with -Xms512.
      • -Xincgc is more harmful than helpful on 1.3.1 server. Not suggested for use on a 1.3.1 MC server anymore
     
  8. Offline

    hawkfalcon

    :confused: *updates AutoBukkitServer*
    EDIT
    TnT
    Should I make it also put it in a ramdisk?
     
  9. Offline

    gauso001

    My solution:
    2 x quad-core Intel Xeons overclocked to 4.5 GHZ
    32GB RAM
    SSD
     
  10. Offline

    _Robert


    Hey tnt, i have a little question for you. Im using CB++ RB 4.1 (Herocraft was using it too), it's 1.2.5 version. I followed your guide for performance since the beginning of my server (thanks for this info!) and the server was doing it fine with 50 players.

    Now, i changed the computer to an i7 2600k with 16 GB of RAM (1333 mhz) and a Wester Digital Caviar Black of 1 TB. Im using ESXi 5 and Debian 6 Squeeze on the server formated with ext4. The server is hella fast with this hard! And with zero problems, only noticiable lag after 2 days of uptime (it was like a little freeze every so, little annoying, but the TPS were on 18-19), i decided to move it to a DataCenter to expand it to 100 players

    But.... now i have serius problems. After 5 hours of uptime the server start with the "little freeze" but the tps are normal, after 10 or 12 hours the freeze becomes a pain, and the tps drops to 10. The CPU usage in this conditions it's on 30% (the machine that holds the MC servers has 4 cores dedicated), and the RAM it's stable with 4GB or more free aviable (has 10 dedicated). To solve this i have to restart the machine, cause if i only restart the server, the lag comes again in a hour, also i can see how everythin, including rsync, works more slow (pretty strange).

    These are my plugins:

    [INFO] Plugins (37): FlatlandsBuilder, Spout, SimpleCommandSigns, Vault, PermissionsEx, Multiverse-Core, Questioner, MyHome, SignEdit, NoPortals, McGroovy, iConomy, HiddenCommandSigns, Deadbolt, SkylandsPlus, SpoutWorld, BKCommonLib, EPDisabler, RandomPlacer, Modifyworld, NoCheat, SimpleReserve, Jobs, Orebfuscator, WorldEdit, Towny, CreativeGates, MaxTPS, CommandBook, VanishNoPacket, Multiverse-NetherPortals, DeathControl, NoLaggExamine, ChestShop, TownyChat
    Also, NoLagg shows nothing relevant and the usage of the RAMDisk it's around 4.4 GB.

    What it could be that is causing the lag? I think it could be some plugin that it's openning files and dosen't close them (in fact i had to expand the limit of opened files cause if not the server crashed), something related to the RamDisk or the bukkit itself (im running a script to make save-all on the console and then rsync).

    Any ideas?
     
  11. Offline

    Omarathon1999

    Thanks Bukkit Team! It has 'HOPEFULLY' fixed my issue with the read time out error. As i have been running my server i have noticed GIANT performance changes as now its sticking at 20.0 or 19.3 or 18.4 tps!
    Also the ip:... Lost Connection has dissapeared!
    Ok, so all good please put as RB or changes can improve with the RAM allocation decrease and make the XMS be turned down for sticked and permanent performance changes!
    Good work Bukkit Team!
    Yours Sincearly.
    Omar Tanner
     
  12. Offline

    grid21

    I think the best way to fix this to have your server reboot when the memory fills up. I have a plugin that trips a reboot when the memory fills and I put my batch file in a loop to boot up again and I don't have anymore problems! Also TnT just turn the stupid warning messages off! Also maybe you try multi-threading your server so the processor can do more of the work. Java is bad because it doesn't handle memory well and there are simple ways of working around it. Good luck gentlemen!
     
  13. Offline

    TnT Retired Staff

    grid21
    I prefer to fix the problem, rather than rebooting constantly due to one of your plugins eating up all your RAM (or due to incorrectly setting your startup parameters) or hiding the problem by turning off those messages.

    This is a thread for help on fixing the performance issues, not turning a blind eye to them.
     
  14. Offline

    grid21

    Good point. And this is interesting topic. I too have problems with this but I am unable to fix them. Being that my server, for right now, is being ran off of a laptop I'm trying to do what is easy for now until I get my server hosted.
     
  15. Offline

    411owen411

  16. Offline

    hawkfalcon

    Is a virtual box really necessary?
     
  17. Offline

    TnT Retired Staff

    Not at all. I choose to do it this way, but I have extensive knowledge of the VMware ESXi/vSphere platform, so it works well for me. Physical servers are just as good, if not better.
     
    hawkfalcon likes this.
  18. Offline

    thernztrom

  19. Offline

    TnT Retired Staff

    thernztrom
    Most of the time (90+%) the default flags are just as good.

    I've switched back to using -Xincgc again myself, as it does tend to work better in the latest builds of CB. -XX:+UseG1GC has been reported to be good to use, but I have not seen actual benchmarks with it used myself.
     
  20. Offline

    LHammonds

    Back when I ran a virtual server on Ubuntu Server 10.10, Java 1.6 and CraftBukkit 1.2.4 and a ton of plugins, the server kept crying about not being able to keep up. I ran across this thread (thanks TnT) and others that recommended going with a RAMDisk. I did that and it helped out quite a bit but the server still needed to be rebooted at least once a day to keep lag away. But with CB 1.3.1, I find that the server does not have the same hard time keeping up when not running on a RAMDisk. I am still running the same VM hardware but I am using a newer OS (Ubuntu Server 12.04.1) and newer CraftBukkit.

    My next tutorial will cover setting up a 1.3.1 server and installing a bunch of plugins. But this time, unlike my 1.2.4/1.2.5 tutorial, I won't be using a RAMDisk since the problem from before has apparently been reduced.

    Thanks,
    LHammonds
     
  21. Offline

    UNKNOWNSOLDE

    ok im a visual lerner can some one post a vidio or tv me to show me how to do the ram disk thing
     
  22. Offline

    MrMime22

    Hey, what would the best start up script be for a Linex server? 16 gigs ram (12-13 for minecraft), Intel Xeon 4 core CPU. I want the best performance possible, would be awesome if you can give me a pre-made script here, thanks!
     
  23. Offline

    zlycher

    Just wanted to chime in and say how helpful this thread was. Especially the topic of the RamDisk was really helpful. I hadn't really considered using one for the world folder.
     
  24. Offline

    GamingStudioX

    my server also run on laptop and constantly lags and sometime crash of java out of memory. Now the loading of plugins slowed down and will load in about 5 to 10 minutes. I am thinking of doin the ram disk, will it help?

    Really? Did you really fix it? What did you do? I have been trying to get rid of this problem months ago! I will be grateful if you can tell me how did you fix it. Thanks in advance!

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

    grid21

    If you set your server to java -Xmx1300M -Xms128M it will keep from crashing. The -Xmx1300M is the magic number for laptops because it leaves room to run Minecraft game and the server. Try it and let me know how it turns out!
     
  26. Offline

    GamingStudioX

    I will try it! But I am now using RAMDisk, and I still have the (IP) lost connection, can't keep up and read timed out or end of stream and connection reset. What did I do wrong? I did this because I want to get rid of this. My minecraft server file has 500+ mb and I set 600mb using dataram. What is wrong? Omarathon fixed it!
     
  27. Offline

    grid21

    Post your server settings for me so I can check.
     
  28. Offline

    highguy272

    generator-settings=
    server-=
    allow-nether=true
    level-name=KingdomCraft
    enable-query=true
    allow-flight=true
    server-port=25565
    query.port=25565
    level-type=DEFAULT
    enable-rcon=false
    level-seed=
    server-ip=
    max-build-height=365
    spawn-npcs=true
    white-list=false
    debug=false
    spawn-animals=true
    snooper-enabled=true
    hardcore=false
    texture-pack=
    online-mode=true
    pvp=true
    difficulty=3
    enable-command-block=true
    gamemode=0
    max-players=36
    spawn-monsters=true
    generate-structures=true
    view-distance=15
    spawn-protection=0
    motd=\u00A76KingdomCraft\! Join us now\! Upgraded\!

    This is my RUN.bat. I use Remote Toolkit.

    Echo off
    java -Xmx1300M -Xms128M -XX:MaxPermSize=30M -jar Minecraft_RKit.jar xiUltraXpro:my12345630account
    pause

    My main problem now is lag and the message 'Can't keep up!'
    It even appears with no one online!
    Anyone solve this please?

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

    grid21

    Um you can turn off the warning message about over load. Your RUN.bat, what is this part? -XX:MaxPermSize=30M -jar Minecraft_RKit.jar xiUltraXpro:my12345630account
     
  30. Offline

    wicked1

    if i were to run a 100 slot server with 10gb ram allocated to it and on a inter E3-1240 processor running java 7, what java parameters should i use?
     
Thread Status:
Not open for further replies.

Share This Page