Introduction to CloudSim
CloudSim Installation on Windows 11
Introduction to CloudSim Framework
CloudSim is an open-source framework used for the modeling and simulation of Cloud Computing infrastructures and services. It provides a virtualized environment to test resource provisioning, energy consumption, and scheduling algorithms without the high costs of real-world cloud deployment.
Key Use Cases
- Energy Efficiency: Analyzing data center power consumption under varying workloads.
- Resource Scheduling: Evaluating algorithms for mapping Cloudlets (tasks) to Virtual Machines.
- Cost Analysis: Estimating operational expenses on commercial cloud platforms.
- Federated Clouds: Simulating inter-cloud resource sharing and cooperation.
Core Classes of CloudSim
1. Datacenter
The core infrastructure provider that models internal hardware (Hosts) and manages storage and bandwidth.
2. Host
A physical server residing within a Datacenter. It possesses defined RAM, storage, and multiple Processing Elements (PEs).
3. PE (Processing Element)
Represents a single CPU core. Its performance is quantified in MIPS (Millions of Instructions Per Second).
4. VM (Virtual Machine)
A software-based emulation of a computer that runs on a Host and competes for its hardware resources.
5. Cloudlet
Models the application task to be executed. It defines the specific workload (Instruction Length) required for completion.
6. DatacenterBroker
Acts as the mediator between users and providers, handling VM placement and task scheduling logic.
Simulation Flow Example
Consider a scenario where a Cloudlet with an instruction length of 5000 is assigned to a VM with 500 MIPS capacity:
Mapping: Physical vs. Simulation
| Physical Entity | CloudSim Class | Primary Attribute |
|---|---|---|
| Server Room | Datacenter | OS, VMM (Hypervisor) |
| Physical Server | Host | RAM, Bandwidth, PEs |
| CPU Core | PE | MIPS Rating |
| Virtual Server | VM | Image Size, MIPS |
| Application Task | Cloudlet | Instruction Length |
CloudSim Plus Simulation Examples
These examples demonstrate the progression from simple single-task simulations to more complex multi-core, multi-task cloud scenarios using the CloudSim Plus framework.
Scenario 1: Basic Single VM & Single Cloudlet
public class BasicCloudSimExample {
public static void main(String[] args) {
CloudSimPlus simulation = new CloudSimPlus();
List<Pe> peList = new ArrayList<>();
peList.add(new PeSimple(1000));
Host host = new HostSimple(2048, 10000, 100000, peList);
Datacenter datacenter = new DatacenterSimple(simulation, List.of(host));
DatacenterBroker broker = new DatacenterBrokerSimple(simulation);
Vm vm = new VmSimple(1000, 1);
vm.setRam(512).setBw(1000).setSize(10000);
Cloudlet cloudlet = new CloudletSimple(5000, 1);
broker.submitVmList(List.of(vm));
broker.submitCloudletList(List.of(cloudlet));
simulation.start();
new CloudletsTableBuilder(broker.getCloudletFinishedList()).build();
}
}
Scenario 2: Resource Contention (Single Core)
public class BasicCloudSimExample {
public static void main(String[] args) {
CloudSimPlus simulation = new CloudSimPlus();
List<Pe> peList = new ArrayList<>();
peList.add(new PeSimple(1000));
Host host = new HostSimple(2048, 10000, 100000, peList);
Datacenter datacenter = new DatacenterSimple(simulation, List.of(host));
DatacenterBroker broker = new DatacenterBrokerSimple(simulation);
Vm vm = new VmSimple(1000, 1);
Cloudlet cloudlet1 = new CloudletSimple(5000, 1);
Cloudlet cloudlet2 = new CloudletSimple(2000, 1);
broker.submitVmList(List.of(vm));
broker.submitCloudletList(List.of(cloudlet1, cloudlet2));
simulation.start();
new CloudletsTableBuilder(broker.getCloudletFinishedList()).build();
}
}
Scenario 3: Parallel Processing (Multi-Core)
public class BasicCloudSimExample {
public static void main(String[] args) {
CloudSimPlus simulation = new CloudSimPlus();
List<Pe> peList = new ArrayList<>();
peList.add(new PeSimple(1000));
peList.add(new PeSimple(1000)); // Second Core
Host host = new HostSimple(16384, 1000000, 1000000, peList);
Datacenter datacenter = new DatacenterSimple(simulation, List.of(host));
DatacenterBroker broker = new DatacenterBrokerSimple(simulation);
Vm vm = new VmSimple(1000, 2); // 2-Core VM
Cloudlet cloudlet1 = new CloudletSimple(5000, 1);
Cloudlet cloudlet2 = new CloudletSimple(2000, 1);
broker.submitVmList(List.of(vm));
broker.submitCloudletList(List.of(cloudlet1, cloudlet2));
simulation.start();
new CloudletsTableBuilder(broker.getCloudletFinishedList()).build();
}
}