How to troubleshoot lag

  Game Hosting

In this article, we will go over common reasons why your Minecraft server may be lagging and how to fix it. In general, we can categorize types of lag into three categories.
1. Server side lag (TPS lag)
2. Connection lag (High latency/ping)
3. Client side lag (FPS lag)

Common reasons for lag:
– You have too many mods/plugins.
– Your server is running out of RAM.
– You are too far away from the server.
– You are using an outdated version of Minecraft.
– You have too many entities/items in your world.

Server side lag

Server is running out of RAM.
RAM is the lifeblood of Minecraft servers; it is used to store your player/entity/plugin/mod/chunk data. Your server’s JVM will have to do a lot more work (garbage collection) to keep up if you don’t have enough RAM and this causes lag on your Minecraft server. Minecraft does not have any built-in methods for checking the RAM usage, but you can check the RAM usage by installing the Essentials plugin and using the command “/memory”. You will get an output similar to this when you run this command.

The End “world_the_end”: 625 chunks, 18 entities, 0 tiles.
Nether “world_nether”: 0 chunks, 0 entities, 0 tiles.
World “world”: 625 chunks, 215 entities, 14 tiles.
Free memory: 1,715 MB.
Allocated memory: 1,963 MB.
Maximum memory: 1,963 MB.
Current TPS = 20
Uptime: 20 Hours

We need to look at the output of  “Free memory” for now, we will discuss other outputs later in the tutorial. If the amount of Free memory is less than 100MB, then there is a big chance the lag is caused because your server is running out of RAM.

Server TPS Lag
TPS stands for ticks per seconds. TPS is used to measure performance and stability of Minecraft servers and is maxed at 20.00TPS. Each tick will update your server; few examples are movements of mobs and players, growing crops, sending redstone signals. If your server is running at 20 TPS, it means your server will update 20 times per second.

You can check server’s TPS by using the same command we used to check the RAM usage: “/memory”. Alternatively, if you are running Spigot, you can use the command “/tps” without having to install the Essentials plugin. Your server’s TPS should be around 19-20 for your server to run at its optimal speed.

Fixing server side lag

Reduce view distance
Your Minecraft server will run at view distance of 10 by default. We recommend changing your view distance to 6, this will not make any noticeable difference to players, but this can hugely help your server performance.

Setup automated restarts
Setting up automatic restarts can help your server run smoother by freeing up your server RAM usage. It can also reclaim RAM that gets used by plugins and mods that have small memory leaks.

Run the latest version (but NOT 1.14)
We recommend using the latest version of Minecraft, plugins, and mods on your server. Most newer versions of software will include bug fixes and performance improvements that will make your server run faster and more stable. However, 1.14 is unstable we recommend staying at 1.13 or lower for now.

Use Spigot
If you are running Craftbukkit or Vanilla Minecraft on your server, you can benefit from many performance improvements and bug fixes by simply changing your server JAR to Spigot. Spigot is built on top of Craftbukkit and all your Bukkit plugins will work with Spigot without needing to make any changes. You can read more about spigot here.

Remove unnecessary mods and plugins
Having unused plugins and mods on the server will use up server resources even if the plugins and mods are not being used. It is a good idea to remove any unnecessary mods and plugins from the server. If you think you may use some plugins in the future and are not using right now, you can disable plugins by renaming the plugin .jar file to end with “.disable.” E.g Essentials.jar.disable. You can remove “.disable” from the plugin name to enable the plugin again.

Use ClearLagg plugin
http://dev.bukkit.org/bukkit-plugins/clearlagg/

ClearLagg plugin comes with many great features that you can use to reduce lag on your server. It is also very configurable and is recommended for any server. Here are few examples of commands that you can use to reduce lag with this plugin.

/lagg clear – Removes all entities on the server.
/lagg killmobs – Removes all mobs on the server.
/lagg chunk – Locate possibly laggy chunks.
/lagg unloadchunk – Unload unneeded chunks.
/lagg gc – Attempts to free RAM.

It is also possible to setup auto clear mobs/entities once the server has reached a specified amount of mobs/entities on config file for this plugin.

Use WorldBoarder plugin or default Minecraft border
You can use the WorldBoarder plugin to limit the world size and pre-generate chunks for your world. This will improve the performance of your server because the server does not have to generate new chunks when players try to access it. This is also useful if you want to keep your world at a reasonable size. You can also use default Minecraft border.


Connection Lag (high latency/ping)
Latency, or otherwise known as ping is the time it takes packets from your computer to reach the server. If you are located too far away from the server’s location, you will have high latency and packets from your computer will take longer to reach the server. For example, if you place a block on the server, it may take a second to actually place the block on the server or if you hit a player, it may take a second to register the damage. This is because your Minecraft client has to send every action to the server and the server has to verify these actions and send it back to your client and other players.

You can find latency/ping to your server by opening command prompt/terminal on your computer and using the commands below depending on your operating system.

IMPORTANT! Don’t include the port number, just enter the server IP address.

Windows:
ping -n 5 <server_ip>


Mac/Linux:
ping -c 5 <server_ip>

Ping command will run for few seconds and once it’s done, it will show your the average ping to the server.

Fast latency: 0-100ms
Medium latency: 100-200ms
Slow latency: 200-300ms
Laggy latency: 300+ms

Fixing connection lag
If your latency to the server is higher than 200ms, that means you are located too far away from the server. There is no way to fix high latency because it is based on your physical location. However, we offer servers in multiple locations so players can get the best latency as possible.

If it appears you accidentally choose the wrong location then you can request a location transfer by contacting support.

Client FPS Lag
Although FPS lag is caused by the client it may be difficult to differentiate lag caused by FPS and the server. And for most cases, it is both. For example, if you have a world with 1000 entities, your server TPS will drop because the server has to iterate over entities and it will do this every tick per second. And your client’s FPS will drop because it has to render and keep up with all the entities.

You can press F3 key on your keyboard while you are playing on the server and it will display your FPS on the top left. You should have at least 30FPS while walking around the server for smooth gameplay.


Fixing FPS/Client lag
Use Optifine mod

The Optifine mod comes with many configurable features and is recommended to anyone. But most importantly Optifine mod can help players achieve higher FTP and smoother game player. You can download and install Optifine mod here.

Lower your video settings
Try using following video settings for your Minecraft client. You can adjust your video settings by going to “Options” -> “Video settings” on your client.

Graphics: Fast
Smooth Lighting: OFF
Clouds: Fast
Render distance: 4-8
Use VSync: ON
Entity shadows: OFF
Particles: Minimal

If you find any information outdated or still need help contact us @ https://elixirnode.com/support

Was this article helpful?
YesNo

Sign up to be alerted of new articles!

We will let you know of any new articles that we publish so that you may benefit from the many upcoming tutorials we have planned for you.