Skip to content

What is LXC AutoScale ML?

LXC AutoScale ML is a resource management daemon for Proxmox environments. It monitors LXC container resource usage and automatically adjusts CPU and memory allocations with zero downtime, using machine learning to predict resource demands.

Key Features

ML-Driven Autoscaling

The system uses an IsolationForest machine learning model to detect anomalies in resource usage patterns. When unusual activity is detected, the model evaluates whether scaling is needed based on:

  • Current CPU and memory utilization
  • Historical usage trends
  • Configured thresholds and limits

Incremental Scaling

Resources scale gradually to avoid instability:

  • CPU: Adjusts by ±1 core per cycle (configurable)
  • RAM: Adjusts by ±512 MB per cycle (configurable)

This prevents the system from jumping between minimum and maximum allocations.

High-Performance Architecture

The batch async API client fetches container configurations concurrently, providing 10x faster performance compared to sequential requests. A deployment with 60 containers completes configuration fetching in approximately 0.6 seconds.

Enterprise Security

  • API Key Authentication: All sensitive endpoints require authentication
  • Rate Limiting: 120 requests per minute with automatic localhost bypass
  • Input Validation: Comprehensive parameter validation prevents injection attacks

Fault Tolerance

The circuit breaker pattern automatically skips failed API endpoints, preventing cascading failures. The system recovers gracefully from crashes through automatic stale lock cleanup.

Architecture Overview

LXC AutoScale ML consists of three main components:

ComponentPurposeService Name
APIRESTful interface for scaling operationslxc_autoscale_api
MonitorCollects resource metrics from containerslxc_monitor
ModelML engine for scaling decisionslxc_autoscale_ml

Data Flow

LXC Containers

      ▼ (metrics collection)
┌─────────────┐
│   Monitor   │──▶ /var/log/lxc_metrics.json
└─────────────┘

      ▼ (read metrics)
┌─────────────┐
│    Model    │──▶ Train IsolationForest
└─────────────┘    Detect anomalies
      │            Predict scaling needs
      ▼ (API calls)
┌─────────────┐
│     API     │──▶ Apply scaling actions
└─────────────┘


LXC Containers (scaled)

Use Cases

Dynamic Web Applications

Scale container resources during peak traffic hours and reduce them during off-peak periods.

Development Environments

Automatically adjust resources based on build activity and test workloads.

Database Servers

Respond to query load variations by scaling memory and CPU as needed.

Batch Processing

Increase resources when batch jobs run and scale down after completion.

Comparison with Manual Scaling

AspectManual ScalingLXC AutoScale ML
Response timeMinutes to hoursSeconds
AccuracyBased on estimatesBased on real data
ConsistencyHuman-dependentAutomated
Overnight coverageRequires on-call staffContinuous
Resource efficiencyOften over-provisionedOptimized

Next Steps

Released under the MIT License.