Virtual machine migration in Cloudsim

Efficient Virtual Machine migration is the primary task that a researcher considers while framing her research problem. And one of the most haunting tasks is to simulate the proposed algorithm using a cloudsim simulation toolkit.

This article will broadly discuss the basics of virtual machine migration, initial virtual machine allocation to hosts, and then how this initial virtual machine allocation is optimized using specific migration strategies. Throughout the article, I have referred to a couple of important methods(functions) that you should check side by side for better understanding. Now if you have not installed/setup the cloudsim on your computer then you should first follow this step by step guide.

Sequence to allocate a Virtual machine to the simulated host in cloudsim

At the start of the cloudsim simulation scenario, first, the configuration details of the Virtual Machine(VM) and cloudlets are defined and submitted to the DatacenterBroker instance. Now, once the Datacentre instance is up and running in the simulation, the DatacenterBroker instance requests the Datacentre instance to create a virtual machine and allocate it to the desired host. For this, the DatacenterBroker initiates the event using 

CloudSimTags.VM_CREATE_ACK

from the method “createVMInDatacentre()” , where DatacentreID passed as a parameter.

aaaaaaaaaaaaa

Now, once the Datacentre is processing, its assigned events and reaches the event call assigned by the DatacentreBroker. Then, it allocates the virtual machines through the “processVMCreate()” method, which intern recognizes the attached Virtual Machine allocation policy and utilizes the “allocateHostForVM()” method and sends an acknowledgment to the DatacentreBroker.

Now, let us consider two different scenarios

  1. If there is a need to map a particular virtual machine to a specific Datacenter, then the method createVMInDatacentre() (defined inside DatacentreBroker) logic is required to be changed as per the need of the scenario. For example, the situation related to the federated Datacentre or failsafe region-based replication. OR
  2. If there is a requirement for managing the adequate host resource utilization corresponding to the virtual machine to host mapping, then “allocateHostForVM()” method from Datacenter class is required to implement the necessary logic. For this already, a scenario is included in “org.cloudbus.cloudsim.power” packages like “PowerVMAllocationPolicyAbstract” and “VMAllocationPolicysimple“.

Sequence to initiate the VM Migration in cloudsim simulation

Datacentres are responsible for the execution of the workloads, and in cloudsim simulation, the cloudlet is considered as workload; therefore, primarily cloudlet processing performed at every cycle of entity(Datacenter, DatacenterBroker, etc.)event processing which in turn update the VM processing metrics through the host. 

The Datacentre instance utilizes the “updateCloudedProcessing()” method for the progress of the simulation run cycle.

Now, because this cloudlet processing cycle is the primary driving force for simulation; therefore, the power-aware package implements the VM utilization checks between these events only.

 There is a method named as “optimizeAllocation()” whose implementation is in PowerVMAllocationPolicyMigrationAbstract.Java. This method accepts the list of active VMs and performs the following steps in sequence:

  1.  Get the list of all the over-utilized hosts as per the threshold (w.r.t.) The VM allocation policy used.
  2. The list of all over-utilized hosts, along with its utilization metrics, are printed on the console.
  3. Identify the list of virtual machines to be migrated from the over-utilized host, but before doing this, the system takes a backup of the current VM to host mappings.
  4. A VM placement/allocation mapping to a new suitable host identified and kept in a temporary migration map. During this phase, the search space for a suitable host excludes already identified, overloaded hosts.
  5. Now the hosts, which are underutilized(utilization below 1%), are also identified to move their virtual machines. It is done to reduce power consumption by idle server machines. Now to reduce the search space overutilized, switched off(previously underutilized) and hosts identified in step 4 are excluded, and the list of VMs from these hosts also marked for migration
  6. And, finally, the final migration map is prepared, and the current allocation is restored to continue the simulation.

Now Once the migration map is final and is available to Datacentre, then the “updateCloudletProcessing()” method call gets to utilize the migration map. And, for each new VM to host mapping from migration map is scheduled as a new event for the current Datacentre instance with event tag as

CloudSimTags.VM_MIGRATE.

This event will also consider an added network delay calculated based on the available network bandwidth, and further cloudlet processing event gets rescheduled. 

This event is then further processed in the next simulation cycle of the cloudsim simulation engine through the “processVMMigrate()” method available in Datacentre.Java class.

In this following steps are followed:

  1.  Location of VM from the current host.
  2. Allocation of VM to the identified suitable host performed, and if acknowledgment is requested, then an acknowledgment is scheduled. Otherwise, confirmation of migration gets printed on the console.

 So, overall in every cycle of the simulation run, the Cloudsim simulator performs intense calculations to determine the right migration map to optimize the overall allocation of virtual machines to hosts. 

Now, to implement your appropriate Virtual Machine allocation and selection policy, you may consider the study of the proper VM allocation and selection policies available in “org.cloudbus.cloudsim.power” package. 

Create a user-defined event and CloudsimTags

Did you ever wonder what drives the Cloudsim core simulation engine? The answer is the CloudsimTags.java class, which exists in org.cloudbus.cloudsim.core package.

CloudsimTags.java is the basic building block class, which contains the constant values defined against the actions that are to be performed during the simulation run.

The actions are defined as Register Resources, Cloudlet Submit, Vm creates, Vm Destroy, Vm Migrate, etc. CloudsimTags class contains a total of 57 variables where 55 are defined with a public modifier, and the other 2 are defined with private modifiers.

These variables defined as static final integers; therefore, these tag variables can be used without any class object initialization, and their values cannot be changed due to its final state.

In case during the simulation flow run, you want to put or call your action, then this is the class from where you should start planning the design of your implementation. The key markers that you should remember while adding a new tag are:

  1. The guideline comments defined by the author suggest that the range of values should be from 0 to 299, and an exclusive no 9600 reserved for describing the baud rate for the communication channel. Therefore the sequence of number series should be maintained. Till now, the sequence up to 49 is in use.
  2. There are two private variables defined named BASE and NETBASE, where the BASE set to 0(zero) and NETBASE set to 100(hundred). Both are used as a seed to determine two different sets of tags; therefore, the new tag values should be chosen carefully as per these categories to avoid any confusion at a later stage.
  3. The value assigned to a new tag should not overlap with the existing variable; otherwise, this will lead to a logical error due to ambiguity.
  4. This class cannot be instantiated i.e. the object cannot be created/initialized as cloudsimtags explicitly throws the exception for the same.

Now, Once the definition of the custom action tag completed, the new action tag can be utilized in any entity as per the requirement.

for example: In datacenter class within processevent() method Cloudlet_submit tag is used to start the call for processCloudletSubmit() method. You may initiate the call for your custom-defined respective method.

Is it still getting challenging to digest this article, then you have missed reading some essential articles related to cloudsim: CloudSim Simulation Toolkit: An Introduction and Beginners Guide to Cloudsim Project Structure.

In case you are looking for a comprehensive cloudsim tutorial, you should subscribe to “Learn Basics of Cloudsim.”

Cloudsim

What is Cloudsim?

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:

  • Test application services in a repeatable and controllable environment.
  • Tune the system bottlenecks before deploying apps in an actual cloud.
  • Experiment with different workload mix and resource performance scenarios on simulated infrastructure for developing and testing adaptive application provisioning techniques

Core features of CloudSim are:

  • The Support of modeling and simulation of large scale computing environment as federated cloud data centers, virtualized server hosts, with customizable policies for provisioning host resources to virtual machines and energy-aware computational resources
  • It is a self-contained platform for modeling cloud’s service brokers, provisioning, and allocation policies.
  • It supports the simulation of network connections among simulated system elements.
  • Support for simulation of federated cloud environment, that inter-networks resources from both private and public domains.
  • Availability of a virtualization engine that aids in the creation and management of multiple independent and co-hosted virtual services on a data center node.
  • Flexibility to switch between space shared and time shared allocation of processing cores to virtualized services.

Is Cloudsim suitable for my research work?

This simulation toolkit is an API that allows a developer to run any server hardware model as a software simulation, to analyze its behavior for real-world workloads. Therefore it is clear that it allows as a researcher to simulate the Infrastructure as a Service(IaaS) layer. This includes software models of data centers, hosts, storage, virtual machines, Cloud datacenter brokers, allocation & scheduling policies for the virtual machines as well as tasks, power management policies including migrations and consolidation of the virtual machines over different hosts, defining the workload attributes for its execution simulation over the cloud systems, etc.

It is not applicable/suitable where you are looking to analyze any service related to Platform as a Service(PaaS) or Software as a Service(SaaS) for example real-time applications, security algorithms, platform implementations, etc

Does it require a High computing system?

No, not at all. The cloudsim is a software simulation toolkit and is developed using Java programming language, Therefore, any computer system with a dual-core processor, 2 GB RAM, and 1 GB storage is good enough to simulate the cloud-based systems using the cloudsim as this is required to support the JRE working. Also, the hardware requirements may differ on the basis of which IDE you are using for JAVA development.

How to download Cloudsim?

Cloudsim project source code, as well as compiled jars files, are published through the GitHub project page: https://github.com/Cloudslab/cloudsim. By default, the project page displays the source code(based on maven build tool) of the current release, which is currently released version 5.0(beta) and the page displays the basic information about the project along with the publication details. Now if you are interested in using the previous versions of this project then you have click on releases link option available on project main page or otherwise, you may access it directly from the following links:

Every version except 5.0(still under development) contains 4 asset files example description for each asset file is as follows:

  • cloudsim-4.0.tar.gz: This file contains the compiled JAR file that can be directly used into the custom simulation implementation where there is no need to change in the source code of cloudsim simulation engine. This version is Linux specific.
  • cloudsim-4.0.zip: This is the same as above the only difference is that it is windows specific.
  • Source code(zip): This file contains the complete source code of the cloudsim simulation framework project. As the cloudsim uses the maven build tool for its DevOps. Therefore to set up this project you require to use an IDE that supports maven project imports. How do you identify that its a maven based project? you will find a “pom.xml” file in the project root folder. This zip is windows operating system specific file.
  • Source code(tar.gz): This file contains a similar structure as mentioned above, but it is specific to Linux

How to install?

Cloudsim setup is very easy, for this you may follow the following link: https://www.cloudsimtutorials.online/cloudsim-setup-using-eclipse/. This link describes in detail all the steps that are required to successfully configure the Cloudsim 3.0.3 version. The cloudsim 3.0.3 version is best to start with that once you understand the basic working and architecture then you can move to any latest version.

How cloudsim work?

As it is already mentioned that the cloudsim allows to model and simulate the cloud system components, therefore to support its function different set of classes has been developed by its developers like:

  • To simulating the regions and datacenters the class named “Datacenter.java” is available in org.cloudbus.cloudsim package.
  • To simulate the workloads for cloud, the class named as “Cloudlet.java” is available in org.cloudbus.cloudsim package.
  • To simulate the load balancing and policy-related implementation the classes named “DatacenterBroker.java”, “CloudletScheduler.java”, “VmAllocationPolicy.java”, etc are available under org.cloudbus.cloudsim package.
  • Now because all the different simulated hardware models are required to communicate with each other to share the simulation work updates for this cloudsim has implemented a discrete event simulation engine that keeps track of all the task assignments among the different simulated cloud components.

To read understand more on the architecture, you should definitely read the article titled “CloudSim Simulation Toolkit: An Introduction” as well as “Beginners Guide to Cloudsim Project Structure

How to run my first cloudsim simulation scenario?

Once you have completed your installation/setup and understand the basic working of the cloudsim, the next step is to implement your own custom scenario. Any simulation will go through the following steps:

  • Initialize the CloudSim with the current clock time and this will also initialize the core CloudInformationService entity.
  • Create Datacenter(s) as Datacenters are the resource providers in CloudSim. We need at list one of them to run a CloudSim simulation.
  • Create Broker to simulate the user workload scheduling as well as virtual machine allocation and placements.
  • Create one/more virtual machine and submit to the broker for further submitting it to the respective DataCenters for its placement and execution management during the simulation run.
  • Create one/more Cloudlet and submit the cloudlet list to the broker for further task scheduling on the active virtual machines for its processing during the simulation run.
  • Starts the simulation, this will initiate all the entities and components created above and put them into execution for supporting various simulation operations.
  • Stop the simulation, concludes simulation and flush all the entities & components before the exit of a simulation run.
  • Print results when the simulation is over, where you will be able to display which cloudlet executed on which virtual machine along with how much time it spent in execution, its start time as well as its finish time.

The step by step detailed description about each step can be read in the article “Guide to CloudsimExample1.java simulation workflow

It is frequently used for?

  • Load Balancing of resources and tasks
  • Task scheduling and its migrations
  • Optimizing the Virtual machine allocation and placement policies
  • Energy-aware Consolidations or Migrations of virtual machines
  • Optimizing schemes for Network latencies for various cloud scenarios
  • and many more.

Other simulators based on cloudsim

The Cloudsim 3.x.x version was a very important release and become the base for many other extensions which in turn supports a very specific type of use cases:

Learning Resources

Sample Source Codes

There are various researchers who have published their cloudsim project code on their GitHub handles, following are the quick links for your reference:

As a beginner, you may refer to these pieces of code to understand, how other fellow researchers have worked upon the cloudsim based simulation to implement their work. And definitely, this will help you to accelerate your by forking these projects and working on your own additions or a complete overhaul of these sets of codes.

References used for this post

Guide to CloudsimExample1.java simulation workflow

Any Example provided in the ‘org.cloudbus.cloudsim.example’ Package under the example folder of the CloudSim project follows some standard steps to implement the specified configuration to start a simulation. To understand the working of the CloudSim simulation framework, knowledge about these steps is a must. This article will help you to get an understanding of CloudsimExample1.java simulation workflow.

Before you start, It is essential that the cloudsim should already installed/setup on your local computer machine. In case you are yet to install it, you may follow the process of Cloudsim setup using Eclipse IDE

The main() method is the pointer from where the execution of this example starts

public static void main(String[] args)

There are eleven steps that are followed in each example with some variation in them, specified as follows:

  • Set the Number of users for the current simulation. This user count is directly proportional to a number of brokers in the current simulation.
int num_user = 1; // number of cloud users
Calendar calendar = Calendar.getInstance();
boolean trace_flag = false; 
  • Initialize the simulation, provided with the current time, number of users and trace flag.
CloudSim.init(num_user, calendar, trace_flag);
  • Create a Datacenter.
Datacenter datacenter0 = createDatacenter("Datacenter_0");

where the createDatacenter() method itself initializes the various datacenter characteristics along with the host list. This is the most important entity without this there is no way the simulation of hosting the virtual machine is applicable.

private static Datacenter createDatacenter(String name) 
{
	List<Host> hostList = new ArrayList<Host>();
	List<Pe> peList = new ArrayList<Pe>();
	int mips = 1000;
	peList.add(new Pe(0, new PeProvisionerSimple(mips))); 
	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)
              		)
		); 
	String arch = "x86"; 
	String os = "Linux"; 
	String vmm = "Xen";
	double time_zone = 10.0; 
	double cost = 3.0; 
	double costPerMem = 0.05; 
	double costPerStorage = 0.001; 	
        double costPerBw = 0.0; 
	LinkedList<Storage> storageList = new LinkedList<Storage>();
	DatacenterCharacteristics characteristics = new 
                    DatacenterCharacteristics(arch, os, vmm, hostList, 
                                              time_zone, cost, costPerMem,
                 				costPerStorage, costPerBw);
	Datacenter datacenter = null;
	try {
		datacenter = new Datacenter(name, characteristics, new 
                                VmAllocationPolicySimple(hostList), 
                                  storageList, 0);
	} catch (Exception e) {
		e.printStackTrace();
         	}
	return datacenter;
}
  • Create a Datacenter broker.
DatacenterBroker broker = createBroker();
int brokerId = broker.getId();

Where the createBroker() method initializes the entity object from DatacenterBroker class

private static DatacenterBroker createBroker() 
{
	DatacenterBroker broker = null;
	try {
		broker = new DatacenterBroker("Broker");
	} catch (Exception e) {
		e.printStackTrace();
		return null;
	}
	return broker;
}
  • Create a Virtual Machine(s).
vmlist = new ArrayList<Vm>();
int vmid = 0;
int mips = 1000;
long size = 10000;
int ram = 512;
long bw = 1000;
int pesNumber = 1;
String vmm = "Xen";

Vm vm = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new 
               CloudletSchedulerTimeShared());

vmlist.add(vm);
  • Submit Virtual Machine to Datacenter broker.
broker.submitVmList(vmlist);
  • Create Cloudlet(s) by specifying their characteristics.
cloudletList = new ArrayList<Cloudlet>();

int id = 0;
long length = 400000;
long fileSize = 300;
long outputSize = 300;
UtilizationModel utilizationModel = new UtilizationModelFull();

Cloudlet cloudlet = new Cloudlet(id, length, pesNumber, fileSize, 
                     outputSize, utilizationModel, utilizationModel, 
                      utilizationModel);

cloudlet.setUserId(brokerId);
cloudlet.setVmId(vmid);

cloudletList.add(cloudlet);	
  • Submit Cloudlets to Datacenter broker.
broker.submitCloudletList(cloudletList);
  • Send call to Start Simulation.
CloudSim.startSimulation();
  • Once no more event to execute, send the call to Stop Simulation.
CloudSim.stopSimulation();
  • Finally, print the final status of the Simulation.
List<Cloudlet> newList = broker.getCloudletReceivedList();
printCloudletList(newList);

Where printCloudletList() method formats the output to correctly display it on the console.

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");

	DecimalFormat dft = new DecimalFormat("###.##");
	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");
			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()));
		}
	}
}

Once you Run the example the output for cloudsimExample1.java will be displayed like:

CloudsimExample1.java console output
CloudsimExample1.java console output

Also, the following video tutorial contains a detailed about cloudsimexample1.java and helps you to understand CloudsimExample1.java simulation workflow

Learn More

You may subscribe to an online self-paced course named Learn Basics of Cloudsim, The content for this course which will be updated weekly till August 2021. Click here to get the applicable discount coupon codes.

Reference link to study material:

  1. http://www.buyya.com/papers/CloudSim2010.pdf.
  2. http://www.cloudbus.org/papers/CloudSim-HPCS2009.pdf.

CloudSim Setup using Eclipse

“How to install Cloudsim?” or “How to setup Cloudsim?” is the first question that comes to your mind when you come to know about it. And, when you look at the various links and forums, Does it looks a bit tricky?

DO NOT WORRY, the Cloudsim simulation toolkit setup or you can say the installation of cloudsim is very easy. This Cloudsim tutorial is going to take through the steps by step journey.

Now before you start to setup CloudSim, following resources must be Installed/downloaded on the local system

Cloudsim simulation toolkit setup is easy. Before you start to setup CloudSim, following resources must be Installed/downloaded on the local system

  • Java Development Kit(JDK): As the Cloudsim simulation toolkit is a class library written in the Java programming language, therefore, the latest version of Java(JDK) should be installed on your machine, which can be downloaded from Oracles Java portal. For assistance in the installation process, detailed documentation is provided by Oracle itself and you may follow the installation instructions
  • Eclipse IDE for Java developers: As per your current installed operating system(Linux/Windows). Before you download to make sure to check if 32-bit or 64-bit version is applicable to your Computer machine. Link for Eclipse Kepler version is available at the following link
  • Download CloudSim source code: To date, various versions of CloudSim are released the latest version is 5.0, which is based on a container-based engine. Whereas to keep the setup simple for beginners we will be setting up the most used version i.e. 3.0.3, which can be directly downloaded by clicking on any of the following: Click for Windows or click for Linux.
  • One external requirement of Cloudsim i.e. common jar package of math-related functions is to be downloaded from the Apache website or you may directly download by clicking here.
  • Unzip Eclipse, Cloudsim and Common Math libraries to some common folder.
Note: Installation steps are almost similar for Windows as well as Linux computer system. 

Let’s Get Started to answer “How to install Cloudsim?”

First of all, navigate to the folder where you have unzipped the eclipse folder and open Eclipse.exe

Now within Eclipse window navigate the menu: File -> New -> Project, to open the new project wizard

A ‘New Project‘ wizard should open. There are a number of options displayed and you have to find & select the ‘Java Project‘ option, once done click ‘Next

Now a detailed new project window will open, here you will provide the project name and the path of CloudSim project source code, which will be done as follows:

  • Project Name: CloudSim.
  • Unselect the ‘Use default location’ option and then click on ‘Browse’ to open the path where you have unzipped the Cloudsim project and finally click Next to set project settings.

Make sure you navigate the path till you can see the bin, docs, examples etc folder in the navigation plane.

Once done finally, click ‘Next’ to go to the next step i.e. setting up of project settings

Now open ‘Libraries’ tab and if you do not find commons-math3-3.x.jar (here ‘x’ means the minor version release of the library which could be 2 or greater) in the list then simply click on Add External Jar’ (commons-math3-3.x.jar will be included in the project from this step)

Once you have clicked on ‘Add External JAR’s‘ Open the path where you have unzipped the commons-math binaries and select ‘Commons-math3-3.x.jar’ and click on open.

Ensure external jar that you opened in the previous step is displayed in the list and then click on ‘Finish’ (your system may take 2-3 minutes to configure the project)

Once the project is configured you can open the ‘Project Explorerand start exploring the Cloudsim project. Also for the first time eclipse automatically start building the workspace for newly configured Cloudsim project, which may take some time depending on the configuration of the computer system.

Following is the final screen which you will see after Cloudsim is configured.

Now just to check you within the ‘Project Explorer‘, you should navigate to the ‘examples‘ folder, then expand the package ‘org.cloudbus.cloudsim.examples‘ and double click to open the ‘CloudsimExample1.java‘.

Now navigate to the Eclipse menu ‘Run -> Run‘ or directly use a keyboard shortcut ‘Ctrl + F11’ to execute the ‘CloudsimExample1.java‘.

if it is successfully executed it should be displaying the following type to output in the console window of the Eclipse IDE.

If Yes then Congratulations!! Now you have successfully setup/Installed the CloudSim Simulation Toolkit on your computer machine and you are ready to start with the experimentation for your further research work. For more insight into the class hierarchy, you may refer to “CloudSim Simulation Toolkit: An Introduction“. Also, You may subscribe to an online self-paced course named Learn Basics of Cloudsim, The content for this course which will be updated weekly till August 2021. Click here to get the applicable discount coupon codes.

Did you encounter an error during the setup of cloudsim?

If you have encountered some error then the eclipse may look like this:

Most of the times, the type of error that you may encounter during setting up of the cloudsim in eclipse should be stating either:
“Syntax error, parameterized types are only available if source level is 1.5 or greater.”

Cloudsim Setup Error Type 1

OR

“Syntax error ‘for each’ statements are only available if source level is 1.5 or greater.”

Cloudsim Setup Error Type 2

These errors occur due to two reasons:
Case 1: The version of Java installed on your computer system is older than 1.5
Case 2: Your default java environment for the eclipse project not set to the latest java version which is available on your computer system.

For Case 1, you have to download and install the latest java version from Oracle/Java website.

For Case 2, you have to do some modifications in the eclipse project, and for this, you should follow these steps:

  1. In the eclipse IDE menu, click on ‘Project’ and from the dropped menu list click on ‘Properties’ to open a project properties window.
  2. On the project properties window, from the list available on left select ‘Java Compiler’, this will display the compiler options.
  3. Now, click on the ‘Enable Project Specific Settings’ checkbox, which further enables the options provided just below the checkbox.
  4. Now, under JDK compliance heading change the ‘Compiler Compliance Level’ to the highest number available on the list.
  5. Also, make sure “Use default compliance settings” should be in the checked state.
  6. Now, click on the “Apply and Close” button. Now a popup alert will be displayed asking for the confirmation to apply the settings. Click ‘Yes’.

Now you will notice that the rebuild process for the project will get started and to confirm the error is resolved or not. You may check the error log window or run any example class available in org.cloudbus.cloudsim.examples namespace.

You may also follow the detailed step by step demo to “Configure CloudSim using Eclipse IDE

Hope this article helped you answer your big question on “How to install Cloudsim using Eclipse?

In case you find this article suitable for your work or you find any difficulty in following the method mentioned above you may feel free to share in the comments section.

CloudSim Simulation Toolkit: An Introduction

Cloud computing is a pay as you use model, which delivers infrastructure (IaaS), platform (PaaS) and software (SaaS) as services to users as per their requirements. Cloud computing exposes data centers capabilities as network virtual services, which may include the set of required hardware, application with support of the database as well as the user interface. This allows the users to deploy and access applications across the internet which is based on demand and QoS requirements.

As Cloud computing is a new concept and is still in a very early stage of its evolution, so researchers and system developers are working on improving the technology to deliver better on processing, quality & cost parameters. But most of the research is focused on improving the performance of provisioning policies and to test such research on real cloud environment like Amazon EC2, Microsoft Azure, Google App Engine for different applications models under variable conditions is extremely challenging as:

  1. Clouds exhibit varying demands, supply patterns, system sizes, and resources (hardware, software, and network).
  2. Users have heterogeneous, dynamic, and competing QoS requirements.
  3. Applications have varying performance, workload, and dynamic application scaling requirements.

Benchmarking the application performance on the real public cloud infrastructure like google cloud, Microsoft Azure, etc., are not suitable due to their multi-tenant nature as well as variable workload fulfillment.

Also, there are very few admin level configurations that a user/researcher could be able to change. Hence, this makes the reproduction of results that can be relied upon, an extremely difficult undertaking.

Further, even if we do, it is a tedious and time-consuming effort to re-configure benchmarking parameters across a massive-scale Cloud computing infrastructure over multiple test runs. Therefore, it is impossible on real-world public Cloud systems to undertake benchmarking experimentations as repeatable, dependable, and scalable environments.

Thus the need to use simulation tool(s) arises, which may become a viable alternative to evaluate/benchmark the test workloads in a controlled and fully configurable environment that can repeatable over multiple iterations and reproduce the results for analysis.

This simulation-based approach can provide various benefits across the researcher’s community as it allows them to:

  1. Test services in a repeatable and controllable environment.
  2. Tuning the system bottlenecks (performance issues) before deploying on real clouds.
  3. Simulating the required infrastructure(small or large scale) to evaluate different sets of workload as well as resource performance, which facilitates for developing, testing and deployment of adaptive application provisioning techniques.

This article provides a beginners guide to cloudsim simulation toolkit and helps then to get an insight into the role of its various components.

Why use Cloudsim?

Several simulators can be used to simulate the working of new services, among them CloudSim Simulation Toolkit is the more generalized and effective simulator for testing Cloud computing-related hypothesis. CloudSim is an extensible simulation framework developed by a team of researchers(under the guidance of Dr. Raj Kumar Buyya) at Cloud Computing and Distributed Systems (CLOUDS) Laboratory, University of Melbourne. This toolkit allows seamless modeling, simulation, and Experimentation related to cloud-based infrastructures and application services and its various released versions are published on Cloudsim’s GitHub project page.

This simulation toolkit allows the researchers as well as cloud developers to test the performance of the potential cloud application for performance testing in a controlled and easy to setup environment. And Also allows finetuning the overall service performance even before it is deployed in the production environment.

Features of CloudSim Simulation Toolkit

  1. Support for modeling and simulation of large-scale Cloud computing environments, including data centers, on a single physical computing node(could be a desktop, laptop, or server machine).
  2. A self-contained platform for modeling Clouds, service brokers, provisioning, and allocation policies.
  3. Facilitates the simulation of network connections across the simulated system elements.
  4. Facility for simulation of federated Cloud environment that inter-networks resources from both private and public domains, a feature critical for research studies related to Cloudbursts and automatic application scaling.
  5. Availability of a virtualization engine that facilitates the creation and management of multiple, independent, and co-hosted virtualized services on a data center node.
  6. Flexibility to switch between space-shared and time-shared allocation of processing cores to virtualized services.

All these features would help in accelerating the development, testing and deployment of potential resource/application provisioning policies/algorithms for Cloud Computing based systems.

CloudSim Architecture

Cloudsim Architecture

The above diagram demonstrates the layered architecture of CloudSim Simulation Toolkit. The CloudSim Core simulation engine provides support for modeling and simulation of virtualized Cloud-based data center environments including queuing and processing of events, creation of cloud system entities (like data center, host, virtual machines, brokers, services, etc.) communication between components and management of the simulation clock.

The CloudSim layer provides dedicated management interfaces for Virtual Machines, memory, storage, and bandwidth. Also, it manages the other fundamental issues, such as provisioning of hosts to Virtual Machines, managing application execution, and monitoring dynamic system state(e.g. Network topology, sensors, storage characteristics, etc), etc.

The User Code layer is a custom layer where the user writes their own code to redefine the characteristics of the stimulating environment as per their new research findings.

Design and Implementation of CloudSim

In this section, we provide finer details related to the fundamental classes of CloudSim Simulation Toolkit(Version 3.0.3), which are also the building blocks of the simulator. The overall class design diagram for CloudSim is as(to better understand read- “Guide to CloudsimExample1.java simulation workflow“):

Detailed Class diagram of cloudsim.

The description of all the major classes mentioned in the class diagram above is described below:

  1. Cloudlet: This class model(define specific attributes such as length of instruction, input/output filesize, no of processor required, etc) the Cloud-based application services (program based tasks) such as content delivery, social networking, etc. CloudSim implements the complexity of an application in terms of its computational requirements. As a developer, we know that every individual executable application/service workload has a pre-defined instruction length and requires certain network data flow (both pre and post fetches) overhead that it needs to undertake during its life cycle. this class allows modeling all the above-said requirements
  2. CloudletScheduler: This is responsible for the implementation of different policies that determine the share of processing power among Cloudlets in a VM. There are two types of provisioning policies offered: space-shared (using CloudetSchedulerSpaceShared class) and time-shared (using CloudletSchedulerTimeShared class).
  3. Datacenter: This class model the core infrastructure-level services (i.e. hardware) that are offered by Cloud providers (Amazon, Azure, and App Engine). It encapsulates a set of hosts(resembling server machine model) instances that can either be homogeneous or heterogeneous concerning their hardware configurations (memory, cores, capacity, and storage). Also, every Datacenter component takes care of generalized application provisioning that enforces a set of policies for the allocation of bandwidth, memory, and storage devices to hosts and its related VMs.
  4. DatacenterBroker or Cloud Broker: This class model a broker, which is responsible for mediating negotiations between SaaS and Cloud providers and such negotiations are driven by QoS requirements. The broker class acts on behalf of applications. Its prime role is to query the CIS to discover suitable resources/services and undertakes negotiations for the allocation of resources/services that can fulfill the application’s QoS needs. This class must be extended for evaluating and testing custom brokering policies.
  5. DatacenterCharacteristics: This class contains configuration information of data center resources like the available host list, the fine-grained cost for each resource type, etc.
  6. Host: This class model a physical resource such as a computer or storage server. It encapsulates important information such as the amount of memory and storage, a list and type of processing cores (if it is a multi-core machine), an allocation of policy for provisioning the compute, memory and bandwidth to the VMs.
  7. NetworkTopology: This class contains the information for inducing network behavior (latencies) in the simulation. It stores the topology information, which is generated using the BRITE topology generator.
  8. RamProvisioner: This is an abstract class that represents the provisioning policy for allocating primary memory (RAM) to Virtual Machines. The execution and deployment of VM on a host are feasible only if the RamProvisioner component approves that the host has the required amount of free memory. The RamProvisionerSimple does not enforce any limitation on the amount of memory that a VM may request. The RAM resource request will be rejected if it is beyond the available capacity.
  9. BwProvisioner: The main role of this component is to undertake the allocation of network bandwidths to a set of competing VMs that are deployed across the data center. Cloud system developers and researchers can extend this class with their policies (priority, QoS) to reflect the needs of their applications.
  10. Vm: This class model a Virtual Machine (VM), which is managed and hosted by a Cloud host component. Every VM component has access to a component that stores the following characteristics related to a VM (i.e.) accessible memory, processor, storage size, and the VM’s internal provisioning policy that is extended from an abstract class called the CloudletScheduler.
  11. VmAllocationPolicy: This is an abstract class that represents a provisioning policy to be utilized by VM Monitor for mapping VMs to hosts. The primary role is to select the best fit host in a data center that meets the memory, storage, and availability requirement for VM deployment mapping.
  12. VmScheduler: This is an abstract class implemented by a Host component that models the allocation policies (space-shared, time-shared) defining the rules for processor cores allocations to VMs. To accommodate application-specific processor sharing policies, the class functionality can be extended to define a new set of provisioning rules.
  13. CloudSim: This is the prime class, with the role of managing entity event queues and controlling the sequential execution of simulation events. Every event that is generated by the CloudSim entity at run-time is stored in the queue called future events. These events are sorted by their time parameters and are enqueued into the future queue. Next, the events that are scheduled at each step of the simulation are removed from the future events queue and transferred to the deferred event queue. Following this, an event processing method is invoked for each entity, which chooses events from the deferred event queue and performs appropriate actions. Such an organization allows flexible management of simulation and provides the following powerful capabilities:
    1. Deactivation (hold/pause) of entities.
    2. Context switching of entities between different states (e.g. waiting to active). Pause and resume the process of simulation.
    3. Creation of new entities at run-time.
    4. Aborting and restarting simulation at run-time.
  14. FutureQueue: This class implements the future event queue accessed by CloudSim and acts as a ready queue to the simulation engine.
  15. DeferredQueue: This class implements the deferred event queue used by CloudSim and hold such events which are failed or paused. It acts as a wait queue of the simulation engine, where preempted resource requests are kept.
  16. CloudInformationService: A CIS is an entity that provides resource registration, indexing, and discovering capabilities. CIS supports two basic primitives:
    1. publish(), on the start of simulation it allows entities to register themselves with CIS
    2. search(), allows Brokers in discovering resources status and endpoint addresses of other entities. This entity also acts as a notification service to the other entities about the end of the simulation.
  17. SimEntity: This is an abstract class, which represents a simulation entity (such as DataCenter, DatacenterBroker, etc) ) that is able to send messages to other entities and processes received messages as well as fire and handle events. SimEntity class provides the ability to schedule new events and send messages to other entities, where network delay is calculated according to the BRITE model. Once created, entities automatically register with CIS. All entities must extend this class and override its three core methods:
    1. startEntity(), which define actions for entity initialization.
    2. processEvent(), which defines actions processing of each called event(s) with respect to the entity.
    3. shutdownEntity(),which define actions for entity destruction.
  18. CloudSimTags. This class contains various static event/command tags that indicate the type of action that needs to be undertaken by CloudSim entities when they receive or send events.
  19. SimEvent: This entity represents a simulation event that is passed between two or more entities. SimEvent stores the following information about an event:
    1. type,
    2. init time,
    3. time at which the event should occur,
    4. finish time,
    5. time at which the event should be delivered to its destination entity,
    6. IDs of the source and destination entities,
    7. the tag of the event, and
    8. Data that have to be passed to the destination entity.
  20. CloudSimShutdown: This is an entity class that waits for the termination of all end-user submitted cloudlets(tasks) and broker entities events, and once detected, then signals the end of simulation to CIS.

Following is a very specific and important call hierarchy of classes which enables the CloudSim Simulation Toolkit to simulate the cloud computing environment, as demonstrated below:

Simulation flow to core cloudsim simulation core package

This hierarchy during the simulation iteratively calls a sequence of events to be performed with respect to the submitted Cloudlets, Datacenterborker policies and other relevant entities. The iteration stops when there are no more events left in FutureQueue/DeferredQueue instances.

Learn More

You may subscribe to an online self-paced course named Learn Basics of Cloudsim, The content for this course which will be updated weekly till August 2021. Click here to get the applicable discount coupon codes.

References used are:

  1. Calheiros, R.N., Ranjan, R., Beloglazov, A., De Rose, C.A. and Buyya, R., 2011. CloudSim: a toolkit for modeling and simulation of cloud computing environments and evaluation of resource provisioning algorithms. Software: Practice and experience41(1), pp.23-50.
  2. CloudSim: A Framework For Modeling And Simulation Of Cloud Computing Infrastructures And Services, Available at http://cloudbus.org/cloudsim/(Accessed: 31 May 2019).