Predictive ML-Based Autoscaling for Containerized Microservices (ECS Fargate)

A multi-signal ensemble with formal guarantees — scaling decisions made 2–5 minutes before demand spikes.

Marcin Wypyszyński March 2026 Summary (PDF) Full paper (PDF)

Problem

AWS ECS threshold-based autoscaling operates reactively, introducing a 3–7 minute lag between load increase and new capacity. For containerized microservices this means service degradation during every traffic spike.

Solution: a 6-component ML pipeline

  1. Agreement-Based Ensemble Predictor — adaptive exponential smoothing (CV-driven α ∈ [0.1, 0.6]) combined with weighted moving average; divergence-based estimator selection.
  2. Linear Trend Extrapolator — EMA-smoothed velocity eliminates the parabolic overshoot of kinematic models.
  3. Multi-Signal Leading Indicators — online-learned request-to-CPU elasticity (E = Cov/Var) for ALB; correlation-learned weights for Micrometer JVM metrics.
  4. Percentile-Based Burst Detector — P95 + median deviation with a capped 1.5× scale factor.
  5. Pattern Learner — hourly/daily temporal load profiles with preemptive scaling triggers.
  6. Confidence-Aware Hysteresis Controller — prediction confidence modulates thresholds; provable oscillation bounds.

Key innovations

  • Minimum baseline stability guards replacing naïve ε = 10⁻¹⁰ denominators — eliminates false signals at low utilization.
  • Online correlation learning for both ALB elasticity and Micrometer signal weights.
  • Formal safety guarantees — proven bounded scaling invariant (Nmin ≤ N* ≤ Nmax) for all execution paths.
  • Oscillation bound theorem — at most ⌊T/(Kconsec+1)⌋ oscillations in T evaluation periods.
  • 9-level decision hierarchy — burst → queue overload → leading indicators → prediction → trend → pattern → reactive → scale-down → no change.

Production results (6 ECS services, 2 environments)

MetricResult
Lambda invocations (verification window)96
Lambda errors0 (0%)
Average decision latency (full ML pipeline)< 400 ms
ML analysis time5–10 ms
CloudWatch metrics published per invocation19
Unintended ECS scaling events0

Technology stack

AWS Lambda (Python 3.11) ECS Fargate CloudWatch DynamoDB EventBridge ALB Micrometer


The full paper contains mathematical proofs, theorems, algorithms and complexity analysis: download the full paper (PDF) or the summary.

Need this in your infrastructure?

I design and deploy predictive autoscaling systems like this one — as consulting engagements.

See services Email me