CloudSim provides a generalised and extensible simulation framework that enables seamless modelling and simulation of app performance. By using CloudSim, developers can focus on specific systems design issues that they want to investigate, without getting concerned about details related to cloud-based infrastructures and services.
Advances in computing have opened up many possibilities. Hitherto, the main concern of application developers was the deployment and hosting of applications, keeping in mind the acquisition of resources with a fixed capacity to handle the expected traffic due to the demand for the application, as well as the installation, configuration and maintenance of the whole supporting stack. With the advent of the cloud, application deployment and hosting has become flexible, easier and less costly because of the pay-per-use chargeback model offered by cloud service providers.
Cloud computing is a best-fit for applications where users have heterogeneous, dynamic, and competing quality of service (QoS) requirements. Different applications have different performance levels, workloads and dynamic application scaling requirements, but these characteristics, service models and deployment models create a vague situation when we use the cloud to host applications. The cloud creates complex provisioning, deployment, and configuration requirements.
Why simulation is important for the cloud environment?
Cloud service providers offer elastic, on-demand, and measured infrastructure, platforms and software services. In the public cloud, tenants have control over the OS, storage and deployed applications. Resources are provisioned in different geographic regions. In the public cloud deployment model, the performance of an application deployed in multiple regions is a matter of concern for organisations. Proof of concepts in the public cloud environment give a better understanding, but cost a lot in terms of capacity building and resource usage even in the pay-per-use model.
CloudSim, which is -a toolkit for the modelling and simulation of Cloud computing environments- comes to the rescue. It provides system and behavioural modelling of the Cloud computing components. Simulation of cloud environments and applications to evaluate performance can provide useful insights to explore such dynamic, massively distributed, and scalable environments.
The principal advantages of simulation are:
- Flexibility of defining configurations
- Ease of use and customisation
- Cost benefits: First designing, developing, testing, and then redesigning, rebuilding, and retesting any application on the cloud can be expensive. Simulations take the building and rebuilding phase out of the loop by using the model already created in the design phase.
- CloudSim is a toolkit for modelling and simulating cloud environments and to assess resource provisioning algorithms.
An introduction to CloudSim
CloudSim is a simulation tool that allows cloud developers to test the performance of their provisioning policies in a repeatable and controllable environment, free of cost. It helps tune the bottlenecks before real-world deployment. It is a simulator; hence, it doesn’t run any actual software. It can be defined as ‘running a model of an environment in a model of hardware’, where technology-specific details are abstracted.
CloudSim is a library for the simulation of cloud scenarios. It provides essential classes for describing data centres, computational resources, virtual machines, applications, users, and policies for the management of various parts of the system such as scheduling and provisioning. Using these components, it is easy to evaluate new strategies governing the use of clouds, while considering policies, scheduling algorithms, load balancing policies, etc. It can also be used to assess the competence of strategies from various perspectives such as cost, application execution time, etc. It also supports the evaluation of Green IT policies. It can be used as a building block for a simulated cloud environment and can add new policies for scheduling, load balancing and new scenarios. It is flexible enough to be used as a library that allows you to add a desired scenario by writing a Java program.
By using CloudSim, organisations, R&D centres and industry-based developers can test the performance of a newly developed application in a controlled and easy to set-up environment.
The prominent features offered by CloudSim are given in Figure 1.
Architecture of CloudSim
The CloudSim layer provides support for modelling and simulation of cloud environments including dedicated management interfaces for memory, storage, bandwidth and VMs. It also provisions hosts to VMs, application execution management and dynamic system state monitoring. A cloud service provider can implement customised strategies at this layer to study the efficiency of different policies in VM provisioning.
The user code layer exposes basic entities such as the number of machines, their specifications, etc, as well as applications, VMs, number of users, application types and scheduling policies.
The main components of the CloudSim framework
Regions: It models geographical regions in which cloud service providers allocate resources to their customers. In cloud analysis, there are six regions that correspond to six continents in the world.
Data centres: It models the infrastructure services provided by various cloud service providers. It encapsulates a set of computing hosts or servers that are either heterogeneous or homogeneous in nature, based on their hardware configurations.
Data centre characteristics: It models information regarding data centre resource configurations.
Hosts: It models physical resources (compute or storage).
The user base: It models a group of users considered as a single unit in the simulation, and its main responsibility is to generate traffic for the simulation.
Cloudlet: It specifies the set of user requests. It contains the application ID, name of the user base that is the originator to which the responses have to be routed back, as well as the size of the request execution commands, and input and output files. It models the cloud-based application services. CloudSim categorises the complexity of an application in terms of its computational requirements. Each application service has a pre-assigned instruction length and data transfer overhead that it needs to carry out during its life cycle.
Service broker: The service broker decides which data centre should be selected to provide the services to the requests from the user base.
VMM allocation policy: It models provisioning policies on how to allocate VMs to hosts.
VM scheduler: It models the time or space shared, scheduling a policy to allocate processor cores to VMs.
How to use CloudSim in Eclipse
CloudSim is written in Java. The knowledge you need to use CloudSim is basic Java programming and some basics about cloud computing. Knowledge of programming IDEs such as Eclipse or NetBeans is also helpful. It is a library and, hence, CloudSim does not have to be installed. Normally, you can unpack the downloaded package in any directory, add it to the Java classpath and it is ready to be used. Please verify whether Java is available on your system.
To use CloudSim in Eclipse:
1. Download CloudSim installable files from this website
2. Open Eclipse
3. Create a new Java Project: File -> New
4. Import an unpacked CloudSim project into the new Java Project
5. The first step is to initialise the CloudSim package by initialising the CloudSim library, as follows:
CloudSim.init(num_user, calendar, trace_flag)
6. Data centres are the resource providers in CloudSim; hence, creation of data centres is a second step. To create Datacenter, you need the DatacenterCharacteristics object that stores the properties of a data centre such as architecture, OS, list of machines, allocation policy that covers the time or spaceshared, the time zone and its price:
Datacenter datacenter9883 = new Datacenter(name, characteristics, new VmAllocationPolicySimple(hostList), storageList, 0);
7. The third step is to create a broker:
DatacenterBroker broker = createBroker();
8. The fourth step is to create one virtual machine unique ID of the VM, userId ID of the VM’s owner, mips, number Of Pes amount of CPUs, amount of RAM, amount of bandwidth, amount of storage, virtual machine monitor, and cloudletScheduler policy for cloudlets:
Vm vm = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared())
9. Submit the VM list to the broker:
10. Create a cloudlet with length, file size, output size, and utilisation model:
Cloudlet cloudlet = new Cloudlet(id, length, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel)
11. Submit the cloudlet list to the broker:
12. Start the simulation:
Sample Output from the Existing Example: Starting CloudSimExample1... Initialising... Starting CloudSim version 3.0 Datacenter_0 is starting... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>null Broker is starting... Entities started. 0.0: Broker: Cloud Resource List received with 1 resource(s) 0.0: Broker: Trying to Create VM #0 in Datacenter_0 0.1: Broker: VM #0 has been created in Datacenter #2, Host #0 0.1: Broker: Sending cloudlet 0 to VM #0 400.1: Broker: Cloudlet 0 received 400.1: Broker: All Cloudlets executed. Finishing... 400.1: Broker: Destroying VM #0 Broker is shutting down... Simulation: No more future events CloudInformationService: Notify all CloudSim entities for shutting down. Datacenter_0 is shutting down... Broker is shutting down... Simulation completed. Simulation completed. ========== OUTPUT ========== Cloudlet ID STATUS Data center ID VM ID Time Start Time Finish Time 0 SUCCESS 2 0 400 0.1 400.1 *****Datacenter: Datacenter_0***** User id Debt 3 35.6 CloudSimExample1 finished!
 CloudSim: A toolkit for modelling and simulation of cloud computing environments and evaluation of resource provisioning algorithms by Rodrigo N Calheiros, Rajiv Ranjan, Anton Beloglazov, CŽesar A F De Rose and Rajkumar Buyya