Practical 12: Study of CloudSim Architecture
Aim
Study CloudSim's main layers, packages and classes. Follow how the broker, data centre, host, VM (Virtual Machine) and cloudlet work together during a simulation.
Theory
Architecture means how the parts of a system are arranged and connected. CloudSim separates the model of a cloud from the engine that processes events.
An event is something that happens at a simulation time, such as creating a VM or finishing a task. Follow these events to understand which class does each job.
Layered architecture
flowchart TB
subgraph L1[User code]
A1[Simulation specification:<br/>cloud scenario, user requirements, application configuration]
A2[Scheduling policy:<br/>custom DatacenterBroker]
end
subgraph L2[CloudSim]
B1[User interface structures – Cloudlet, Vm]
B2[VM services – cloudlet execution, VM management]
B3[Cloud services – VM provisioning, CPU, memory, storage, bandwidth allocation]
B4[Cloud resources – events handling, sensor, cloud coordinator, data center]
B5[Network – network topology, message delay calculation]
end
subgraph L3[Core simulation engine]
C1["CloudSim core: SimEntity, SimEvent, FutureQueue, DeferredQueue, CIS<br/>replaces SimJava / GridSim of early versions"]
end
L1 --> L2 --> L3
| Layer | What it contains | Typical classes |
|---|---|---|
| User code | Your simulation programs and policies | CloudSimExample1, custom brokers / allocation policies |
| User interface structures | Objects representing the workload and VMs | Cloudlet, Vm |
| VM services | Running cloudlets inside VMs, managing VM lifecycle | CloudletScheduler* |
| Cloud services | Provisioning VMs and allocating host resources | VmAllocationPolicy*, VmScheduler*, *Provisioner* |
| Cloud resources | Physical infrastructure and events | Datacenter, Host, Pe, DatacenterCharacteristics |
| Network | Topology and latency | NetworkTopology, org.cloudbus.cloudsim.network.* |
| Core simulation engine | Discrete-event machinery | CloudSim, SimEntity, SimEvent, FutureQueue, CloudInformationService, CloudSimTags |
CloudSim 1.0 was built on GridSim, which used the SimJava discrete-event library. From CloudSim 2.0 the SimJava layer was replaced by CloudSim’s own, faster core engine (org.cloudbus.cloudsim.core), and GridSim dependencies were removed – but the layered model remains.
Packages in cloudsim-3.0.3.jar
| Package | Contents |
|---|---|
org.cloudbus.cloudsim |
Main model classes – Datacenter, Host, Pe, Vm, Cloudlet, DatacenterBroker, policies, schedulers, Log |
org.cloudbus.cloudsim.core |
Simulation engine – CloudSim, SimEntity, SimEvent, queues, CIS (Cloud Information Service), CloudSimTags, predicates |
org.cloudbus.cloudsim.provisioners |
PeProvisioner, RamProvisioner, BwProvisioner (Simple implementations) |
org.cloudbus.cloudsim.power |
Power-aware hosts, data centres, VM consolidation and migration policies |
org.cloudbus.cloudsim.power.models |
Power models (linear, square, SPECpower benchmarks) |
org.cloudbus.cloudsim.network |
BRITE topology, delay matrix |
org.cloudbus.cloudsim.network.datacenter |
Network data centres with switches, network cloudlets |
org.cloudbus.cloudsim.distributions |
Random distributions for workloads |
org.cloudbus.cloudsim.util |
Utilities (workload file readers, math helpers) |
Class relationships
classDiagram
class CloudSim { +init() +startSimulation() +stopSimulation() +clock() }
class SimEntity { <<abstract>> +processEvent() +schedule() +send() }
SimEntity <|-- Datacenter
SimEntity <|-- DatacenterBroker
SimEntity <|-- CloudInformationService
Datacenter --> DatacenterCharacteristics
Datacenter --> VmAllocationPolicy
DatacenterCharacteristics --> "*" Host
Host --> "*" Pe
Host --> VmScheduler
Host --> RamProvisioner
Host --> BwProvisioner
Host --> "*" Vm
Vm --> CloudletScheduler
DatacenterBroker --> "*" Vm
DatacenterBroker --> "*" Cloudlet
VmAllocationPolicy <|-- VmAllocationPolicySimple
VmScheduler <|-- VmSchedulerTimeShared
VmScheduler <|-- VmSchedulerSpaceShared
CloudletScheduler <|-- CloudletSchedulerTimeShared
CloudletScheduler <|-- CloudletSchedulerSpaceShared
Event flow during a simulation
sequenceDiagram
participant DC as Datacenter
participant CIS as CloudInformationService
participant BR as DatacenterBroker
DC->>CIS: REGISTER_RESOURCE
BR->>CIS: RESOURCE_CHARACTERISTICS_REQUEST
CIS-->>BR: list of datacenter IDs
BR->>DC: VM_CREATE_ACK (for each VM)
DC-->>BR: VM created / failed
BR->>DC: CLOUDLET_SUBMIT
DC-->>BR: CLOUDLET_RETURN (when finished)
BR->>DC: VM_DESTROY
Note over BR,DC: END_OF_SIMULATION when no events remain
Event types are integer constants in CloudSimTags (for example VM_CREATE_ACK, CLOUDLET_SUBMIT, CLOUDLET_RETURN).
Extension points (how researchers customise CloudSim)
| To change… | Extend / implement |
|---|---|
| Where VMs are placed | VmAllocationPolicy (override allocateHostForVm) |
| How a host shares PEs (Processing Elements) among VMs | VmScheduler |
| How a VM shares capacity among cloudlets | CloudletScheduler |
| Which VM runs which cloudlet / which data centre is used | DatacenterBroker (override submitCloudlets, processResourceCharacteristics) |
| Task resource usage over time | UtilizationModel |
| Energy consumption | PowerModel, power-aware hosts and policies |
Requirements
Use the CloudSim 3.0.3 project prepared in Practical 4, with its CloudSim and Commons Math library files on the classpath. Confirm that the first example runs before continuing.
Procedure (study steps)
- Open the CloudSim project (Practical 4) and expand Referenced Libraries → cloudsim-3.0.3.jar.
- Open
org.cloudbus.cloudsim.core.CloudSim– note the static methodsinit,startSimulation,stopSimulation,clock. - Open
SimEntityand observe abstractstartEntity,processEvent,shutdownEntity. - Open
CloudInformationServiceandCloudSimTags. - Open
Datacenter,Host,Pe,Vm,Cloudlet,DatacenterBrokerinorg.cloudbus.cloudsim. - Open
VmAllocationPolicySimple,VmSchedulerTimeShared,CloudletSchedulerSpaceShared. - Map each class to the layer in the diagram above.
- Run
CloudSimExample1and relate each log line to an entity and event (for example “Broker: Trying to Create VM #0” = broker sends a VM creation event to the datacenter).
Virtual lab · CloudSim · 20 min
Study the CloudSim architecture inside the JAR
Explore cloudsim-3.0.3.jar layer by layer – simulation core, cloud services, VM services and user code – and map each class to the architecture diagram.
Output
Your record should show the class relationships and the events from one sample run. Use the observations below to check your explanation.
Observations
| Log line | Layer / class responsible |
|---|---|
Initialising... |
Core engine – CloudSim.init |
Datacenter_0 is starting... |
Cloud resources – Datacenter (a SimEntity) |
Cloud Resource List received with 1 resource(s) |
Broker querying the CIS |
VM #0 has been created in Datacenter #2, Host #0 |
Cloud services – VmAllocationPolicySimple |
Sending cloudlet 0 to VM #0 |
User interface structures – Cloudlet through broker |
Cloudlet 0 received |
VM services – CloudletScheduler finished it |
Simulation: No more future events |
Core engine – empty FutureQueue |
Conclusion
Locate the main classes in the CloudSim JAR (Java Archive). Match them with the objects in your program and the messages in the output. Explain the path from submitting a task to receiving its result.
Viva questions
- Draw and explain the layered architecture of CloudSim. User code → CloudSim (interface structures, VM services, cloud services, resources, network) → core simulation engine – see the diagram.
- What were SimJava and GridSim and what replaced them? SimJava was a discrete-event library and GridSim a grid simulator used by CloudSim 1.0; CloudSim 2.0+ uses its own core engine (
org.cloudbus.cloudsim.core). - Which class is the base of all simulation entities?
SimEntity. - What is the role of the Cloud Information Service? A registry where data centres register and brokers look them up.
- Name the packages of CloudSim 3.0.3 and their contents. See the packages table – for example
cloudsim(main model),core(engine),provisioners,powerandpower.models,networkandnetwork.datacenter,distributions,util. - Which classes would you extend to implement a new VM placement algorithm?
VmAllocationPolicy(and, for task mapping,DatacenterBroker). - What are CloudSimTags? Constants that name event types, for example VM_CREATE, CLOUDLET_SUBMIT, CLOUDLET_RETURN.
Practise this topic
Hands-on virtual lab
Apply what you just read in a realistic, guided simulation. Free with a verified account.
Create a free account to track your progress and unlock virtual labs.