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
- Agreement-Based Ensemble Predictor — adaptive exponential smoothing (CV-driven α ∈ [0.1, 0.6]) combined with weighted moving average; divergence-based estimator selection.
- Linear Trend Extrapolator — EMA-smoothed velocity eliminates the parabolic overshoot of kinematic models.
- Multi-Signal Leading Indicators — online-learned request-to-CPU elasticity (E = Cov/Var) for ALB; correlation-learned weights for Micrometer JVM metrics.
- Percentile-Based Burst Detector — P95 + median deviation with a capped 1.5× scale factor.
- Pattern Learner — hourly/daily temporal load profiles with preemptive scaling triggers.
- 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)
| Metric | Result |
|---|---|
| Lambda invocations (verification window) | 96 |
| Lambda errors | 0 (0%) |
| Average decision latency (full ML pipeline) | < 400 ms |
| ML analysis time | 5–10 ms |
| CloudWatch metrics published per invocation | 19 |
| Unintended ECS scaling events | 0 |
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.