Investigating Minecraft with spark
Use spark to record a specific Minecraft lag window and examine where the server spent time without treating a profile as proof of cause.
When a Minecraft server stutters during a particular activity, a spark profile helps you inspect that exact time window. Start the recording shortly before a repeatable situation and stop it afterward. A profile shows where time was spent during the recording; on its own, it proves neither that there is a fault nor that a particular plugin caused it.
Before profiling
First note when the problem occurs and what is happening in the game: world, approximate player count, activity, and time. This makes two recordings comparable. A profile over a long, quiet period can hide a brief spike because the other samples dilute it. PaperMC notes that the problem being investigated must actually occur while profiling. The PaperMC profiling guide describes spark as an included profiler from Paper 1.21. With other server software or older versions, first check whether spark is available and configured appropriately.
Profiler commands require the spark or spark.profiler permission; /spark tickmonitor requires spark or spark.tickmonitor. In in-game chat, run the examples with a leading / as an authorized operator. In the server console, enter the same command without a leading slash. Check /spark profiler info to see whether spark is accessible and whether a recording is already running. Available commands and permissions are listed in the spark command usage reference.
Record a specific lag window
For repeatable or longer-lasting load
Start a time-limited recording shortly before the situation:
/spark profiler start --timeout 120
Here, 120 represents 120 seconds. Adjust the time window to the expected activity. During the recording, repeat as closely as possible the situation in which the server normally stutters. spark stops automatically after the time limit and outputs a link to the viewer. You can also end the recording early with /spark profiler stop. The command reference lists --timeout as an option for profiler start.
For isolated, recurring pauses
If the problem consists of brief spikes, first enable the tick monitor:
/spark tickmonitor --threshold-tick 50
The value is in milliseconds per tick. At 20 TPS, the average tick time is at most 50 ms; individual slower ticks can leave the server needing to catch up. Use 50 ms as a clear starting point and adjust the threshold to the spikes you actually observe. The tick monitor reports overruns. spark recommends using it to identify the pauses first and then profiling only the slow ticks. The guide to finding lag spikes explains this process.
After observing, turn off the tick monitor with /spark tickmonitor; according to spark, the command toggles it on or off.
If the spike can be repeated, start the filtered recording during normal activity. Choose a threshold below the slow ticks you observed—for example, 50 ms if the spikes are clearly above it:
/spark profiler start --only-ticks-over 50
The recording then collects samples from ticks above the chosen threshold. Stop it after the observed recurrence, and no later than about two minutes, with /spark profiler stop. If the recording misses the time window, the profile may contain too little useful data. Do not deliberately add extra load to a production server just to create a spike.
Read the result carefully
Open the link provided and first inspect the Server thread. Expand areas with larger shares instead of judging only by the first entry with the highest percentage. In the tree view, spark shows each thread's share of the profiled time; calling methods also include work from their nested calls. The viewer documentation explains how to use the tree, flat view, and plugin/mod source view. It also notes that names show classes and methods and are not always self-explanatory without context. spark: Read a profile in the viewer.
A high share in world or entity ticks may fit a heavily loaded gameplay situation. A plugin entry may be a useful starting point for further investigation. Both are clues at first: check whether the method ran during the reported event, whether the situation recurs, and whether a second recording shows the same pattern. In a filtered profile, the shares refer only to the selected slow ticks; they do not automatically describe the load of all normal ticks. An absent result also does not mean there is no cause: the recording may have missed the event or used an unsuitable threshold.
If a method name is unclear or obfuscated, expand the tree further and check the mappings used in the viewer. According to spark, the profile link can be shared. Treat it as shared diagnostic information and send it only to people who should inspect the server.
For general troubleshooting, see targeted Minecraft server lag troubleshooting. If the profile raises a question about world and entity ticks, setting view distance and simulation distance explains the two values. Prepare logs for a specific request with preparing game server logs for a support request.
Sources
Did this guide help? We are happy to help personally.