How to Evaluate the Impact of the Most Full Container Placement Policy on Resource Utilization, Load Balancing, and Performance in Containercloudsim?
Share
Condition for Evaluate the Impact of the Most Full Container Placement Policy on Resource Utilization
Description: This simulation presents a comprehensive analysis of the Most Full Container Placement Policy in a CloudSim-based containerized cloud computing environment. The model evaluates how containers are placed onto virtual machines (VMs) based on the "most full" heuristic — a policy that aims to maximize resource utilization by allocating new containers to VMs that are already heavily loaded but not yet overloaded. The experiment integrates the PowerContainerDatacenter, PowerContainerVmAllocationPolicyMigrationAbstractHostSelection, and ContainerPlacementPolicyMostFull to simulate realistic workload dynamics.The system measures key performance metrics including VM utilization, overload frequency, execution time distribution, concentration index, and performance degradation under various load conditions. Through detailed post-simulation analytics, it identifies trade-offs between high utilization and system stability, highlighting scenarios where aggressive packing improves energy efficiency but risks overloading.This study provides valuable insights into resource consolidation strategies, load concentration metrics, and efficiency analysis in container-based cloud infrastructures — contributing to optimization models for energy-efficient cloud resource management.
/**
* Comprehensive analysis of Most Full Container Placement Policy
*/
public class PlacementPolicyMostFull {
private static List cloudletList;
private static List vmList;
private static List containerList;
private static List hostList;
// Statistics for Most Full analysis
private static MostFullStats mostFullStats;
public static void main(String[] args) {
Log.printLine("Starting Most Full Container Placement Policy Analysis...");
mostFullStats = new MostFullStats();
// Get results and analyze
List completedCloudlets = broker.getCloudletReceivedList();
printCloudletList(completedCloudlets);
analyzeMostFullResults(completedCloudlets, containerList, vmList);
printMostFullStatistics();
Log.printLine("Most Full Container Placement Analysis finished!");
/**
* Analyze Most Full placement pattern
*/
private static void analyzeMostFullPlacement(List containers, List vms) {
Log.printLine("\n=== MOST FULL PLACEMENT ANALYSIS ===");
// Simulate Most Full placement
ContainerPlacementPolicy mostFullPolicy = new ContainerPlacementPolicyMostFull();
Map vmContainerCount = new HashMap<>();
Map vmCpuUtilization = new HashMap<>();
Map vmRamUtilization = new HashMap<>();
Map initialAvailableMips = new HashMap<>();
Map overloadedVMs = new HashMap<>();
// Initialize maps and record initial available MIPS
for (ContainerVm vm : vms) {
vmContainerCount.put(vm.getId(), 0);
vmCpuUtilization.put(vm.getId(), 0.0);
vmRamUtilization.put(vm.getId(), 0.0);
overloadedVMs.put(vm.getId(), 0);
initialAvailableMips.put(vm.getId(), vm.getContainerScheduler().getAvailableMips());
}
Log.printLine("Initial Available MIPS per VM:");
for (ContainerVm vm : vms) {
Log.printLine(String.format("VM %d: %.2f MIPS available",
vm.getId(), initialAvailableMips.get(vm.getId())));
}
// Simulate placement for each container
List containersCopy = new ArrayList<>(containers);
for (Container container : containersCopy) {
ContainerVm selectedVm = mostFullPolicy.getContainerVm(vmList, container, new HashSet());
if (selectedVm != null) {
// Update statistics
int vmId = selectedVm.getId();
vmContainerCount.put(vmId, vmContainerCount.get(vmId) + 1);
// Calculate concentration ratio (Gini coefficient-like metric)
List sortedUtilization = new ArrayList<>(mostFullStats.vmUtilization);
Collections.sort(sortedUtilization);
/**
* Analyze Most Full results after simulation
*/
private static void analyzeMostFullResults(List completedCloudlets,
List containers, List vms) {
Log.printLine("\n=== MOST FULL PERFORMANCE RESULTS ===");
Map> vmExecutionTimes = new HashMap<>();
Map vmSuccessCount = new HashMap<>();
Map vmFailureCount = new HashMap<>();
Map vmTotalMips = new HashMap<>();
// Initialize maps
for (ContainerVm vm : vms) {
vmExecutionTimes.put(vm.getId(), new ArrayList());
vmSuccessCount.put(vm.getId(), 0);
vmFailureCount.put(vm.getId(), 0);
vmTotalMips.put(vm.getId(), vm.getMips());
}
// Analyze completed cloudlets
for (ContainerCloudlet cloudlet : completedCloudlets) {
int vmId = cloudlet.getVmId();
if (cloudlet.getCloudletStatusString().equals("Success")) {
double executionTime = cloudlet.getActualCPUTime();
// Calculate performance metrics per VM with focus on overload impact
Log.printLine("\nVM ID | Success | Failure | Avg Time (s) | Std Dev | Util (%) | Overloads");
Log.printLine("------|---------|---------|--------------|----------|----------|----------");
for (ContainerVm vm : vms) {
int vmId = vm.getId();
List times = vmExecutionTimes.get(vmId);
int successCount = vmSuccessCount.get(vmId);
int failureCount = vmFailureCount.get(vmId);
double utilization = mostFullStats.finalVmUtilization.get(vmId);
int overloadCount = mostFullStats.overloadCounts.get(vmId);
// Calculate success and failure rates
int totalSuccess = vmSuccessCount.values().stream().mapToInt(Integer::intValue).sum();
int totalFailures = vmFailureCount.values().stream().mapToInt(Integer::intValue).sum();
mostFullStats.successRate = (double) totalSuccess / mostFullStats.totalPlacements * 100;
mostFullStats.failureRate = (double) totalFailures / mostFullStats.totalPlacements * 100;
// Calculate efficiency loss due to overload
if (mostFullStats.overloadEvents > 0) {
mostFullStats.avgPerformanceDegradation = mostFullStats.performanceDegradation / mostFullStats.overloadEvents;
}
}
/**
* Print comprehensive Most Full statistics
*/
private static void printMostFullStatistics() {
Log.printLine("\n=== MOST FULL STATISTICS SUMMARY ===");
/**
* Analyze placement patterns for Most Full
*/
private static void analyzeMostFullPlacementPatterns() {
Log.printLine("\n=== MOST FULL PLACEMENT PATTERN ANALYSIS ===");
// Count containers per VM in placement sequence
Map placementDistribution = new HashMap<>();
for (Placement placement : mostFullStats.placementSequence) {
placementDistribution.put(placement.vmId,
placementDistribution.getOrDefault(placement.vmId, 0) + 1);
}
Log.printLine("Placement Distribution (sorted by utilization):");
List> sortedEntries = new ArrayList<>(placementDistribution.entrySet());
sortedEntries.sort((a, b) -> Double.compare(
mostFullStats.finalVmUtilization.get(b.getKey()),
mostFullStats.finalVmUtilization.get(a.getKey())
));
Log.printLine(String.format("\nLoad Concentration Score: %.3f (0 = even distribution, 1 = maximum concentration)", concentrationScore));
Log.printLine(String.format("Utilization Range: %.1f%% (difference between min and max utilization)",
mostFullStats.maxVmUtilization - mostFullStats.minVmUtilization));
Log.printLine(String.format("Top VM Utilization: %.1f%%", mostFullStats.maxVmUtilization));
private static ArrayList createVmList(int brokerId, int containerVmsNumber) {
ArrayList containerVms = new ArrayList();
for (int i = 0; i < containerVmsNumber; ++i) {
ArrayList peList = new ArrayList();
int vmType = i / (int) Math.ceil((double) containerVmsNumber / 4.0D);
for (int j = 0; j < ConstantsExamples.VM_PES[vmType]; ++j) {
peList.add(new ContainerPe(j,
new ContainerPeProvisionerSimple((double) ConstantsExamples.VM_MIPS[vmType])));
}
containerVms.add(new PowerContainerVm(IDs.pollId(ContainerVm.class), brokerId,
(double) ConstantsExamples.VM_MIPS[vmType], (float) ConstantsExamples.VM_RAM[vmType],
ConstantsExamples.VM_BW, ConstantsExamples.VM_SIZE, "Xen",
new ContainerSchedulerTimeSharedOverSubscription(peList),
new ContainerRamProvisionerSimple(ConstantsExamples.VM_RAM[vmType]),
new ContainerBwProvisionerSimple(ConstantsExamples.VM_BW),
peList, ConstantsExamples.SCHEDULING_INTERVAL));
}
return containerVms;
}
public static List createHostList(int hostsNumber) {
ArrayList hostList = new ArrayList();
for (int i = 0; i < hostsNumber; ++i) {
int hostType = i / (int) Math.ceil((double) hostsNumber / 3.0D);
ArrayList peList = new ArrayList();
for (int j = 0; j < ConstantsExamples.HOST_PES[hostType]; ++j) {
peList.add(new ContainerVmPe(j,
new ContainerVmPeProvisionerSimple((double) ConstantsExamples.HOST_MIPS[hostType])));
}
hostList.add(new PowerContainerHostUtilizationHistory(IDs.pollId(ContainerHost.class),
new ContainerVmRamProvisionerSimple(ConstantsExamples.HOST_RAM[hostType]),
new ContainerVmBwProvisionerSimple(1000000L), 1000000L, peList,
new ContainerVmSchedulerTimeSharedOverSubscription(peList),
ConstantsExamples.HOST_POWER[hostType]));
}
return hostList;
}
List vmUtilization = new ArrayList<>();
List availableMipsAtPlacement = new ArrayList<>();
List placementSequence = new ArrayList<>();
Map vmAvgTimes = new HashMap<>();
Map finalVmUtilization = new HashMap<>();
Map overloadCounts = new HashMap<>();
}
/**
* Placement record class
*/
static class Placement {