Diagnosing lag on your Minecraft server
I HATE LAG!!!
Don't we all? Luckily, Lilypad provides the tools and support you need to quickly diagnose and fix the most common causes of lag. Unluckily, we're taking money from your bank account every month. Checkmate.
While some statistics may lead you to believe your server is lagging, it's important to check if you're actually experiencing lag in-game. If you're not, then there is probably nothing to worry about.
Diagnosing lag can be confusing sometimes. If you need any help throughout the process, don't hesitate to contact us via live chat or our Discord server.
First of all, consider the type of lag you're experiencing.
Is the lag only affecting you, and not other players in the game? There's probably some network issues affecting your connection to the server. Try installing and running Cloudflare's 1.1.1.1 tool. It'll reroute your internet connection and we see it quite often magically fixing connection issues that players may (rarely) experience on our customers' servers.
Are you getting frame drops in-game, or is your FPS very low? This won't be something on the server side. Try increasing the amount of RAM allocated to your Minecraft client, or install a mod like Entity Culling to reduce the number of entities rendered by your client.
Is it affecting all players on the server, by delaying movement/opening chests/placing and breaking blocks? Read below as your server may be lagging.
Make sure you have spark installed on your server, which will allow you to diagnose the source of the lag. Modded servers will automatically have it installed if you install Fabric/Forge via the Software tab. Modern plugin servers running Paper or derivatives will also have spark built-in.
Wait until you next think the server may be lagging, then run the spark tps command. It should generate an output like below:

In this example, the server's TPS (ticks per second) is consistently 20.0 meaning the server isn't overloaded. You can try running this again if you suspect the server may be lagging in the future. If it's still not dropping below 20 TPS, you may want to refer to the info at the top of this article.
If the server is dropping below 20 TPS, run the spark profiler open command via console, and click the link sent in console to open the generated spark profile. If it says "The profiler isn't running", run spark profiler --start then wait 15+ minutes (the longer the better), and repeat this step.
You should be able to see a chart displaying the TPS over time, like below, with a noticeable dip at the point when your server was lagging. Select this area where the TPS drops to filter the profile.

Let's take a look at the profiler tree a bit further down. Click on the text that reads Server thread 100.00% before continually expanding each item, until you reach recognisable details (such as a mod/plugin name, or vanilla features such as entities/chunk loading).
Typically, when lag is noticeable in-game, these large-number nodes will be orange, red, or just significantly bigger than the rest of the nodes next to them.
However, if the nodes seemingly responsible look like this (including text such as wairForTasks, LockSupport.parkNanos(), and Unsafe.park() ), then it means spark is not detecting any lag on your server. You may not be experiencing server lag, but rather FPS or ping (internet) lag. Or, you may need to find a new way to diagnose your server lag.

If you see a bunch of nodes referencing Minecraft commands, the lag you're experiencing is most likely being caused by a datapack. Datapacks can cause a lot of lag, especially if you have a large number of them. There are some other profilers you can use, such as Minecraft's /perf command, that can help you determine exactly which datapack is causing the lag.
Now that you know what is causing the lag, you can take actions to squash it! For example, if it's entities, you can lower your view-distance, simulation-distance, and entity spawn rates.
If you're using a pre-made modpack from Modrinth, CurseForge, or similar, it's often best to contact the author of that modpack, as they will know best how to resolve lag and potential issues. They'll usually have a link to a support Discord server on the modpack page, which you can join and ask for help in.
spark has some useful docs over at this link which may be suitable for more advanced users.
Updated on: 13/04/2025
Thank you!