Minecraft Server Tick Profiling: How to Find and Fix Lag with Spark and Timings
# Minecraft Server Tick Profiling: How to Find and Fix Lag with Spark and Timings
You've tweaked your server.properties, adjusted view distance, and installed every optimization plugin you've heard of — but your server still stutters. The problem is that most server admins optimize *blindly*. Without proper profiling, you're guessing.
This guide shows you how to use Spark and Paper Timings to pinpoint exactly what's causing lag on your Minecraft server and how to fix it.
---
Why Profiling Matters Before You Optimize
Every Minecraft server tick (ideally 50ms, or 20 TPS) involves hundreds of operations: entity AI, chunk loading, plugin event handlers, world saving, and more. When a tick takes longer than 50ms, your TPS drops.
Without profiling, you might spend hours tuning entity limits when the real culprit is a plugin running a heavy database query every tick. Profiling tells you where your milliseconds are actually going.
---
Method 1: Spark Profiler (Recommended)
[Spark](https://spark.lucko.me/) is the gold standard for Minecraft server profiling. It works on Paper, Spigot, Purpur, Folia, and even Velocity/BungeeCord proxies.
Installing Spark
Download the latest Spark jar from [spark.lucko.me](https://spark.lucko.me/) and drop it into your /plugins folder. Restart the server.
Running a Profile
During a period of lag or high player activity, run:
/spark profiler start
Let it run for 60–120 seconds while the lag occurs, then stop it:
/spark profiler stop
Spark will generate a shareable link (e.g., https://spark.lucko.me/xxxxxxxxxx) with an interactive flame graph.
Reading the Flame Graph
The flame graph shows you a call stack breakdown of where CPU time is spent:
- Wide bars = more time spent in that method
- Look for wide bars near the top of the stack — those are your bottlenecks
- Common culprits:
CraftScheduler(plugin tasks),EntityAI,ChunkMap,LevelChunk
Example findings:
- A wide
AsyncChatDecoratorEventbar → a chat plugin is slowing message processing - Heavy
PathfinderGoalusage → too many mobs with complex AI running at once BlockPhysicsEventspamming → plugin or piston chain reacting to every block update
Spark Health Commands
Spark also includes quick diagnostic commands:
/spark health — overview of TPS, CPU, memory
/spark gc — garbage collection stats
/spark heapsummary — memory breakdown by object type
/spark tps — last 5s/10s/1min TPS
These are invaluable for quick checks without running a full profile.
---
Method 2: Paper Timings
If you're running Paper (or its forks), you have access to the built-in Timings system. While Spark is generally more accurate, Timings is easier to interpret for beginners.
Running Timings
/timings reset — clears existing data
/timings report — generates a report after collecting data
Wait a few minutes during active gameplay, then run /timings report. You'll get a link to [timings.aikar.co](https://timings.aikar.co).
Reading the Timings Report
The report is broken into sections:
- Plugin timings — shows how long each plugin spends per tick
- Entity timings — which entity types are taking the most time
- World timings — per-world breakdown
Look for:
- Any plugin exceeding 1ms per tick consistently — this is a red flag
- High
Tile Entity Tickvalues → too many hoppers, furnaces, or custom tile entities - High
Entity Tickin a specific world → mob overpopulation
> Note: Paper has been moving away from Timings in favor of Spark. On newer Paper versions, Timings may be deprecated. Spark is always the better long-term choice.
---
Common Lag Sources and Fixes
Once you've identified the culprit, here's how to address the most common findings:
Plugin Scheduler Abuse
If Spark shows heavy CraftScheduler usage, a plugin is running expensive tasks on the main thread.
Fix: Check which plugin is listed under the scheduler call. Look for plugins that run sync tasks every few ticks. Contact the developer or replace the plugin.
In bukkit.yml, you can also check:
tick-per:
animal-spawns: 400
monster-spawns: 1
water-spawns: 1
autosave: 6000
Increasing monster-spawns to 2 or 4 reduces how often spawn checks run.
Hopper Lag
Hoppers are one of the most expensive tile entities. In paper-world.yml:
hopper:
cooldown-when-full: true
disable-move-event: true
ignore-occluding-blocks: true
And in spigot.yml:
world-settings:
default:
hopper-amount: 1
hopper-can-load-chunks: false
Excessive Entity AI
If PathfinderGoal dominates your flame graph:
In paper-world.yml:
entity:
activation-range:
animals: 16
monsters: 24
misc: 8
brain-ticks:
villager: 2
In purpur.yml (if using Purpur):
mobs:
villager:
lobotomize:
enabled: true
check-interval: 100
Lobotomizing villagers that are stuck or inactive saves enormous tick time.
World Save Lag Spikes
If you see periodic lag spikes in Spark around save-all, adjust in bukkit.yml:
chunk-gc:
period-in-ticks: 600
autosave-period: 6000
And in server.properties:
sync-chunk-writes=false
This moves chunk writes off the main thread on Paper servers.
---
Building a Profiling Workflow
Don't profile once and forget it. Build a habit:
- Profile during peak hours — lag is harder to reproduce off-peak
- Profile after every major plugin update — updates can introduce regressions
- Keep a baseline — save a Spark report from a healthy server state to compare against
- Profile before and after changes — verify your fixes actually helped
Tools like [PulseNode](https://pulsenode.tech) can help you correlate TPS drops with server events automatically, so you know exactly *when* to trigger a Spark profile — without having to watch your console 24/7.
---
Summary
| Tool | Best For | Platform |
|------|----------|----------|
| Spark | Deep CPU profiling, flame graphs | All platforms |
| Paper Timings | Quick plugin/entity breakdown | Paper/forks |
| /spark health | Fast TPS/memory snapshot | All platforms |
Profiling is the single most effective optimization technique because it eliminates guesswork. Once you know your actual bottleneck, every config change you make has a measurable, targeted impact.
Stop optimizing blind — profile first, fix second.
---
*Want to know the moment your server starts lagging — before your players notice? [PulseNode](https://pulsenode.tech) monitors your TPS, memory, and entity counts in real time and alerts you instantly when something goes wrong.*