CloudComputing Lab 25feb2025 ENPO
CloudComputing Lab 25feb2025 ENPO
1. Lab Presentation
CloudSim is an open-source framework, which is used to simulate cloud computing infrastructure and
services. It is developed by the CLOUDS Lab organization and is written entirely in Java. It is used for
modeling and simulating a cloud computing environment as a means for evaluating a hypothesis prior to
software development in order to reproduce tests and results.
For example, if you were to deploy an application or a website on the cloud and wanted to test the services
and load that your product can handle and also tune its performance to overcome bottlenecks before risking
deployment, then such evaluations could be performed by simply coding a simulation of that environment
with the help of various flexible and scalable classes provided by the CloudSim package, free of cost. To know
more, refer to the article
– What is CloudSim?
Step-by-Step Implementation
Step 1: Download Eclipse IDE for Java Developers. It is developed by the CLOUDS Lab organization and is
written entirely in Java so we would need a Java IDE to simulate a cloud scenario using CloudSim.
Fig1 : step1.
Step 2: Download the CloudSim 3.0.3 zip file from GitHub and extract the folders within a folder in our
computer storage.
1
Fig2 : Lab’s step2.
Step 3: Download Apache Commons Math 3.6.1 zip file. It is required as it provides a faster, more accurate,
portable alternative to the regular Math and StrictMath classes for large-scale computation in java files.
Fig3 : step3.
2
Step 4: Open Eclipse IDE and create a new Java Project.
Fig4 : step 4.
Step 5: The above-mentioned Java Project should be created with the location of the previously downloaded
and extracted CloudSim 3.0.3 folder.
Fig5 : step5.
3
Fig6 : step 5.2.
Step 6: The JAR file from the extracted Apache Commons Math 3.6.1 folder needs to be added to the JAR
files of CloudSim.
Fig7: step 6.
Jar files of Apache Commons Math extracted to the Jar files of CloudSim
Step 7: Now the CloudSim Environment has been setup in the Eclipse IDE.
4
Fig8 : step7.
Now Creating Datacenters, Virtual Machines, And Cloudlets In The CloudSim Environment And
Checking Its Output
Step 1: We open CloudSimExample2.java from the library on the left and create a data center first.
Step 2: The initial configuration of one of VM(Virtual machine) is done i.e mips(million instructions),
ram(size of RAM), bw(bandwidth), etc. Here we create 4 VMs which are initialized with different
configuration and added to vmlist, which is the array list created to store all the 4VMs.
5
Fig10 : step 7.2.
Configuring Virtual Machine
Step 3: We create 8 cloudlets that are initialized with different properties or characteristics i.e id length,
outputsize, and filesize.
6
Fig12 : step 7.4
VM-Cloudlet Binding
Java
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.CloudletSchedulerTimeShared;
import org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.DatacenterCharacteristics;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Pe;
import org.cloudbus.cloudsim.Storage;
import org.cloudbus.cloudsim.UtilizationModel;
import org.cloudbus.cloudsim.UtilizationModelFull;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.VmAllocationPolicySimple;
import org.cloudbus.cloudsim.VmSchedulerTimeShared;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;
7
// The vmlist
// ….
Step 5: Output after running the program is shown. One can see all the VM and cloudlets are created and
their finish time(performance) is different as their VM and cloudlet configurations were different.
8
Fig15 : GUI second proposition.
Reference
[1] https://www.geeksforgeeks.org/cloud-computing-simulation-using-cloudsim/
[4] Example 2: a datacentre with one host, two virtual machines and two cloudlets
https://www.youtube.com/watch?v=ohNUqIQ2t3M&list=PL9IfziJ50JY5z2ppTLAFJ2yxyVtBbhpgD&index=3
[5] Example 3: a datacentre with two hosts, two virtual machines and two cloudlets
https://www.youtube.com/watch?v=Ci-mKYbpeYQ&list=PL9IfziJ50JY5z2ppTLAFJ2yxyVtBbhpgD&index=4
[6] Example 4: two datacenters with one host each and two cloudlets
https://www.youtube.com/watch?v=c8DsJzxkhos&list=PL9IfziJ50JY5z2ppTLAFJ2yxyVtBbhpgD&index=5
Used links:
9
10