layout: page title: "Say "Hello World!" with CloudSim Express" permalink: /examples/hello-world-simulation
In this example, we are writing a basic simulation scenario to demonstrate simulations with CloudSim Express.
- Install Java.
- CloudSim Express has been tested with JDK 17 on Ubuntu 22.10.
- Install Maven.
- Build the
cloudsim-express
repository by using the following command,mvn clean install
- Copy the CloudSim Express tool from
<project-home>/release-artifacts/cloudsim-express.zip
- Extract the zip file in a preferred location. This location is thereafter known as
cloudsim-express-tool
.
For this example, we are simulating a cloud region with a datacenter and a broker. The broker is offered with a fixed workload, and that workload is executed.
- Backup the default system model script, and create a new one.
- Go to the
cloudsim-express-tool
location. - Go inside the
scenarios
folder.- It has the default system model shipped with the tool.
Rename the existing
system-model.yaml
file intosystem-model-backup.yaml
.
- It has the default system model shipped with the tool.
Rename the existing
- Create an empty
system-model.yaml
. We are going to script our system model in this.- The
system-model.yaml
is a reserved file name. CloudSim Express executes the system model defined in it.
- The
- Go to the
- Let's build the system model from ground-up.
- Create a
processing element
component of aHost
.-
# The component type, and a reference (We will reuse this reference later) ProcessingElement: &ProcessingElement variant: className: "org.cloudbus.cloudsim.Pe" # A processing element is an extension. We use default class. id: -1 # -1 is a reserved value, means auto increment id. processingElementProvisioner: variant: className: "org.cloudbus.cloudsim.provisioners.PeProvisionerSimple" # Again, similar extension. Default class is used. mips: 2660 # mips value of the processing element.
-
- A
Host
have a list ofprocessing elements
.-
# The component type, and a reference (We will reuse this reference later) ProcessingElementList: &ProcessingElementList - <<: *ProcessingElement # Notice how we use the previously declared ProcessingElement reference. variant: # In YAML, attributes can be overridden. We use that to indicate that we need 5 copies of the same processing element. className: "org.cloudbus.cloudsim.Pe" copies: 5
-
- Let's create the
Host
.-
# The component type, and a reference (We will reuse this reference later) Host: &Host variant: className: "org.cloudbus.cloudsim.Host" copies: 1 id: -1 # -1 is a reserved value, means auto increment id. ramProvisioner: className: "org.cloudbus.cloudsim.provisioners.RamProvisionerSimple" extensionProperties: - key: "ram" value: "515639" bwProvisioner: className: "org.cloudbus.cloudsim.provisioners.BwProvisionerSimple" extensionProperties: - key: "bw" value: "100000000" vmScheduler: className: "org.cloudbus.cloudsim.VmSchedulerTimeShared" storage: 1000000 processingElementList: *ProcessingElementList # Notice how we use the previously declared ProcessingElementList reference.
-
- A
Datacenter
have a list ofHosts
.-
HostList: &HostList - <<: *Host variant: className: "org.cloudbus.cloudsim.Host" copies: 10
-
- Let's create
Datacenter Characterictics
of the datacenter.-
Characteristics: &Characteristics arch: "x86" os: "Linux" vmm: "Xen" timeZone: 10.0 cost: 3.0 costPerMemory: 0.05 costPerStorage: 0.01 costPerBandwidth: 0.0 hostList: *HostList
-
- Let's create the
Datacenter
.-
Datacenter: &Datacenter variant: className: "org.cloudbus.cloudsim.Datacenter" characteristics: *Characteristics vmAllocationPolicy: className: "org.cloudbus.cloudsim.VmAllocationPolicySimple" storage: "" schedulingInterval: 0 name: "regional-datacenter"
-
- We are now ready to create the regional zone. We are using the in-built
DummyWorkloadGenerator
extension of CloudSim Express for the workload.-
Zone: &Zone name: "default zone" datacenter: *Datacenter broker: variant: className: "org.cloudbus.cloudsim.DatacenterBroker" name: "RegionalBroker" workloadGenerator: variant: className: "org.crunchycookie.research.distributed.computing.cloudsim.workload.impl.DummyWorkloadGenerator"
-
- Finally, we configure our system model using the reserved
SimulationSystemModel
component.-
SimulationSystemModel: name: 'Zone'
-
- Create a
Since we only used the standard components without any extensions, we can execute the simulation straight away. Notice that we did not even touch Java yet.
- Go to
cloudsim-express-tool
. - Execute the simulation.
-
sh cloudsim-express.sh
-
- Observe the CloudSim Express logs in the terminal.
-
sh cloudsim-express.sh [main] INFO org.cloudbus.cloudsim.express.simulator.impl.DefaultCloudSimExpressSimulator - Initializing the Low-code simulator... [main] INFO org.cloudbus.cloudsim.express.simulator.impl.DefaultCloudSimExpressSimulator - Using Extension Resolver: class org.cloudbus.cloudsim.express.resolver.impl.JARExtensionsResolver [main] INFO org.cloudbus.cloudsim.express.simulator.impl.DefaultCloudSimExpressSimulator - Using Environment Resolver: class org.cloudbus.cloudsim.express.resolver.impl.YAMLEnvironmentResolver [main] INFO org.cloudbus.cloudsim.express.simulator.impl.DefaultCloudSimExpressSimulator - Using Simulation Handler: class org.cloudbus.cloudsim.express.handler.impl.cloudsim.DefaultZoneHandler [main] INFO org.cloudbus.cloudsim.express.simulator.impl.DefaultCloudSimExpressSimulator - Using Scenario Manager: class org.cloudbus.cloudsim.express.manager.impl.DefaultScenarioManager Initialising... [main] INFO org.cloudbus.cloudsim.express.simulator.impl.DefaultCloudSimExpressSimulator - Using Simulation Manager: class org.cloudbus.cloudsim.express.manager.impl.CloudSimSimulationManager [main] INFO org.cloudbus.cloudsim.express.manager.impl.CloudSimSimulationManager - Building the scenario [main] INFO org.cloudbus.cloudsim.express.manager.impl.DefaultScenarioManager - Building the scenario using class org.cloudbus.cloudsim.express.handler.impl.cloudsim.DefaultZoneHandler [main] INFO org.cloudbus.cloudsim.express.manager.impl.CloudSimSimulationManager - Starting CloudSim simulation [main] INFO org.cloudbus.cloudsim.express.manager.impl.DefaultScenarioManager - Waiting for scenario to be completed... [main] INFO org.cloudbus.cloudsim.express.manager.impl.CloudSimSimulationManager - CloudSim Simulation is completed [main] INFO org.cloudbus.cloudsim.express.simulator.impl.DefaultCloudSimExpressSimulator - Low-code simulation is completed in 0 seconds
-
- The corresponding CloudSim logs are available in the
logs
folder.-
... RegionalBroker is starting... Starting CloudSim version 3.0 regional-datacenter is starting... Entities started. 0.0: RegionalBroker: Cloud Resource List received with 1 resource(s) 0.0: RegionalBroker: Trying to Create VM #0 in regional-datacenter 0.0: RegionalBroker: Trying to Create VM #1 in regional-datacenter ...
-
The related materials are included in the resources folder.