How to Simulate a Power-Aware Container-Based Cloud Data Center Using Containercloudsim and Evaluate its Energy Consumption?
Share
Condition for Mapping Between Containers and Virtual Machines (Vms) in a Container-Based Cloud Data Center using ContainerCloudSim
Description: The ContainerVMMapping program simulates a container-based cloud data center using the CloudSim framework to demonstrate how containers are efficiently mapped to virtual machines (VMs) within a virtualized environment. It models the hierarchical relationship among the main cloud entities hosts, virtual machines, containers, and cloudlets and shows how resources are provisioned and managed at each level.
To initializing the CloudSim environment and creating physical hosts that form the foundation of the data center.Over these hosts, multiple VMs are deployed, each configured with specific computational resources. Containers are then instantiated within these VMs to provide isolated execution environments for cloudlets, which represent user application tasks.
The Container Datacenter Broker manages the submission, scheduling, and mapping of VMs, containers, and cloudlets, ensuring proper allocation and execution during the simulation. Finally, the simulation results display the mapping between containers and VMs, highlighting how containerized workloads are distributed in a cloud data center to achieve better resource utilization and scalability.
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;
}
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 % ConstantsExamples.VM_MIPS.length;
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 createContainerList(int brokerId, int containersNumber) {
ArrayList containers = new ArrayList();
for (int i = 0; i < containersNumber; ++i) {
int containerType = i % ConstantsExamples.CONTAINER_MIPS.length;
private static List createCloudletList(int brokerId, int num) {
List list = new ArrayList<>();
UtilizationModel utilization = new UtilizationModelNull();
for (int i = 0; i < num; i++) {
list.add(new ContainerCloudlet(IDs.pollId(ContainerCloudlet.class),
1000, 1, 300, 300,
utilization, utilization, utilization));
list.get(i).setUserId(brokerId);
}
return list;
}