Minecraft Modded Server Optimizations Guide
Last modified on Apr 13, 2022 in General
By Dalton Whalen
Of all aspects of a Minecraft Server, lag is something that no server owner ever wants to experience. No one wants to have to keep placing blocks that disappear or wait many seconds to eat a piece of food. These are just minor inconveniences in a whole slew of problems that can arise from server lag. We have a great overall guide here that covers types of lag and ways to help reduce it. You may notice the scarcity of modded server optimizations that are discussed. Do not worry, we are here to now supplement that guide with much more information on how you can optimize your modded Apex Hosting Minecraft server.
The most common type of modded server you may find yourself using would be a Forge server. Most one-click modpacks provided by Apex will be running on Forge. If you are unsure whether the modpack is running forge or not you can search for it on curseforge. If you do not see any mention of fabric that is usually a good sign to say that it is indeed not a fabric modpack but instead it is running on forge.
Forge servers will not have a lot in terms of settings that can be used to optimize the servers. The best thing you can do settings wise is lowering your server view distance. The view distance is used to determine how many chunks around each player will be loaded. Below is an example of the amount of chunks loaded around one player with a server view distance of 6.
Each server defaults to 10 view distance. This may be okay in some cases but if you are experiencing lag on your modded server it is best to start here and reduce this value. We would recommend a view distance of 4-6 for modded servers as to increase performance while also keeping the view distance adequate for gameplay. To change your view distance please follow these steps:
- Head to your Apex Panel and login.
- Click on Config Files on the left of the panel and then select Server Settings.
- Locate and change the view distance setting to whatever you prefer.
- Lastly you will need to click save at the bottom and then head back to the main panel page and restart the server for that to take effect.
You can calculate how many chunks are loaded around each player with this formula: (2x+1)² where x is your current view distance. The lower the number the better.
A very common cause of lag within modpacks and modded servers will be chunk generation. Players will want to go out exploring, finding custom biomes, dimensions, and mobs. Constantly exploring and generating new chunks can result in a heavy toll on the server’s performance. This is why pre-generating the chunks on the server is an excellent way to help improve performance.
The best way to generate chunks in your world is with a mod called Chunk-Pregenerator. Regardless of server version this mod should have you covered. It has versions all the way from 1.4.6 to 1.16.5. After installing this mod you can run a simple generation command such as:
/pregen start gen radius GenExample SQUARE 0 0 100
This will generate everything within a 100 chunk radius in the dimension you are standing in starting at (0,0) in your world. This can be adjusted to fit your needs such as increasing the value of 100 to include a lot more areas of generation. The mod has plenty more features we encourage you to explore on its Curseforge page.
If you have tried lowering the view distance or generating chunks and you still experience lag then something very specific could be causing problems. This is where server profiling comes into play. You can use forge’s built in debug profiler to find specific lag sources.
To run the debug profiler you can do the following:
- Head to your Apex panel console.
- Enter the command:
debug start(ensure you do not use a / in the command)
- Let the debug profiler run for around 20-30 minutes.
- After you have given it time to run issue the command:
You have now successfully run the debug profiler. The results will be saved to a text file in a folder called debug in your server’s FTP Files.
Here is an example of what you may find when checking your debug results:
The depth of the section is defined as the number. In this example we will look at line 02. To the right we see the name of the specific section is called tick. To the right of the name we see the first percentage. This first percentage of 99.31% would be the time this took in relation to its parent above. For Layer 0 it’s the percentage of the time a tick takes, while for Layer 1 it’s the percentage of the time its parent takes. The second percentage of 95.81% is the time it took from the entire tick.
Installing Spongeforge to your modded server will open up a lot of great opportunities when it comes to increasing your server performance. Spongeforge is available for modded servers from versions 1.10.2-1.12.2.
The first important feature that Spongeforge will offer is timings reports. This will help you determine what the biggest stressors are on your server. This is similar to the aforementioned debug profiling but will provide some more in depth information. You can run a timings report with the following commands.
- In-Game Issue the command
/sponge timings on
- Wait roughly 20-30 minutes and then issue the command
/sponge timings paste
After you run the paste command a link will generate for you to view the report. Below is an example of what a sponge report may look like.
In this case the large orange section shows lots of TPS loss in the server. If we take a closer look we can see one of the biggest causes here was chunk generation taking up 58% of the tick.
We can safely assume in this instance that the lag is being caused by excessive chunk generation on the server. Good first steps to fix this would be to ensure the view distance is not too high. You could also pre-generate your world chunks to help with this.
Installing Spongeforge is great for advanced server profiling however you can also install many performance enhancing plugins alongside it. Here is a list of recommended plugins you may want to use:
Mobpression – This plugin is used to compress mobs to help reduce entity counts. This is helpful if you have mob farms on your server.
EpicBanItem – With this plugin you can ban items from being crafted or used. This is useful for certain mods that may have items that cause lots of lag on a server.
Not all servers will be able to run Spongeforge due to version compatibility. If you are running very old or very new versions of forge you might not be able to run Spongeforge. Luckily there are plenty of options for performance enhancing mods you can add to your server.
AI Improvements 1.7.10-1.16.5 – This mod focuses on improving the performance of the AI of mobs in your server.
RandomPatches 1.8.9-1.16.5 – RandomPatches aims to be a highly configurable collection of bug fixes and quality of life improvements for Minecraft, and additionally to allow several hardcoded settings to be configured
FoamFix 1.7.10-1.14.4 – FoamFix is an all purpose optimizations mod that helps reduce Java heap usage through many different patches and fixes.
Performant 1.12.2-1.16.5 – This mod is lightweight and can be used to help improve the AI of entities, login timeouts, entity collisions and much more.
Surge 1.10.2/1.12.2 – Surge is an open source mod which aims to improve the load time and performance of the game.
Spark 1.12.2/1.15.2-1.16.5 – This is a forge version of the famous sponge plugin spark. It can be used to profile the server performance in a more advanced way than typical debugging to help find specific causes of lag.
Fabric is another type of modded server you may be running. While it is made to be more lightweight and modular it too can experience lag under the right circumstances.
Fabric similarly to forge lacks settings that can be changed to help with performance. The best thing we can recommend setting wise will be lowering your view distance similar to Forge servers. This will reduce loaded chunks in the world in the same way. The main fix for lag within fabric servers will be adding performance enhancing mods as well as profiling the server to understand what in game may be causing the problems. Below will be a list of mods that we recommend for your fabric server.
There are a lot of great options for performance-enhancing fabric mods. Below is a list of recommended mods you can add if you need to further optimize your server and help reduce any lag you may be facing.
Lithium 1.15.2-1.16.5 – Lithium is a general-purpose optimization mod for Minecraft which works to improve a number of systems (game physics, mob AI, block ticking, etc) without changing any behavior.
Phosphor 1.15.2-1.16.5 – Phosphor is a Minecraft mod which works to optimize the lighting engine of the game. This can drastically decrease loading times of specific dimensions in the game.
Fat Experience Orbs 1.14-1.16.5 – This mod will merge all exp orbs into one single orb. This is extremely useful if you have built large exp farms. This will help reduce the lag in the area greatly.
Keeping the server optimized and lag free is never an easy task. With so many different mods and ways you can run or customize your server it may be difficult to really understand what may be causing the lag. We hope that our recommendations here can help optimize your modded server to identify and eliminate any lag issues you are facing.