Need a Minecraft server? BeastNode offers the highest performance servers with DDoS protection!
Shop for plans now
Common Causes of Lag
The first thing to do when your server appears to be lagging is to try and isolate the cause of the lag - without knowing what is causing the problem there is no way to effectively fix or reduce it.
Before anything else - please make sure that the issue persists after a server restart. One of the most common causes of lag - especially on Vanilla servers where you don't think about it as much - is that the server has simply not been restarted recently.
Regular restarts will unload all of the loaded chunks that are not actively in use, which reduces the server resource usage. You can set up a scheduled task to regularly restart the server for you - which we recommend setting up for every 10-12 hours at the very least. There is a guide on setting up these scheduled tasks here
If the lag does not occur for all players that are online at the time, even if they are all stood in the same part of the server world, then the problem is clientside. With clientside lag, lowering your launchers video settings can help with this - such as disabling the sky/clouds/fog, decreasing particles and lowering the chunk view radius - as this reduces the amount of world data sent from the server to the client - and the servers view-distance in the server.properties as the lower this is the less chunks and entities around each player the server loads in at once (must be between 3 and 15, 10 by default).
If the lag does occur for all players on the server, but only in certain areas of the map then it is local-lag. This can be caused by a number of things in that area such as a large amount of tile/block entities
(the same applies to modded tile/block entities) a build up of general entities, such as mobs at a mob grinder/farm or a large amount of item drops/arrows/xp orbs, or flowing liquids such as lava (or modded flowing liquids - Water is rarely an issue). Reducing these can help with local-lag.
Server-wide lag, for all players at the same time regardless of where in the world they are, is most commonly caused by plugins or world errors such as entity/chunk errors or corruption. Any plugins that give errors in the console should be disabled/removed (or put on a version compatible with the server version) to see if it helps the issue, and if it persists when no errors are given, the plugins should be disabled one at a time to make sure that no plugins are causing the issue and not giving errors to report it.
To test whether the world is the cause, due to chunk/entity error or corruption, a new world will need to be loaded on the server. To do so enter a new world name in the World box on your control panel, hit Save at the bottom of the page and restart the server (If you have MultiWorld/MultiVerse installed these should be disabled whilst testing this as they will still load every previous world ontop of the new one). Your old world will still be in the files, the World box simply dictates which folder in your server files the world is being loaded from, and if it is a name not already present in the files it will generate a new one in a folder with this name.
Most cases of entity/chunk errors or corruption will give errors in the console and/or cause crashes to make it clear that this is the issue - to fix these problems either a backup from before it started would need to be restored, or the problem entity/block would need to be removed if the errors were specifying where they were, or we can attempt a world repair if you submit a ticket requesting it. The repair would require your server to be offline, and if successful would revert any problem chunks to their original state to remove the problem, however it is not guaranteed to work.
Unusual, or specific, forms of lag - such as chat lag, block lag or hit/PvP lag - can be caused by any of the above but on CraftBukkit/Spigot servers are most commonly caused by faulty plugins. Any plugins, as above, that give errors in the console should be disabled/removed to see if it helps the issue, and if none of the above lag fixes help, the plugins should be disabled one at a time to make sure that no plugins are causing the issue and not giving errors to report it.
Another common cause of lag is setting the View Distance in the server.properties too high. The higher this number is the higher the number of chunks and entities loaded around each player on the server, which will increase the servers resource/RAM usage (and any increase in entity/chunk count also increases the small likelihood of them erroring and causing chunk errors or corruption). This number should be set between 3 and 15, with 10 being the default value. Lower numbers should improve performance (but will reduce how far away from players entities/mobs will spawn in).
The randomTickSpeed gamerule in newer MC versions is another common cause of server performance issues if it is edited - by default it is 3 and it is not recommended to be changed unless you *specifically* need it changed, especially when increasing it as this will cause problems. You can check this with '/gamerule randomTickSpeed' and change it with '/gamerule randomTickSpeed <number>' (never set this to 0 as this will stop a lot of server activity from working, such as crop growth).
If none of the above helps, or you want us to take a look and see if we can find the cause, please submit a support ticket with as much information about the problem and what you have already checked and tried to fix as possible and we will take a look at things for you!