Cloudlet in Cloudsim defined the workload, which is to be executed during the simulation run of the cloudsim simulation engine. Cloudlet in Cloudsim is a model class that exists inside the package ‘org.cloudbus.cloudsim‘. Cloudlet is one of the most important models which defined the specifications for a simulation engine corresponding to the real-life candidate application to be considered for moving to a Cloud-based system.
In contrast, we can also define this cloudlet as a single process or task being executed on the cloud-based system which is to be simulated through a Cloudsim simulation engine.
The cloudlet model class defines four different constructors for its initialization, its method signatures are as follows:
/* First method signature with 8 parameters with simplest cloudlet execution with out maintaining its history or additional files */ public Cloudlet( final int cloudletId, final long cloudletLength, final int pesNumber, final long cloudletFileSize, final long cloudletOutputSize, final UtilizationModel utilizationModelCpu, final UtilizationModel utilizationModelRam, final UtilizationModel utilizationModelBw) /* Second method signature with 10 parameters with support for cloudlet execution history maintenance as well as additionl list of file requirements for execution. */ public Cloudlet( final int cloudletId, final long cloudletLength, final int pesNumber, final long cloudletFileSize, final long cloudletOutputSize, final UtilizationModel utilizationModelCpu, final UtilizationModel utilizationModelRam, final UtilizationModel utilizationModelBw, final boolean record, final List<String> fileList) /* Third method signature with 9 parameters with support for cloudlet execution additionl list of file requirements for execution. */ public Cloudlet( final int cloudletId, final long cloudletLength, final int pesNumber, final long cloudletFileSize, final long cloudletOutputSize, final UtilizationModel utilizationModelCpu, final UtilizationModel utilizationModelRam, final UtilizationModel utilizationModelBw, final List<String> fileList) /* Fourth method signature with 9 parameters with support for cloudlet execution history maintenance. */ public Cloudlet( final int cloudletId, final long cloudletLength, final int pesNumber, final long cloudletFileSize, final long cloudletOutputSize, final UtilizationModel utilizationModelCpu, final UtilizationModel utilizationModelRam, final UtilizationModel utilizationModelBw, final boolean record)
Cloudlet in Cloudsim defines following are the attributes that are being by the cloudsim simulation engine:
- userId: defines the broker id to through which this cloudlet will be executed and the result of execution will be returned & displayed on the console through the same broker.
- cloudletLength: defines the length of the cloudlet in terms of the expected number of instructions required to be executed in the lifetime of the workload under execution.
- cloudletFileSize: As the cloudlet is supposed to be executed over the cloud that means the input data transfer over the network should be happening during the execution. This attribute defines the total size of the input data in bytes.
- cloudletOutputSize: Similar to cloudletFileSize the output data size is also defined in bytes.
- numberOfPes: Defines the number of processors required to execute this cloudlet, if parallel processing is required to be performed.
- cloudletId: used as a unique identification number for cloudlets, required for referencing throughout the simulation flow.
- status: defines the current state of the cloudlet. A cloudlet could be in any one of the state as follows: CREATED, READY, QUEUED, INEXEC, SUCCESS, FAILED, CANCELED, PAUSED, RESUMED, FAILED_RESOURCE_UNAVAILABLE. These states are defined explicitly in cloudlet model class and are assigned a numerical value.
- num: defined the time at various stages of cloudlet execution
- execStartTime: Defines the latest execution time and is updated every time the status of cloudlet shuffle among CANCEL, PAUSED and RESUMED
- finishTime: Stores the time, when the execution of the cloudlet is finished and status is not a success.
- reservationId: defines the ID of the resource reserved for which this cloudlet.
- record: defines in boolean(True/False) if the history of the cloudlet execution across different resources is maintained or not.
- newline: Defined newline characteristics and used during the string concatenations while logging the history of cloudlet execution.
- history: maintains the history of the cloudlet execution across simulation flow.
- resList: Maintains the log of the resources where the cloudlet is being executed.
- index: defines the ID of the resource on which the cloudlet is being currently assigned and helps in getting the status
- classType: Defines the resource scheduling information(never used in cloudsim 3.0.3)
- netToS: Defines the type of service for the network transactions. This is a field for IPv6 for ensuring the quality of service.
- vmId: stores the Id of the virtual machine to which this cloudlet is to be allocated for allocation. This is done in the case where you are planning to move a real-life application to a cloud-based system with a specific Virtual machine configuration. Such mapping of cloudlet helps in determining the behavior of the application in various scenarios as simulated over the cloudsim simulation engine.
- costPerBw: defines the cost associated with the usage of the network for cloudlet network usage. this is overridden if the cost on bandwidth is defined by the datacenter instance which is always done.
- accumulatedBwCost: Stores the overall cost of bandwidth consumed by the cloudlet while processing during the simulation. This can be used to check what is the cost involved in network bandwidth for a particular candidate application which is under consideration to be moved to the cloud-based system.
- utilizationModelCpu/utilizationModelRam/utilizationModelBw: these attributes defines the type of model to be used for executing the defined cloudlet. It may individually defined for each attribute from following: UtilizationModelFull, UtilizationModelNull, UtilizationModelStochastic and UtilizationModelPlanetLabInMemory(used in power-aware workloads only).
- requiredFiles: defines the path for the list of files to be required by the cloudlet during execution. These are the input files and are directly associated with the network bandwidth cost.
Following are the states that each cloudlet can sustain during the simulation flow:
- CREATED: Defined when the cloudlet is created and added to the CloudletList(used by the datacenter broker during the simulation flow)
- READY: Defined when the cloudlet is assigned with a resource for execution
- QUEUED: Defined when the cloudlet is moved to the cloud resource on which it will wait for its execution
- INEXEC: Defined when the cloudlet is put into execution on the assigned cloud resource;
- SUCCESS: Defined when the cloudlet execution is successfully completed and is ready to be sent back to the broker with its final status
- FAILED: Defined in case the cloudlet is failed to be executed to the planned cloud node e.g. when the VM for which the cloudlet is to be assigned is failed to start due to any reason the cloudlet execution will be failed.
- CANCELED: Defined, when the execution of the cloudlet is canceled due to any situation and can be further denoted in the failed state is required
- PAUSED: Defined, when the cloudlet execution is put on hold. This could be due to some high priority cloudlet arrival or due to VM migration etc.
- RESUMED: Defined to resume the cloudlet execution after it is being paused.
- FAILED_RESOURCE_UNAVAILABLE: Defined when the cloudlet execution failed due to the failure of the resource on which it was supposed to be executed.
The cloudlets would shuffle between these states any number of times depending upon the simulation scenario under consideration.
One of the most important behaviors of the Cloudlet model class is that it may be moved from one resource to another resource due to any implicit/explicit reasons, therefore, the track is to be maintained for its movement during the simulation flow. To support this a nested class named ‘Resource’ is defined which contains the following attributes:
- submissionTime: defines when the cloudlet was submitted to the provided cloud resource instance.
- wallClockTime: defines the total time that a cloudlet spent of the currently provided cloud resource.
- actualCPUTime: defines the actual time spent under the execution and may or may not differ from wallClockTime.
- costPerSec: defines the cost spent on execution of cloudlet on currently provided cloud resources based on usage per second.
- finishedSoFar: defines the currently completed execution under the currently provided cloud resource.
- resourceId: stores the unique ID of the cloud resource which is currently provided to the cloudlet for the execution.
- resourceName: defines the name of the current cloud resource.
The instance of this ‘Resource’ model class is defined and utilized through the setResourceParameter() method of cloudlet class. Which is further utilized in the processCloudletSubmit() method(line no 715) of DataCenter class available under the same package i.e. ‘org.cloudbus.cloudsim’. This class plays a very important role in simulated distributed network applications.
You may subscribe to an online self-paced course named Learn Basics of Cloudsim, The content for this course will be updated weekly till August 2021.