CloudSim Plus

CloudSim Plus: A modern, full-featured, highly extensible and easier-to-use Java 8 Framework for Modeling and Simulation of Cloud Computing Infrastructures and Services

View project on GitHub

Build Status Dependency Status Codacy Badge Codacy Badge Maven Central Documentation Status GitHub Closed Issues Gitter GPL licensed

Overview | Exclusive Features | Structure | How to use | Examples | Docs and Help | Why should I care? | Why an independent fork? | Differences from CloudSim | General Features | Publications | License | Contributing

Overview

CloudSim Plus is a full-featured, highly extensible simulation framework that enables modeling, simulation, and experimentation of emerging Cloud computing infrastructures and application services. It allows users to focus on specific system design issues to be investigated, without the concern of the low level details related to Cloud-based infrastructures and services.

Cloud computing is the leading technology for delivery of reliable, secure, fault-tolerant, sustainable, and scalable computational services. For assurance of such characteristics in cloud systems under development, it is required timely, repeatable, and controllable methodologies for evaluation of new cloud applications and policies, before actual development of cloud products. Because utilization of real testbeds limits the experiments to the scale of the testbed and makes the reproduction of results cumbersome, computer-base simulation may constitute an interesting tool. This project is suitable to quickly develop such simulation scenarios and run them quickly, in a typical PC.

CloudSim Plus is a fork of CloudSim 3, re-engineered primarily to avoid code duplication. It provides code reusability and ensures compliance with software engineering principles and recommendations for extensibility improvements. It focuses on usage of software engineering standards and recommendations such as Design Patterns, SOLID principles and other ones such as KISS and DRY.

The efforts dedicated to this project have been recognized by the EU/Brasil Cloud FORUM. A post about CloudSim Plus is available at this page of the Forum, including a White Paper available in the Publications Section.

CloudSim Plus is developed through a partnership among the Systems, Security and Image Communication Lab of Instituto de Telecomunicações (IT, Portugal), the Universidade da Beira Interior (UBI, Portugal) and the Instituto Federal de Educação Ciência e Tecnologia do Tocantins (IFTO, Brazil). It is supported by the Portuguese Fundação para a Ciência e a Tecnologia (FCT) and by the Brazilian foundation Coordenação de Aperfeiçoamento de Pessoal de Nível Superior (CAPES).

There are different ways you can contribute to CloudSim Plus, as it is shown in the contribution guide. One easy way is to click on the “Star” button at the top of the project’s GitHub page, so that you are helping to promote the project.

The original CloudSim project is developed in the Cloud Computing and Distributed Systems (CLOUDS) Laboratory, at the Computer Science and Software Engineering Department of the University of Melbourne.

:arrow_up:

Exclusive Features

CloudSim Plus provides a lot of exclusive features, ranging from the most basic ones that enable building simple simulations, to advanced features for simulating more realistic cloud scenarios:

  1. It is easier to use. A complete and easy-to-understand simulation scenario can be built in few lines of code. Check the Examples Section;
  2. Vertical VM Scaling that performs on-demand up and down allocation of VM resources such as Ram, Bandwidth and PEs (CPUs) (#7);
  3. Horizontal VM scaling, allowing dynamic creation of VMs according to an overload condition. Such a condition is defined by a predicate that checks different VM resources usage such as CPU, RAM or BW (#41);
  4. Parallel execution of simulations, allowing several simulations to be run simultaneously, in a isolated way, inside a multi-core computer (#38);
  5. Delay creation of submitted VMs and Cloudlets, enabling simulation of dynamic arrival of tasks (#11, #23);
  6. Allow dynamic creation of VMs and Cloudlets without requiring creation of Datacenter Brokers at runtime, enabling VMs to be created on-demand according to arrived cloudlets (#43);
  7. Listeners to enable simulation monitoring and creation of VMs and Cloudlets at runtime;
  8. Builders to enable creating multiple simulation objects with same configuration;
  9. It is a strongly object-oriented framework that creates relationships among classes and allows chained calls such as cloudlet.getVm().getHost().getDatacenter(). And guess what? You don’t even have to worry about NullPointerException when making such a chained call because CloudSim Plus uses the Null Object Design Pattern to avoid that (#10);
  10. Classes and interfaces to allow implementation of heuristics such as Tabu Search, Simulated Annealing, Ant Colony Systems and so on. See an example using Simulated Annealing here;
  11. Implementation of the Completely Fair Scheduler used in recent versions of the Linux Kernel. See an example here (#58);
  12. Completely re-designed and reusable Network module. Totally refactored network examples to make them clear and easy to change (#13, #49, #57);
  13. Enables the use of any regular CloudletScheduler with a NetworkVm, such as the CloudletSchedulerTimeShared, CloudletSchedulerSpaceShared or the new CloudletSchedulerCompletelyFair. The new PacketScheduler is used internally with all CloudletSchedulers to dispatch network packets when you are building a network simulation;
  14. Simpler constructors to instantiate simulation objects, making it less confusing to use the framework. It applies the Convention over Configuration principle (CoC) to ask just mandatory parameters when instantiating objects (#30);
  15. TableBuilder objects that are used in all examples and enable printing simulation results in different formats such as ASCII Table, CSV or HTML. It shows simulation results in perfectly aligned tables, including data units and additional data. Check the last line of the BasicFirstExample constructor to see how it is easy to print results;
  16. Throughout documentation update, improvement and extension;
  17. Improved class hierarchy, modules and package structure that is easier to understand and follows the Separation of Concerns principle (SoC);
  18. As it is usual to extend framework classes to provide some specific behaviors for your simulations, you will find a totally refactored code that follows clean code programming, SOLID, Design Patterns and several other software engineering principles and practices. This way, it will be easier to understand the code and implement the feature you want;
  19. Integration Tests to increase framework accuracy by testing entire simulation scenarios;
  20. Updated to Java 8 to provide some Functional Programming features (such as the next one), using Lambda Expressions and Streams API to improve efficiency and make the code cleaner and easier to maintain;
  21. A Functional DatacenterBrokerSimple class that enables changing, at runtime, policies for different goals. This dynamic behavior allows implementing specific policies, without requiring the creation of new DatacenterBroker classes. Consider P the number of policies and I the number of implementations for each policy. For P = 3 and I = 2, if you want to try all possible combinations of policies and implementations, without CloudSim Plus, it would be required to create 12 DatacenterBroker classes (P * I^(P-1)), instead of just using the existing one. Some of these behaviors which can be changed are:
    • selection of a Datacenter to place waiting VMs and a fallback Datacenter when a previous selected one fails in finding a suitable Host for a VM (#28);
    • selection of a VM to run each Cloudlet (#25);
    • definition of the time when an idle VM should be destroyed (#99);
    • sorting of requests to create submitted VMs and Cloudlets, defining priorities to create such objects (#102).
  22. Host Fault Injection Mechanism to enable injection of random failures into Hosts PEs: it injects failures into Host PEs and reallocates working PEs to running VMs. When all PEs from a Host fail, it starts clones of failed VMs to recovery from failure. This way, it is simulated the instantiation of VM snapshots into different Hosts (#81).

Project’s Structure

CloudSim Plus has a simpler structure to make it ease to use and understand. It consists of 4 modules, 2 of which are new, as presented below.

CloudSim Plus Modules

  • cloudsim-plus: the CloudSim Plus cloud simulation framework API, which is used by all other modules. It is the main and only required module you need to write cloud simulations.
  • cloudsim-plus-examples: includes a series of different examples, since minimal simulation scenarios using basic CloudSim Plus features, to complex scenarios using workloads from trace files or Vm migration examples. This is an excellent starting point for learning how to build cloud simulations using CloudSim Plus.
  • cloudsim-plus-testbeds: enables implementation of simulation testbeds in a repeatable manner, allowing a researcher to execute several simulation runs for a given experiment and collect statistical data using a scientific approach.
  • cloudsim-plus-benchmarks: a new module used just internally to implement micro benchmarks to assess framework performance.

It also has a better package organization, improving Separation of Concerns (SoC) and making it easy to know where a desired class is and what is inside each package. The figure below presents the new package organization. The dark yellow packages are new in CloudSim Plus and include its exclusive interfaces and classes. The light yellow ones were introduced just to better organize existing CloudSim classes and interfaces.

CloudSim Plus Packages

:arrow_up:

How to Use CloudSim Plus

There are 3 ways to use CloudSim Plus. It can be downloaded and executed: (i) directly from some IDE; (ii) from the command line; or (iii) from Maven Central once you include it as a dependency inside your own project.

You can watch the video below (high quality version here) or follow the instructions in one of the next subsections.

Downloading CloudSim Plus and running Examples using NetBeans

Via Command Line

Considering that you have git and maven installed on your operating system, download the project source by cloning the repository issuing the command git clone https://github.com/manoelcampos/cloudsim-plus.git at a terminal.

The project has a bash script you can use to build and run CloudSim Plus examples. This is a script for Unix-like systems such as Linux, FreeBDS and Mac OSX.

To run some example type the command: sh script/bootstrap.sh package.ExampleClassName. For instance, to run the CloudSimExample0 you can type: sh script/bootstrap.sh org.cloudbus.cloudsim.examples.CloudSimExample0.

The script checks if it is required to build the project, using maven in this case, making sure to download all dependencies. To see which examples are available, just navigate through the examples directory. To check more script options, run it without any parameter.

By Means of an IDE

The easiest way to use the project is relying on some IDE such as NetBeans, Eclipse or IntelliJ IDEA. Below are the steps to start using the project:

  • Download the project sources by using: the download button on top of this page; your own IDE for it; or the command line as described above.
  • Open/import the project in your IDE:
    • For NetBeans, just use the “Open project” menu and select the directory where the project was downloaded/cloned.
    • For Eclipse or IntelliJ IDEA, you have to import the project selecting the folder where the project was cloned.
  • Inside the opened/imported project you will have the cloudsim-plus and cloudsim-plus-examples modules. The cloudsim-plus module is where the simulator source code is, that usually you don’t have to change, unless you want to contribute to the project. The cloudsim-plus-examples is where you can start.
  • Open the cloudsim-plus-examples module. The most basic examples are in the root of the org.cloudbus.cloudsim.examples package. You can run any one of the classes in this package to get a specific example.
  • If you want to build your own simulations, the easiest way is to create another class inside this module.

Adding it as a Maven Dependency into Your Own Project

You can add CloudSim Plus API module, that is the only one required to build simulations, as a dependency inside the pom.xml file or your own maven project, as presened below (check if the informed version is the latest one). This way you can start building your simulations from scratch.

<dependency>
    <groupId>org.cloudsimplus</groupId>
    <artifactId>cloudsim-plus</artifactId>
    <version>1.2.4</version>
</dependency>

:arrow_up:

A Minimal and Complete Simulation Example

In order to build a simulation scenario you have to create, at least:

  • a datacenter with a list of physical machines (Hosts);
  • a broker that allows submission of VMs and Cloudlets to be executed, on behalf of a given customer, into the cloud infrastructure;
  • a list of customer’s virtual machines (VMs);
  • and a list of customer’s cloudlets (objects that model resource requirements of different applications).

Due to the simplicity provided by CloudSim Plus, all the code to create a minimal simulation scenario can be as simple as presented below. A more adequate and reusable example is available here, together with other examples. Specific examples of CloudSim Plus, showing several new exclusive features and advanced scenarios, can be found here.

//Creates a CloudSim object to initialize the simulation.
CloudSim cloudsim = new CloudSim();

/*Creates a Broker that will act on behalf of a cloud user (customer).*/
DatacenterBroker broker0 = new DatacenterBrokerSimple(cloudsim);

//Creates a list of Hosts, each host with a specific list of CPU cores (PEs).
List<Host> hostList = new ArrayList<>(1);
List<Pe> hostPes = new ArrayList<>(1);
hostPes.add(new PeSimple(20000, new PeProvisionerSimple()));
long ram = 10000; //in Megabytes
long storage = 100000; //in Megabytes
long bw = 100000; //in Megabits/s
Host host0 = new HostSimple(ram, bw, storage, hostPes);
host0.setRamProvisioner(new ResourceProvisionerSimple())
      .setBwProvisioner(new ResourceProvisionerSimple())
      .setVmScheduler(new VmSchedulerSpaceShared());
hostList.add(host0);

//Creates a Datacenter with a list of Hosts.
DatacenterCharacteristics characts = new DatacenterCharacteristicsSimple(hostList);
VmAllocationPolicy vmAllocationPolicy = new VmAllocationPolicySimple();
Datacenter dc0 = new DatacenterSimple(cloudsim, characts, vmAllocationPolicy);

//Creates VMs to run applications.
List<Vm> vmList = new ArrayList<>(1);
Vm vm0 = new VmSimple(0, 1000, 1);
vm0.setRam(1000).setBw(1000).setSize(1000)
   .setCloudletScheduler(new CloudletSchedulerSpaceShared());
vmList.add(vm0);

//Creates Cloudlets that represent applications to be run inside a VM.
List<Cloudlet> cloudletList = new ArrayList<>(1);
Cloudlet cloudlet0 = new CloudletSimple(0, 10000, 1);
cloudlet0.setUtilizationModel(new UtilizationModelFull());
cloudletList.add(cloudlet0);
Cloudlet cloudlet1 = new CloudletSimple(1, 10000, 1);
cloudlet1.setUtilizationModel(new UtilizationModelFull());
cloudletList.add(cloudlet1);

broker0.submitVmList(vmList);
broker0.submitCloudletList(cloudletList);

/*Starts the simulation and waits all cloudlets to be executed, automatically
stopping when there is no more events to process.*/
cloudsim.start();

/*Prints results when the simulation is over
(you can use your own code here to print what you want from this cloudlet list).*/
new CloudletsTableBuilder(broker0.getCloudletsFinishedList()).build();

The presented results are structured and clear to allow better understanding. For example, the image below shows the output for a simulation with two cloudlets (applications). Simulation Results

:arrow_up:

Documentation and Help

The project documentation originated from CloudSim was entirely updated and extended. You can see the javadoc documentation for classes and their elements directly on your IDE.

The documentation is available online at ReadTheDocs, which includes a FAQ and guides. CloudSim Plus has extended documentation of classes and interfaces and also includes extremely helpful package documentation that can be viewed directly on your IDE or at the link provided above. Such a package documentation gives a general overview of the classes used to build a cloud simulation.

A Google Group forum is also available at https://groups.google.com/group/cloudsim-plus. See the publications section to access published CloudSim Plus papers.

:arrow_up:

Why should I care about this CloudSim fork? I just want to build my simulations. :neutral_face:

Well, the design of the tool has a direct impact when you need to extend it to include some feature required for your simulations. The simulator has a set of classes that implement interfaces such as VmScheduler, CloudletScheduler, VmAllocationPolicy, ResourceProvisioner, UtilizationModel, PowerModel and DatacenterBroker and provide basic algorithms for different goals. For instance, the VmAllocationPolicySimple class implements a Worst Fit policy that selects the PM which less processor cores in use to host a VM and, in fact, it is the only policy available.

Usually you have to write your own implementations of these classes, such as a Best Fit VmAllocationPolicy, a resource UtilizationModel with an upper threshold or a DatacenterBroker that selects the best Datacenter to submit a VM.

Several software engineering principles aim to ease the task of creating new classes to implement those features. They also try to avoid forcing you to change core classes of the simulator in order to introduce a feature you need to implement. Changing these core classes just to implement a particular feature which will be used only in your simulations is a bad practice, since you will not be able to automatically update your project to new versions of the simulator, without losing your changes or struggling to fix merge conflicts.

As we have seen in forums that we’ve attended, many times users have to perform these changes in core classes just to implement some specific features they need. We think those problems are enough reasons that show the need of a new re-engineered version of the simulator.

:arrow_up:

But why an independent CloudSim fork? :unamused:

The original CloudSim moved on to a new major release, introducing a completely new set of classes to provide Container as a Service (CaaS) simulations, before the changes proposed here being merged to the official repository. This way, all the work performed here was not incorporated to allow this new CaaS module to be developed using this redesigned version. Unfortunately, there are several months of hard work that would need to be replicated to merge both projects. In reason of that, CloudSim Plus was born as an independent fork, following its own way and philosophies.

:arrow_up:

What are the practical differences of using CloudSim Plus instead of CloudSim? How can I update my simulations to use CloudSim Plus?

It’s much easier to use CloudSim Plus. A complete, side-by-side comparison between CloudSim and CloudSim Plus Java simulation scenarios is available here.

To update your simulations to use the CloudSim Plus you have to change the way that some objects are instantiated, because some new interfaces were introduced to follow the “program to an interface, not an implementation” recommendation and also to increase abstraction. These new interfaces were also crucial to implement the Null Object Pattern to try avoiding NullPointerExceptions.

The initialization of the simulation is not performed by the static CloudSim.startSimulation method anymore, which required a lot of parameters. Now you have just to instantiate a CloudSim object using the default, no-arguments constructor, as shown below. This instance is used in the constructor of DatacenterBroker and Datacenter objects:

CloudSim cloudsim = new CloudSim();

The classes Datacenter, DatacenterCharacteristics, Host, Pe, Vm and Cloudlet were renamed due to the introduction of interfaces with these same names. Now all these classes have a suffix Simple (as already defined for some previous classes such as PeProvisionerSimple and VmAllocationPolicySimple). For instance, to instantiate a Cloudlet you have to execute a code such as:

CloudletSimple cloudlet = new CloudletSimple(required, parameters, here);

However, since these interfaces were introduced in order to also enable the creation of different cloudlet classes, the recommendation is to declare your object using the interface, not the class:

Cloudlet cloudlet = new CloudletSimple(required, parameters, here);

The method setBrokerId(int userId) from Vm and Cloudlet were refactored to setBroker(DatacenterBroker broker), now requiring a DatacenterBroker instead of just an int ID which may be even nonexistent.

A DatacenterCharacteristics now requires just the list of hosts. All the other parameters (such as costs) are optional. A VmAllocationPolicy doesn’t require any parameter anymore. A Datacenter doesn’t require a name, storage list and scheduling interval too. The name will be automatically defined. It and all the other parameter can be set further using the respective setter methods. Now it is just required a CloudSim, a DatacenterCharacteristics and a VmAllocationPolicy instance.

DatacenterCharacteristics characts = new DatacenterCharacteristicsSimple(hostList);
VmAllocationPolicy vmAllocationPolicy = new VmAllocationPolicySimple();
Datacenter datacenter0 = new DatacenterSimple(cloudsim, characts, vmAllocationPolicy);

The way you instantiate a host has changed too. The classes RamProvisionerSimple and BwProvisionerSimple don’t exist anymore. Now you just have the generic class ResourceProvisionerSimple and you can just use its default no-args constructor. RAM and bandwidth capacity of the host now are given in the constructor, as it already was for storage. A VmScheduler constructor doesn’t require any parameter. You don’t need to set an ID for each Host, since if one is not given, when the List of hosts is attached to a Datacenter, it will generate an ID for those hosts. Instantiating a host should be now similar to:

long ram = 20480; //in MB
long bw = 1000000; //in Megabits/s
long storage = 1000000; //in MB
Host host = new HostSimple(ram, bw, storage, pesList);
host.setRamProvisioner(new ResourceProvisionerSimple())
    .setBwProvisioner(new ResourceProvisionerSimple())
    .setVmScheduler(new VmSchedulerTimeShared());

Additionally, the interface Storage was renamed to FileStorage and its implementations are SanStorage and HarddriveStorage, that can be used as before. Finally, since the packages were reorganized, you have to adjust them. However, use your IDE to correct the imports for you. A complete and clear example was presented in the Examples section above.

:arrow_up:

General Features of the Framework

  • Support for modeling and simulation of large scale Cloud computing data centers.
  • Support for modeling and simulation of virtualized server hosts, with customizable policies for provisioning host resources to virtual machines.
  • Support for modeling and simulation of energy-aware computational resources.
  • Support for modeling and simulation of data center network topologies and message-passing applications.
  • Support for modeling and simulation of federated clouds.
  • Support for dynamic insertion of simulation elements, stop and resume of simulation.
  • Support for user-defined policies for allocation of hosts to virtual machines and policies for allocation of host resources to virtual machines.

:arrow_up:

CloudSim Plus Publications

  1. M. C. Silva Filho, R. L. Oliveira, C. C. Monteiro, P. R. M. Inácio, and M. M. Freire, “CloudSim Plus: a Cloud Computing Simulation Framework Pursuing Software Engineering Principles for Improved Modularity, Extensibility and Correctness,” in IFIP/IEEE International Symposium on Integrated Network Management, 2017, p. 7. If you are using CloudSim Plus in your research, please make sure you cite that paper. You can check the paper presentation here.
  2. White Paper “CloudSim Plus: A Modern Java 8 Framework for Modeling and Simulation of Cloud Computing Infrastructures and Services”

:arrow_up:

License

This project is licensed under GNU GPLv3, as defined inside CloudSim 3 source files.

:arrow_up:

Contributing

You are welcome to contribute to the project. However, make sure you read the contribution guide before starting. The guide provides information on the different ways you can contribute, such as by requesting a feature, reporting an issue, fixing a bug or providing some new feature.

:arrow_up: