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: 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

Beginners Guide to Cloudsim Project Structure

The Cloudsim Simulation Toolkit is an API that is written using the Java programming language and its classes are structured in a very specific way. This article will serve as a guide to the Cloudsim project structure and will help you understand how the Cloudsim architecture is divided into different packages and their important classes that facilitate the cloud simulation using Cloudsim.

Let us first explore and understand the structure of this simulation project. I assume that you have already set up the cloudsim using Ecplise if not you may follow my previous article on “Cloudsim Setup using Eclipse“.

Let proceed further and your eclipse project explorer should contain 6 folders and 7 files.

Eclipse Project Explorer representing Cloudsim project structure
CloudSim Project Structure

The readme.txt file contains the necessary information about this project, like how to install and run the cloudsim, what is the basic directory structure, if you are not using any IDE then how to build the project source code.

Cloudsim Readme.txt file content
Readme.txt file

Now, let us look at the directory structure in detail and understand the various namespaces available in the “Source” folder

Source Folder namespace/packages
Cloudsim Source folder namespace/package view

There exist 12 namespaces; each namespace has a set of classes with specific correlated functions as discussed below:

  • Org.cloudbus.cloudsim: It contains the model classes of various basic hardware components, their groups, and the allocation/utilization methods, etc. Here, the model means that the classes contain the implementation of the various attributes and behaviors of the real-life cloud computing hardware component as a collection of Java methods. Once these classes initiate during the simulation, they are going to simulate the behavior of the real-life cloud-based system component.
List of org.cloudbus.cloudsim classes
  • Org.cloudbus.cloudsim.core: This namespace contains the implementation of the simulation engine where the cloudsim.java class is the main class and is responsible for the start and stop of the simulation process. Similarly, the simentity.java class is for maintaining the state of the simulated cloud components. Simevent.java, futurequeue.java, and defferedqueue.java are responsible for maintaining the inter-entity(cloud component) related event call during the simulation process.
Class list of org.cloudbus.cloudsim.core
  • Org.cloudbus.cloudsim.core.predicates: contains the classes related to the selection of events from the defferedqueue.java to be processed during the simulation event processing.
Class List of Org.cloudbus.cloudsim.core.predicates
  • Org.cloudbus.cloudsim.distribution: It contains the implementation of the various distribution function but is not used anywhere in the cloudsim. These classes might be for future purposes.
Class list of Org.cloudbus.cloudsim.distribution
  • Org.cloudbus.cloudsim.lists: It contains the implementation of lists to be used globally during the simulation process. These are the specialized set of classes, where sorting and comparison operation implemented. There exist the list class for the host, processing element, cloudlet, virtual machine, and resources.
Class list of Org.cloudbus.cloudsim.lists
  • Org.cloudbus.cloudsim.network: it contains the implementation for the network related simulations purpose, and if you are working on a research work based on network optimization techniques then this is the best set of classes to extend for simulation.
Class list of Org.cloudbus.cloudsim.Network
  • Org.cloudbus.cloudsim.network.datacenter: This namespace contains the extended implementation of the basic cloud hardware components which can support the simulation of federated cloud functions distributed across the regions.
Class list of Org.cloudbus.cloudsim.Network.datacenter
  • Org.cloudbus.cloudsim.power: This package contains the extended implementation of cloud components, which can simulate the green or power-aware computing scenarios. This namespace implements the VM migration related classes where extensive algorithm codes for virtual machine selection and allocation related to migrations are available.
Class list of Org.cloudbus.cloudsim.power
  • Org.cloudbus.cloudsim.power.lists: This namespace contains only the implementation of powervmlist.java, which is an extended version of the VmList.java class of org.cloudbus.cloudsim.list namespace.
Class list of Org.cloudbus.cloudsim.power.lists
  • Org.cloudbus.cloudsim.power.models: It contains the set of classes that specifies the power configurations of servers as model classes. These classes imitate the actual working of the various server machine brands available in the market and help in determining the power consumption by such machines during the simulation process.
Class list of Org.cloudbus.cloudsim.power.models
  • Org.cloudbus.cloudsim.provisioners: This namespace contains the behavior implementation regarding how the specified cloud component provisioned to requesting virtual resources.
Class list of Org.cloudbus.cloudsim.provisioners
  • Org.cloudbus.cloudsim.util: this namespace contains the implementation of essential calculation functions and a general utility set.
Class list of Org.cloudbus.cloudsim.utils

Now let’s look at the “examples” folder. It contains 7 namespaces, and each namespace contains a particular type of scenario implementations.

Class list of Org.cloudbus.cloudsim.examples and relevant namespaces

Examples.txt gives you an overview of various basic example scenarios that are available in this folder. The file contains the instructions for the compile and execution of example classes.

Workload.planetlab: It contains a real dataset containing a set of CPU utilization traces from PlanetLab VMs collected during the 10 random days in March & April of 2011. The PlanetLab dataset is used as a benchmark dataset for the validation of various research scenarios.

Now let’s move to the other folders:

  • JRE system library: It is automatically created during the first build process of the CloudSim by the eclipse.
cloudsim project JRE automated compiled dependencies.
  • Reference Libraries: It contains the various dependency jars again automatically added by the eclipse during the first build process.
cloudsim reference libraries
  • Docs: Contains the minimalist documentation of the cloudsim class API and is automatically generated from the inline comments.
cloudsim documentation
  • Jars: This folder is supplied with the source zip file and contains the pre-compiled build of the cloudsim 3.0.3. It can be used for creating custom project scenarios whenever required. We will work on this in further blog posts.
cloudsim bundled jar provided with source code.
  • Build.xml is an ANT based XML file used during the console based builds.
  • Changelog.txt contains the history of the changes done to cloudsim during various version releases.
  • License.xml contans GNU-GPL notification.
  • Pom.xml is a maven configuration file used during the setup of cloudsim using eclipse.
  • Releasenotes.txt contains the note from the cloudsim development team.

You may also follow the detailed step by step demo to “Cloudsim Tutorial: Introduction to Package Intro (Part 2)

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.