Skip to content

Repository files navigation

ML-Enhanced VM Consolidation

Course: CS493 Virtualization
Authors: Soponloe Sovann, Sophana Phat, Vanhong Luy
Date: January 2026

Overview

This project implements and compares two VM consolidation strategies in cloud datacenters:

  1. FFD Baseline - Traditional First-Fit Decreasing algorithm (reactive)
  2. ML-Enhanced - Predictive consolidation using Exponential Weighted Moving Average (EWMA)

The goal is to demonstrate how machine learning-based workload prediction can reduce energy consumption and SLA violations compared to traditional reactive approaches.


Key Features

  • Workload Prediction: EWMA-based predictor forecasts future VM resource usage
  • Smart Migration: ML agent makes proactive consolidation decisions
  • Three Workload Scenarios: Steady, Peak, and Variable load patterns
  • Comprehensive Metrics: Energy consumption, SLA violations, migration count
  • Visual Analytics: Automated generation of comparison charts

Architecture

Components

ml_consolidation_testing.py
├── WorkloadPredictor         # ML component for workload forecasting
├── MLConsolidationAgent      # Decision-making engine
├── VM                        # Virtual machine simulation
├── Host                      # Physical server simulation
├── Datacenter                # Control plane orchestrator
└── ExperimentRunner          # Test framework

How It Works

  1. Prediction Phase: ML predictor analyzes past workload patterns (5-step history)
  2. Decision Phase: Agent classifies hosts as underloaded/overloaded based on predictions
  3. Execution Phase: Best-fit placement algorithm migrates VMs to optimize resource usage
  4. Power Management: Empty hosts are powered down to save energy

Results Summary

Based on 300-step simulations with 10 hosts and 25 VMs:

Metric Steady Load Peak Load Variable Load Average
Energy Savings +3.03% -0.80% +3.13% +1.78%
SLA Improvement +30.65% +10.64% +41.38% +27.56%

Key Findings

ML approach reduces SLA violations by 27.56% on average
Best performance in variable workload scenarios (+41.38% SLA improvement)
Peak load scenario shows negative energy savings due to aggressive migrations
Trade-off: ML makes more migrations but prevents more SLA violations


Quick Start

Prerequisites

python --version  # Requires Python 3.7+
pip install -r requirements.txt

Run Experiments

python run_experiments.py

This will:

  1. Run FFD baseline and ML approach across 3 scenarios
  2. Generate results in results/ folder
  3. Create comparison charts automatically

View Results

# Text report
cat results/report.txt

# JSON data
cat results/results.json

# Charts (open in image viewer)
open results/comparison.png
open results/energy_steady_load.png
open results/energy_peak_load.png
open results/energy_variable_load.png

Project Structure

CS493/
├── ml_consolidation_testing.py    # Main simulation code
├── run_experiments.py             # Quick start script
├── requirements.txt               # Python dependencies
├── README.md                      # This file
└── results/                       # Output directory
    ├── results.json              # Raw metrics
    ├── report.txt                # Detailed analysis
    ├── comparison.png            # Multi-scenario comparison
    └── energy_*.png              # Time-series plots

Configuration

Modify parameters in run_experiments.py:

runner = ExperimentRunner(
    num_hosts=10,              # Number of physical servers
    host_cpu=200,              # CPU capacity per host
    num_vms=25,                # Number of virtual machines
    vm_cpus=[15, 25, 35, ...], # VM resource requirements
    num_steps=300,             # Simulation length
    consolidation_interval=8   # How often to consolidate
)

Simulation Details

Workload Patterns

  • Steady Load: Gradual daily cycles with 20% utilization variation
  • Peak Load: Two distinct peak periods (60% → 80% utilization)
  • Variable Load: Flash crowds with exponential spikes and sustained loads

Power Model

P(util) = {
    0 W           if host is powered off
    50 W          if host is idle (no VMs)
    100 + 200·u²  if host is active (quadratic power curve)
}

Migration Cost

  • Energy overhead: 50 Wh per VM migration
  • Applied to both FFD and ML approaches

Academic Context

This project demonstrates key concepts from CS493 Virtualization:

  • Resource Management: Dynamic VM placement and consolidation
  • Energy Efficiency: Power-aware scheduling and host management
  • QoS Guarantees: SLA violation tracking and prevention
  • Machine Learning: Predictive analytics for proactive optimization

Key Algorithms

FFD (First-Fit Decreasing) Baseline

  • Reactive: Responds to current utilization only
  • Strategy: Sort VMs by size (largest first), place in first available host
  • Thresholds: Migrate if host < 30% or > 75% utilized

ML-Enhanced Approach

  • Proactive: Uses EWMA prediction (α=0.3, 5-step history)
  • Strategy: Best-fit placement based on predicted workload
  • Thresholds: Migrate if current AND predicted < 20% or > 80%

References

  1. Beloglazov, A., & Buyya, R. (2012). "Optimal online deterministic algorithms and adaptive heuristics for energy and performance efficient dynamic consolidation of virtual machines in Cloud data centers"
  2. Chen, Z., et al. (2020). "Workload prediction for cloud resource management"

Contributing

This is an academic project for CS493:

  • Course: CS493 Virtualization, Spring 2026

License

Academic use only - CS493 Course Project


Future Improvements

  • Implement LSTM for longer-term prediction
  • Add multi-resource constraints (CPU, memory, network)
  • Support live migration cost modeling
  • Integrate with real cloud traces (Google, Azure)
  • Hyperparameter tuning for ML predictor

Last Updated: January 23, 2026

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages