What Are the Three Main Components of spark and What Does Each Do?
Updated
spark is a performance profiler for Minecraft clients, servers, and proxies, and it is built from three main components: a Profiler, Memory Inspection, and Health Reporting. Each one targets a different kind of performance question, so the right choice depends on whether you are chasing a lag spike, investigating memory growth, or watching performance over time.
Profiler: diagnosing performance problems and bottlenecks
The Profiler is the component you reach for when something is slow and you need to know why. According to spark's own description, it helps "diagnose performance problems and bottlenecks with its built-in profiler."
Use it when you have a concrete symptom to explain, for example:
- The server freezes for a second or two at regular intervals.
- A specific action, such as a large redstone contraption or a modded machine, causes a visible stall.
- Tick times are consistently higher than you expect and you want to find the code responsible.
The output of a profiling run is what you then open in the viewer on spark.lucko.me to inspect where time is being spent.
Memory Inspection: heap dumps, memory summaries, and GC activity
Memory Inspection answers questions about memory rather than raw CPU time. spark can:
- Produce full heap dumps.
- Present a summary of what is using the most memory.
- Monitor GC (garbage collection) activity.
This is the component to use when the symptom is memory-related, for example:
- Memory usage climbs steadily and never seems to come back down.
- You suspect a leak and want to see which objects dominate the heap.
- Garbage collection pauses are causing noticeable hitches.
A heap summary or full heap dump generated here is also viewable through the same online viewer.
Health Reporting: tracking key metrics over time
Health Reporting is the long-term observation component. spark "monitors and reports a number of key metrics which are useful for tracking performance over time."
Where the Profiler and Memory Inspection are about investigating a specific moment, Health Reporting is about the trend. Use it when you want to know whether performance is degrading gradually, whether a recent change made things better or worse, or whether a server behaves differently at peak hours than at quiet ones.
Choosing between the three
| Component | Question it answers | Typical trigger |
|---|---|---|
| Profiler | Where is time being spent, and what is the bottleneck? | Lag spikes, slow ticks, a specific action causing stalls |
| Memory Inspection | What is using memory, and how is GC behaving? | Rising memory, suspected leaks, GC pauses |
| Health Reporting | How is performance changing over time? | Tracking trends, comparing before/after a change |
The three are complementary rather than alternatives. A common sequence is to notice a problem through Health Reporting, confirm and locate it with the Profiler, and then check Memory Inspection if the cause looks memory-related.
Getting data into the viewer
The spark website doubles as an online viewer for spark data. To use it:
- Generate a profile or heap summary using the appropriate spark commands.
- After the data has been uploaded, click the link to open the viewer.
- Alternatively, generate or export a
.sparkprofileor.sparkheapfile and open it by dragging it into the box on the page.
The drag-and-drop box only accepts .sparkprofile or .sparkheap files, so other file types will not load. The viewer itself is written in JavaScript using the React framework and is open-source on GitHub.