Resolve Minecraft Server Lag
You may experience chat, block and other delays on a Minecraft server. There are various causes, ranging from high CPU and memory usage to network issues. To simplify troubleshooting, first check the CPU usage in Command Center right when you experience performance issues. Next, refer to the appropriate sections below.
To Our Customers
If you have purchased a server through us, please feel free to contact us and we can help out with any lag you may be having on the server.
When CPU Usage is About 100% or Higher
Based on our experience, too high CPU usage is the main cause of lag. To maintain best performance, try to keep your CPU usage below 100%. There are many different reasons for increased CPU usage. Mods, plugins, and world entities are the most common culprits.
If you’re wondering whether you can get access to more and “better” CPU resources, the short answer is “no.” As the Minecraft server is dependent on single-core performance, we only use the latest processors and don’t impose any hard limit on your usage. We also monitor our machines around the clock to ensure that you can always use at least one core. Since we already give you the best, the best way to identify the cause of CPU usage issues is to troubleshoot in-game.
Exploration is Consuming CPU
Whenever you first start a server, you may notice some lag immediately while people are exploring. The world is divided into regions, which are divided into chunks, which contain a 16x16 area of blocks. Every time you see a new chunk, that chunk is generated by Minecraft. You can lower view distance to help this out.
Chunk generation takes up CPU. It is very common for this to cause lag on your server whenever someone is exploring the world. There is no way around this other than to wait for the lag to die down after the generation is complete.
If you are playing modded Minecraft using the Forge modloader, there are mods that can help alleviate the chunk generation problem by quietly and automatically generating chunks before you explore, without using as much CPU. For forge you can use Chunky or Chunk Pregenerator. For Fabric you can also use Chunky. Try adding one of those to your server to see if it helps when people are exploring. Each one has instructions on what commands to use to do the pregen.
Mods are Consuming CPU
If you’re running a modded server, some mods can cause increased CPU usage and result in performance issues. Think back for a bit. Did you start experiencing lag after you started using certain items on your server? For example in Minecraft 1.6.4, Twilight Forest and certain Mekanism items can be very CPU intensive. However, these are general experiences, and may not be relevant to your situation.
There are mods that can help you profile your server to find the source of the lag. To install any of these mods that don't already come with the modpack you are using, you'll need to use SFTP. Following is a chart of them and what version of Minecraft they work with:
Minecraft Version | Mod |
---|---|
1.6 and 1.7 | Opis |
1.10 and 1.12 | LagGoggles |
1.12 | Tiquality |
1.12, 1.15, 1.16, 1.17, 1.18, and 1.19 | Spark |
1.16, 1.17, 1.18 and 1.19 | Observable |
For those who are on older versions of Minecraft, open a support ticket, and we’ll run an external profiler to determine the mod(s) that are causing the lag. Unlike most of the above, which have the ability to tell you the exact problematic blocks, our profiler can only give results at a high level.
Entities are Consuming CPU
Another common issue is too many world entities. One of your players might have blown something up, resulting in tons of unplaced blocks. Another might have spawned hundreds or thousands of monsters. Each one of these items or mobs will use up CPU and memory resources, and when there are many, will cause a noticeable impact on performance.
CraftBukkit, Spigot, and Cauldron were issued DMCA takedown notices. Because of this, CraftBukkit and Cauldron are no longer publically available. Spigot was largely rewritten for Minecraft 1.8+, but still suffers in a legal gray area.
To remove entities in Minecraft versions prior to 1.8, make sure you’re running a server that can support CraftBukkit plugins, like CraftBukkit, Spigot, or Cauldron. Next, install Essentials or WorldEdit and run one of the appropriate commands. If you are running a Forge based server, you can use ForgeEssentials or the Forge version of WorldEdit for similar features:
- WorldEdit:
/clear items -1
- Essentials:
/remove all
To remove entities in Minecraft 1.8 or higher, you can use the kill
command. You can find more information about that on the Minecraft wiki but an example command to remove all items on the ground would be:
kill @e[type=item]
Single Server Tick Took Longer Than 60 Seconds
Sometimes your server may crash while trying to load because of the number of item entities everywhere. This might be due to a rogue collector of some kind not picking up the items from a mob farm, or other similar situations. There is a way to combat this.
Too Many Chunks are Consuming CPU
In vanilla Minecraft, there is only one chunk that is loaded when you're not around, and that is the spawn chunk. However, in modded Minecraft, there are a lot of mods that offer the ability to keep a chunk loaded even when people aren't nearby. Some functions of mods require this, so it has its uses.
However, some players get in the habit of loading all of their chunks so that items can be created while they are offline. This causes a bunch of chunks to continue working even when no one is on the server. Servers should always limit chunk loading as a rule. We would also recommend that you turn off "easy" chunk loaders like the one found in FTB Utilities. Just check the configs of the mod and looking for chunk loading references. Turn them off if possible.
Your Server is Running into its Memory Limit
Java’s memory cleanup process, garbage collection, uses up CPU resources. In some cases, you may run into the memory limit of your server. You may experience extended high CPU usage at 100%, crashes with OutOfMemoryErrors
or spikes of latency. There is currently no way to tell in Command Center whether your garbage collector is using up CPU resources.
If you suspect this, open a support ticket, and we can check for you from our end.
View Distance and/or Simulation Distance are Too Large
If you have a popular server with players scattered across your map, reducing your view distance may help improve performance. From the Minecraft Wiki the server view distance:
Sets the amount of world data the server sends the client, measured in chunks in each direction of the player. It determines the server-side viewing distance. The “Far” viewing distance is 9 chunks, sending 441 total chunks (the amount of chunks that the server will load can be seen in the debug screen).
10 is the default/recommended. Tip: if you have major lag, reduce this value.
Reducing it may lower the CPU usage when you have many players on. It may also help players who have slower Internet connections.
- Log into Command Center.
- From your server list, find the server you would like to modify and click the Manage button on the right.
- From the server you selected, click the Files tab above the console.
- Locate and open
server.properties
. - Find the line with
view-distance
and/orsimulation-distance
. - Reduce it from
10
to4
or5
. - Save the file and restart your server.
Lack of Server Restarts is Causing Lag
If you've been playing on your server for a few days and it just keeps getting laggier and laggier every day, you probably haven't restarted in a while. A regular restart helps to keep the servers nice and fresh and happy. You should use our scheduler to create automatic restarts at least twice a day:
- Log into Command Center.
- Click on the gear icon and look for
Scheduled Tasks
. Click it. - Click on
Schedule Restart
. - Pick a time for it to start and set the
Restart Every
to 12 hours, or even 6 hours.
❗️❗️❗️ DO NOT SKIP THE NEXT STEPS ❗️❗️❗️ - Click
Schedule Command
, and set it for 5 minutes before your restart. - Then set the command to something like
say Server restarting in 5 minutes.
This will give your users a warning before the server suddenly restarts. - Click
Save
.
Recommended Automatic Restarts
For 1.7.10 or lower, we recommend at least 12 hour restarts. For 1.8 or higher, we recommend every 6 hours.
Adaptive Restarts
To help combat server lag issues we have added Adaptive Restarts to all Minecraft servers. They automatically detect when the server hasn't been restarted for a period of time and will restart the server if there are no players on. However, it's still best to schedule restarts as you can control when they happen.
Bukkit Plugins Consume CPU
To check plugin resource usage, use the Bukkit /timings
command, and scrutinize the output.
- Make sure you’re running CraftBukkit.
- Change
plugin-profiling
inbukkit.yml
fromfalse
totrue
. - Restart.
When you start experiencing lag, run: timings merged
. The command produces a timings[n].txt
file in the timings
folder. Open it and look at how many seconds it took to process each plugin. If you need an easy to use timings file interpreter, try this timings tool. The ones that take the longest should be the most of concern. You can try temporarily disabling them and seeing if the lag improves.
Tekkit Classic Lag
Certain mods in Tekkit are known to cause performance issues. The following commands let you determine the most resource intensive mods in Tekkit Classic. When you experience lag, run:
modtiming start [seconds]
, where seconds is the duration to sample for. For example,modtiming start 10
, will sample for 10 seconds.- Next, type:
modtiming show
- The most resource intensive mods will appear at the top.
Try stopping the usage of the mods and seeing if performance improves.
When CPU Usage is Below 100%
Network Issues
Transient network connection issues or if you’re physically far away from your server can make your Minecraft server appear less responsive. Before continuing with the directions below, we recommend trying to use a wired connection and making sure that the users on your network aren’t downloading large files or consuming a lot of bandwidth. We also have a connection troubleshooter here.
You and your players can test the connection quality from your computer to your server by testing in game and running the ping and trace route commands.
In game:
- Connect to your server with your Minecraft client.
- Log into Command Center.
- From your server list, find the server you would like to modify and click the Manage button on the right.
- On the console, type "say test" and press enter.
- Check if
test
appears right away in your game window. A delay indicates network latency.
To provide further diagnostic information, run the ping and traceroute commands and send us the results.
Not Enough RAM on the Client
The Minecraft client, especially for modded Minecraft, needs to have enough RAM allocated to it to have a smooth experience. If you don't have enough you can get FPS lag or even timeouts when trying to connect to a server because of how long it is taking to load into the server.
Make sure you have 4-8gb allocated in your Minecraft client or on your modded Minecraft launcher. For any modern modpack, it should be 8gb as long as your PC has at least 12gb of RAM total.
Reduce View Distance
Sometimes reducing the server view-distance can help players who have slower connections:
- Log into Command Center.
- From your server list, find the server you would like to modify and click the Manage button on the right.
- From the server you selected, click the Files tab above the console.
- Locate and open
server.properties
- Find the line with
view-distance
- Reduce it from
10
to4
or5
. - Save the file and restart your server.
Client Side Frame Rate
Your server may appear to lag, but in reality it’s your client. To check your frames per second (FPS), press F3
within Minecraft. It’ll display your current FPS. Anything above 20-30 FPS should provide adequate gameplay. If it’s below 20-30 FPS, try adjusting your video settings in game. Try using the following settings:
- Graphics: Fast
- Render Distance: Short or Normal
- Smooth Lighting: Off
- Performance: Max FPS
- Advanced OpenGL: On
- MipMap: 0
- Max Framerate: 30 or 60
You can also attempt to use mods like OptiFine and FpsPlus to increase your framerate and improve your client side rendering performance. However, mods like these rewrite the default Minecraft rendering engine and game logic that the game and other mods depend on. You could experience weird errors, visual glitches, or crashes. Most people trade stability for some increase in performance.
Other Resources
Finally, there are other more obscure causes of lag. The SK Minecraft Wiki has a detailed list. This list includes causes and instructions to solve them.
Please contact support if you continue to experience any issues.
Updated about 1 year ago