Take the 2-minute tour ×
Arqade is a question and answer site for passionate videogamers on all platforms. It's 100% free, no registration required.

I recently decided to set up a Minecraft server on an old PowerEdge 1850 I had lying around. I'd like to start expanding and getting more players on, but I've been having massive lag issues when the server's been running for a day or so. There's usually only about 4 or 5 people logged in, and while the map is fairly large (~650 MB), people don't wander much. However, after sometimes just a few hours, redstone grinds to a halt and water/lava hang in midair. Restarting the server process fixes all the lag issues. When the server starts lagging, it's still well under its allowed memory usage, and CPU usage is fairly normal. Clearing entities doesn't seem to help. I've tried both CraftBukkit and CraftBukkit++, both with similar results. Here's the stats I've got:

  • 2 x Xeon @ 3.20GHz
  • 10 GB RAM (PC2-3200R 400MHz) (8 going to Minecraft)
  • 2 x 300GB 10k RPM U320 SCSI drives (hardware RAID 1)
  • Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
  • Linux 3.2.0-29-generic x86_64
  • Ubuntu 12.04.1 LTS
  • CraftBukkit version git-Bukkit-1.3.2-b286jnks (MC: 1.3.2)

Does anyone know what could be causing all this lag, and how I could fix the problem without restarting the server every few hours?

share|improve this question
    
Just to know, how much redstones stuff you got on your server. I know that, example, a lighthouse is taking a lot of juice from the server just to keep it running. –  Warface Oct 11 '12 at 19:03
    
Not much at the moment, though in the future I'd like to be able to support a good deal. Right now, redstone is just being used for lighting and a few piston doors. Large, complex redstone contraptions are usually temporary, and get taken down within a couple days of being built. –  Dan Oct 11 '12 at 20:07
    
What's the command line you use to start the server ? –  Warface Oct 11 '12 at 20:31
    
java -Xmx8G -Xms8G -Djava.awt.headless=true -jar bukkit.jar –  Dan Oct 11 '12 at 21:15
    
mind posting what type of hard drive setup you've got? I use to run a server on my HP G3 ML 330 and it would get bogged down on chunk creation/loading because of the 2 shitty hard drives I had in RAID 0 –  Brent Hacker Oct 11 '12 at 21:29

5 Answers 5

up vote 5 down vote accepted

If you're using Java 7, it has been known to cause issues running Minecraft. I would download java 6, and give that a try.

Also, if your server supports 64-bit, grab that version.

Update:

The only other advice I can offer is to maybe grab a server auto-restart plugin for bukkit, perhaps give one of those a go, and set it to 6am or whenever your server is least busy. Not an exact solution, but perhaps a livable workaround?

You can get ones that give logged on players warnings when the server will restart as well.

One I've used in the past is Simple Restart. It allows you to set up intervals for restarting & warn players at specific times.

I hope this helps

share|improve this answer
    
That's a good catch: I downloaded Java from the same place I always get Java 6, but I notice now Oracle is quietly sending you to a Java 7 download page, what with Java 6 reaching its EOL in February of next year. Still, I'll give the downgrade a try and report back with results. –  Dan Oct 13 '12 at 2:28
    
Downgrading to Java 6 seems to have helped somewhat, but water and redstone still grind to a halt after a day or two. Any ideas what else I should look into? –  Dan Oct 15 '12 at 2:48
    
@Dan the only other workaround I can suggest is an auto-restart plugin for bukkit (see my update). I realise that you didn't want a solution like this but at least it'll be every 24/48 hours or so as opposed to every couple. –  Robotnik Oct 15 '12 at 22:37

With this amount of RAM try to save the map on a RAM-Drive. Just don't forget to dump it to HDD regulary. This should speed up MC a lot!

For a tutorial check the wiki.

share|improve this answer
    
I assume you intended that second link to be this. At any rate, I tried that, and while things did speed up noticeably, I still have the gradual lag issue every couple days. It's an odd problem: I've run a few other MC servers in the past, and none ever did this. –  Dan Oct 27 '12 at 14:11

Your plugins could be causing some lag..

I've had the same problem in the past..

After 4 - 6 hours my TPS would drop to 3 - 8. And stay there until a reboot was initiated. After weeks of trial and error, I reset my map, along with my plugins. Usually the only problem is the plugin folders. Updates with the .jar could be trying to add, or delete certain things, or it could be throwing errors.

The plugins that have caused the most trouble, in size wise. Were Factions, McMMO, and Essentials.

They create such huge data files overtime it's insane! But rest assured if it's not too late, I hope this helped.

Try reseting some of your plugin folders. And always be sure to update CraftBukkit and your plugins.

share|improve this answer

You need to analyze the problem and work your way towards a solution by eliminating possible culprits. Here are the main reasons for lag:

  • lack of memory
  • HD reading
  • CPU load
  • software bugs.

All of them are possible to be fixed by throwing hardware at them, but depending on the size of your server, you will not be able to fix those permanently. They will come back once the bottleneck is reached.

First of all, you need to know where the bottle neck is.

memory For the memory, you need one of the plugins that let you monitor the memory usage. Essentials and Commandbook allow that AFAIk. You also need to make sure that your server does not allocate all the memory from the start since this will disable you from seeing how the memory usage changes. I have the following startup command for a Quad core 16GB:

java -Xmx10G -Xmn512M -XX:ParallelGCThreads=4 -jar craftbukkit.jar nogui

This defines 512MB For faster moving stuff and helped me a lot. I have a max usage of 10GB. When I start the server, it uses pretty much only 2GB and I can see with the /mem command from essentials where I am as it grows slowly over the day. If you realize you are running out of memory, a restart is often the only solution. There are a lot of plugins that have memory leaks and will not give memory back after they have used it. So a scheduled restart (I do it once ever 24 hours, when it's 4am in the USA) does the trick. It takes only 30-60 seconds anyhow. You need to read this page to get a better idea for the parameters.

HD loading This one is more tricky to detect. It's mostly affected by people joining/leaving/teleporting around, large viewing distance and a general spread of users over large spaces. This can be easiest fixed with a RAM Disk. If you are running low on RAM, remember that in case you have multiple worlds, you do not need to have ALL your worlds in the RAM disk. Make a Ramdisk and only move your most frequently moved world into it, symlink it and you will be fine.

CPU Load This one is tricky since there are several things that you will have trouble finding. Mob spawners, redstone, animals & mobs in general, can cause a lot of lag. You will have to monitor your CPU level. Check if it fluctuates if certain users are joining or if people go to certain areas. One of my users had a large ice field with torches on it. The torches would permanently melt the ice and it re-froze. This massively lagged the server. There are also plugins that limit mob spawning. Sheep eating grass that grows back are an issue there. If you have users that think they need a sheep farm with 2k sheep, you are in trouble. Make rules and check or limit with plugins. Redstone is bad if it runs permanently without anyone pushing a start button. You need to make a rule that redstone contraptions should not run by themselves longer than 2-3 minutes or so. Get a plugin like Nolag and use the /nl examine command to see if you can pinpoint lag to a special plugin.

Software Bugs As I mentioned before, there are lots of plugins that use a lot of CPU or Memory. Minecraft itself, Bukkit etc included. You should try to always run the latest bukkit release and get updated on the plugins. Minecraft itself causes massive lag for example when you have lava or water flowing over a surface in large quantities. Falling water and lava is fine, but a 200 block wide flow of lava over steps is not good. Also, if you have a world where you do not need caves, fill them. This will prevent mobs from spawning and rendering will speed up dramatically.

share|improve this answer

Check the view-distance in the server config file. Even if people don't move much the server still must keep all blocks within this square loaded. Decreasing this value will lessen the amount of chunks to be loaded around the character.

share|improve this answer
2  
render distance is client side. and chunks are loaded based on a square around the player, not direction of view. –  legacy Oct 12 '12 at 20:05
    
@JohnathanMilford thank you for understanding what I was trying to say :) Massive brainfart there –  Yamikuronue Oct 17 '12 at 12:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.