CC Lab Manual
CC Lab Manual
CC Lab Manual
LABORATORY MANUAL
Year/Sem : 4th/7
th
NBA Code : C406
We wish to serve the nation by becoming a reputed deemed university for providing value based
professional education.
To be recognized globally for delivering high quality education in the ever changing field of computer
science & engineering, both of value & relevance to the communities we serve.
1. To provide quality education in both the theoretical and applied foundations of Computer Science
and train students to effectively apply this education to solve real worldproblems.
2. To amplify their potential for lifelong high quality careers and give them a competitive advantage
in the challenging global workenvironment.
PEO 1: Learning: Our graduates to be competent with sound knowledge in field of Computer
Science &Engineering.
PEO 2: Employable: To develop the ability among students to synthesize data and technical
concepts for application to software product design for successful careers that meet the
needs of Indian and multinationalcompanies.
PEO 3: Innovative: To develop research oriented analytical ability among students to prepare them
for making technical contribution to the society.
PEO 4: Entrepreneur / Contribution: To develop excellent leadership quality among students
which they can use at different levels according to their experience and contribute for
progress and development in thesociety.
.
PO2: Problem analysis: Identify, formulate, review research literature, and analyze
complex engineering problems reaching substantiated conclusions using first principles of
mathematics, natural sciences, and engineeringsciences.
PO5: Modern tool usage: Create, select, and apply appropriate techniques,
resources, a n d modern engineering and IT tools including prediction and modelling to complex
engineering activities with an understanding of thelimitations.
PO6: The engineer and society: Apply reasoning informed by the contextual knowledge
to assess societal, health, safety, legal and cultural issues and the consequent
responsibilities relevant to the professional engineeringpractice.
PO7: Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and need
for sustainabledevelopment.
PO8: Ethics: Apply ethical principles and commit to professional ethics and
responsibilities and norms of the engineeringpractice.
PO9: Individual and team work: Function effectively as an individual, and as a member
or leader in diverse teams, and in multidisciplinarysettings.
PO12: Life-long learning: Recognize the need for, and have the preparation and ability to
engage in independent and life-long learning in the broadest context of technological
change.
PSO1: The ability to use standard practices and suitable programming environment to develop
softwaresolutions.
PSO2: The ability to employ latest computer languages and platforms in creating innovative career
opportunities.
CO-PO MAPPING
NBA
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
CODE
C406.1
3 3 3 3 2 2 2 3 3 3 3
C406.2
3 2 3 3 3 2 2 3 3 3 3
C406.3
3 2 3 3 2 1 2 2 3 3 3 3
C406.4
2 2 3 3 3 1 2 2 3 2 3
C406.5
2 2 3 3 3 1 2 2 3 2 3
LIST OF EXPERIMENTS
DO’s
DONT’S
1. Know the location of the fire extinguisher and the first aid box and how to use them in caseof
anemergency.
While preparing the lab records, the student is required to adhere to the following guidelines:
Name
Alok Kumar Singh
“C”-C1
Section- Batch
INDEX
Students are provided with the details of the experiment (Aim, pre-experimental questions, procedure
etc.) to be conducted in next lab and are expected to come prepared for each lab class.
Faculty ensures that students have completed the required pre-experiment questions and they complete
the in-lab programming assignment(s) before the end of class. Given that the lab programs are meant
to be formative in nature, students can ask faculty for help before and during the labclass.
Students’ performance will be assessed in each lab based on the following Lab Assessment
Components:
AC1: Written Work (Max. marks = 5)
AC2: Fundamental Knowledge to conduct Experiment (Max. marks = 5)
AC3: Experiment Completed Successfully (Max. marks = 5)
AC4: Questions Answered (Max. marks = 5)
AC5: Punctuality (Max. marks = 5)
In each lab class, students will be awarded marks out of 5 under each component head, making
it total out of 25marks.
EXPERIMENT – 1
1. To understand the NIST cloud models, types of service and deployment models and
prerequisite to install thesame.
CloudSim is a framework for modelling and simulating cloud computing infrastructure and services.
In this DIY we will see how to install CloudSim in Windows easily and efficiently. A more detailed
description, APIs and research papers related to CloudSim can be found here. Let us begin.
1. First of all we need to download the CloudSim and latest version of the Java Development Toolkit
(JDK). These can be foundhere:
● CloudSim3.0.3
Note: It is advisable that you must download the appropriate version of the JDK for your system i.e.
x86 version for x86 systems and x64 version for x64 systems.
3. Now its time to install the CloudSim. Unpack the downloaded 'CloudSim-3.0.3.tar.gz' or
'CloudSim-3.0.3.zip' (let the name of the unpacked folder be 'cloudsim-3.0.3'). As you can see there is
no executable file inside the folder so there is no special program to install the CloudSim. Later if you
want to remove the CloudSim, then remove the whole 'cloudsim-3.0.3'directory.
Now comes the critical part, the most important part of the CloudSim setup is the setting up the paths
to different classes and jar files correctly or you won't be able to run your programs efficiently.
1. The first path to be set is the 'Path' variable which will contain the location of executable java files
such as 'javac' and 'java' and will be used by the CloudSim while compiling and running a CloudSim
or Javaprogram.
2. The second path to be set is the 'CLASSPATH' variable which will contain the location of the class
files and will be used by the CloudSim while executing an application. So we have to set three
consecutive values first one for location of JDK executables, second one is the location of jar files
provided in the CloudSim and is used exclusively by the CloudSim applications and third one is the
location where we have stored ourprograms.
To set the paths go to the properties of 'My Computer' —>'Advanced system settings' —>'Advanced'
tab —>'Environment Variables...' —>under the 'System variables' —>'New...' —>in the popped up
box set the 'Variable name' and 'Variable Value' as shown and click 'OK'.
Dhyan\Desktop\cloudsim-3.0.3\jars\*; C:\Users\
Dhyan\Desktop\cloudsim-3.0.3\examples;
Note: We have to close all the opened command prompt windows, if any.
Finally now we can test whether our installation is successful or not. CloudSim includes some test
example programs in the 'CloudSim\examples\gridsim\' folder that we can use to test our setup.
1. Compiling a CloudSim program: If you have followed this DIY then compiling a CloudSim
program is pretty straightforward; the basic syntax for compilation is just similar to that of Java
programs i.e.javac filename.java or javacfile_location\filename.java. Let us compile the
Example2.java included in 'CloudSim\examples\gridsim\example02\' folder. We will now run the
following command in a new commandprompt
2. Running the compiled program: The syntax for running a compiled CloudSim program is similar
to that of running a program in Java i.e. java filename. In our case we have to type (see image1)
java org.cloudbus.cloudsim.examples.CloudSimExample1
OR if you want to save the output of your program to a file you can use the following
Note: The examples given in the CloudSim uses the concept of packages hence it is advisable to go
through the basics of packages in Java for a better understanding of the above stated commands.
● It is important to set the CLASSPATH correctly, if you make any mistake you might get a
class not found error and if you want to supply the classpath externally while compiling
/*
* Title: CloudSimToolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling andSimulation
* of Clouds
* Licence: GPL -http://www.gnu.org/copyleft/gpl.html
*
* Copyright (c) 2009, The University of Melbourne,Australia
*/
package org.cloudbus.cloudsim.examples;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedList;
importjava.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;
/**
* A simple example showing how tocreate
* a datacenter with one host and runtwo
DESIGN AND ANALYSIS OF ALGORITHMS LAB (RCS-552) Manual (CS, V SEM) Page 17
Raj Kumar Goel Institute of Technology,
* cloudlets on it. The cloudlets runin
* VMs with the same MIPSrequirements.
* The cloudlets will take the same timeto
* complete theexecution.
*/
public class CloudSimExample2 {
/**
* Creates main() to run thisexample
*/
public static void main(String[] args)
{ Log.printLine("Starting
CloudSimExample2...");
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();
booleantrace_flag = false; // mean traceevents
//VM description
int vmid = 0;
int mips = 250;
long size = 10000; //image size (MB)
int ram = 512; //vm memory (MB)
DESIGN AND ANALYSIS OF ALGORITHMS LAB (RCS-552) Manual (CS, V Page
Raj Kumar Goel Institute of Technology,
long bw = 1000;
int pesNumber = 1; //number of cpus
vmid++;
Vm vm2 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new
CloudletSchedulerTimeShared());
//Cloudlet properties
int id = 0;
pesNumber=1;
long length = 250000;
long fileSize = 300;
long outputSize = 300;
UtilizationModelutilizationModel = new UtilizationModelFull();
id++;
Cloudlet cloudlet2 = new Cloudlet(id, length, pesNumber, fileSize, outputSize,
utilizationModel, utilizationModel, utilizationModel);
cloudlet2.setUserId(brokerId);
CloudSim.stopSimulation();
printCloudletList(newList);
Log.printLine("CloudSimExample2 finished!");
}
catch (Exception e)
{ e.printStackTrace
();
Log.printLine("The simulation has been terminated due to an unexpected error");
}
}
//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;
hostList.add
(
new Host(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
DESIGN AND ANALYSIS OF ALGORITHMS LAB (RCS-552) Manual (CS, V Page
Raj Kumar Goel Institute of Technology,
peList,
return datacenter;
}
//We strongly encourage users to develop their own broker policies, to submit vms and
cloudlets according
//to the specific rules of the simulated scenario
private static DatacenterBrokercreateBroker(){
/**
* Prints the Cloudlet objects
* @param list list ofCloudlets
*/
private static void printCloudletList(List<Cloudlet> list) {
int size = list.size();
Cloudlet cloudlet;
if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS){
Log.print("SUCCESS");
}
}
Experiment 3.
/*
* Title: CloudSimToolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling andSimulation
* of Clouds
* Licence: GPL -http://www.gnu.org/copyleft/gpl.html
*
* Copyright (c) 2009, The University of Melbourne,Australia
*/
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedList;
importjava.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;
import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;
/**
* A simple example showing how tocreate
* two datacenters with one host eachand
* run two cloudlets onthem.
*/
public class CloudSimExample4 {
/**
* Creates main() to run thisexample
*/
public static void main(String[] args)
{ Log.printLine("Starting
CloudSimExample4...");
//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
vmid++;
Vm vm2 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new
CloudletSchedulerTimeShared());
//Cloudlet properties
int id = 0;
long length = 40000;
long fileSize = 300;
long outputSize = 300;
UtilizationModelutilizationModel = new UtilizationModelFull();
id++;
Cloudlet cloudlet2 = new Cloudlet(id, length, pesNumber, fileSize, outputSize,
utilizationModel, utilizationModel, utilizationModel);
cloudlet2.setUserId(brokerId);
CloudSim.stopSimulation();
printCloudletList(newList);
Log.printLine("CloudSimExample4 finished!");
}
catch (Exception e) {
e.printStackTrace();
Log.printLine("The simulation has been terminated due to an unexpected error");
}
}
//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 SpaceShared. It means that only one
VM
//is allowed to run on each Pe. As each Host has only one Pe, only one VM can run on
each Host.
hostList.add(
new Host(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList,
new VmSchedulerSpaceShared(peList)
)
); // This is our first machine
return datacenter;
}
//We strongly encourage users to develop their own broker policies, to submit vms and cloudlets
according
//to the specific rules of the simulated scenario
private static DatacenterBrokercreateBroker(){
/**
* Prints the Cloudletobjects
* @param list list ofCloudlets
*/
private static void printCloudletList(List<Cloudlet> list) {
int size = list.size();
Cloudlet cloudlet;
if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS){
Log.print("SUCCESS");
}
}
Experiment No 4:
Simulate a cloud scenario using CloudSim and run cloudlets with different configuration
/*
* Title: CloudSimToolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling andSimulation
* of Clouds
* Licence: GPL -http://www.gnu.org/copyleft/gpl.html
*
* Copyright (c) 2009, The University of Melbourne,Australia
*/
package org.cloudbus.cloudsim.examples;
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;
DESIGN AND ANALYSIS OF ALGORITHMS LAB (RCS-552) Manual (CS, V Page
Raj Kumar Goel Institute of Technology,
importorg.cloudbus.cloudsim.Storage;
/**
* A simple example showing how tocreate
* two datacenters with one host eachand
* run cloudlets of two users onthem.
*/
public class CloudSimExample5 {
/**
* Creates main() to run thisexample
*/
public static void main(String[] args)
{ Log.printLine("Starting
CloudSimExample5...");
try {
// First step: Initialize the CloudSim package. It should be called
// before creating any entities.
int num_user = 2; // number of cloud users
Calendar calendar = Calendar.getInstance();
booleantrace_flag = false; // mean traceevents
//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
//Cloudlet properties
int id = 0;
long length = 40000;
long fileSize = 300;
long outputSize = 300;
UtilizationModelutilizationModel = new UtilizationModelFull();
//add the cloudlets to the lists: each cloudlet belongs to one user
cloudletList1.add(cloudlet1);
cloudletList2.add(cloudlet2);
CloudSim.stopSimulation();
Log.print("=============>User"+brokerId1+" ");
printCloudletList(newList1);
Log.print("=============>User"+brokerId2+" ");
printCloudletList(newList2);
Log.printLine("CloudSimExample5 finished!");
}
catch (Exception e) {
e.printStackTrace();
Log.printLine("The simulation has been terminated due to an unexpected error");
}
}
int mips=1000;
//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 SpaceShared. It means that only one
VM
//is allowed to run on each Pe. As each Host has only one Pe, only one VM can run on
each Host.
hostList.add(
new Host(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList,
new VmSchedulerSpaceShared(peList)
)
); // This is our first machine
return datacenter;
}
//We strongly encourage users to develop their own broker policies, to submit vms and cloudlets
according
//to the specific rules of the simulated scenario
private static DatacenterBrokercreateBroker(int id){
/**
* Prints the Cloudletobjects
* @param list list ofCloudlets
*/
private static void printCloudletList(List<Cloudlet> list) {
int size = list.size();
Cloudlet cloudlet;
if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS){
Log.print("SUCCESS");
}
}
Experiment No 5:
package
examples.org.
cloubus.
cloudsim.exa
mples;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.CloudletSchedulerSpaceShared;
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;
/**
* An example showing how to create
* scalable simulations.
*/
public class Simulation {
/** The cloudlet list. */
private static List<Cloudlet>cloudletList;
/** The vmlist. */
for(int i=0;i<vms;i++){
vm[i] = new Vm(i, userId, mips, pesNumber, ram,
bw, size, vmm, new CloudletSchedulerSpaceShared());
//for creating a VM with a space shared scheduling
policy for cloudlets:
//vm[i] = Vm(i, userId, mips, pesNumber, ram, bw,
size, vmm, new CloudletSchedulerSpaceShared());
list.add(vm[i]);
}
return list;
}
private static List<Cloudlet>createCloudlet(int userId, int
cloudlets){
// Creates a container to store Cloudlets
LinkedList<Cloudlet> list = new LinkedList<Cloudlet>();
//cloudlet parameters
long length = 1000;
long fileSize = 300;
long outputSize = 300;
int pesNumber = 1;
UtilizationModelutilizationModel = new
UtilizationModelFull();
Cloudlet[] cloudlet = new Cloudlet[cloudlets];
for(int i=0;i<cloudlets;i++){
Random r= new Random();
cloudlet[i] = new Cloudlet(i, length
+r.nextInt(2000), pesNumber, fileSize, outputSize, utilizationModel,
utilizationModel, utilizationModel);
// setting the owner of these Cloudlets
cloudlet[i].setUserId(userId);
list.add(cloudlet[i]);
}
} return list;
DESIGN AND ANALYSIS OF ALGORITHMS LAB (RCS-552) Manual (CS,V SEM) Page35
Raj Kumar Goel Institute of Technology,
////////////////////////// STATIC METHODS ///////////////////////
/**
* Creates main() to run this example
*/
public static void main(String[] args) {
Log.printLine("Starting CloudSimExample6...");
try {
// First step: Initialize the CloudSim package. It
should be called
// before creating any entities.
int num_user = 3; // number of grid users
Calendar calendar = Calendar.getInstance();
booleantrace_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 VMs and Cloudlets and send
them to broker
vmlist = createVM(brokerId,10); //creating 20 vms
cloudletList = createCloudlet(brokerId,40); //
creating 40 cloudlets
broker.submitVmList(vmlist);
broker.submitCloudletList(cloudletList);
// Fifth step: Starts the simulation
CloudSim.startSimulation();
// Final step: Print results when simulation is over
List<Cloudlet>newList =
broker.getCloudletReceivedList();
CloudSim.stopSimulation();
printCloudletList(newList);
//Print the debt of each user to each datacenter
datacenter0.printDebts();
datacenter1.printDebts();
Log.printLine("CloudSimExample6 finished!");
}
catch (Exception e)
{
e.printStackTrace();
Log.printLine("The simulation has been terminated
due to an unexpected error");
DESI
GN AND S LAB (RCS-552) Manual (CS, VSEM) Page36
Raj Kumar Goel Institute of Technology,
}
}
private static Datacenter createDatacenter(String name){
// Here are the steps needed to create a PowerDatacenter:
// 1. We need to create a list to store one or more
// Machines
List<Host>hostList = new ArrayList<Host>();
// 2. A Machine contains one or more PEs or CPUs/Cores.
Therefore, should
// create a list to store these PEs beforecreating
// aMachine.
List<Pe> peList1 = new ArrayList<Pe>();
int mips = 1000;
// 3. Create PEs and add these into the list.
//for a quad-core machine, a list of 4 PEs is required:
peList1.add(new Pe(0, new PeProvisionerSimple(mips))); //
need to store Pe id and MIPS Rating
peList1.add(new Pe(1, new PeProvisionerSimple(mips)));
peList1.add(new Pe(2, new PeProvisionerSimple(mips)));
peList1.add(new Pe(3, new PeProvisionerSimple(mips)));
//Another list, for a dual-core machine
List<Pe> peList2 = new ArrayList<Pe>();
peList2.add(new Pe(0, new PeProvisionerSimple(mips)));
peList2.add(new Pe(1, new PeProvisionerSimple(mips)));
//4. Create Hosts 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;
hostList.add(
new Host(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList1,
new VmSchedulerTimeShared(peList1)
)
); // This is our first machine
hostId++;
hostList.add(
new Host(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList2,
DESIGN AND ANALYSIS OF ALGORITHMS LAB new VmSchedulerTimeShared(peList2)
(RCS-552) Manual (CS, V SEM)
Page 37
Raj Kumar Goel Institute of Technology,
)
); // Second machine
//To create a host with a space-shared allocation policy for
PEs to VMs:
//hostList.add(
// new Host(
// hostId,
// newCpuProvisionerSimple(peList1),
// newRamProvisionerSimple(ram),
// newBwProvisionerSimple(bw),
// storage,
// newVmSchedulerSpaceShared(peList1)
// )
// );
//To create a host with aoportunistic space-shared allocation
policy for PEs to VMs:
//hostList.add(
// new Host(
// hostId,
// newCpuProvisionerSimple(peList1),
// newRamProvisionerSimple(ram),
// newBwProvisionerSimple(bw),
// storage,
// new
VmSchedulerOportunisticSpaceShared(peList1)
// )
// );
// 5. Create a DatacenterCharacteristics object that stores the
// properties of a data center: architecture, OS, listof
// Machines, allocation policy: time- or space-shared,time
zone
// and its price (G$/Pe timeunit).
String arch= "x86"; // systemarchitecture
String os="Linux"; // operatingsystem
String vmm = "Xen";
double time_zone= 10.0; // time zone thisresource
located
double cost =3.0; // the cost of using processingin
this resource
double costPerMem= 0.05; // the cost ofusing
memory in this resource
double costPerStorage= 0.1; // the cost of usingstorage
in this resource
double costPerBw= 0.1; // thecost
of using bw in this resource
LinkedList<Storage>storageList = new
LinkedList<Storage>(); //we are not adding SAN devices by now
DatacenterCharacteristics characteristics = new
DatacenterCharacteristics(
ANALYSIS OF ALGORITHMS LAB (RCS-552) Manual (CS, V SEM)
DESIGN Page
Raj Kumar Goel Institute of Technology,
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
//to the specific rules of the simulated scenario
private static DatacenterBrokercreateBroker(){
}
}
}
}
CloudAnalyst
Cloud Analyst is a tool developed at the University of Melbourne whose goal is to support evaluation of
social networks tools according to geographic distribution of users and data centers. In this tool,
communities of users and data centers supporting the social networks are characterized and, based on their
location; parameters such as user experience while using the social network application and load on the
data center are obtained/logged
1.DownloadCloudAnalyst
http://www.cloudbus.org/cloudsim/CloudAnalyst.zi
2. Extract Files from the Zip file which will give following folderstructure
1. Or click on run.batfile
2. Done!!!
· Advanced
· User Base: models a group of users and generates traffic representing theusers.
o Service BrokerPolicy
1. You can Save this Configuration as well in case you want to use it later. It is storedas
.sim file. XML data is generated and saved as Sim file.
So you need to enter data each time you want to run simulation.
6 User bases and each in different region; 25 VMs are allocated to fulfil requests from all user
bases from both the Data Center
Click on
1. RunSimulation
Close it.
Click on Exit
Experiment no. 7
Case Study on AmazonEC2/Microsoft Azure
Therearemanycloudcomputingprovidersavailableinindustry.Fewcompaniesareleadinginthisislisted below.
Amazon Elastic Compute Cloud(EC2)
Microsoft Azure ServicesPlatform
Google AppEngine
Salesforce.com
AkamaiEdgePlatform
IBM Computing on Demand(CoD)
RackspaceCloud
Terremark
NetSuite
I. UNDERSTANDINGAMAZON ELASTICCOMPUTECLOUD
Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizable compute capacity in
the cloud. It is designed to make web-scale computing easier for developers. Amazon EC2’s simple web
service interface allows you to obtain and configure capacity with minimal friction. It provides you with
complete control of your computing resources and lets you run on Amazon’s proven computing
environment. Amazon EC2 reduces the time required to obtain and boot new server instances to minutes,
allowing you to quickly scale capacity, both up and down, as your computing requirements change. Amazon
EC2 changes the economics of computing by allowing you to pay only for capacity that you actually use.
Amazon EC2 provides developers the tools to build failureresilientapplications and isolate themselves from
commonfailure scenarios.
1) Elastic Compute Units:The Elastic Compute Unit (ECU) was introduced by Amazon EC2 as an
abstraction of computer resources.Amazon’s Definition of ECU notes “We use several benchmarks and
tests to manage the consistency and predictability of the performance of an EC2 Compute Unit.OneEC2
Compute Unit provides the equivalent CPU capacity of a 1.0-1.2 GHz 2007 Opteron or 2007Xeon
processor.
3) EC2 StorageTypes
Elastic Block Storage (EBS): This is persistent, network-based storage called Elastic Block
Store(EBS), which can be attached to running instances or also used as a persistent boot
medium.
Instance Storage: This is local storage, which is non-persistent and data will be lost after an instance
terminates .
4) Elastic IPAddresses
Amazon's Elastic IP Address feature is similar to static IP address in traditional data centers, with one
key difference. A user can programmatically map an Elastic IP Address to any virtual machine instance
without a network administrator's help and without having to wait for DNS topropagate the new binding.
In this sense an Elastic IP Address belongs to the account and not to a virtual machineinstance. It exists
until it is explicitly removed. It remains associated with the account, even while it is associated with no
instance.
5) AmazonCloudWatch
Amazon CloudWatch is a web service that provides monitoring for AWS cloud resources and
applications, starting with Amazon EC2. It provides you with visibility into resource utilization,
operational performance, and overall demand patterns—including metrics such as CPU utilization, disk
reads and writes, and network traffic. You can get statistics, view graphs, and set alarms for your metric
data. To use Amazon CloudWatch, simply select the Amazon EC2 instances that you’d like to monitor.
You can also supply your own business or application metric data. Amazon CloudWatch will begin
aggregating and storing monitoring data that can be accessed using web service APIs or Command Line
Tools.
6) AutomatedScaling
Auto Scaling allows you to automatically scale your Amazon EC2 capacity up or down according to
conditionsyou define. With Auto Scaling, you can ensure that the number of Amazon EC2 instances you’re
using scales up seamlessly during demand spikes to maintain performance, and scales down automatically
during demand lulls tominimize costs.
Auto Scaling is particularly well suited for applications thatexperience hourly, daily, or weekly variability in
usage. Auto Scaling is enabled by Amazon CloudWatch and available at no additional charge beyond
Amazon CloudWatch fees .
II.DUESNIDGNERASNTDAANNDALINYGSISWOIFNDALOGWOSRIATZHUMRSELAWBin(RdCowS-
s55A2z)uMreanisuaMl(iCcrSo,sVofStE'sMap)plicationPpalagtefo5r4mforthe
Raj Kumar Goel Institute of Technology,
WindowsAzureto build a web application that runs and stores itsdata in Microsoft datacenters. You can
use Windows Azureonlyto store data, with the applications that use that datarunning on-premises (that is,
outside the public cloud). Youcanuse Windows Azure to help on-premises applicationsconnect with each
otherortomapbetweendifferentsetsofidentityinformationorinotherways.Becausetheplatformoffersa
widerangeofservices,allofthesethings—andmore—are possible.
To understand what Windows Azure offers, it's useful to group its services into distinct categories and you
need to know what its components do. Figure 4 shows one waytodo this
.
Components of Windows Azure
Cloud Applications
2) DataManagement
EveryWindowsAzureapplicationrunsinoneormoreVMs.EachVMhaslocalstorage,whichan application
isfreetouse.
Windows Azure provides five data management options:
SQL Azure
Tables
DEWSIiGnNdoAwNsDAAzuNrAeLBYloSbISsOStForaAgLeGSOerRvIiTceHMSLAB(RCS-552)Manual(CS,VSEM)Pag
Import / Export
Raj Kumar Goel Institute of Technology,
3) Networking:
Azure runs today in many datacenters spread across the world. When you run an application or store
data, you canselect one or more of these datacenters to use. You can alsoconnect to these datacenters in
various ways using the services below.
Virtual Network
Traffic Manager
Express Route
5) Messaging andIntegration
No matter what it's doing, code frequently needs to interact with other code. In some situations, all that's
needed is basic queued messaging. In other cases, more complex interactions are required. Azure provides a
few different ways to solve these problems. Figure 4 illustrates the choices.
Storage Queue
Service Bus Queue
Service Bus Relay
Service Bus Topics
Biz Talk Hybrid Connection
Biz Talk Service
2) Pricecomparison
Price Comparison
3) Administration andSupport
Java Java
PHP Node
Python PHP
Ruby Python
Ruby
Middleware Tomcat ----
Frameworks Django Drupal
Drupal Symfony
Online/Self- LiveChat
Serve
Resources Phone
4) Specification
Oracle Oracle
Enterpris Enterprise
eLinux Linux
SUSE Ubuntu
Enterpris
eLinux Windows
Server
Ubuntu
Windows
Server
Available
.NET .NET
Runtimes
Specification Comparison
IV. CONCLUSION
ADVANTAGES OFAMAZONEC2
EC2 is cheaper, at least to start. One can get an EC2 Windows 2008 R2 Server instance up and
running for about $40 per month.
EC2 is familiar. The nice thing about EC2 is it’s like having your own Windows Server without
buying the hardware. I can do anything I want to it; I just have to remote desktop intoit.
EC2’s biggest strength: it’s conceptually simple. Anyone who’s ever used any VM software is
going to be able to grasp what it does immediately. There’s no learning curve, just instant
gratification
Azure may be cheaper than EC2 in the long run. Azure is a zero maintenance solution. You just
deploy your application and Microsoft takes care of the software, patches and backups. There’s a
cost to maintenance which has to be taken into account when using EC2 compared to Azure. The
problemisthatcostisabithardtocalculate.
Scalability with Windows Azure is seamless. There’s a good chance this application will grow to
have many users and consume a massive amount of data. If it does, adding additional machines
with Windows Azure is as simple as changing a value in the configurationfile.
It’s completely integrated with Visual Studio. Once set up, deploying changes from Visual Studio to
Windows Azure is just a coupleclicks.
Azure does more for you than EC2 does for the same price – management of the underlying OS and
application server are included in addition to management of thehardware.
Many start-up companies are interested in cloud computing but they are facing a real dilemma as they hear
different (positive and negative) views from different sources. This is understandable as this technology is in
its infant stage. Most of the startup companies, which are in the process of making a decision to adopt some
Cloud Computing technology, e.g. Microsoft Azure or Amazon EC2, find thisto be a difficult decision.
Experiment No. 8
Deploy application on commercial cloud(Google cloud platform)
To upload the guestbook app, run the following command from within the appengine-guestbook-python directory of
your application where the app.yaml and index.yaml files are located:
Optional flags:
Include the --project flag to specify an alternate Cloud Console project ID to what you initialized as the default in
the gcloud tool. Example: --project[YOUR_PROJECT_ID]
Include the -v flag to specify a version ID, otherwise one is generated for you. Example: -v[YOUR_VERSION_ID]
The Datastore indexesmight take some time to generate before your application is available. If the indexes are still in
the process of being generated, you will receive a NeedIndexError message when accessing your app. This is a
transient error, so try a little later if at first you receive this error.
To learn more about deploying your app from the command line, see Deploying a Python App.