Skip to content
Minecraft Minecraft: Bedrock Edition Rust Counter-Strike 2 Palworld Valheim Satisfactory Enshrouded
Configure server Sign in
DE EN

Investigate Minecraft Datapack Functions and Command Workload

When a Minecraft server stutters during a specific action, use a short profile to investigate datapack functions and command chains before changing limits.


If a Minecraft server stutters during a particular action, a frequently called datapack function may be involved. First check when the load occurs and capture a short profile during that window. This helps narrow down the trigger without prematurely disabling command limits or the watchdog.

Which datapack calls run especially often

Functions in the minecraft:tick tag group run on every game tick. Such an entry point can call additional functions or execute many commands. Look for chains with multiple function calls and commands that use execute as @e to create many execution contexts. These are candidates to investigate, not proof of the cause. For Java 1.20.3, Mojang describes separate limits for executed operations and created contexts. Function calls and steps of an execute command count too, not just lines in a file. The Java 1.20.3 release notes list maxCommandChainLength and the new rule maxCommandForkCount, including an example with nested entity selection.

schedule function can also trigger recurring work. The function is scheduled after a delay measured in game ticks. The Java 1.15 development changes introduced multiple scheduling and the append and replace options; replace is used when no option is specified. Check whether a function schedules itself again, which scheduled entries are created, and whether append is used. Repeated scheduling alone does not prove that a queue grows without limit. Mojang's Java 1.14 notes explain the delay in game ticks; the 19w38b snapshot with the changes from 19w38a documents multiple scheduling, while the Buzzy Bees notes document the default.

Narrow down the load

  1. Note the exact Java version, server software, world, approximate player count, time, and action when the stuttering occurs. Try to repeat the same action later. A profile without the problem window may miss the trigger.

  2. Check the tag file for minecraft:tick and follow its function entries. The tag ID does not necessarily appear as text in every function file it calls. Also search for schedule function, append, execute as @e, and called function names. Compare the chain with the time of the problem, and do not change any files while investigating.

  3. If spark is already available, start a short recording just before the repeatable action:

    /spark profiler start --timeout 120

    The 120 seconds is a bounded example, not a required measurement. The profile needs to include the action in question. Paper bundles spark starting with version 1.21; for other versions or server software, first check whether the command is available. This example applies in game chat with the spark.profiler or spark permission; in the server console, omit the leading slash. In the console, check with spark profiler info whether a recording is already running before starting another. Do not install an additional plugin on a running server for this first diagnosis. The Paper profiling guide explains the prerequisite to reproduce the problem while recording; the spark command reference confirms the status check, --timeout, and permissions.

  4. Open the profile and inspect the server thread during the time window you noted. Repeated function or command calls are a clue. spark shows classes and methods; a pack name or function ID may not be directly identifiable there. Compare the call chain with the datapack files you read earlier. A single high entry does not prove that this datapack is the cause. The spark viewer guide explains what the methods view can show. Share a profile link only with people who need it for diagnosis.

  5. If the cause remains unclear, work with a separate copy of the world. Preserve a usable state, stop the instance before copying, and compare the same in-game situation each time. On the copy, disable at most one suspect pack per comparison. If the load and profile pattern return with the pack, that is stronger evidence than a single high entry in the profile. Do not change the pack, server version, and other settings at the same time.

What to change when you find a cause

A frequently run minecraft:tick function is not automatically wrong. First check whether its work is needed every tick, whether an entity selection is unnecessarily broad, and whether the same step is reached more than once in a function chain. For a delayed function, check whether it is repeatedly scheduled and whether append or replace matches the intended behavior. Change only the confirmed location, then compare the same time window again.

Do not raise command limits blindly or disable the watchdog as a lag fix. The gamerule names above are supported by the Java 1.20.3 reference. Since Java 1.21.11, they are named minecraft:max_command_sequence_length and minecraft:max_command_forks. Check the names and allowed values for the version you are running. If a limit is being reached, first reduce unnecessary calls and execution contexts; a higher limit does not make the work faster.

If the profile does not show function load, check other server causes with the Minecraft server lag guide. For datapack storage, activation, and version compatibility, use the separate datapack installation and checks guide. The individual spark views are explained in investigating Minecraft with spark.

Sources

Did this guide help? We are happy to help personally.