> ## Documentation Index
> Fetch the complete documentation index at: https://help.freakhosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Profile Server Lag with Spark in Minecraft

> Use the Spark profiler to identify laggy plugins, entity bottlenecks, and memory leaks on your Minecraft server. Generate detailed performance reports.

## Advanced Technical Diagnostics: Spark

Identifying the root cause of performance degradation on a complex Minecraft server can be mathematically challenging without the correct telemetry. **Spark** is a premier, high-performance CPU and memory profiler designed to provide granular visibility into your server's "heartbeat" (TPS). By capturing and visualizing technical stack traces, Spark enables administrators to pinpoint exactly which plugin, entity type, or world event is consuming excessive hardware resources. This guide ensuring you can move beyond guesswork and resolve lag through data-driven analysis.

<CardGroup cols={2}>
  <Card title="Difficulty" icon="gauge-low">
    Advanced
  </Card>

  <Card title="Time" icon="clock">
    8 Minutes
  </Card>
</CardGroup>

***

## Technical Data Collection Workflow

To generate a meaningful performance report, you must capture data while the server is experiencing its highest load.

<Steps>
  <Step title="Initialize the Profiler">
    Ensure the Spark plugin is active (Note: Spark is built-in to the **Purpur** modloader). Execute the following command in-game or via the console:

    ```bash theme={null}
    /spark profiler start
    ```
  </Step>

  <Step title="The Observation Window">
    Allow the server to operate for **10 to 15 minutes** while participants are actively playing. Profiling an empty server will not yield actionable diagnostic data.
  </Step>

  <Step title="Execute Data Export">
    Conclude the capture by running:

    ```bash theme={null}
    /spark profiler stop
    ```
  </Step>

  <Step title="Access the Visualizer">
    The plugin will generate a unique, secure URL (e.g., `spark.lucko.me/XXXXXX`). Open this link in a modern web browser to access the hierarchical diagnostic dashboard.
  </Step>
</Steps>

***

## Interpreting the Flame Graph

The Flame Graph is a visual representation of your CPU's time allocation. Understanding its geometry is essential for successful optimization.

* **Horizontal Width = CPU Time:** The wider a specific bar or "node," the higher the percentage of your total tick time it consumed. Focus your optimization efforts on the widest nodes.
* **`EntityTick` Hierarchies:** If this section is disproportionately wide, your community likely has too many active mobs, unoptimized entity farms, or a large volume of dropped items.
* **Plugin Callstacks:** Individual plugin names will appear in the graph. If a single plugin (e.g., `EssentialsX`) accounts for more than **15%** of the total tick time, it indicates a significant configuration issue or a technical conflict.

***

## Strategic Memory Analysis

<AccordionGroup>
  <Accordion title="Diagnosing Memory Leaks">
    If your server experiences "Out of Memory" (OOM) crashes, use the **`/spark heapsummary`** command. This generates a report of every object currently residing in your server's RAM, allowing you to identify buggy modifications that are failing to release unused memory.
  </Accordion>

  <Accordion title="Real-Time Performance Overlay">
    Use **`/spark health`** for a rapid overview of your current TPS, CPU usage percentages, and memory heap allocation. This is the fastest method for verifying if a recent technical change had an immediate impact on stability.
  </Accordion>
</AccordionGroup>

<Tip>
  ### Seeking Expert Review

  If you are unable to identify the source of your lag within the Flame Graph, we recommend sharing your Spark URL within our official community Discord. Our technical staff and experienced community members can help you parse complex stack traces to find the bottleneck.
</Tip>

***

<Note>
  ### Need Extra Help?

  If you encounter any issues, our support team is ready to assist:

  * **Live Chat:** Quick assistance via our website.
  * **Support Ticket:** [Open a Ticket](https://freakhosting.com/clientarea/submitticket.php)
  * **Discord:** [Join our Community](https://discord.gg/freakhosting)
  * **Email:** [support@freakhosting.com](mailto:support@freakhosting.com)
</Note>

<Tip>
  ### Save on Your Hosting

  Ready to get a new server? Use code **KB20** at checkout for **20% off** your first month!
</Tip>

***

<div align="center">
  **Last Updated:** January 2026 | **Minecraft:** Diagnostics active.
</div>
