19dce064 CC
19dce064 CC
19dce064 CC
PRACTICAL - 1
AIM: To implement Cloud-based infrastructures and services, it isrequired
to set up the complete system requirements. Researchers &industry-based
developers can focus on specific system designissues that they want to
investigate, without taking more concerned about the low level details so
the Clousim is very much useful forthese activities and it can support
simulation environment toimplement cloud based infrastructure solutions.
Perform Cloud Computing Set up using Cloudsim Tool:
Introduction to CloudSim tool.
Perform Installation steps of CloudSim on NetBeans.
THEORY:
CloudSim is a simulation toolkit that supports the modeling and simulation of the core
functionality of cloud, like job/task queue, processing of events, creation of cloud
entities(datacenter, datacenter brokers, etc), communication between different entities,
implementation of broker policies, etc. This toolkit allows to:
DEPSTAR (CE) 1
Cloud Computing - CE443 19DCE064
If you didn’t have the setup you can download from the following link:
https://netbeans.org/images_www/v6/download/community/8.2
You can download any type of setup as per your requirements from the above mention web
page.
Right-click on the setup or you can Double-Click on the setup by using the mouse.
Click on the next option.
DEPSTAR (CE) 2
Cloud Computing - CE443 19DCE064
select “Java with Ant” folder then select first option Java Application, Press next
Now give a name to the project as you wish.
DEPSTAR (CE) 3
Cloud Computing - CE443 19DCE064
Go to library, right click on it, a menu will come, click on “Add jars/Folders”
Now browse the cloudsim folder which you have extracted from zip file .and go to that folder
and select “cloudsim-3.0.3.jar”.
CONCLUSION:
In this practical, we learnt about Netbeans and Cloudsim. We installed both the tools in our
system.
DEPSTAR (CE) 4
Cloud Computing - CE443 19DCE064
PRACTICAL - 2
AIM: Cloud Computing aims for Internet based application services
todeliver reliable, secure, fault-tolerant, scalable infrastructure. It is
atremendous challenging task to model and schedule the
differentapplications and services on real cloud infrastructure which
requiresto handle different workload and energy performance
parameters.Consider the real world analogy into cloudsim and Perform:
following Programs:
Understanding of basic CloudSim Examples.
(1) Write a program in cloudsim using NetBeans IDE to create a datacenter
with one host and run four cloudlet on it.
(2) Write a program in cloudsim using NetBeans IDE to create a datacenter
with three hosts and run three cloudlets on it.
(3) Write a program in cloudsim using NetBeans IDE to create a five
datacenters with five hosts and run cloudlets of five users on them.
CODE:
1st:
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;
DEPSTAR (CE) 5
Cloud Computing - CE443 19DCE064
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;
DEPSTAR (CE) 6
Cloud Computing - CE443 19DCE064
broker.submitCloudletList(cloudletList);
CloudSim.startSimulation();
CloudSim.stopSimulation();
DEPSTAR (CE) 7
Cloud Computing - CE443 19DCE064
if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS) {
Log.print("SUCCESS");
DEPSTAR (CE) 8
Cloud Computing - CE443 19DCE064
OUTPUT 1:
2nd:
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;
DEPSTAR (CE) 9
Cloud Computing - CE443 19DCE064
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;
/**
* @param args the command line arguments
*/
private static List<Cloudlet> cloudletList;
private static List<Vm> vmlist;
public static void main(String[] args) {
// TODO code application logic here
Log.printLine("Staring CloudSim ...");
try
{
int num_user = 1;
Calendar calendar = Calendar.getInstance();
boolean trace_flag = false;
CloudSim.init(num_user, calendar, trace_flag);
Datacenter datacenter0 = createDatacenter("Datacenter_0");
DatacenterBroker broker = createBroker("broker1");
int brokerId = broker.getId();
vmlist = new ArrayList<Vm>();
int vmid = 0;
int mips = 250;
long size = 10000;
int ram = 512;
//int ram = 1024;
long bw = 1000;
int pesNumber = 1;
String vmm = "Xen";
//Vm vm = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new
CloudletSchedulerTimeShared());
Vm vm0 = new Vm(vmid++, brokerId, mips, pesNumber, ram, bw, size, vmm, new
CloudletSchedulerTimeShared());
Vm vm1 = new Vm(vmid++, brokerId, mips, pesNumber, ram, bw, size, vmm, new
CloudletSchedulerTimeShared());
DEPSTAR (CE) 10
Cloud Computing - CE443 19DCE064
Vm vm2 = new Vm(vmid++, brokerId, mips, pesNumber, ram, bw, size, vmm, new
CloudletSchedulerTimeShared());
//vmlist.add(vm);
vmlist.add(vm0);
vmlist.add(vm1);
vmlist.add(vm2);
broker.submitVmList(vmlist);
cloudletList = new ArrayList<Cloudlet>();
int id = 0;
long length = 400000;
long fileSize = 300;
long outputSize = 300;
UtilizationModel utilizationModel = new UtilizationModelFull();
broker.submitCloudletList(cloudletList);
CloudSim.startSimulation();
CloudSim.stopSimulation();
List<Cloudlet> newList = broker.getCloudletReceivedList();
printCloudletList(newList);
Log.printLine("Cloudsim finished");
}
catch(Exception ex)
{
ex.printStackTrace();
Log.printLine("Unwanted error occured");
}
}
DEPSTAR (CE) 11
Cloud Computing - CE443 19DCE064
int hostId = 0;
int ram = 2048;
long storage = 1000000;
int bw = 10000;
hostList.add(new Host(hostId++, new RamProvisionerSimple(ram), new
BwProvisionerSimple(bw), storage, peList0, new VmSchedulerTimeShared(peList0)));
hostList.add(new Host(hostId++, new RamProvisionerSimple(ram), new
BwProvisionerSimple(bw), storage, peList1, new VmSchedulerTimeShared(peList1)));
hostList.add(new Host(hostId++, new RamProvisionerSimple(ram), new
BwProvisionerSimple(bw), storage, peList2, new VmSchedulerTimeShared(peList2)));
DEPSTAR (CE) 12
Cloud Computing - CE443 19DCE064
if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS) {
Log.print("SUCCESS");
DEPSTAR (CE) 13
Cloud Computing - CE443 19DCE064
OUTPUT 2:
3rd:
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.VmSchedulerSpaceShared;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple;
DEPSTAR (CE) 14
Cloud Computing - CE443 19DCE064
import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;
public class Prac2_C {
/**
* @param args the command line arguments
*/
/** The cloudlet lists. */
private static List<Cloudlet> cloudletList1;
private static List<Cloudlet> cloudletList2;
private static List<Cloudlet> cloudletList3;
private static List<Cloudlet> cloudletList4;
private static List<Cloudlet> cloudletList5;
/** The vmlists. */
private static List<Vm> vmlist1;
private static List<Vm> vmlist2;
private static List<Vm> vmlist3;
private static List<Vm> vmlist4;
private static List<Vm> vmlist5;
public static void main(String[] args) {
// TODO code application logic here
Log.printLine("Starting CloudSim ...");
try {
// First step: Initialize the CloudSim package. It should be called
// before creating any entities.
int num_user = 5; // number of cloud users
Calendar calendar = Calendar.getInstance();
boolean trace_flag = false; // mean trace events
// Initialize the CloudSim library
CloudSim.init(num_user, calendar, trace_flag);
// Second step: Create Datacenters
//Datacenters are the resource providers in CloudSim. We need at list one of them
to run a CloudSim simulation
@SuppressWarnings("unused")
Datacenter datacenter0 = createDatacenter("Datacenter_0");
@SuppressWarnings("unused")
Datacenter datacenter1 = createDatacenter("Datacenter_1");
@SuppressWarnings("unused")
Datacenter datacenter2 = createDatacenter("Datacenter_2");
@SuppressWarnings("unused")
Datacenter datacenter3 = createDatacenter("Datacenter_3");
@SuppressWarnings("unused")
Datacenter datacenter4 = createDatacenter("Datacenter_4");
//Third step: Create Brokers
DatacenterBroker broker1 = createBroker(1);
int brokerId1 = broker1.getId();
DEPSTAR (CE) 15
Cloud Computing - CE443 19DCE064
DEPSTAR (CE) 16
Cloud Computing - CE443 19DCE064
broker2.submitVmList(vmlist2);
broker3.submitVmList(vmlist3);
broker4.submitVmList(vmlist4);
broker5.submitVmList(vmlist5);
//Fifth step: Create two Cloudlets
cloudletList1 = new ArrayList<Cloudlet>();
cloudletList2 = new ArrayList<Cloudlet>();
cloudletList3 = new ArrayList<Cloudlet>();
cloudletList4 = new ArrayList<Cloudlet>();
cloudletList5 = new ArrayList<Cloudlet>();
//Cloudlet properties
int id = 0;
long length = 40000;
long fileSize = 300;
long outputSize = 300;
UtilizationModel utilizationModel = new UtilizationModelFull();
DEPSTAR (CE) 17
Cloud Computing - CE443 19DCE064
DEPSTAR (CE) 18
Cloud Computing - CE443 19DCE064
DEPSTAR (CE) 19
Cloud Computing - CE443 19DCE064
storage,
peList3,
new VmSchedulerSpaceShared(peList3)
)
); // This is our forth machine
hostList.add(
new Host(
hostId++,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList4,
new VmSchedulerSpaceShared(peList4)
)
); // This is our fifth machine
// 5. Create a DatacenterCharacteristics object that stores the
// properties of a data center: architecture, OS, list of
// Machines, allocation policy: time- or space-shared, time zone
// and its price (G$/Pe time unit).
String arch = "x86"; // system architecture
String os = "Linux"; // operating system
String vmm = "Xen";
double time_zone = 10.0; // time zone this resource located
double cost = 3.0; // the cost of using processing in this resource
double costPerMem = 0.05; // the cost of using memory in this
resource
double costPerStorage = 0.001; // the cost of using storage in this
resource
double costPerBw = 0.0; // the cost of using bw in this
resource
LinkedList<Storage> storageList = new LinkedList<Storage>(); //we are
not adding SAN devices by now
DEPSTAR (CE) 20
Cloud Computing - CE443 19DCE064
if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS){
Log.print("SUCCESS");
DEPSTAR (CE) 21
Cloud Computing - CE443 19DCE064
OUTPUT 3:
DEPSTAR (CE) 22
Cloud Computing - CE443 19DCE064
CONCLUSION:
In this practical, we learnt about cloudsim architecture and implemented several different
scenarios using different number of datacenters, hosts and cloudlets.
DEPSTAR (CE) 23
Cloud Computing - CE443 19DCE064
PRACTICAL - 3
AIM:Perform following Programs on network topology using CloudSim:
1. Write a program in cloudsim to create three datacenters with
threehost and a network topology each and run three cloudlets on
them.
2. Write a program in cloudsim to create two datacenters with onehost
each and run cloudlets of two users with network topology on them.
CODE:
1st:
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.NetworkTopology;
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;
/**
* A simple example showing how to create
* a datacenter with one host and a network
* topology and and run one cloudlet on it.
*/
public class NetworkExample1 {
DEPSTAR (CE) 24
Cloud Computing - CE443 19DCE064
/**
* Creates main() to run this example
*/
public static void main(String[] args) {
Log.printLine("Starting NetworkExample1...");
try {
// First step: Initialize the CloudSim package. It should be called
// before creating any entities.
int num_user = 1; // number of cloud users
Calendar calendar = Calendar.getInstance();
boolean trace_flag = false; // mean trace events
// Initialize the CloudSim library
CloudSim.init(num_user, calendar, trace_flag);
// Second step: Create Datacenters
//Datacenters are the resource providers in CloudSim. We need at list
one of them to run a CloudSim simulation
Datacenter datacenter0 = createDatacenter("Datacenter_0");
//Third step: Create Broker
DatacenterBroker broker = createBroker();
int brokerId = broker.getId();
//Fourth step: Create one virtual machine
vmlist = new ArrayList<Vm>();
//VM description
int vmid = 0;
int mips = 250;
long size = 10000; //image size (MB)
int ram = 512; //vm memory (MB)
long bw = 1000;
int pesNumber = 1; //number of cpus
String vmm = "Xen"; //VMM name
//create VM
Vm vm1 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size,
vmm, new CloudletSchedulerTimeShared());
//add the VM to the vmList
vmlist.add(vm1);
//submit vm list to the broker
broker.submitVmList(vmlist);
//Fifth step: Create one Cloudlet
cloudletList = new ArrayList<Cloudlet>();
//Cloudlet properties
int id = 0;
long length = 40000;
long fileSize = 300;
DEPSTAR (CE) 25
Cloud Computing - CE443 19DCE064
DEPSTAR (CE) 26
Cloud Computing - CE443 19DCE064
int hostId=0;
int ram = 2048; //host memory (MB)
long storage = 1000000; //host storage
int bw = 10000;
hostList.add(
new Host(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList,
new VmSchedulerTimeShared(peList)
)
); // This is our machine
// 5. Create a DatacenterCharacteristics object that stores the
// properties of a data center: architecture, OS, list of
// Machines, allocation policy: time- or space-shared, time zone
// and its price (G$/Pe time unit).
String arch = "x86"; // system architecture
String os = "Linux"; // operating system
String vmm = "Xen";
double time_zone = 10.0; // time zone this resource located
double cost = 3.0; // the cost of using processing in this resource
double costPerMem = 0.05; // the cost of using memory in this
resource
double costPerStorage = 0.001; // the cost of using storage in this
resource
double costPerBw = 0.0; // the cost of using bw in this
resource
LinkedList<Storage> storageList = new LinkedList<Storage>(); //we are
not adding SAN devices by now
DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
arch, os, vmm, hostList, time_zone, cost, costPerMem,
costPerStorage, costPerBw);
// 6. Finally, we need to create a PowerDatacenter object.
Datacenter datacenter = null;
try {
datacenter = new Datacenter(name, characteristics, new
VmAllocationPolicySimple(hostList), storageList, 0);
} catch (Exception e) {
e.printStackTrace();
}
return datacenter;
}
//We strongly encourage users to develop their own broker policies, to submit vms
and cloudlets according
DEPSTAR (CE) 27
Cloud Computing - CE443 19DCE064
/**
* Prints the Cloudlet objects
* @param list list of Cloudlets
*/
private static void printCloudletList(List<Cloudlet> list) {
int size = list.size();
Cloudlet cloudlet;
String indent = " ";
Log.printLine();
Log.printLine("========== OUTPUT ==========");
Log.printLine("Cloudlet ID" + indent + "STATUS" + indent +
"Data center ID" + indent + "VM ID" + indent + "Time" +
indent + "Start Time" + indent + "Finish Time");
if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS){
Log.print("SUCCESS");
DEPSTAR (CE) 28
Cloud Computing - CE443 19DCE064
}
OUTPUT 1:
2nd:
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.NetworkTopology;
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;
DEPSTAR (CE) 29
Cloud Computing - CE443 19DCE064
/**
* A simple example showing how to create
* two datacenters with one host and a
* network topology each and run two cloudlets
* on them.
*/
public class NetworkExample2 {
/** The cloudlet list. */
private static List<Cloudlet> cloudletList;
/** The vmlist. */
private static List<Vm> vmlist;
/**
* Creates main() to run this example
*/
public static void main(String[] args) {
Log.printLine("Starting NetworkExample2...");
try {
// First step: Initialize the CloudSim package. It should be called
// before creating any entities.
int num_user = 1; // number of cloud users
Calendar calendar = Calendar.getInstance();
boolean trace_flag = false; // mean trace events
// Initialize the CloudSim library
CloudSim.init(num_user, calendar, trace_flag);
// Second step: Create Datacenters
//Datacenters are the resource providers in CloudSim. We need at list
one of them to run a CloudSim simulation
Datacenter datacenter0 = createDatacenter("Datacenter_0");
Datacenter datacenter1 = createDatacenter("Datacenter_1");
//Third step: Create Broker
DatacenterBroker broker = createBroker();
int brokerId = broker.getId();
//Fourth step: Create one virtual machine
vmlist = new ArrayList<Vm>();
//VM description
int vmid = 0;
int mips = 250;
long size = 10000; //image size (MB)
int ram = 512; //vm memory (MB)
long bw = 1000;
int pesNumber = 1; //number of cpus
String vmm = "Xen"; //VMM name
//create two VMs
Vm vm1 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size,
vmm, new CloudletSchedulerTimeShared());
DEPSTAR (CE) 30
Cloud Computing - CE443 19DCE064
//the second VM will have twice the priority of VM1 and so will
receive twice CPU time
vmid++;
Vm vm2 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size,
vmm, new CloudletSchedulerTimeShared());
//add the VMs to the vmList
vmlist.add(vm1);
vmlist.add(vm2);
//submit vm list to the broker
broker.submitVmList(vmlist);
//Fifth step: Create two Cloudlets
cloudletList = new ArrayList<Cloudlet>();
//Cloudlet properties
int id = 0;
long length = 40000;
long fileSize = 300;
long outputSize = 300;
UtilizationModel utilizationModel = new UtilizationModelFull();
Cloudlet cloudlet1 = new Cloudlet(id, length, pesNumber, fileSize,
outputSize, utilizationModel, utilizationModel, utilizationModel);
cloudlet1.setUserId(brokerId);
id++;
Cloudlet cloudlet2 = new Cloudlet(id, length, pesNumber, fileSize,
outputSize, utilizationModel, utilizationModel, utilizationModel);
cloudlet2.setUserId(brokerId);
//add the cloudlets to the list
cloudletList.add(cloudlet1);
cloudletList.add(cloudlet2);
//submit cloudlet list to the broker
broker.submitCloudletList(cloudletList);
//bind the cloudlets to the vms. This way, the broker
// will submit the bound cloudlets only to the specific VM
broker.bindCloudletToVm(cloudlet1.getCloudletId(),vm1.getId());
broker.bindCloudletToVm(cloudlet2.getCloudletId(),vm2.getId());
//Sixth step: configure network
//load the network topology file
NetworkTopology.buildNetworkTopology("topology.brite");
//maps CloudSim entities to BRITE entities
//Datacenter0 will correspond to BRITE node 0
int briteNode=0;
NetworkTopology.mapNode(datacenter0.getId(),briteNode);
//Datacenter1 will correspond to BRITE node 2
briteNode=2;
NetworkTopology.mapNode(datacenter1.getId(),briteNode);
//Broker will correspond to BRITE node 3
DEPSTAR (CE) 31
Cloud Computing - CE443 19DCE064
briteNode=3;
NetworkTopology.mapNode(broker.getId(),briteNode);
// Sixth step: Starts the simulation
CloudSim.startSimulation();
// Final step: Print results when simulation is over
List<Cloudlet> newList = broker.getCloudletReceivedList();
CloudSim.stopSimulation();
printCloudletList(newList);
Log.printLine("NetworkExample2 finished!");
}
catch (Exception e) {
e.printStackTrace();
Log.printLine("The simulation has been terminated due to an
unexpected error");
}
}
private static Datacenter createDatacenter(String name){
// Here are the steps needed to create a PowerDatacenter:
// 1. We need to create a list to store
// our machine
List<Host> hostList = new ArrayList<Host>();
// 2. A Machine contains one or more PEs or CPUs/Cores.
// In this example, it will have only one core.
List<Pe> peList = new ArrayList<Pe>();
int mips = 1000;
// 3. Create PEs and add these into a list
peList.add(new Pe(0, new PeProvisionerSimple(mips))); // need to store Pe id
and MIPS Rating
//4. Create Host with its id and list of PEs and add them to the list of machines
int hostId=0;
int ram = 2048; //host memory (MB)
long storage = 1000000; //host storage
int bw = 10000;
//in this example, the VMAllocatonPolicy in use is Time Shared with
priorities. It means that VMs
//receive time shares accroding to their priority.
hostList.add(
new Host(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList,
new VmSchedulerTimeShared(peList)
)
); // This is our machine
DEPSTAR (CE) 32
Cloud Computing - CE443 19DCE064
DEPSTAR (CE) 33
Cloud Computing - CE443 19DCE064
Cloudlet cloudlet;
String indent = " ";
Log.printLine();
Log.printLine("========== OUTPUT ==========");
Log.printLine("Cloudlet ID" + indent + "STATUS" + indent +
"Data center ID" + indent + "VM ID" + indent + "Time" +
indent + "Start Time" + indent + "Finish Time");
for (int i = 0; i < size; i++) {
cloudlet = list.get(i);
Log.print(indent + cloudlet.getCloudletId() + indent + indent);
if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS){
Log.print("SUCCESS");
DecimalFormat dft = new DecimalFormat("###.##");
Log.printLine( indent + indent + cloudlet.getResourceId() +
indent + indent + indent + cloudlet.getVmId() + indent + indent +
dft.format(cloudlet.getActualCPUTime()) + indent + indent +
dft.format(cloudlet.getExecStartTime())+indent + indent +
dft.format(cloudlet.getFinishTime())); } } } }
OUTPUT 2:
CONCLUSION:
In this practical, we learnt about network examples of cloudsim and we run the first two
examples and analysed their code.
DEPSTAR (CE) 34
Cloud Computing - CE443 19DCE064
PRACTICAL 4
AIM:Perform following using Cloud Analyst:
1. Install a Cloud Analyst and Integrate with Netbeans. Monitor the
performance of an Existing Algorithms given in Cloud Analyst.
2. Modify or propose a new load balancing algorithm compatible with
Cloud Analyst.
THEORY:
CloudAnalyst:
PRACTICAL:
Download CloudAnalyst from
http://www.cloudbus.org/cloudsim/CloudAnalyst.zip
Extract Files from the Zip file which will give following folder structure.
If you want to Run from Command line then type the following command in cmd.
DEPSTAR (CE) 35
Cloud Computing - CE443 19DCE064
DEPSTAR (CE) 36
Cloud Computing - CE443 19DCE064
Here we are creating 5 copies of one of them so it will give us total of 6 hosts.
DEPSTAR (CE) 37
Cloud Computing - CE443 19DCE064
We can also customize user base that is models a group of users and generates traffic
representing the users.0
DEPSTAR (CE) 38
Cloud Computing - CE443 19DCE064
You can Save this Configuration as well in case you want to use it later. It is stored as .sim
file. XML data is generated and saved as Sim file.
DEPSTAR (CE) 39
Cloud Computing - CE443 19DCE064
Then we can run simulation that would give us overall report of simulation.
DEPSTAR (CE) 40
Cloud Computing - CE443 19DCE064
CONCLUSION:
In this practical, we learnt about cloudAnalyst and simulated a simple case with single
datacenter with 6 hosts and single user base.
DEPSTAR (CE) 41
Cloud Computing - CE443 19DCE064
PRACTICAL - 5
AIM: Develop Cluster application.
Choose any real time Cluster application and make analysis on that.
THEORY:
Cluster Computing:
Everyone might have faced the situation of low-speed services and content criticality. Cluster
computing resolves the need for content criticality and process services in a quicker
approach. As Internet Service Providers look for enhanced availability in a scalable approach,
cluster computing will provide this. And even, this technology is the heavy need for the film
industry as they require this for rendering extended quality of graphics and cartoons.
Implementation of the cluster through the Beowulf method also resolves the requirement of
statistics, fluid dynamics, genetic analysis, astrophysics, economics, neural networks,
engineering, and finance. Many of the organizations and IT giants are implementing this
technology to augment their scalability, processing speed, availability and resource
management at the economic prices.
Cost efficacy – Even mainframe computers seems to be extremely stable, cluster computing
is more in implementation because of their cost-effectiveness and economical. Also, these
systems provide enhanced performance than that of mainframe computer networks.
Processing speed – The cluster computing systems offer the same processing speed as that of
mainframe computers and the speed is also equal to supercomputers.
DEPSTAR (CE) 42
Cloud Computing - CE443 19DCE064
Some of the popular implementations of cluster computing are Google search engine,
Earthquake Simulation, Petroleum Reservoir Simulation, and Weather Forecasting system.
We’re going to focus on Clustering search Engine in this report.
Clustering Search Engines unlike traditional Search Engines provide clusters that are related
to the original search phrase. Clusters help users see search results by topic so they can zero
in on exactly what they are looking for or discover unexpected relationships between items.
So instead of having to look through pages of search results, the clusters help users find
results they might have missed or that were buried deep in the ranked list.
These suggested clusters provide an interesting way of finding relevant topics to extract
keywords from.
Although this method finds relevant topics, it has some fairly serious shortcomings, some of
which are:
Most search engines do not allow the automated querying of their services.
Automated querying where allowed takes too long.
The clusters generated by clustering search engines are often not Closely Related Themes.
For these reasons the use of clustering search engines is not considered a viable method of
keyword discovery.
Several commercial clustering engines have been launched recently; the most popular one
among them is the Vivisimo engine. Vivisimo won the “best meta-search engine award”
assigned by Search Engine http://watch.com/ from 2001 to 2003
Vivisimo is possibly the most popular commercial clustering search engine. Vivisimo calls
search engines such as Yahoo and Google to extract relevant information (titles, URLs, and
short descriptions) from the result retrieved. It groups documents in the retrieved result based
on summarized information. The Vivisimo search clustering engine was sold to Yippy, Inc. in
2010. Grouper uses snippets obtained by the search engines. It is an interface for the results
of the Husky Search meta-search engine. Grouper uses the Suffix Tree Clustering (STC)
algorithm to cluster together documents that have great common subphrases. Carrot2 is a
clustering search engine solution that uses search results from various search engines
including Yahoo, Google, and MSN. It uses five different clustering algorithms (STC,
DEPSTAR (CE) 43
Cloud Computing - CE443 19DCE064
FussyAnts, Lingo, HAOG-STC, and Rough k-means) where Lingo Algorithm is the default
clustering algorithm used. The output is a flat folder structure; overlapping folders are
revealed when the user places the mouse over a document title. The system presented in is a
meta-search clustering engine, called the Search Clustering System (SCS), which organizes
the results returned by conventional Web search engines into a cluster hierarchy. The
hierarchy is produced by the Cluster Hierarchy Construction Algorithm (CHCA). Unlike
most other clustering algorithms, CHCA operates on nominal data: its input is a set of binary
vectors representing Web documents. Document representations are based either on snippets
or on the full contents of the retrieved pages.
All of the above clustering engines except use snippets that probably contain terms that are
part of the query keywords. Snippets are not necessarily good representative of the whole
document contents, which affects the quality of the clusters. Proposed solution uses whole
documents rather than titles and short snippets, to ensure proper extraction of the semantics
of the retrieved documents. While all of the above clustering engines have been mostly
performed without explicit use of lexical semantics, proposed work takes into consideration
both lexical and semantics similarities.
CONCLUSION:
In this practical, we learnt about cluster computing and its advantages. We analysed the
cluster search engine and different examples of it.
DEPSTAR (CE) 44
Cloud Computing - CE443 19DCE064
PRACTICAL - 6
AIM: Develop Grid application
Choose any one real time Grid Application and analyze its applications.
THEORY:
Grid Computing:
Grid Computing can be defined as a network of computers working together to perform a
task that would rather be difficult for a single machine. All machines on that network work
under the same protocol to act like a virtual supercomputer. The task that they work on may
include analysing huge datasets or simulating situations which require high computing power.
Computers on the network contribute resources like processing power and storage capacity to
the network.
Working:
A Grid computing network mainly consists of these three types of machines
Control Node:
A computer, usually a server or a group of servers which administrates the whole network
and keeps the account of the resources in the network pool.
Provider:
The computer which contributes it’s resources in the network resource pool.
User:
The computer that uses the resources on the network.
When a computer makes a request for resources to the control node, control node gives the
user access to the resources available on the network. When it is not in use it should ideally
contribute it’s resources to the network. Hence a normal computer on the node can swing in
between being a user or a provider based on it’s needs. The nodes may consist of machines
with similar platforms using same OS called homogeneous networks, else machines with
different platforms running on various different OS called heterogeneous networks. This is
the distinguishing part of grid computing from other distributed computing architectures.
For controlling the network and it’s resources a software/networking protocol is used
generally known as Middleware. This is responsible for administrating the network and the
DEPSTAR (CE) 45
Cloud Computing - CE443 19DCE064
control nodes are merely it’s executors. As a grid computing system should use only unused
resources of a computer, it is the job of the control node that any provider is not overloaded
with tasks.
Another job of the middleware is to authorize any process that is being executed on the
network. In a grid computing system, a provider gives permission to the user to run anything
on it’s computer, hence it is a huge security threat for the network. Hence a middleware
should ensure that there is no unwanted task being executed on the network.
The meaning of the term Grid Computing has changed over the years, according to “The
Grid: Blueprint for a new computing infrastructure” by Ian Foster and Carl Kesselman
published in 1999, the idea was to consume computing power like electricity is consumed
from a power grid. This idea is similar to current concept of cloud computing, whereas now
grid computing is viewed as a distributed collaborative network.Currently grid computing is
being used in various institutions to solve a lot of mathematical, analytical and physics
problems.
● It is not centralized, as there are no servers required, except the control node which is
just used for controlling and not for processing.
● Multiple heterogeneous machines i.e. machines with different Operating Systems can
use a single grid computing network.
● Tasks can be performed parallelly across various physical locations and the users
don’t have to pay for it(with money).
● Distributed Supercomputing
● High-throughput Supercomputing
● On-demand Supercomputing
● Data-intensive Supercomputing
● Collaborative Supercomputing
● Movie Industry
● Gaming Industry
● Life Sciences
● Engineering and Design
● Government
Distributed Supercomputing:
A distributed supercomputer is a supercomputer with processors spread around the world,
connected via the internet. It’s conceptually the exact same as a classic supercomputer, but
distributed. These processors are located in the desktops and laptops used by average people
every day. In a distributed supercomputer, device owners allow other people to use their
DEPSTAR (CE) 46
Cloud Computing - CE443 19DCE064
processors when they aren’t using them, and the devices are wirelessly connected to the
distributed supercomputer. That’s pretty neat, but there’s a downside. Currently, distributed
supercomputers can only solve certain, very specific, problems.
This is why the future is Hypercomputi2. Write a program in cloudsim to create two
datacenters with onehost each and run cloudlets of two users with network topology on
them.
Hypercomputing is a term we adapted to describe distributed supercomputing that is done
much faster, and in a truly parallel manner. Because it is parallel, Hypernet is not limited in
its computational abilities in the way that other distributed supercomputers are. This means it
can be used for complex parallel processing tasks, like the identification of cancer cells, the
prediction of traffic patterns, or even predicting natural disasters!
the advantage of distributed systems is that relative to supercomputers they are much less
expensive. Many distributed systems make use of cheap, off-the-shelf computers for
processors and memory, which only require minimal cooling costs. In addition, they are
simpler to scale, as adding an additional processor to the system often consists of little more
than connecting it to the network. However, unlike supercomputers, which send data short
distances via sophisticated and highly optimized connections, distributed systems must move
data from processor to processor over slower networks making them unsuitable for many
real-time applications.
Distributed systems are most useful for problems that are not as sensitive to latency. For
example, when NASA’s Jet Propulsion Laboratory (JPL) needed to process high volumes of
image data collected by its Mars rovers, a computer cluster hosted on the Amazon Cloud was
a natural fit. Such tasks are not substantially hindered by small delays in individual
computations, so distributed systems offered the most pragmatic solution. Other distributed
computing applications include large-scale records management and text mining.
CONCLUSION:
In this practical, we learnt about grid computing and listed different applications of it. We
chose distributed supercomputing to analyse in detail.
DEPSTAR (CE) 47