Skip to content

Maximus Protocol

RunningArmy6 edited this page Nov 18, 2026 · 2 revisions

Colossus v2.8.2 — Memory Watchdog & Cache Maintenance Engine

A complex locking system continuously generates temporary runtime data.

Player name resolutions, hopper ownership information, minecart locks, pending PDC writes and chunk-tracking metadata can accumulate as the server operates.

SecureAutoSmartLocks (SASL) uses the Maximus Engine to monitor and maintain these internal data structures.

Maximus is the central maintenance component responsible for cleaning expired temporary data, controlling selected cache sizes and reducing unnecessary runtime-state accumulation.

It operates through two independent scheduled maintenance cycles.


⚓ 1. Dual Watchdog Architecture

Maximus operates two separate asynchronous maintenance tasks.

Rapid Sweeper — 5 Seconds

The Rapid Sweeper executes every 100 ticks (approximately 5 seconds).

Its primary responsibility is the maintenance of the denied-transfer cache managed by the Security Listener.

The process:

  1. Obtains the denied-transfer cache.
  2. Synchronizes access to the cache.
  3. Checks the over-capacity flag.
  4. Clears the cache when the over-capacity flag is activated.
  5. Otherwise, removes entries whose cooldown period has expired.

This keeps temporary denied-transfer tracking from accumulating indefinitely.

Heavy Watchdog — 60 Seconds

The Heavy Watchdog executes every 1200 ticks (approximately 60 seconds).

Before starting, it checks whether another purge operation is already running.

If so, the maintenance cycle is skipped.

Otherwise, Maximus activates the purge-running guard and begins its scheduled maintenance operations.

The Heavy Watchdog is responsible for the broader cache and metadata cleanup process.


🧠 2. RAM Guard & Metadata Cleanup

Maximus monitors several internal data structures.

Player Name Cache

The resolvedNameCache stores resolved player-name information.

When its size exceeds the configured name-cache limit, Maximus clears the cache.

This is a full cache clear rather than an individual least-recently-used eviction process.

Break Purge Tracking

The breakPurgeSet tracks block keys involved in break-related purge operations.

Under normal operation, this set is expected to be continuously drained.

If its size exceeds 50,000 entries, Maximus clears it and writes a warning to the server log.

This acts as an emergency safeguard against excessive temporary tracking data.

Log Cooldowns

The logCooldowns map contains temporary logging cooldown entries.

Maximus removes entries whose expiration timestamps have already been reached.

Argus Ghost Suspects

Maximus also maintains the temporary tracking data used by Argus.

Ghost-suspect entries older than 20 minutes are removed.

This prevents lingering suspicion records from remaining in memory indefinitely.


🌍 3. Multi-World Hopper Cache Management

Hopper ownership information is maintained through a world-based cache.

Maximus calculates the combined number of cached hopper entries across all worlds.

It also identifies the world containing the largest hopper cache.

When the combined number exceeds the configured hopper-cache limit, Maximus removes approximately one-third of the entries from the heaviest world's cache.

The process is designed to reduce the largest source of hopper-cache pressure instead of clearing every world's data simultaneously.

Empty world-cache entries are also removed during maintenance.


🚋 4. Minecart Cache Management

Maximus monitors the minecartOwnerCache.

When the number of cached minecart entries exceeds the configured minecart-cache limit, the cache is cleared.

This is a full cache reset rather than a partial eviction strategy.


📦 5. Chunk Tracking & Pending PDC Maintenance

Maximus also works with the Lock Chunk Manager.

It maintains several temporary data structures associated with chunk operations.

Scheduled Flush Cleanup

The scheduledFlushChunks map tracks chunks with scheduled flush operations.

Maximus removes entries older than the configured scheduled-flush TTL.

Recently Scanned Chunk Cleanup

Phoenix maintains world-specific chunk scan timestamps to prevent repeated recovery scans within the debounce interval.

Maximus removes scan timestamps that have exceeded the configured Phoenix debounce duration.

Empty world entries are removed afterward.

Pending PDC Write Cleanup

The Chunk Manager can hold pending PDC write payloads when the corresponding data cannot yet be written to its destination.

Maximus examines these pending payloads and removes entries whose creation time exceeds the configured pending-PDC TTL.

Empty pending-write maps are also removed.

This prevents expired temporary write payloads from remaining in the runtime tracking structures indefinitely.


⚙️ 6. Configuration Integration

Maximus loads its configuration through updateMaximusConfigValues().

The values are validated before being assigned to the engine's volatile configuration fields.

Invalid values fall back to their default settings.

The engine also prints its loaded parameters to the server log during initialization.

Configuration Parameters

Parameter Default Purpose
maximus-name-cache-limit 2,000 Maximum resolved-name cache threshold
maximus-hopper-cache-limit 250,000 Combined hopper-cache threshold
maximus-minecart-cache-limit 50,000 Minecart-cache threshold
maximus-locks-cache-limit 10,000 Configured lock-cache soft-cap
maximus-purge-batch-limit 300 Configured purge synchronization batch limit
maximus-scheduled-ttl-seconds 30 Scheduled flush entry lifetime
maximus-pending-pdc-ttl-seconds 3,600 Pending PDC payload lifetime

Configuration Validation Ranges

Parameter Accepted Range
Name Cache Limit 100–100,000
Hopper Cache Limit 10,000–1,000,000
Minecart Cache Limit 1,000–500,000
Locks Cache Limit 1,000–100,000
Purge Batch Limit 50–2,000
Scheduled Flush TTL 5–600 seconds
Pending PDC TTL 60–86,400 seconds

Implementation Note: The lock-cache soft-cap and purge-batch settings are loaded and logged by the current configuration loader. Their direct enforcement is not demonstrated in the inspected Heavy Watchdog maintenance path.


🔄 7. Maintenance Execution Flow

The Maximus maintenance architecture can be summarized as follows:

  1. Start the Rapid Sweeper.
  2. Clean expired denied-transfer cache entries every 5 seconds.
  3. Start the Heavy Watchdog.
  4. Check whether another purge operation is active.
  5. Activate the maintenance guard.
  6. Enforce the resolved-name cache threshold.
  7. Clean oversized break-purge tracking data.
  8. Remove expired log cooldowns and Argus ghost-suspect entries.
  9. Inspect multi-world hopper cache usage.
  10. Reduce the heaviest hopper cache when the combined threshold is exceeded.
  11. Enforce the minecart-cache threshold.
  12. Remove expired scheduled flush entries.
  13. Clean old Phoenix chunk-scan timestamps.
  14. Remove expired pending PDC payloads.
  15. Complete the maintenance cycle and release the purge-running guard.

💎 Core Responsibilities

  • Dual Watchdog: Separates rapid temporary-cache cleanup from periodic maintenance.
  • Cache Management: Controls selected name, hopper and minecart cache thresholds.
  • Multi-World Awareness: Evaluates hopper cache usage across multiple worlds.
  • TTL Cleanup: Removes expired temporary records and scheduled operations.
  • Argus Integration: Cleans obsolete ghost-suspicion tracking entries.
  • Phoenix Integration: Maintains the lifecycle of chunk-scan debounce metadata.
  • PDC Queue Maintenance: Removes expired pending write payloads.
  • Overflow Protection: Provides an emergency cleanup path for oversized break-purge tracking.

Architected by Protocol-S Development
Lead Dev: RunningArmy6

Clone this wiki locally