Skip to content

Diagnostics and Optimization

Pratham Anand Basavanal edited this page Nov 10, 2026 · 1 revision

Diagnostics and Optimization

Monitoring Engine

Monitor Measures
TickMonitor MSPT and TPS over 5s, 30s, 1m, 5m, and 15m windows, with P50/P95/P99 and standard deviation
CpuMonitor CPU load for the server process and the host
MemoryMonitor Heap, non-heap, GC pause rate, and allocation rate. Never forces GC.
NetworkMonitor Player ping, kept separate from server-side tick and packet delays
ChunkMonitor Loaded chunks and chunk load, unload, and generation rates
EntityMonitor Entity and block-entity counts by type and world (read-only)
TaskMonitor Pending scheduled tasks and active workers, per plugin
StorageMonitor Free disk space and I/O latency (checked async)

History is kept in fixed-size ring buffers, so memory use stays flat no matter how long the server runs.

Diagnostic Engine

/os diagnose runs the analysis pipeline:

  1. EvidenceCollector gathers the current metric snapshots.
  2. AnomalyDetector flags values that stray far from normal (z-score).
  3. TrendAnalyzer spots metrics that are getting worse over time.
  4. BottleneckAnalyzer classifies the main bottleneck as one of: CPU · Memory · GC · Chunks · Entities · Plugin Tasks · Storage · Network · Insufficient Evidence
  5. RecommendationEngine turns the findings into steps you can act on.

Each finding comes with a confidence score and the evidence behind it. If the data doesn't support a clear conclusion, OptimizeServer says so instead of guessing.

Example Workflow for Lag

/os status              # quick overview
/os mspt                # is the tick time consistently high or spiky?
/os diagnose full       # find the bottleneck
/os profile start       # if a plugin is suspected, gather Spark samples
/os profile stop
/os report generate     # save everything for later review

Optimization Modules

These modules make OptimizeServer's own work cheaper, and they never touch gameplay. Each one records before/after measurements and can be rolled back.

Automatic Safe

Module What it does
config-lookup-cache Caches config value lookups
monitoring-buffer-pool Reuses monitoring buffers to cut down on allocations
bounded-metric-ring Stores metric history in fixed-size rings
zero-alloc-aggregation Aggregates statistics without creating new objects
redundant-query-coalescer Merges duplicate world queries made within a short window
diagnostic-deduplicator Suppresses repeated identical findings
task-batch-coordinator Batches small internal tasks together

Conditional

These are validated first, and they are blocked while safe mode is on.

Module What it does
adaptive-monitoring-sampler Samples world data less often while the server is stable
worker-pool-governor Resizes the async worker pool to match demand
diagnostic-result-cache Caches diagnostic results for a short time
adaptive-telemetry-batcher Batches telemetry processing

Safety

Before any module is turned on, SafetyValidator checks it against all 16 vanilla gameplay rules. A module that could affect gameplay is rejected. If auto-rollback-on-regression is enabled and performance gets worse after a change, RollbackManager reverts that change.

Clone this wiki locally