Cloudlet input and output file size.

Skip to first unread message

Irfan Ahmed

Jul 13, 2012, 8:59:04 AM7/13/12
Hi All,
 Can anyone please tell me why the Cloudlet length, input and output file's size should be greater than or equal to 1? Please reply to my post, it will be really appreciated. 

Irfan. D


Jul 17, 2012, 5:35:13 AM7/17/12
Hi Irfan,

I think as per the documentation , Cloudlet length specifies how many instructions need to be executed to get the task done. The input file size indicates the size of source code of cloudlet + input data(if any) in bytes. I hope from this it is clear enough to understand that we can't submit a zero length cloudlet.

Thanks & Regards,

Irfan Ahmed

Jul 17, 2012, 5:39:11 AM7/17/12
Thanks Satish :)

On Friday, July 13, 2012 6:29:04 PM UTC+5:30, Irfan Ahmed wrote:


Feb 17, 2013, 12:02:38 AM2/17/13
Hi satish,
                      Can you please tell me about what is output size ?

Manoel Campos

Feb 19, 2014, 11:21:13 AM2/19/14
Is the cloudletOutputSize the cloudletFileSize + output data
or only the output data?

In the this is not complety clear for me.

Thank you.

Mario Henrique Souza Pardo

Mar 2, 2014, 10:26:44 AM3/2/14
Hello Manoel Campos,

   really using the source code comments and CloudSim API we cannot 
to assert so much about the meaning of input/output files from Cloudlets. But, I gave a little look within CloudSim classes and what I have found was:
- input/output file sizes are setted in bytes, like described below in
* @param cloudletFileSize the file size (in byte) of this cloudlet
     * <tt>BEFORE</tt> submitting to a PowerDatacenter
     * @param cloudletOutputSize the file size (in byte) of this cloudlet
     * <tt>AFTER</tt> finish executing by a PowerDatacenter
- these items are handled by some classes of simulator such as CloudletSchedulers (Space and Time Shared), Datacenter, PowerDatacenter... it looks like input file size is used to calculate network delays between components to emulate its upload to VMs and its migration. 
- What about output file size not grow, I not sure about this point, but I think that is necessary to perform some kind of operation adding data to cloudlet result to its output file size can grow up. An possible idea for this goal is implement one extended CloudScheduler (from another one implemented like CloudSchedulerSpace or Time Shared) to handle the cloud application business rule, this way you can stablish conditions where output file size will be increased.
- I saw on NetworkCloudletSpaceSharedScheduler some codes that handle file transfer and copies adding length value to cloudlets. Like this part (cloudletSubmit method)

// use the current capacity to estimate the extra amount of
// time to file transferring. It must be added to the cloudlet length
double extraSize = capacity * fileTransferTime;
long length = cloudlet.getCloudletLength();
length += extraSize;
return cloudlet.getCloudletLength() / capacity;

Maybe could be an idea to create new rules programming your own CloudletScheduler as I said before. I have made a sample code trying to help with this question. Maybe this isn't the best way to do, but is a start form.

So, there is a new CloudletScheduler with a simple business to do increasing of output file:

package simulacaoUSP.duvidas.cloudsim;

import java.util.List;
import org.cloudbus.cloudsim.CloudletSchedulerSpaceShared;
import org.cloudbus.cloudsim.Consts;
import org.cloudbus.cloudsim.ResCloudlet;

 * @author Mário Pardo
public class SampleCloudletScheduler extends CloudletSchedulerSpaceShared{
    public double updateVmProcessing(double currentTime, List<Double> mipsShare){
        //Business Rule to increase output file size -> TO DO Here!!
        for (ResCloudlet rcl : getCloudletExecList()) {
            if (rcl.getRemainingCloudletLength()/rcl.getCloudletTotalLength()<0.5) {
                long increaseLength = (long)rcl.getRemainingCloudletLength() + rcl.getCloudletLength()*15/100;
            } else if (rcl.getRemainingCloudletLength()/rcl.getCloudletTotalLength()>=0.5) {
                long increaseLength = (long)rcl.getRemainingCloudletLength() + rcl.getCloudletLength()*15/100;
        return super.updateVmProcessing(currentTime, mipsShare);

So, there is a Test Class too, pay attention at modification done in createVm class in line:

vm[i] = new Vm(idShift + i, userId, mips, pesNumber, ram, bw, size, vmm, new SampleCloudletScheduler());



package simulacaoUSP.duvidas.cloudsim;

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.CloudletSchedulerSpaceShared;
import org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.DatacenterCharacteristics;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Storage;
import org.cloudbus.cloudsim.UtilizationModel;
import org.cloudbus.cloudsim.UtilizationModelFull;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.VmAllocationPolicySimple;
import org.cloudbus.cloudsim.VmSchedulerSpaceShared;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.core.SimEntity;
import org.cloudbus.cloudsim.core.SimEvent;
import org.cloudbus.cloudsim.power.PowerDatacenter;
import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;

 * @author Mário
public class CloudletGrowUpExample {
     private static List<Cloudlet> cloudletList;
    private static List<Vm> vmlist;
    public static void main(String[] args) {
        int num_user = 2;
        Calendar calendar = Calendar.getInstance();
        boolean trace_flag = false;
        CloudSim.init(num_user, calendar, trace_flag);
        //Creating 1 Datacenter with 1 host with 5 PEs
        Datacenter dc1 = createDatacenter("DC1", 1);
        DatacenterBroker broker = createBroker("broker1");
        broker.submitVmList(createVM(broker.getId(), 5, 1));
        broker.submitCloudletList(createCloudlet(broker.getId(), 5, 1));
        List<Cloudlet> newList = broker.getCloudletReceivedList(); 
    private static List<Vm> createVM(int userId, int vms, int idShift) {
        //Creates a container to store VMs. This list is passed to the broker later
        LinkedList<Vm> list = new LinkedList<Vm>();

        //VM Parameters
        long size = 10000; //image size (MB)
        int ram = 512; //vm memory (MB)
        int mips = 1000;
        long bw = 1000;
        int pesNumber = 1; //number of cpus
        String vmm = "Xen"; //VMM name

        //create VMs
        Vm[] vm = new Vm[vms];
        for (int i = 0; i < vms; i++) {
            vm[i] = new Vm(idShift + i, userId, mips, pesNumber, ram, bw, size, vmm, new SampleCloudletScheduler());
            //vm[i] = new Vm(idShift + i, userId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerSpaceShared());
        return list;
    private static List<Cloudlet> createCloudlet(int userId, int cloudlets, int idShift) {
        // Creates a container to store Cloudlets
        LinkedList<Cloudlet> list = new LinkedList<Cloudlet>();

        //cloudlet parameters
        long length = 100000;
        long fileSize = 300;
        long outputSize = 300;
        int pesNumber = 1;
        UtilizationModel utilizationModel = new UtilizationModelFull();
        Cloudlet[] cloudlet = new Cloudlet[cloudlets];
        for (int i = 0; i < cloudlets; i++) {
            cloudlet[i] = new Cloudlet(idShift + i, length, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel);
            // setting the owner of these Cloudlets
        return list;
    private static Datacenter createDatacenter(String name, int hostNumber) {
        List<Host> hostList = new ArrayList<Host>();
        List<Pe> peList1 = new ArrayList<Pe>();
        int mips = 1000;
        int hostId = 0;
        int ram = 16384;
        long storage = 1000000;
        int bw = 10000;
        peList1.add(new Pe(0, new PeProvisionerSimple(mips)));
        peList1.add(new Pe(1, new PeProvisionerSimple(mips)));
        peList1.add(new Pe(2, new PeProvisionerSimple(mips)));
        peList1.add(new Pe(3, new PeProvisionerSimple(mips)));
        peList1.add(new Pe(4, new PeProvisionerSimple(mips)));
        for (int i = 0; i < hostNumber; i++) {
                    new Host(
                    new RamProvisionerSimple(ram),
                    new BwProvisionerSimple(bw),
                    new VmSchedulerSpaceShared(peList1)));
        String arch = "x86";      // system architecture
        String os = "Linux";          // operating system
        String vmm = "Xen";
        double time_zone = 10.0;         // time zone this resource located
        double cost = 3.0;              // the cost of using processing in this resource
        double costPerMem = 0.05; // the cost of using memory in this resource
        double costPerStorage = 0.1; // the cost of using storage in this resource
        double costPerBw = 0.1; // the cost of using bw in this resource
        LinkedList<Storage> storageList = new LinkedList<Storage>(); //we are not adding SAN devices by now

        DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
                arch, os, vmm, hostList, time_zone, cost, costPerMem, costPerStorage, costPerBw);
        Datacenter datacenter = null;
        try {
            datacenter = new Datacenter(name, characteristics, new VmAllocationPolicySimple(hostList), storageList, 0);
        } catch (Exception e) {
        return datacenter;
    private static DatacenterBroker createBroker(String name) {
        DatacenterBroker broker = null;
        try {
            broker = new DatacenterBroker(name);
        } catch (Exception e) {
            return null;
        return broker;

     * Prints the Cloudlet objects
     * @param list list of Cloudlets
    private static void printCloudletList(List<Cloudlet> list) {
        int size = list.size();
        Cloudlet cloudlet;
        String indent = "    ";
        Log.printLine("========== OUTPUT ==========");
        Log.printLine("Cloudlet ID" + indent + "STATUS" + indent
                + "Data center ID" + indent + "VM ID" + indent + indent + "Time" + indent + "Start Time" + indent + "Finish Time");
        DecimalFormat dft = new DecimalFormat("###.##");
        for (int i = 0; i < size; i++) {
            cloudlet = list.get(i);
            Log.print(indent + cloudlet.getCloudletId() + indent + indent);
            if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS) {
                Log.printLine(indent + indent + cloudlet.getResourceId() + indent + indent + indent + cloudlet.getVmId()
                        + indent + indent + indent + dft.format(cloudlet.getActualCPUTime())
                        + indent + indent + dft.format(cloudlet.getExecStartTime()) + indent + indent + indent + dft.format(cloudlet.getFinishTime()));

    //Inner-Class GLOBAL BROKER...
    public static class GlobalBroker extends SimEntity {
        private static final int CREATE_BROKER = 0;
        private List<Vm> vmList;
        private List<Cloudlet> cloudletList;
        private DatacenterBroker broker;
        public GlobalBroker(String name) {
        public void processEvent(SimEvent ev) {
            switch (ev.getTag()) {
                case CREATE_BROKER:
                    setBroker(createBroker(super.getName() + "_"));

                    //Create VMs and Cloudlets and send them to broker
//                    setVmList(createVM(getBroker().getId(), 5, 100)); //creating 5 vms
//                    setCloudletList(createCloudlet(getBroker().getId(), 10, 100)); // creating 10 cloudlets


//                    CloudSim.resumeSimulation();

                    Log.printLine(getName() + ": unknown event type");
        public void startEntity() {
            Log.printLine(CloudSim.clock() + super.getName() + " is starting...");
            schedule(getId(), 200, CREATE_BROKER);
        public void shutdownEntity() {
            System.out.println("Global Broker is shutting down...");
        public List<Vm> getVmList() {
            return vmList;
        protected void setVmList(List<Vm> vmList) {
            this.vmList = vmList;
        public List<Cloudlet> getCloudletList() {
            return cloudletList;
        protected void setCloudletList(List<Cloudlet> cloudletList) {
            this.cloudletList = cloudletList;
        public DatacenterBroker getBroker() {
            return broker;
        protected void setBroker(DatacenterBroker broker) {
   = broker;


This code don't really increase the file output size, because cloudlets not grant access to modify this field in class. You can do a new cloudlet version with this improvement. My sample just increase the execution time of each cloudlet and not affect the Debts print at the end of simulation process.

I hope that can be helpful for you and other CloudSim users.

Good luck!

Mário Pardo
ICMC-USP / São Carlos / Brazil
Research Gate Profile [LINK]

You received this message because you are subscribed to the Google Groups "cloudsim" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit

Manoel Campos

Oct 23, 2014, 7:51:00 AM10/23/14
Hello Mário, 
Thank you and sorry for the late reply.

Your code was very useful.

Mario Henrique Souza Pardo

Oct 23, 2014, 8:54:04 AM10/23/14

  ok, no problem!! =)


Mário Henrique de Souza Pardo / PhD Candidate
University of São Paulo / Institute of Mathematical and Computer Science (ICMC)
Laboratory of Distributed Systems and Concurrent Programming (LaSDPC)
São Carlos / SP / Brazil
Research Gate Profile [LINK]

For more options, visit

hari priya

Apr 16, 2018, 12:50:53 AM4/16/18
to cloudsim

How can we know for any particular task(cloudlet) how many instructions we need?(cloudlet length).

Thanking you.

Pardeep Maan

Sep 22, 2021, 10:23:29 AM9/22/21
to cloudsim
As per my knowledge, Cloudlet length describes the number of instructions to be executed by/in that cloudlet (task), file size defines the memory (in bytes) taken by a cloudlet to store in VM memory(RAM), and output size (in bytes) is related to the output stream generated by a cloudlet (task), so it's linked with data transfer over the network by a cloudlet.
Pardeep Singh 

Anupinder Singh

Sep 23, 2021, 6:40:05 AM9/23/21
to cloudsim
Hello Pardeep

Yes, correct and this is used to calculate the accumulated cost of bandwidth(check the file), which can be displayed on the console while running any of the basic example scenarios in the printCloudletList() method.

for more detailed explanation, you may check the following link:



You received this message because you are subscribed to the Google Groups "cloudsim" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
Reply all
Reply to author
0 new messages