Class StorageBenchmark

java.lang.Object
com.enhancedechest.benchmark.StorageBenchmark

public final class StorageBenchmark extends Object
Real, in-server performance and memory benchmark for the storage engine (CachedStorage + OwnerResidencyCache + ChestCacheState).

Unlike the offline JUnit simulation this replaces, it runs inside the live Paper/Folia server process: the real JVM, the real thread scheduler, the real GC. It drives the actual production storage classes over an isolated throwaway SQLite database in plugins/EnhancedEchest/benchmark/ — never the live data — so it measures the engine as it really behaves without any risk to a real player's chests. The DB and its files are deleted when the run ends.

Two memory numbers are reported and answer different questions:

  • Alloc/op — bytes allocated on the calling thread per operation, read from ThreadMXBean. This is GC pressure: how much garbage one operation produces.
  • Retained — live heap held after the operation, a GC-settled Runtime delta. This is where a leak shows up, and it is what proves "memory ∝ online players".

The whole run is blocking and does real disk I/O plus System.gc() settling, so it must be invoked off the main server thread (the command dispatches it to a dedicated thread). It is gated to local developer builds only (see the bootstrap).

  • Method Details

    • run

      public static void run(org.bukkit.command.CommandSender sender, Path pluginDataFolder)
      Runs the whole suite. Blocking; call from a dedicated thread. Progress and the final report are streamed to sender and also written to plugins/EnhancedEchest/benchmark/…txt.