levelrail-cli system health.
What is measured
- Process: goroutines, heap in use, last GC pause.
- Database: query latency p50, p95 and p99, writes that waited for the single SQLite connection (the write queue), reads that waited for a free read connection (the read queue, with the pool size and how many connections are busy; shown as “read pool off” when
APP_DB_READ_CONNSis 0 or the database is in memory, because reads then use the writer), write ahead log size, and a slow query log. - Reconcile loop: last pass duration, p50 and p95, the slowest controller, and seconds since the last pass finished (event lag).
- Live streams: open log, deploy and event streams against the cap.
- Footprint: resident memory, OS threads, CPU, the metrics database size, the soft memory limit, and every background loop with its interval, last run and share of a core. See Performance budget.
Findings and fixes
Each measurement above its threshold becomes a warning, or critical at twice the threshold. Where the control plane can fix it, the page shows a button.
Goroutines, heap, reconcile pass, event lag and stream findings have no automatic fix. The page says what to look at, and a restart (
system restart) is the last resort.
Applying a fix needs a root token. Reading health needs read access. The API is GET /api/v1/system/control-plane-health and POST /api/v1/system/control-plane-health/fix with {"fix": "<id>"}.
Guards that are always on
- Live streams (deploy logs, resource logs, pipeline logs, the deployments stream) are capped. Past the cap a new stream gets
503withRetry-After. SetAPP_MAX_LIVE_STREAMS(default 500). - The write ahead log is checkpointed every minute and capped at 64 MiB after a checkpoint, so a long reader cannot let it grow without bound.
- Planner statistics are refreshed with
PRAGMA optimizeevery 6 hours and once at shutdown. Change the interval with the runtime settingstore.optimize_interval(0disables it,APP_DB_OPTIMIZE_INTERVALonly seeds the default). Thesqlite optimizeloop shows in the footprint card. - The app list is paginated (
limit,offset) with a hard cap, and API requests are rate limited per actor.
Thresholds
See Benchmarks for measured latency at 1000 apps.
Upload spool
Uploads (assets, buckets, database imports, source zips) stage their body in a spool directory (LEVELRAIL_SPOOL_DIR, default under the OS temp dir). The health response carries a spool block with file count, bytes, quota and orphan count. A sweeper loop deletes files older than the max age, which only exist after a crash. The max age (LEVELRAIL_SPOOL_MAX_AGE_SECONDS, default 3600) and the quota (LEVELRAIL_SPOOL_QUOTA_BYTES, default unlimited) seed live settings. Past the quota, source zip uploads answer 507.