Repository navigation
Maximus Protocol
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.
Maximus operates two separate asynchronous maintenance tasks.
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:
- Obtains the denied-transfer cache.
- Synchronizes access to the cache.
- Checks the over-capacity flag.
- Clears the cache when the over-capacity flag is activated.
- Otherwise, removes entries whose cooldown period has expired.
This keeps temporary denied-transfer tracking from accumulating indefinitely.
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.
Maximus monitors several internal data structures.
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.
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.
The logCooldowns map contains temporary logging cooldown entries.
Maximus removes entries whose expiration timestamps have already been reached.
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.
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.
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.
Maximus also works with the Lock Chunk Manager.
It maintains several temporary data structures associated with chunk operations.
The scheduledFlushChunks map tracks chunks with scheduled flush operations.
Maximus removes entries older than the configured scheduled-flush TTL.
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.
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.
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.
| 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 |
| 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.
The Maximus maintenance architecture can be summarized as follows:
- Start the Rapid Sweeper.
- Clean expired denied-transfer cache entries every 5 seconds.
- Start the Heavy Watchdog.
- Check whether another purge operation is active.
- Activate the maintenance guard.
- Enforce the resolved-name cache threshold.
- Clean oversized break-purge tracking data.
- Remove expired log cooldowns and Argus ghost-suspect entries.
- Inspect multi-world hopper cache usage.
- Reduce the heaviest hopper cache when the combined threshold is exceeded.
- Enforce the minecart-cache threshold.
- Remove expired scheduled flush entries.
- Clean old Phoenix chunk-scan timestamps.
- Remove expired pending PDC payloads.
- Complete the maintenance cycle and release the purge-running guard.
- 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