Skip to main content

Cloud Computing Simulator 
CloudSim 
CloudSim is a simulation tool . This tool is easily and free of cost available   for cloud developer to test the performance of their provisioning policies in a repeatable and controllable environment.This tool is design and developed in java language and available in the form of jar files for the simulation of cloud scenarios. CloudSim library is help to tune the bottlenecks before real-world deployment. It provides essential classes for describing data centres, computational resources, virtual machines, applications, users, and policies for the management of various parts of the system such as scheduling and provisioning. Using these components, it is easy to evaluate new strategies governing the use of clouds, while considering policies, scheduling algorithms, load balancing policies, etc. It can also be used to assess the competence of strategies from various perspectives such as cost, application execution time, etc. It also supports the evaluation of Green IT policies. 
What is CloudSim
CloudSim is a framework which contains libraries and does not have to be installed. 
First step for CloudSim Environment 
Unpack the downloaded package on any directory
Add it to the Java classpath 
Need to follow the step for Set the classpath for CloudSim
First Step
Select MyComputer, right click and select the Properties option. The “System Properties” Window appears.



Select “Environment Variables”.

Select New

Set Variable Name as classpath

Copy the CloudSim jar folder path

Set the variable value as
D:\jars\cloudsim-3.0.3.jar; D:\jars\cloudsim-3.0.3-sources.jar ; D:\jars\cloudsim-examples-3.0.3.jar ; D:\jars\cloudsim-examples-3.0.3-sources.jar ;.

click ok


Architecture of CloudSim
The CloudSim layer provides support for modelling and simulation of cloud environments including dedicated management interfaces for memory, storage, bandwidth and VMs. It also provisions hosts to VMs, application execution management and dynamic system state monitoring. A cloud service provider can implement customized strategies at this layer to study the efficiency of different policies in VM provisioning.
The user code layer exposes basic entities such as the number of machines, their specifications, etc, as well as applications, VMs, number of users, application types and scheduling policies.
The main components of the CloudSim framework
Regions: It models geographical regions in which cloud service providers allocate resources to their customers. In cloud analysis, there are six regions that correspond to six continents in the world.
Data centres: It models the infrastructure services provided by various cloud service providers. It encapsulates a set of computing hosts or servers that are either heterogeneous or homogeneous in nature, based on their hardware configurations.
Data centre characteristics: It models information regarding data centre resource configurations.
Hosts: It models physical resources (compute or storage).
The user base: It models a group of users considered as a single unit in the simulation, and its main responsibility is to generate traffic for the simulation.
Cloudlet: It specifies the set of user requests. It contains the application ID, name of the user base that is the originator to which the responses have to be routed back, as well as the size of the request execution commands, and input and output files. It models the cloud-based application services. CloudSim categorises the complexity of an application in terms of its computational requirements. Each application service has a pre-assigned instruction length and data transfer overhead that it needs to carry out during its life cycle.
Service broker: The service broker decides which data centre should be selected to provide the services to the requests from the user base.
VM allocation policy: It models provisioning policies on how to allocate VMs to hosts.
VM scheduler: It models the time or space shared, scheduling a policy to allocate processor cores to VMs.
CloudSim in NetBeans 
CloudSim is written in Java. The knowledge you need to use CloudSim is basic Java programming and some basics about cloud computing. Knowledge of programming IDEs such as Eclipse or NetBeans is also helpful. It is a library and, hence, CloudSim does not have to be installed. Normally, you can unpack the downloaded package in any directory, add it to the Java classpath and it is ready to be used. Please verify whether Java is available on your system.
To use CloudSim in Eclipse:
1.    Download CloudSim installable files from https://code.google.com/p/cloudsim/downloads/list and unzip
2.     Open Eclipse
3.     Create a new Java Project: File -> New
4.     Import an unpacked CloudSim project into the new Java Project
5.     The first step is to initialise the CloudSim package by initialising the CloudSim library, as follows:
CloudSim.init(num_user, calendar, trace_flag)
6.     Data centres are the resource providers in CloudSim; hence, creation of data centres is a second step. To create Datacenter, you need the DatacenterCharacteristics object that stores the properties of a data centre such as architecture, OS, list of machines, allocation policy that covers the time or spaceshared, the time zone and its price:
Datacenter datacenter9883 = new Datacenter(name, characteristics, new VmAllocationPolicySimple(hostList), storageList, 0);
7.     The third step is to create a broker:
DatacenterBroker broker = createBroker();
8.   The fourth step is to create one virtual machine unique ID of the VM, userId ID of the VM’s owner, mips, number Of Pes amount of CPUs, amount of RAM, amount of bandwidth, amount of storage, virtual machine monitor, and cloudletScheduler policy for cloudlets:
Vm vm = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared())
9.    Submit the VM list to the broker:
broker.submitVmList(vmlist)
10.    Create a cloudlet with length, file size, output size, and utilisation model:
Cloudlet cloudlet = new Cloudlet(id, length, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel)
11.     Submit the cloudlet list to the broker:
broker.submitCloudletList(cloudletList)
12. Start the simulation:
CloudSim.startSimulation()
Sample Output from the Existing Example:
Starting CloudSimExample1...
Initialising...
Starting CloudSim version 3.0
Datacenter_0 is starting...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>null
Broker is starting...
Entities started.
0.0: Broker: Cloud Resource List received with 1 resource(s)
0.0: Broker: Trying to Create VM #0 in Datacenter_0
0.1: Broker: VM #0 has been created in Datacenter #2, Host #0
0.1: Broker: Sending cloudlet 0 to VM #0
400.1: Broker: Cloudlet 0 received
400.1: Broker: All Cloudlets executed. Finishing...
400.1: Broker: Destroying VM #0
Broker is shutting down...
Simulation: No more future events
CloudInformationService: Notify all CloudSim entities for shutting down.
Datacenter_0 is shutting down...
Broker is shutting down...
Simulation completed.
Simulation completed.
========== OUTPUT ==========
Cloudlet ID   STATUS   Data center ID   VM ID   Time   Start Time   Finish Time
      0             SUCCESS     2             0       400                        0.1              400.1
*****Datacenter: Datacenter_0*****
User id      Debt
     3           35.6
CloudSimExample1 finished!
References
[1]    https://code.google.com/p/cloudsim/wiki/FAQ  
[2]    CloudSim: A toolkit for modelling and simulation of cloud computing environments and evaluation of resource provisioning algorithms by Rodrigo N Calheiros, Rajiv Ranjan, Anton Beloglazov, CŽesar A F De Rose and Rajkumar Buyya

Comments

Popular posts from this blog

EER Diagram for non Profit Organization

Question:  Draw E-R diagram for Non Profit Organisation. Convert E-R diagram into tables. Step 1: E-R Diagram Step 2: Converting the E-R Diagram into Tables b. Converting entity to table and attribute to columns Orgpital Orgp-id Primary Key HCity HAddress Org-Name Pat-id Foreign key references to Pat-id of Patient table Doc-id Foreign key references to Doc-id of Doctor table Patient Pat-id Primary Key PName PAddress PDiagnosis Record-id Foreign key references to Record-id of Medical Record table Orgp-id Foreign key references to Orgp-id of Non Profit Orgnaisationtable Medical Record Record-id Primary Key Problem Date_of_examination Pat-id Foreig...
CloudSim Simulator Pause and Stop This code is for simulator work for pause and start after simulation The Cloudsim API having number of class and class having method For pausing the simulator CloudSim.pauseSimulation() method for pause the simulation we have to pass the integer number for pausing the cloudsim simulator CloudSim.pauseSimulation(int) The resumeSimulation() method is use for CloudSim simulation start after the pause CloudSim.resumeSimulation(); Runnable monitor=new Runnable(){ Public void run(){ CloudSim.pauseSimulation(200); While(true){ If(CloudSim.isPaused()){ Break; } try{ Thred.sleep(100); }catch(InterruptedException e){ e.printStackTrace(); } Log.printLine(“\n\n”+CloudSim.clock()+”:The Simulation is paused for 5 sec \n\n”); try{ Thread.sleep(5000); }catch(InterruptedException e){ e.printStackTrace(); } //Add the cloudlet to the list and submit the list to the broker. CloudSim.resumeSimulation(); }; new Thread(monitor).start()...