How to Use Spark Profiler to Find and Fix Minecraft Server Lag

Published on

Your TPS dropped to 15 and you do not know why. Spark tells you exactly where the server is spending its time. Here is how to read a Spark report and turn it into actionable fixes.

Written by Jochem Wassenaar – CEO of Space-Node – 15+ years combined experience in game server hosting, VPS infrastructure, and 24/7 streaming solutions. Read author bio →

spark profiler find fix minecraft server lag

Something is eating your TPS. You check the player count, it is only 12 players. Should be fine. But TPS sits at 15 and blocks break with a delay. Without data, you are guessing. Spark stops the guessing.


What Spark Does

Spark is a performance profiler for Minecraft servers. It samples the server's main thread hundreds of times per second and builds a tree of where time is being spent. The result is a detailed report that shows you which plugins, systems, or game mechanics are consuming your tick budget.


Installing Spark

Download from spark.lucko.me. Place the .jar in plugins/ and restart.

Spark works on Paper, Spigot, Fabric, Forge, BungeeCord, and Velocity.


Basic Commands

| Command | What It Does | |---|---| | /spark tps | Shows current and recent TPS | | /spark health | Shows TPS, CPU, RAM, and GC activity | | /spark profiler start | Starts recording a profile | | /spark profiler stop | Stops recording and generates a report URL | | /spark profiler start --timeout 300 | Records for 5 minutes then auto-stops | | /spark gc | Shows garbage collection statistics |


How to Record a Good Profile

  1. Wait for lag to happen (or trigger it by having players do what normally causes lag)
  2. Run /spark profiler start
  3. Wait at least 3-5 minutes with players online doing normal activities
  4. Run /spark profiler stop
  5. Open the URL that appears in chat

A 30-second profile is usually too short. You need enough time for patterns to show up.


Reading the Spark Report

The report opens in your browser at spark.lucko.me. Here is how to read it.

The Flame Graph

The flame graph shows stacked bars. The bottom bar is the main server tick. Each bar above it is a sub-task that runs inside the tick. The wider a bar, the more time it consumes.

What to look for:

  • Very wide bars near the top: These are the specific operations consuming the most time
  • Plugin names: If you see a plugin class name in a wide bar, that plugin is responsible for the load
  • Minecraft internal classes: Names like ServerChunkCache, EntityLiving, HopperBlockEntity tell you which game system is the bottleneck

Common Findings

EntityLiving.travel or EntityLiving.tick taking 30%+ of tick time: Too many entities. Reduce mob spawn limits or increase merge radius.

HopperBlockEntity.tryMoveItems taking 15%+ of tick time: Hopper networks are too large. Increase hopper transfer cooldown.

ChunkProviderServer.getChunkFutureMainThread taking 20%+ of tick time: Chunk loading is overwhelming the server. Pre-generate terrain with Chunky or reduce view distance.

A specific plugin name taking 10%+ of tick time: That plugin is a performance problem. Check its configuration, update it, or find an alternative.

GC (garbage collection) pauses showing in the health report: You are allocating too much or too little RAM. GC pauses above 50ms cause noticeable lag spikes all at once.


Step-by-Step Example

You profile your server and the Spark report shows:

100% Server thread
  ├── 35% Chunk ticking
  │   ├── 20% Entity ticking
  │   │   └── 15% Monster pathfinding
  │   └── 12% Hopper transfers
  ├── 25% Plugin: ShopGUI+
  │   └── 22% Database query
  ├── 15% Chunk loading
  └── 25% Everything else

Reading this:

  1. Monster pathfinding uses 15%: Too many monsters. Lower spawn limits in bukkit.yml
  2. Hopper transfers use 12%: Hopper networks need throttling. Set hopper-transfer to 8 in spigot.yml
  3. ShopGUI+ uses 25%: The shop plugin is making slow database queries every tick. Switch from SQLite to MySQL, or reduce the plugin's update frequency in its config
  4. Chunk loading uses 15%: Players exploring new terrain. Pre-generate with Chunky

After making these changes, profile again. Compare the new report with the old one. You should see those percentages drop.


Memory Profiling

Spark also profiles memory allocation:

/spark heapdump

This creates a snapshot of what is in memory. Open the generated file with VisualVM or Eclipse MAT to see which objects use the most RAM.

For most server owners, the health command is sufficient:

/spark health

This shows:

  • Current memory usage and max allocation
  • GC frequency and pause duration
  • CPU usage
  • TPS over time

Sharing Spark Reports

Spark reports are hosted on spark.lucko.me with a unique URL. You can share this URL with:

  • Plugin developers (to show them their plugin is slow)
  • Hosting support (to diagnose hardware issues)
  • Community forums (to get optimization help)

The report contains no sensitive data. It shows class names and timing data, not player information or passwords.


When to Profile

  • After adding a new plugin
  • When TPS drops below 18 during normal play
  • After a Minecraft version update
  • Before and after optimization changes (to measure improvement)
  • Whenever players report lag and you cannot identify the source

Make profiling a regular habit. Profile once a month during peak hours even if nothing seems wrong. You might catch a slow leak before it becomes a crisis.

Space-Node servers support Spark on all plans. Install it through the file manager and start profiling in minutes. Get started here.

Jochem Wassenaar

About the Author

Jochem Wassenaar – CEO of Space-Node – Experts in game server hosting, VPS infrastructure, and 24/7 streaming solutions with 15+ years combined experience.

Since 2023
500+ servers hosted
4.8/5 avg rating

Our team specializes in Minecraft, FiveM, Rust, and 24/7 streaming infrastructure, operating enterprise-grade AMD Ryzen 9 hardware in Netherlands datacenters. We maintain GDPR compliance and ISO 27001-aligned security standards.

View Space-Node's full team bio and credentials →

Start Minecraft Server in Minutes

Join content creators worldwide who trust our minecraft infrastructure. Setup is instant and support is always available.

How to Use Spark Profiler to Find and Fix Minecraft Server Lag