|

How To Make a Minecraft Server Less Laggy? (13 Ninja Tips)

Minecraft servers are software that is not optimized for performance. They consume a lot of RAM, solicit the disk and operate in a single-thread.
Server delays are therefore frequent, and this can become very complicated for the gaming experience if no action is taken to improve this.
In this guide, I’ll explain what you can do to reduce these lags.

Actions can be performed on several levels to reduce the slowness of a Minecraft server.
On the first level, it is advisable to limit the plugins used or the size of the worlds.
In terms of configuration, there are many options to limit these problems.

So we’ll start by seeing the best practices to follow from a logical point of view to avoid adding lag not necessary, then we will see some configuration options a little magical to solve some problems.

Identifying what generates slowness

The first thing to do to reduce the lag of a Minecraft server, is to try to find ways to explain it. That is the purpose of this first part, which is the most important.

The material

A problem with the machine hosting the server is usually the easy solution to identify a lag problem.
Of course if you have 30 players on a PC that is 10 years old, this is probably the first cause to observe, but often the hardware is not directly involved.

We’ll come back to the end of this guide on why you might consider a server change, but for now let’s focus on factors that limit a good operation.

The amount of RAM

A Minecraft server is very sensitive to the amount of memory available (RAM).
The number of players, the loading of worlds or some plugins can generate additional RAM usage.

If you’re with a RoxServers Minecraft host, there won’t be much to do at this level (other than switching to the next server if that’s really the only reason).
On the other hand, if you are on a dedicated, virtual server or your own computer at home, there are things to check.

First, start by typing the following Spigot command:
/gc (provided by the Essentials plugin)
This will show you the size of the allocated memory, and the size of the memory remaining available, for example:

This allows you to have both information at a glance.

If the free memory is very low, this is probably the problem, in this case, I advise you to increase the RAM allocated to your server when starting.
The options are as follows:
java -Xmx1024M -Xms1024M -jar file_server.jar
Replace 1024M with the amount of RAM to be allocated.

Also remember to check that the entire machine is not saturated in terms of memory.
If you allocate 8GB, but there’s only 4GB in all, that won’t work 🙂
Same if you have other apps that run and consume a lot of memory.

In case you host your server yourself, adding RAM to your machine has become very affordable. So there’s no reason to miss it if it’s really the problem that generates lags (see the good deals of the moment on Amazon).

The type of disk

Currently, there are still two types of hard drives for computers and servers: SATA or SSD. SATA is becoming increasingly obsolete, and is much slower than SSD.
A switch to a server using SSD can therefore significantly improve performance at certain levels.

It won’t necessarily be revolutionary everywhere if the rest doesn’t change, but it can give a significant boost to all access to the disk.
This includes, for example, the start of the server, the backup of the worlds, the different progress records of your players, etc.

If you host your server at home, a 64 or 128GB SSD doesn’t cost much anymore, and it would be a shame to miss it when your old drive is hurting performance (see the model I use on Amazon).
For traditional online hosts, you will probably find possible upgrades (Roxservers has very affordable prices in SSD for example).

The processor

The processor itself is less and less limiting for Minecraft servers. Indeed, PCs and servers now have more than enough power to run a Minecraft server.

The real problem with the processor is managing your server’s process. Indeed, Minecraft and servers were developed with the idea of using only one processor at a time.
Except that currently most machines have at least 4 CPU cores.


A processor with 1 core and very fast, will work much better than another one with 16 cores, but rather slow (it’s not really realistic, but you understood the idea ^^).

On Windows, the resource monitor allows you to monitor this and identify if this may be a problem.
On Linux, I use the “htop” tool, which is not always installed by default, to supervise this use (illustrated above in the CPU part).

Unfortunately, once this problem is identified, there is no simple solution.
A processor change usually involves a complete machine change.
To select the best CPU in your budget, it’s important to look for the benchmark on a benchmark site like CPU Benchmark , and look only at the “Single Thread Rating” score.

Other causes of slowness on Minecraft server

Now that we know a little more about the different hardware limitations that can generate on your server, let’s see the causes.

The number of plugins

The first thing to consider is the plugins installed on the server.
While plugins bring useful or fun new features, the build-up of these plugins is often penalizing for performance and game quality.

So on a new server, be vigilant with each new plugin added. Is it essential? Doesn’t it duplicate with another that could be replaced? Does it really make sense to have 70 of the animation-related plugins on a survival server?

On an old server, consider doing a regular analysis of installed plugins, whether they still serve or not. It’s easy to keep everything, but it can affect performance, and it’s pretty easy to adjust if some of the plugins have lost their usefulness over time.

I am well placed to tell you that on a server more than 5 years old, it is not at all obvious to do without plugins that bring benefits to players. That’s why it’s important to think carefully at the start.

The choice of plugins

Additional note about plugins, the choice of plugins also has all its importance.
In addition to being sure that it makes sense to add this feature, also consider whether other plugins do not offer it with better performance.

Indeed, adding a plugin that allows 200 functions when you only need one, and that it is available in a plugin that does that, is not going to help you.

Similarly, since plugins are developed by independent coders, the performance of 2 plugins that do the same can vary greatly. Do some tests, and go back if it’s too slow.

The size and number of worlds

The server loads the spawn of each world at the start, and it loads the areas (chunks) around each player for a smooth game.
If necessary, these chunks will have to be generated before being loaded (which is even more resource-intensive).

The more people you have, the longer it will take to start the server.
But also, the bigger you have worlds, the more connected players will have an impact on performance.

Here are my two tips on this:

  • Preloading the worlds: The generation part of the chunks I was talking about is the heaviest. If you have a huge world with 30 players on its loading areas, your server will have a hard time holding, whatever its characteristics.
  • Putting limits to your worlds: Whatever your server type (except among friends may be), avoid leaving your worlds limitless. There will be less generation needed if you restrict the map to the bare minimum.

To help you set up these two tips on Spigot, I recommend the WorldBorder plugin, which allows you to do both.
It also reduces a map to the new limit.
You can find all the information here on the Spigot website.

The number of entities

Finally, one of the last key things to consider is the number of features on your server.
As a reminder, an entity is any dynamic element on the server (unlike a block that is static).

This includes:

  • players
  • animals and mobs
  • boats and wagons
  • torches and frames
  • blocks subjected to gravity (sand, gravel, etc.)
  • items inventories lost or thrown to the ground

The resolution of this problem will depend on your server type and the restrictions in place.
For example, on a creative, if everyone fills their plot with boats, you’re going to have problems. Even if in survival all worlds to farms of 500 animals of each kind, it can very quickly impair performance.
It’s up to you to see the best solutions to put in place.

However, I recommend you to take a look at the StackMob plugin and the WorldGuard configuration.
The ClearLag plugin can also help remove the surplus features or those left on the ground.

Useful tools to help you

Knowing the possible reasons for lag can already guide you to look in certain directions, but there are a few tools to help you in this task.

Timings

Timings is a tool that can help you find the cause of your problems among all the possibilities we have already listed.
This is a command, included in Spigot, that will generate you a web report with the state of your server, and possible causes of slowness.

The syntax of the command is:
Use:
/timings <reset|report|on|off|verbon|verboff>
To launch a report, use the command
/timings on
Then, after a few minutes (the longest is the best, minimum 3 minutes):
/timings report
This will show you a link to the web report to consult:

You have a tab with important information (global, regions, configuration and plugins).
In each tab, the most important issues to consider are listed in order.

It takes a bit of time at first to analyze, but you’ll find plenty of help online about it if needed. In general, the results will be quite obvious.

Paper

Paper is an alternative to Spigot whose main objective is to optimize performance in general.
I went from Spigot to Paper when updating my server to 1.13, and it saved my life, the server was unplayable with Spigot, and everything was better with Paper (without changing anything else).

I’m not going to go into more detail here because I already have a full article about Paper if you’re interested in learning more (I highly recommend it if you’re still reading me, the change is done very quickly, with no impact, and can therefore be tested easily).

Configurations to reduce lag

In this part, I’m just making a quick reminder about the various concrete tracks that you can explore to fix your server slowdown problem.

Plugins

The first thing to look at once the causes are identified (with more or less certainty) is if there is not a plugin that could help you in this area.

I have already mentioned several, but here are some examples to make it more telling:

  • ClearLagg, AntiLag and others: they add some useful features such as removing items left on the ground by players.
  • Mobstacker: The number of entities generating a lot of slowness, why not merge the mobs when they are close? (in a farm, for example).

There are plenty of other problems, I’m not going to list everything.
Remember, adding 5 plugins to reduce lag doesn’t make much sense, so make sure first and foremost that your current plugins are essential and well configured.

Bukkit.yml

Bukkit.yml is one of the 3 main files that allows you to refine some of your server’s options.  This can be used in particular to optimize performance.

For example, the “spawn-limits” part determines the number of monsters and animals that can appear per connected player. Lowering these values slightly (50, 8, 3 and 1 for example), will inevitably reduce the load on your server.

I invite you to take a look at all the options and see what could be refined without too much impact on the game.

Spigot.yml

Spigot.yml is the second file to look at if you’re on Spigot or Paper.
In addition to all the various configuration options added by Spigot, it includes many variables that can reduce server lag, for example:

  • item-despawn-rate: allows items to disappear on the ground faster than the traditional 5 minutes.
  • mob-spawn-range: reduces the number of chunks around which mobs can appear.
  • entity-activation-range: in the same way, how far does a player have to be from a mob for his AI to activate?

An explanation of all the options can be found on the official Spigot website.

Paper.yml

Finally, if you’ve taken the plunge and your server is running on Paper, you have one last file to look at.
Paper is primarily performance-oriented, most of the options in this file can play a role. Here are some examples:

  • despawn-range: in the same way as for the spawns of the mobs we saw in spigot.yml, it is possible to adjust here the distance of despawn.
  • grass-spread-tick-rate, mob-spawner-tick-rate, … : perhaps it is not necessary for everything to be updated with each tick in the game? In this case, you should be interested in these kinds of options.

As with Spigot, you will find the explanations of the contents of this file in the official documentation of Paper.

New server?

You’ve been trying everything for weeks and nothing works? Maybe it’s just time to consider a new server?
That is what we will see in this last part.

When should you change the server?

If you wonder, you already have part of the answer. A server change may be necessary if you see this as your last option.
After that, there are lots of questions to ask if this is the right time, and unfortunately the answers are up to you:

  • Have you followed all the recommendations to lighten your server?
  • Do you think your server is already running on an undersized machine?
  • Do you have the budget to switch to a more powerful server?
  • Could it remain financially profitable? (if you make money with your server)

If you have a majority of yes, it’s probably time to take this seriously, and do the test.

If you’re with a shared host, it’s straightforward to update your server with superior performance without any impact on the current configuration.
On the other hand, if you have your server on a machine that you manage entirely (pc, private server, etc.), it will take a long time to complete the migration that will have to be considered in the decision.

How do I choose a server?

Once your decision has been made to leave on a better server, remains the choice to make the machine on which to pass.
Again, this will depend on the cases and guiding you to the right choice in a few words is not easy.

On the other hand, I wrote a full article on the choice of its Minecraft host, which I advise you to read before anything else.

Conclusion

So here we are at the end of this very important article on optimizing the performance of a Minecraft server.
As I said in the introduction, this is a delicate subject, because it is very important for players, but at the same time not so obvious to grasp since the game itself is not very optimized at the base.

In any case I hope that my advice will have been useful to you.
If so, feel free to share this article on your favorite networks, or when you are asked about it 🙂

Similar Posts