Articles on: Minecraft
This article is also available in:

How to optimize your Minecraft Server and read Timings

In this article we will learn how to optimize your Minecraft server to its fullest. Please note, this isn't a magic set of instructions that will remove all lag from your server, but they will help.

This article is a little different from our others, being that it will be updated very frequently to make it the best it can be.


Software that this applies for:


Paper and any of its forks

Software that this doesn't apply for:


Pocketmine
Nukkit
Vanilla Bedrock
Vanilla Java
Spigot or below forks
Others

* If you are using Spigot or any below forks, you really shouldn't be and should be using more optimised forks, like Paper or Purpur (we recommend purpur).

Key Terms:


TPS is the ticks per second. There are 20 minecraft ticks in one irl second, therefore if your server isn't lagging, it should be running at 20TPS.
MSPT is how long each tick takes. The lower this number is, the better.
Ping (ms). 99.9% of the time, this is not related to your servers performance, and rather, the location delay between your client and the server.


🏁 Getting started 🏁



The first section will require editing your server config files that are located in the root folder of your server.
To get to these files if you don't know how to, follow this mini guide:

Getting to and editing config files:



Go to the panel, at witherpanel.com
Select the server from the list.
Navigate to the File Manager at the side of the panel. Navigate to the config folder
Here you can see the list of the server files which includes the config files that we want.

There are a list of settings that are recommend to be changed to bring you the most optimized server.
We could go through and list them all here, but there is a perfectly good list that people have made over the years, that we recommend you change the settings to match.

The guide that combines lots of other smaller guides is here: https://github.com/YouHaveTrouble/minecraft-optimization and here https://www.spigotmc.org/threads/guide-server-optimization%E2%9A%A1.283181/

We recommend you go through them both, and apply changes from them to your server.

If your server requires to work as close to vanilla behaviour as possible (whilst using Spigot forks), some of the settings that modify core features of the game, like container behaviour and mob spawning, you might not want to change. That being said, its your server, so you do what you want to do!


🐌 Finding causes of lag: 🐌



You have followed those 2 guides, changing lots of settings on your server, but it still has a low TPS...
Let's show you how to debug what is causing the lag on your server.

This is for Paper and above forks, as Spigot doesn't have this updated functionality (Spigot only has Timings v1, whereas Paper/forks have Timings v2, which is what we need).

Steps:



On your server, run the command timings on .
Leave your server running for about 30 mins, as the timings collects data for the report.
After 30 mins, run the command timings paste, and go to the link it makes in console.
This is where the fun starts, looking through the timings to see what is causing the lag.

Walkthrough:


To start easier, we are going to take a look at the PLUGINS tab, to see if any of your plugins are causing lag.
This is an example timings report, in the said tab:



You can see in the image that the plugin "InventoryRollback" is taking up a more than average amount of the tick.
Clicking on InventoryRollback::Combined Total, will bring a more detailed list of events that the plugin is handling, that is causing lag:



The first steps we recommend you take, is have a look to see if there is an updated version of the plugin you are using, that has more optimisations in place, to reduce the lag (like an update that attempts to run the plugins events in async, rather then in the main server CPU thread).

For example, the plugin "InventoryRollback" has a newer version, called "InventoryRollbackPlus", which is an updated, improved and less laggy version of the plugin. See here.

If no such update exists, or there isn't one that improves the state of your server's timings report, then looking into what the timings report is saying your plugin is doing to cause lag would be the next step we recommend that you take.

Example:
We can see that InventoryRollback has some events that are lagging the server more then others, such as, InventoryRollback::Event: m.d.i.l.EventLogs (PlayerQuitEvent) (refer to screenshot).
In the InventoryRollback config we can see that there is options in the config that controls when it takes a backup of the players inventory.



Specifically, note quit, which is the most laggy event when reading from our timings. We can disable that event by setting the value to 0.

What this aims to do is reduce the impact that a specific plugin has on your server's ticks.
Following this kind of method with other plugins that cause issues on your timings, will help decrease the load on your server.


Now onto the TIMINGS tab.



Looking at this tab can seem daunting at first, but it can be broken down quite easily.




The timings report has the numbers of the "lag" colour-coded (red being worst, white being little impact), however, the different sections aren't, so I have colour-coded the main part of the Timings that we will be looking at.
Colours:
Aqua = Entities
Pink = World
Yellow = Plugins

Starting at the top, we can see that the Full Server Tick is being impacted the most by Minecraft::world -doTick, and expanding doTick, we see tickEntities being the top-lagger.




Expanding the next few values brings us to this:




In this, we see `mooshroom`s are taking up a lot of the tick. This means there are most likely a lot of mushrooms on your server.
This could be happening for multiple reasons, such as:
Players using them for farms.
Your server's mob spawning settings are high and allowing lots to spawn.
Lots of chunks that contain the mob are loaded.

The things you could do to reduce the impact of these listed things could be things such as:
Introducing an AFK kick, so players cant keep chunks loaded for long periods of time.
Changing the mob spawning settings in bukkit.yml to reduce the amount of spawns. You might want to enable per-player-mob-spawns in paper.yml, which aims to change the distribution of mobs between players on the server more fairly (this may result in more mobs being spawned, depending on how your server is setup).
Reducing the render distance for chunks, and using simulation-distance in server.properties (how many chunks around the player will tick, have this smaller than render distance).

In my example timings, almost all of the lag is coming from the mob spawning in chunks. Reducing the render distance while setting the no-tick-distance in paper.yml would help the issue of mobs spawning in a wide area, because the no tick distance is like render distance (view distance), but the chunks don't tick, so mobs won't spawn in them. In the timings, I can see lots of mobs in chunks and spawning tasks causing most of the issues with the lag. Reducing the mob spawning and cap would help solve this issue.


Going through the timings report like this will help you identify where the TPS and MSPT lag is coming from and is needed for your server to run smoothly.



Try not to use an over the top amount of plugins, as these can use a lot of resources especially if coded badly, and be reasonable with your server settings.




For help with server optimisation further, feel free to ping MrRazamataz#6614 in #community-help in the WitherHosting Discord server.

Updated on: 10/03/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!