Spark - spark is a performance profiling plugin/mod for Minecraft clients, servers and proxies

This is a discussion topic for the Ore project, spark. View the full project on Ore for downloads and more information.


spark

spark is a performance profiling plugin/mod for Minecraft clients, servers and proxies.

Useful Links

What does spark do?

spark is made up of a number of components, each detailed separately below.

spark is made up of three separate components:

CPU Profiler Memory Inspection Server Health Reporting
Diagnose performance issues. Diagnose memory issues. Keep track of overall server health.

:zap: CPU Profiler

spark’s profiler can be used to diagnose performance issues: “lag”, low tick rate, high CPU usage, etc.

It is:

  • Lightweight - can be ran in production with minimal impact.
  • Easy to use - no configuration or setup necessary, just install the plugin.
  • Quick to produce results - running for just ~30 seconds is enough to produce useful insights into problematic areas for performance.
  • Customisable - can be tuned to target specific threads, sample at a specific interval, record only “laggy” periods, etc
  • Highly readable - simple tree structure lends itself to easy analysis and interpretation. The viewer can also apply deobfuscation mappings.

It works by sampling statistical data about the systems activity, and constructing a call graph based on this data. The call graph is then displayed in an online viewer for further analysis by the user.

There are two different profiler engines:

  • Native AsyncGetCallTrace + perf_events - uses async-profiler (only available on Linux x86_64 systems)
  • Built-in Java ThreadMXBean - an improved version of the popular WarmRoast profiler by sk89q.

:zap: Memory Inspection

spark includes a number of tools which are useful for diagnosing memory issues with a server.

  • Heap Summary - take & analyse a basic snapshot of the servers memory
    • A simple view of the JVM’s heap, see memory usage and instance counts for each class
    • Not intended to be a full replacement of proper memory analysis tools. (see below)
  • Heap Dump - take a full (HPROF) snapshot of the servers memory
    • Dumps (& optionally compresses) a full snapshot of JVM’s heap.
    • This snapshot can then be inspected using conventional analysis tools.
  • GC Monitoring - monitor garbage collection activity on the server
    • Allows the user to relate GC activity to game server hangs, and easily see how long they are taking & how much memory is being free’d.
    • Observe frequency/duration of young/old generation garbage collections to inform which GC tuning flags to use

:zap: Server Health Reporting

spark can report a number of metrics summarising the servers overall health.

These metrics include:

  • TPS - ticks per second, to a more accurate degree indicated by the /tps command
  • Tick Durations - how long each tick is taking (min, max and average)
  • CPU Usage - how much of the CPU is being used by the server process, and by the overall system
  • Memory Usage - how much memory is being used by the process
  • Disk Usage - how much disk space is free/being used by the system

As well as providing tick rate averages, spark can also monitor individual ticks - sending a report whenever a single tick’s duration exceeds a certain threshold. This can be used to identify trends and the nature of performance issues, relative to other system or game events.

Usage

To install, just add the spark.jar file to your servers plugins directory.

In order to use any of the commands, you need to have the ‘spark’ permission.

Information about how to use commands can be found in the docs.

If you’d like help analysing a profiling report, or just want to chat, feel free to join us on Discord.

Guides

There are a few small “guides” available in the docs, covering the following topics.

11 Likes

A new version has been released for spark, it is available for download here.


  • Fixed an issue which prevented links from being “clickable”
  • Added a /spark alias

A new version has been released for spark, it is available for download here.


  • Added a max stack depth limit to fix issues with rendering

A new version has been released for spark, it is available for download here.


  • Allow multiple threads to be specified in the same command. e.g. /profiler start --thread Thread1 --thread Thread2
  • Optimize the way data is collected and processed
  • Add an option to group all thread pool processes under the same node in the viewer. This is enabled by default, use --not-combined to disable it.

A new version has been released for spark, it is available for download here.


  • Add ‘/profiler monitoring’ command to monitor tick times, and ‘–only-ticks-over’ argument to filter profiling output to ticks lasting over a certain duration
  • Improved the way data is serialized
  • Changed the default sampling interval from 10 to 4ms

is not support for API 7?

Latest version supports API5->API7

A new version has been released for spark, it is available for download here.


  • Improve sampler efficiency
  • Implement GC notifications as part of the monitoring command
  • Add /spark heap for basic heap dump (memory) analysis
  • Implement tab completion for commands

A new version has been released for spark, it is available for download here.


  • Add a command (/spark heapdump) for generating hprof memory snapshots
  • Allow thread names to be specified using regex
  • Use fragment identifier instead of query parameters for web viewer (fixes issue with Multicraft consoles)
  • Add --without-gc flag to disable GC notifications during monitoring
  • Add --include-line-numbers flag to record the line number of method calls during sampling
  • Improve the type descriptor conversion in heap dump outputs
  • Update okhttp library version
  • Count ticks using a normal Java int instead of a LongAdder
  • Improve ThreadGrouper “by pool” regex expression
1 Like

A new version has been released for spark, it is available for download here.


  • Add a /spark tps command, for more accurate monitoring of the servers tick rate
  • Add /spark healthreport command, to view general information about the servers status
  • Add “activity log” feature for keeping track of past samples/memory dumps
  • Add support for generating heap dumps on non-hotspot JVMs (OpenJ9)
  • Add “combine-all” thread grouping argument
  • Allow sampling at fractions of a millisecond intervals
  • Improve the performance/efficiency of the sampler
  • Ensure that the plugin cleans up completely when disabled

Is there a general Permission node for this? i’d like to only grant access to the plugin to Staff. thanks

https://github.com/lucko/spark/blob/master/spark-sponge/src/main/java/me/lucko/spark/sponge/SparkSpongePlugin.java#L149

A new version has been released for spark, it is available for download here.


spark is a performance profiling plugin based on sk89q’s WarmRoast profiler

A new version has been released for spark, it is available for download here.


No description given.

A new version has been released for spark, it is available for download here.


spark is a performance profiling plugin/mod for Minecraft clients, servers and proxies.

A new version has been released for spark, it is available for download here.


Initial release for API 8

1 Like