[go: up one dir, main page]

0% found this document useful (0 votes)
12 views10 pages

CloudComputing Lab 25feb2025 ENPO

The document provides a detailed guide on simulating cloud computing using CloudSim, an open-source framework developed in Java. It outlines the steps for setting up the CloudSim environment in Eclipse IDE, including downloading necessary files and creating data centers, virtual machines, and cloudlets. Additionally, it includes code examples and references for further learning about CloudSim functionalities and configurations.

Uploaded by

abdessamed630
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views10 pages

CloudComputing Lab 25feb2025 ENPO

The document provides a detailed guide on simulating cloud computing using CloudSim, an open-source framework developed in Java. It outlines the steps for setting up the CloudSim environment in Eclipse IDE, including downloading necessary files and creating data centers, virtual machines, and cloudlets. Additionally, it includes code examples and references for further learning about CloudSim functionalities and configurations.

Uploaded by

abdessamed630
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

ENPO-MA – DGSI-

Lab : Simulation of Cloud Computing Using CloudSim


Proposed by Dr Mezzoudj F.

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.

Select name of the project as mentioned and extract CloudSim folder

3
Fig6 : step 5.2.

Selecting the CloudSim 3.0.3 folder

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.

CloudSim Environment Has Been Setup

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.

Fig9 : step 7.1.

Creating a datacenter in CloudSimExample2.java

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.

Fig11 : step 7.3.


Creating Cloudlets With Different Characteristics

Step 4: Now the VM-cloudlet binding is done using the broker.

6
Fig12 : step 7.4
VM-Cloudlet Binding

Below is the code for the above implementation of steps:


Note: You have to run this Java program on your Eclipse IDE after extracting CloudSim 3.0.3 and Apache
Commons Math 3.6.1 zip file. Only then will the code run properly.

 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;

// A simple example showing how to create a data center


// with one host and run eight cloudlets on it
public class CloudSimExample1 {
// The cloudlet list
private static List<Cloudlet> cloudletList;
//See on the refernce link

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.

Fig13 : step 7.5


If we change the VM-cloudlet binding, we will get different outputs.
Graphical Interface
You have to link the cloudsim code to a graphical interface to make easy the simulation, there are two
propositions (others can be accepted):

Fig14 : GUI first proposition.

8
Fig15 : GUI second proposition.
Reference
[1] https://www.geeksforgeeks.org/cloud-computing-simulation-using-cloudsim/

[2] Cloudsim setup on Eclipse- Naveen Chandra Gowda


https://youtu.be/u1olWm2agFM?list=PL9IfziJ50JY5z2ppTLAFJ2yxyVtBbhpgD

[3] Example 1: Data ceter with one host, one Cloudlet


https://www.youtube.com/watch?v=YYTrlyUYpRU&list=PL9IfziJ50JY5z2ppTLAFJ2yxyVtBbhpgD&index=2

[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

[7] setup Cloudsim – Khadijah tech


https://www.youtube.com/watch?v=CLAAVb4aQts&list=PLUW2KB2aXoGvNB0R60Hvi0SdsIxaK2Svr

[8] Cloudsim tool


https://www.youtube.com/watch?v=CLAAVb4aQts&list=PLUW2KB2aXoGvNB0R60Hvi0SdsIxaK2Svr&index=1

[9] Installation of Cloudsim


https://www.youtube.com/watch?v=75VYj-q9dD4&list=PLUW2KB2aXoGvNB0R60Hvi0SdsIxaK2Svr&index=2

Used links:

java JDK http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html


Eclipse https://eclipse.org/downloads/packages/
common math jar http://commons.apache.org/proper/commons-math/download_math.cgi
clousdim https://code.google.com/archive/p/cloudsim/downloads

9
10

You might also like