Diagnosing Minecraft Server Lag with Spark Profiler | NodeFlux.eu Docs

Use the Spark performance profiling plugin to pinpoint tick lag causes, memory leaks, and entity bottlenecks.

Steps

  1. Install the spark plugin JAR into your plugins folder (or mod folder for Fabric/Forge) and restart the server.
  2. When experiencing lag or low TPS, run the console command: /spark sampler --duration 60.
  3. Wait 60 seconds for the profiler to collect CPU thread telemetry across game ticks.
  4. Open the generated spark view web link provided in the console response.
  5. Examine the CPU call tree to see whether lag originates from mob pathfinding, redstone clocks, plugin listeners, or chunk loading.
  6. Run /spark heap to capture a snapshot of JVM memory allocations when investigating high RAM usage or GC pauses.

Notes