2. Cloud Simulation Environment
CloudSim is an extensible simulation toolkit
that enables modeling and simulation of
Cloud computing systems and application
provisioning environments.
Components of Cloud
Data centers,
virtual machines (VMs) and
resource provisioning policies etc.
3. • CloudSim implements core entities that simulate
resource, information service, statistics, and
shutdown services.
• These services are used to simulate a user with
application, a broker for scheduling, etc.
• Interaction between these entities takes place
through events.
• Events are used for service request and service
delivery. Events can be internal (generated by the
entity which receives it) or external (generated by
some other entity).
4. Main three components of
CloudSim model:
• User: The client/customer who wants access
to services of cloud.
• Datacenter: Service/resource provider.
• Broker: Act as a mediator between user and
resource/service provider.
5.
6. Steps of CloudSim Simulation
First step: Initialize the CloudSim package. It
should be called before creating any entities.
Second step: Create Datacenters (Datacenters
are the resource providers in CloudSim. We
need at list one of them to run a CloudSim
simulation)
Third step: Create Broker
7. Fourth step: Create virtual machine
• create VMs
• add the VMs to the vmList
• submit vm list to the broker
Fifth step: Create Cloudlets
• Create cloudlets
• add the cloudlets to the list
• submit cloudlet list to the broker
• bind the cloudlets to the vms. This way, the broker will
submit the bound cloudlets only to the specific VM
8. Sixth step: Starts the simulation
Seventh step: Stop the simulation
Final step: Print results when simulation is over.
9. How to create integer List
List <Integer> intList;
intList = new ArrayList <Integer>();
10. How to create cloudletlist
private static List<Cloudlet> cloudletList;
cloudletList = new ArrayList<Cloudlet>();
How to create vmlist
private static List<Vm> vmlist;
vmlist = new ArrayList<Vm>();
11. initialize cloudsim
int num_user = 1; // number of cloud users
Calendar calendar = Calendar.getInstance();
boolean trace_flag = false; // mean trace events
CloudSim.init(num_user, calendar, trace_flag);
12. How to create vm
//VM description
int vmid = 0; // vertual machine id
int mips = 250; // processing speed
long size = 10000; //image size (MB)
int ram = 512; //vm memory (MB)
long bw = 1000; // bandwidth
int pesNumber = 1; //number of cpus
String vmm = "Xen"; //VMM name
//create VMs
Vm vm1 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw,
size, vmm, new CloudletSchedulerTimeShared());
13. How to create cloudlet
//Cloudlet properties
int id = 0; //cloudlet id
long length = 40000; //cloudlet length
long fileSize = 300; // cloudlet file size
long outputSize = 300;
UtilizationModel utilizationModel = new UtilizationModelFull();
Cloudlet cloudlet1 = new Cloudlet(id, length, pesNumber,
fileSize, outputSize, utilizationModel, utilizationModel,
utilizationModel);
cloudlet1.setUserId(brokerId);
14. How to bind cloudlet to vm
bindCloudletToVm ( int CloudletId , int vmId );
broker.bindCloudletToVm(cloudlet1.getCloudletId(),vm1.getId());