Autonomous Maintenance
How the SveltyCMS System Watchdog performs proactive self-healing and performance optimization.
On this page
SveltyCMS 2026 introduces Autonomous Maintenance, a background self-healing layer that proactively optimizes the system without human intervention. This is orchestrated by the System Watchdog.
π The System Watchdog
The Watchdog is a persistent background service initialized during the WARMING phase. It executes a health check loop every 5 minutes.
Core Responsibilities
- Service Re-initialization: If a critical adapter (e.g., Database or Auth) reports a
FAILEDstate, the Watchdog attempts a surgicalreinitializeSystem()call. - Resource Monitoring: Tracks RAM and CPU spikes, logging anomalies to the Enterprise Monitor.
- Drift Detection: Verifies that the database schema remains in sync with the filesystem-based βSource of Truth.β
β‘ Cache Compaction
To prevent memory bloat in high-traffic environments, the Watchdog monitors the internal L1 Cache (in-memory store).
- Threshold: Compaction is triggered when the cache exceeds 10,000 items or a 30% fragmentation level.
- Action: The system performs a βLRU Sweep,β purging the least-recently-used items across all tenants while preserving βHotβ system settings and auth sessions.
- Result: Ensures the SvelteKit server maintains a stable memory footprint, even during massive content imports.
ποΈ Database Index Optimization
The Watchdog analyzes query performance bubbled up through the DatabaseResilience micro-telemetry.
- Slow Query Detection: If queries consistently exceed 50ms, the Watchdog logs a performance incident.
- Auto-Indexing: For MongoDB and SQL adapters, the system can autonomously rebuild missing indexes for fields marked as
searchableoruniquein the collection schema if it detects a full table scan is occurring.
ποΈ Automated Trash Purge
While SveltyCMS uses βSoft Deletesβ by default, the maintenance layer manages the archival lifecycle.
- Retention Policy: By default, items in the Trash are kept for 30 days.
- Autonomous Purge: During the nightly maintenance window, the Watchdog permanently removes items that have exceeded the retention threshold, reclaiming database storage.
π Monitoring
Admins can track autonomous activity in the Enterprise Monitor under the System Vitals quadrant.
- Last Run: Timestamp of the most recent maintenance cycle.
- Heals Performed: Count of automated service recoveries.
- Purge Stats: Number of items cleared from trash/cache.