Cloudsim Tutorials

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 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, researchers and system developers are working on improving the technology to deliver better 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 environments 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., is 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 for real-world public Cloud systems to undertake benchmarking experimentations in 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 be 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 workloads as well as resource performance, which facilitates for development, testing, and deployment of adaptive application provisioning techniques.

This article provides a beginner’s guide to the cloudsim simulation toolkit and helps them 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 hypotheses.

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

The above diagram demonstrates the layered architecture of the 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“):

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 their related VMs.
  4. DatacenterBroker or Cloud Broker: This class model is 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 models 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), and 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 a 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 for the simulation engine.
  15. DeferredQueue: This class implements the deferred event queue used by CloudSim and holds 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(), at the start of the 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 defines actions for entity initialization.
    2. processEvent(), which defines actions processing of each called event(s) with respect to the entity.
    3. shutdownEntity(), which defines 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 that enables the CloudSim Simulation Toolkit to simulate the cloud computing environment, as demonstrated below:

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

Also, To quickly get started with Cloudsim Simulation Toolkit, Feel free to join our learners community on online self-paced course named “Essential Cloudsim Tutorials” I would be interested to interact with you. for further discussion.

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).
Exit mobile version